Hey,
i have a problem with the sponge API. How do I get the name of the player, tried to complete the chat with tabcomplete?
please help me!
PT400C
Hey,
i have a problem with the sponge API. How do I get the name of the player, tried to complete the chat with tabcomplete?
please help me!
PT400C
The Player is in the Cause. So you could do either of these:
@Listener
public void tabComplete(TabCompleteEvent e) {
Optional<Player> p = e.getCause().first(Player.class);
if (p.isPresent()) {
//...
}
}
Or this (which I greatly prefer):
@Listener
public void tabComplete(TabCompleteEvent e, @First Player p) {
//...
}
Hi,
okay thanks! That works. But, how do I get, if the person is operator?
I’m new at sponge.
Please help me
PT400C
In spongeAPI, there is no concept of an ‘operator’ status. If you wish to test for permissions of a player then use the hasPermission
method