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;
|
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.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -10,78 +14,58 @@ public class Command_list extends TFM_Command
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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 onlineStats = new StringBuilder();
|
||||||
StringBuilder onlineUsers = new StringBuilder();
|
StringBuilder onlineUsers = new StringBuilder();
|
||||||
|
|
||||||
if (senderIsConsole)
|
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.");
|
||||||
|
|
||||||
|
List<String> player_names = new ArrayList<String>();
|
||||||
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
onlineStats.append(String.format("There are %d out of a maximum %d players online.", server.getOnlinePlayers().length, server.getMaxPlayers()));
|
String prefix = "";
|
||||||
|
|
||||||
onlineUsers.append("Connected players: ");
|
if (!is_clanforge)
|
||||||
boolean first = true;
|
|
||||||
for (Player p : server.getOnlinePlayers())
|
|
||||||
{
|
{
|
||||||
if (first)
|
if (TFM_Util.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
first = false;
|
if (p.isOp())
|
||||||
}
|
{
|
||||||
else
|
prefix = (ChatColor.GOLD + "[SA+OP]");
|
||||||
{
|
}
|
||||||
onlineUsers.append(", ");
|
else
|
||||||
}
|
{
|
||||||
|
prefix = (ChatColor.GOLD + "[SA]");
|
||||||
if (sender.getName().equalsIgnoreCase("remotebukkit"))
|
}
|
||||||
{
|
|
||||||
onlineUsers.append(p.getName());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (p.isOp())
|
if (p.isOp())
|
||||||
{
|
{
|
||||||
onlineUsers.append("[OP]").append(p.getName());
|
prefix = (ChatColor.RED + "[OP]");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
onlineUsers.append(p.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
else
|
||||||
{
|
{
|
||||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length);
|
sender.sendMessage(onlineStats.toString());
|
||||||
onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers());
|
sender.sendMessage(onlineUsers.toString());
|
||||||
onlineStats.append(ChatColor.BLUE).append(" players online.");
|
|
||||||
|
|
||||||
onlineUsers.append("Connected players: ");
|
|
||||||
boolean first = true;
|
|
||||||
for (Player p : server.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
if (first)
|
|
||||||
{
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
onlineUsers.append(", ");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p.isOp())
|
|
||||||
{
|
|
||||||
onlineUsers.append(ChatColor.RED).append(p.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
onlineUsers.append(p.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
onlineUsers.append(ChatColor.WHITE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(onlineStats.toString());
|
|
||||||
sender.sendMessage(onlineUsers.toString());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ public class TFM_PlayerListener implements Listener
|
|||||||
|
|
||||||
if (out_of_cage)
|
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.regenerateHistory();
|
||||||
playerdata.clearHistory();
|
playerdata.clearHistory();
|
||||||
TFM_Util.buildHistory(target_pos, 2, playerdata);
|
TFM_Util.buildHistory(target_pos, 2, playerdata);
|
||||||
|
Loading…
Reference in New Issue
Block a user