mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-17 21:06:11 +00:00
Rewrote the /list command. Now shows superadmins in GOLD + a few other goodies.
Fixed a bug in the cager.
This commit is contained in:
parent
2c224af271
commit
9344a13116
@ -1,5 +1,9 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -10,77 +14,57 @@ public class Command_list extends TFM_Command
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
final boolean is_clanforge = sender.getName().equalsIgnoreCase("remotebukkit");
|
||||
|
||||
StringBuilder onlineStats = new StringBuilder();
|
||||
StringBuilder onlineUsers = new StringBuilder();
|
||||
|
||||
if (senderIsConsole)
|
||||
{
|
||||
onlineStats.append(String.format("There are %d out of a maximum %d players online.", server.getOnlinePlayers().length, server.getMaxPlayers()));
|
||||
|
||||
onlineUsers.append("Connected players: ");
|
||||
boolean first = true;
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineUsers.append(", ");
|
||||
}
|
||||
|
||||
if (sender.getName().equalsIgnoreCase("remotebukkit"))
|
||||
{
|
||||
onlineUsers.append(p.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p.isOp())
|
||||
{
|
||||
onlineUsers.append("[OP]").append(p.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineUsers.append(p.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length);
|
||||
onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers());
|
||||
onlineStats.append(ChatColor.BLUE).append(" players online.");
|
||||
|
||||
onlineUsers.append("Connected players: ");
|
||||
boolean first = true;
|
||||
List<String> player_names = new ArrayList<String>();
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineUsers.append(", ");
|
||||
}
|
||||
String prefix = "";
|
||||
|
||||
if (!is_clanforge)
|
||||
{
|
||||
if (TFM_Util.isUserSuperadmin(p))
|
||||
{
|
||||
if (p.isOp())
|
||||
{
|
||||
onlineUsers.append(ChatColor.RED).append(p.getName());
|
||||
prefix = (ChatColor.GOLD + "[SA+OP]");
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineUsers.append(p.getName());
|
||||
prefix = (ChatColor.GOLD + "[SA]");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p.isOp())
|
||||
{
|
||||
prefix = (ChatColor.RED + "[OP]");
|
||||
}
|
||||
|
||||
onlineUsers.append(ChatColor.WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
player_names.add(prefix + p.getName() + ChatColor.WHITE);
|
||||
}
|
||||
|
||||
onlineUsers.append("Connected players: ").append(StringUtils.join(player_names, ", "));
|
||||
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(ChatColor.stripColor(onlineStats.toString()));
|
||||
sender.sendMessage(ChatColor.stripColor(onlineUsers.toString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(onlineStats.toString());
|
||||
sender.sendMessage(onlineUsers.toString());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ public class TFM_PlayerListener implements Listener
|
||||
|
||||
if (out_of_cage)
|
||||
{
|
||||
playerdata.setCaged(true, target_pos, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.INNER), playerdata.getCageMaterial(TFM_UserInfo.CageLayer.OUTER));
|
||||
playerdata.setCaged(true, target_pos, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.OUTER), playerdata.getCageMaterial(TFM_UserInfo.CageLayer.INNER));
|
||||
playerdata.regenerateHistory();
|
||||
playerdata.clearHistory();
|
||||
TFM_Util.buildHistory(target_pos, 2, playerdata);
|
||||
|
Loading…
Reference in New Issue
Block a user