Some ideas

My English is not the best but I just want to offer some ideas.
Here they are :

1 - boolean fakeMessage) // display a fake message
2 - Collection<Player> World.getPlayers() // get all players in the world
3 - Optional<Map<String, String>> Player.getModList() // from Forge, empty if Vanilla
4 - long Server.getTickAverage(int tickCount) // return milliseconds
5 - double Server.getTickPerSecond(int tickCount) // return server’s tps since %tickCount% ticks
6 - void Viewer.sendEntity(Entity fakeEntity) // just send the packet to the viewer

These methods would be very useful for lot of plugins :smile:
Maybe I forgot something, I will add if needed.

To half of them I may say something :smiley:

I don’t get it. What is the use case? What is the method supposed to do?

2 (untested)

public Collection<Player> getPlayersInWorld(final World world) {
        .stream().filter(player -> player.getLocation().getExtent().equals(world))

I doubt this should be present in the API if it is Forge-specific. Maybe this could be handled by a service that will only be present on SpongeForge? Seems cleaner to me.

1: Take a look at this Add a way to simulate a player chatting · Issue #733 · SpongePowered/SpongeAPI · GitHub
2: You could already do this but you will have to loop each player on the server.
3: I don’t think that is possible? Getting the mods the player has when he joins the server? Or getting the mods on the server? Unless you are talking about Sponge in SP.
4: Good idea
5: This exists! :smiley: SpongeAPI/ at 20bad1be5c4b80598d820b4c937c6390d0b0384b · SpongePowered/SpongeAPI · GitHub
6: They are working on sending fake entities/blocks! :slight_smile:

1 - The method should send a fake message in the chat
2 - I know that is possible but I just want a shortcut ^^
3 -

 public static Optional<Map<String, String>> getModList(Player player) {
     try {
         return Optional.of(NetworkDispatcher.get(((EntityPlayerMP) player).playerNetServerHandler.netManager).getModList());
     } catch (Throwable t) {
         return Optional.absent();

5 - I dont want that ^^’, I want a method who return the server’s speed (tick per second (tps)) since a amount of time/tick

That would be a good thing to have too!

That may be the easiest way though. The function you asked for would be based on World:getEntities(Predicate<Entity>) and honestly I thinkt that will be way slower than just iterating over the online Player list.

Adding a getPlayers() method to the World class does seem neither necessary nor advisable to me.

There is a field in NMS World.class :

 // Taken from Forge
public abstract class World implements IBlockAccess {
    /** Array list of players in the world. */
public final List playerEntities = Lists.newArrayList();

if SpongeAPI just provide a method who return this list we can improve plugins performance

a fake message? And what is a fake message?

Gosh… I think he just wants to force a player to chat some message… fake as in the player him/her self did not type it.

so… player.sendMessage( … )


my bad, I think your looking for MessageSink stuff

player.getMessageSink().sendMessage( … );


MessageSinks.toAll().sendMessage( … );

This is exactly what I want : Add a way to simulate a player chatting · Issue #733 · SpongePowered/SpongeAPI · GitHub
but even after three months, they forgot to add the method in SpongeAPI or I can’t find it :frowning:

I believe your looking for the MessageSinkEvent