mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Improvements, now works with latest bukkit
This commit is contained in:
parent
30f144b21b
commit
7deb6f3e84
@ -36,20 +36,24 @@ public class vPlayerListener extends PlayerListener {
|
||||
}
|
||||
//Message to be sent when a player uses /list
|
||||
public void onPlayerCommand(PlayerChatEvent event) {
|
||||
log.log(Level.INFO, event.getMessage() + "|" + event.getPlayer().getName());
|
||||
String[] split = event.getMessage().split(" ");
|
||||
Player player = event.getPlayer();
|
||||
if(split[0].equalsIgnoreCase("/list") || split[0].equalsIgnoreCase("/who")){
|
||||
event.setCancelled(true);
|
||||
String tempList = "";
|
||||
int x = 0;
|
||||
for(Player p : plugin.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(p != null){
|
||||
tempList+= p.getName();
|
||||
if(p != null && x < playerCount()){
|
||||
tempList+= p.getName() +", ";
|
||||
x++;
|
||||
}
|
||||
if(x >= playerCount())
|
||||
tempList+= p.getName();
|
||||
}
|
||||
//Output the player list
|
||||
player.sendMessage(ChatColor.RED + "Player List (" + tempList +")");
|
||||
player.sendMessage(ChatColor.RED + "Player List ("+ChatColor.WHITE + tempList +ChatColor.RED+")");
|
||||
player.sendMessage(ChatColor.RED + "Total Players: " + ChatColor.GREEN + playerCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public class vPlayersOnline extends JavaPlugin {
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
|
||||
//Displays a message when plugin is loaded
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||
|
@ -1,3 +1,3 @@
|
||||
name: vPlayersOnline
|
||||
main: com.bukkit.nossr50.vPlayersOnline.vPlayersOnline
|
||||
version: 1.1
|
||||
version: 1.2
|
Loading…
Reference in New Issue
Block a user