@EventHandler(priority = EventPriority.MONITOR) public void onPlayerKick(PlayerKickEvent event) { Player player = event.getPlayer(); if (TotalFreedomMod.fuckoffEnabledFor.containsKey(player)) { TotalFreedomMod.fuckoffEnabledFor.remove(player); } TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); playerdata.disarmMP44(); if (playerdata.isCaged()) { playerdata.regenerateHistory(); playerdata.clearHistory(); } TFM_Log.info("[EXIT] " + player.getName() + " left the game.", true); }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length == 1) { if (!args[0].equals("reload")) { return false; } if (!TFM_AdminList.isSuperAdmin(sender)) { playerMsg(TFM_Command.MSG_NO_PERMS); return true; } TFM_MainConfig.load(); TFM_AdminList.load(); TFM_PermbanList.load(); TFM_PlayerList.load(); TFM_BanManager.load(); TFM_CommandBlocker.load(); final String message = String.format( "%s v%s reloaded.", TotalFreedomMod.pluginName, TotalFreedomMod.pluginVersion); playerMsg(message); TFM_Log.info(message); return true; } TFM_Util.playerMsg(sender_p, "§9§ki§r §7|§6Electro§eFreedom§6Mod§7| §9§ki§r", ChatColor.GOLD); TFM_Util.playerMsg(sender_p, "Edited by: SanikIsFast.", ChatColor.GREEN); TFM_Util.playerMsg(sender_p, "§5Made in the image of the §9TFM", ChatColor.GOLD); TFM_Util.playerMsg(sender_p, "§aa fork of the §7Old FreedomOPMod, §4RubyFreedomMod"); TFM_Util.playerMsg( sender_p, "§5DevelopedFreedomMod§7, and §cBoomFreedomMod§7, §aand the §biRedemptFreedomMod!"); TFM_Util.playerMsg( sender_p, "§7This is ElectoFreedomMod v§8:§b" + plugin.getDescription().getVersion(), ChatColor.GOLD); return true; }
@Override public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length == 1) { if (!args[0].equals("reload")) { return false; } if (!TFM_AdminList.isSuperAdmin(sender)) { playerMsg(TFM_Command.MSG_NO_PERMS); return true; } TFM_MainConfig.load(); TFM_AdminList.load(); TFM_PermbanList.load(); TFM_PlayerList.load(); TFM_BanManager.load(); TFM_CommandBlocker.load(); final String message = String.format("%s v%s.%s reloaded.", TotalFreedomMod.pluginName, TotalFreedomMod.pluginVersion, TotalFreedomMod.buildNumber); playerMsg(message); TFM_Log.info(message); return true; } playerMsg("NickFreedomMod for 'Nick Freedom', the forked all-op server, forked from TotalFreedom.", ChatColor.GOLD); playerMsg(String.format("Version " + ChatColor.BLUE + "%s.%s" + ChatColor.GOLD + ", built " + ChatColor.BLUE + "%s" + ChatColor.GOLD + " by " + ChatColor.BLUE + "%s" + ChatColor.GOLD + ".", TotalFreedomMod.pluginVersion, TotalFreedomMod.buildNumber, TotalFreedomMod.buildDate, TotalFreedomMod.buildCreator), ChatColor.GOLD); playerMsg("Running on " + TFM_ConfigEntry.SERVER_NAME.getString() + ".", ChatColor.GOLD); playerMsg("Created by Madgeek1450 and Prozza. Later forked by ItsTeeqo_ (_ItsNick_) to make NickFreedom", ChatColor.GOLD); return true; }
private void playerLeave(Player player) { if (TotalFreedomMod.fuckoffEnabledFor.containsKey(player)) { TotalFreedomMod.fuckoffEnabledFor.remove(player); } final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); playerdata.disarmMP44(); if (playerdata.isCaged()) { playerdata.regenerateHistory(); playerdata.clearHistory(); } TFM_PlayerList.removeEntry(player); TFM_Log.info("[EXIT] " + player.getName() + " left the game.", true); }
public static void wipeFlatlandsIfFlagged() { boolean doFlatlandsWipe = false; try { doFlatlandsWipe = TFM_Util.getSavedFlag("do_wipe_flatlands"); } catch (Exception ex) { } if (doFlatlandsWipe) { if (Bukkit.getServer().getWorld("donatorworld") == null) { TFM_Log.info("Wiping pvp world."); TFM_Util.setSavedFlag("do_wipe_flatlands", false); FileUtils.deleteQuietly(new File("./pvpworld")); } else { TFM_Log.severe("Can't wipe donator word. it is already loaded."); } } }
public static void scan() { CommandMap commandMap = getCommandMap(); if (commandMap == null) { TFM_Log.severe("Error loading commandMap."); return; } COMMAND_LIST.clear(); COMMAND_LIST.addAll(getCommands()); for (TFM_CommandInfo commandInfo : COMMAND_LIST) { TFM_DynamicCommand dynamicCommand = new TFM_DynamicCommand(commandInfo); Command existing = commandMap.getCommand(dynamicCommand.getName()); if (existing != null) { unregisterCommand(existing, commandMap); } commandMap.register(TotalFreedomMod.plugin.getDescription().getName(), dynamicCommand); } TFM_Log.info("TFM commands loaded."); }
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(PlayerJoinEvent event) { final Player player = event.getPlayer(); final String ip = TFM_Util.getIp(player); final TFM_Player playerEntry; TFM_Log.info( "[JOIN] " + TFM_Util.formatPlayer(player) + " joined the game with IP address: " + ip, true); // Check absolute value to account for negatives if (Math.abs(player.getLocation().getX()) >= MAX_XY_COORD || Math.abs(player.getLocation().getZ()) >= MAX_XY_COORD) { player.teleport(player.getWorld().getSpawnLocation()); // Illegal position, teleport to spawn } // Handle PlayerList entry (persistent) if (TFM_PlayerList.existsEntry(player)) { playerEntry = TFM_PlayerList.getEntry(player); playerEntry.setLastLoginUnix(TFM_Util.getUnixTime()); playerEntry.setLastLoginName(player.getName()); playerEntry.addIp(ip); playerEntry.save(); } else { playerEntry = TFM_PlayerList.getEntry(player); TFM_Log.info("Added new player: " + TFM_Util.formatPlayer(player)); } // Generate PlayerData (non-persistent) final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); playerdata.setSuperadminIdVerified(false); if (TFM_AdminList.isSuperAdmin(player)) { for (String storedIp : playerEntry.getIps()) { TFM_BanManager.unbanIp(storedIp); TFM_BanManager.unbanIp(TFM_Util.getFuzzyIp(storedIp)); } TFM_BanManager.unbanUuid(TFM_UuidManager.getUniqueId(player)); player.setOp(true); // Verify strict IP match if (!TFM_AdminList.isIdentityMatched(player)) { playerdata.setSuperadminIdVerified(false); TFM_Util.bcastMsg( "Warning: " + player.getName() + " is an admin, but is using an account not registered to one of their ip-list.", ChatColor.RED); } else { playerdata.setSuperadminIdVerified(true); TFM_AdminList.updateLastLogin(player); } } TFM_PlayerData.getPlayerData(player).setCommandSpy(true); // Handle admin impostors if (TFM_AdminList.isAdminImpostor(player)) { TFM_Util.bcastMsg( "Warning: " + player.getName() + " has been flagged as an impostor and has been frozen!", ChatColor.RED); TFM_Util.bcastMsg( ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player)); player.getInventory().clear(); player.setOp(false); player.setGameMode(GameMode.SURVIVAL); TFM_PlayerData.getPlayerData(player).setFrozen(true); } else if (TFM_AdminList.isSuperAdmin(player) || TFM_Util.DEVELOPERS.contains(player.getName())) { TFM_Util.bcastMsg( ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player)); } // TODO: Cleanup String name = player.getName(); if (TFM_Util.DEVELOPERS.contains(player.getName())) { name = ChatColor.DARK_PURPLE + name; TFM_PlayerData.getPlayerData(player).setTag("&8[&5Developer&8]"); } if (TFM_Util.EXECUTIVES.contains(player.getName())) { name = ChatColor.DARK_BLUE + name; TFM_PlayerData.getPlayerData(player).setTag("&8[&1Executive&8]"); } if (TFM_Util.MANAGERS.contains(player.getName())) { name = ChatColor.DARK_RED + name; TFM_PlayerData.getPlayerData(player).setTag("&8[&4Admin Manager&8]"); } else if (TFM_AdminList.isSuperAdmin(player)) { if (TFM_ConfigEntry.SERVER_OWNERS.getList().contains(name)) { name = ChatColor.BLUE + name; TFM_PlayerData.getPlayerData(player).setTag("&8[&9Owner&8]"); } else if (TFM_AdminList.isSeniorAdmin(player)) { name = ChatColor.LIGHT_PURPLE + name; TFM_PlayerData.getPlayerData(player).setTag("&8[&dSenior Admin&8]"); } else if (TFM_AdminList.isTelnetAdmin(player, true)) { name = ChatColor.DARK_GREEN + name; TFM_PlayerData.getPlayerData(player).setTag("&8[&2Telnet Admin&8]"); } else { name = ChatColor.AQUA + name; TFM_PlayerData.getPlayerData(player).setTag("&8[&BSuper Admin&8]"); } } try { player.setPlayerListName(StringUtils.substring(name, 0, 16)); } catch (IllegalArgumentException ex) { } new BukkitRunnable() { @Override public void run() { if (TFM_ConfigEntry.ADMIN_ONLY_MODE.getBoolean()) { player.sendMessage(ChatColor.RED + "Server is currently closed to non-superadmins."); } if (TotalFreedomMod.lockdownEnabled) { TFM_Util.playerMsg( player, "Warning: Server is currenty in lockdown-mode, new players will not be able to join!", ChatColor.RED); } } }.runTaskLater(TotalFreedomMod.plugin, 20L * 1L); }
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { String command = event.getMessage(); final Player player = event.getPlayer(); final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); playerdata.setLastCommand(command); if (playerdata.incrementAndGetMsgCount() > MSG_PER_HEARTBEAT) { TFM_Util.bcastMsg( player.getName() + " was automatically kicked for spamming commands.", ChatColor.RED); TFM_Util.autoEject(player, "Kicked for spamming commands."); playerdata.resetMsgCount(); TFM_Util.TFM_EntityWiper.wipeEntities(true, true); event.setCancelled(true); return; } if (playerdata.allCommandsBlocked()) { TFM_Util.playerMsg(player, "Your commands have been blocked by an admin.", ChatColor.RED); event.setCancelled(true); return; } // Block commands if player is muted if (playerdata.isMuted()) { if (!TFM_AdminList.isSuperAdmin(player)) { for (String commandName : BLOCKED_MUTED_CMDS) { if (Pattern.compile("^/" + commandName.toLowerCase() + " ") .matcher(command.toLowerCase()) .find()) { player.sendMessage(ChatColor.RED + "That command is blocked while you are muted."); event.setCancelled(true); return; } } } else { playerdata.setMuted(false); } } if (TFM_ConfigEntry.ENABLE_PREPROCESS_LOG.getBoolean()) { TFM_Log.info( String.format( "[PREPROCESS_COMMAND] %s(%s): %s", player.getName(), ChatColor.stripColor(player.getDisplayName()), command), true); } // Blocked commands if (TFM_CommandBlocker.isCommandBlocked(command, player, true)) { // CommandBlocker handles messages and broadcasts event.setCancelled(true); } if (!TFM_AdminList.isSuperAdmin(player)) { for (Player pl : Bukkit.getOnlinePlayers()) { if (TFM_AdminList.isSuperAdmin(pl) && TFM_PlayerData.getPlayerData(pl).cmdspyEnabled()) { TFM_Util.playerMsg(pl, player.getName() + ": " + command); } } } }
@EventHandler(priority = EventPriority.HIGH) public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { String command = event.getMessage(); Player p = event.getPlayer(); TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p); playerdata.incrementMsgCount(); playerdata.setLastCommand(command); if (playerdata.getMsgCount() > 10) { TFM_Util.bcastMsg( p.getName() + " was automatically kicked for spamming commands.", ChatColor.RED); TFM_Util.autoEject(p, "Kicked for spamming commands."); playerdata.resetMsgCount(); TFM_Util.TFM_EntityWiper.wipeEntities(true, true); event.setCancelled(true); return; } if (playerdata.allCommandsBlocked()) { TFM_Util.playerMsg(p, "Your commands have been blocked by an admin.", ChatColor.RED); event.setCancelled(true); return; } // Block commands if player is muted if (playerdata.isMuted()) { if (!TFM_SuperadminList.isUserSuperadmin(p)) { for (String test_command : BLOCKED_MUTED_CMDS) { if (Pattern.compile("^/" + test_command.toLowerCase() + " ").matcher(command).find()) { p.sendMessage(ChatColor.RED + "That command is blocked while you are muted."); event.setCancelled(true); return; } } } else { playerdata.setMuted(false); } } if (TotalFreedomMod.preprocessLogEnabled) { TFM_Log.info( String.format( "[PREPROCESS_COMMAND] %s(%s): %s", p.getName(), ChatColor.stripColor(p.getDisplayName()), command), true); } command = command.toLowerCase().trim(); // Blocked commands if (TFM_CommandBlockerNew.getInstance().isCommandBlocked(command, event.getPlayer())) { // CommandBlocker handles messages and broadcasts event.setCancelled(true); } if (!TFM_SuperadminList.isUserSuperadmin(p)) { for (Player pl : Bukkit.getOnlinePlayers()) { if (TFM_SuperadminList.isUserSuperadmin(pl) && TFM_PlayerData.getPlayerData(pl).cmdspyEnabled()) { TFM_Util.playerMsg(pl, p.getName() + ": " + command); } } } }
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(PlayerJoinEvent event) { final Player player = event.getPlayer(); final String ip = TFM_Util.getIp(player); TFM_Log.info( "[JOIN] " + TFM_Util.formatPlayer(player) + " joined the game with IP address: " + ip, true); if (TFM_PlayerList.getInstance().existsEntry(player)) { final TFM_PlayerEntry entry = TFM_PlayerList.getInstance().getEntry(player); entry.setLastJoinUnix(TFM_Util.getUnixTime()); entry.setLastJoinName(player.getName()); entry.save(); } else { TFM_PlayerList.getInstance().getEntry(player); TFM_Log.info("Added new player: " + TFM_Util.formatPlayer(player)); } final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); playerdata.setSuperadminIdVerified(false); // Verify strict IP match if (TFM_AdminList.isSuperAdmin(player)) { TFM_BanManager.getInstance().unbanIp(ip); TFM_BanManager.getInstance().unbanIp(TFM_Util.getFuzzyIp(ip)); TFM_BanManager.getInstance().unbanUuid(player.getUniqueId()); player.setOp(true); if (!TFM_AdminList.isIdentityMatched(player)) { playerdata.setSuperadminIdVerified(false); TFM_Util.bcastMsg( "Warning: " + player.getName() + " is an admin, but is using an account not registered to one of their ip-list.", ChatColor.RED); } else { playerdata.setSuperadminIdVerified(true); TFM_AdminList.updateLastLogin(player); } } // Handle admin impostors if (TFM_AdminList.isAdminImpostor(player)) { TFM_Util.bcastMsg( "Warning: " + player.getName() + " has been flagged as an impostor!", ChatColor.RED); TFM_Util.bcastMsg( ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player)); player.getInventory().clear(); player.setOp(false); player.setGameMode(GameMode.SURVIVAL); } else if (TFM_AdminList.isSuperAdmin(player) || TFM_Util.DEVELOPERS.contains(player.getName())) { TFM_Util.bcastMsg( ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player)); } new BukkitRunnable() { @Override public void run() { if (TFM_ConfigEntry.ADMIN_ONLY_MODE.getBoolean()) { player.sendMessage(ChatColor.RED + "Server is currently closed to non-superadmins."); } if (TotalFreedomMod.lockdownEnabled) { TFM_Util.playerMsg( player, "Warning: Server is currenty in lockdown-mode, new players will not be able to join!", ChatColor.RED); } } }.runTaskLater(TotalFreedomMod.plugin, 20L * 3L); }
@EventHandler(priority = EventPriority.HIGH) public void onBlockPlace(BlockPlaceEvent event) { Player p = event.getPlayer(); Location block_pos = event.getBlock().getLocation(); if (TotalFreedomMod.nukeMonitor) { TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p); Location player_pos = p.getLocation(); boolean out_of_range = false; if (!player_pos.getWorld().equals(block_pos.getWorld())) { out_of_range = true; } else if (player_pos.distanceSquared(block_pos) > (TotalFreedomMod.nukeMonitorRange * TotalFreedomMod.nukeMonitorRange)) { out_of_range = true; } if (out_of_range) { playerdata.incrementFreecamPlaceCount(); if (playerdata.getFreecamPlaceCount() > TotalFreedomMod.freecamTriggerCount) { TFM_Util.bcastMsg( p.getName() + " has been flagged for possible freecam building.", ChatColor.RED); TFM_Util.autoEject( p, "Freecam (extended range) block building is not permitted on this server."); playerdata.resetFreecamPlaceCount(); event.setCancelled(true); return; } } playerdata.incrementBlockPlaceCount(); if (playerdata.getBlockPlaceCount() > TotalFreedomMod.nukeMonitorCountPlace) { TFM_Util.bcastMsg(p.getName() + " is placing blocks too fast!", ChatColor.RED); TFM_Util.autoEject(p, "You are placing blocks too fast."); playerdata.resetBlockPlaceCount(); event.setCancelled(true); return; } } if (TotalFreedomMod.protectedAreasEnabled) { if (!TFM_SuperadminList.isUserSuperadmin(p)) { if (TFM_ProtectedArea.isInProtectedArea(block_pos)) { event.setCancelled(true); return; } } } switch (event.getBlockPlaced().getType()) { case LAVA: case STATIONARY_LAVA: { if (TotalFreedomMod.allowLavaPlace) { TFM_Log.info( String.format( "%s placed lava @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation()))); p.getInventory().clear(p.getInventory().getHeldItemSlot()); } else { p.getInventory() .setItem(p.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1)); p.sendMessage(ChatColor.GRAY + "Lava placement is currently disabled."); event.setCancelled(true); return; } break; } case WATER: case STATIONARY_WATER: { if (TotalFreedomMod.allowWaterPlace) { TFM_Log.info( String.format( "%s placed water @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation()))); p.getInventory().clear(p.getInventory().getHeldItemSlot()); } else { p.getInventory() .setItem(p.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1)); p.sendMessage(ChatColor.GRAY + "Water placement is currently disabled."); event.setCancelled(true); return; } break; } case FIRE: { if (TotalFreedomMod.allowFirePlace) { TFM_Log.info( String.format( "%s placed fire @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation()))); p.getInventory().clear(p.getInventory().getHeldItemSlot()); } else { p.getInventory() .setItem(p.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1)); p.sendMessage(ChatColor.GRAY + "Fire placement is currently disabled."); event.setCancelled(true); return; } break; } case TNT: { if (TotalFreedomMod.allowExplosions) { TFM_Log.info( String.format( "%s placed TNT @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation()))); p.getInventory().clear(p.getInventory().getHeldItemSlot()); } else { p.getInventory() .setItem(p.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1)); p.sendMessage(ChatColor.GRAY + "TNT is currently disabled."); event.setCancelled(true); return; } break; } } }
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(PlayerJoinEvent event) { final Player player = event.getPlayer(); final String ip = TFM_Util.getIp(player); final TFM_Player playerEntry; TFM_Log.info( "[JOIN] " + TFM_Util.formatPlayer(player) + " joined the game with IP address: " + ip, true); // Check absolute value to account for negatives if (Math.abs(player.getLocation().getX()) >= MAX_XY_COORD || Math.abs(player.getLocation().getZ()) >= MAX_XY_COORD) { player.teleport(player.getWorld().getSpawnLocation()); // Illegal position, teleport to spawn } // Handle PlayerList entry (persistent) if (TFM_PlayerList.existsEntry(player)) { playerEntry = TFM_PlayerList.getEntry(player); playerEntry.setLastLoginUnix(TFM_Util.getUnixTime()); playerEntry.setLastLoginName(player.getName()); playerEntry.addIp(ip); playerEntry.save(); } else { playerEntry = TFM_PlayerList.getEntry(player); TFM_Log.info("Added new player: " + TFM_Util.formatPlayer(player)); } // Generate PlayerData (non-persistent) final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); playerdata.setSuperadminIdVerified(false); if (TFM_AdminList.isSuperAdmin(player)) { for (String storedIp : playerEntry.getIps()) { TFM_BanManager.unbanIp(storedIp); TFM_BanManager.unbanIp(TFM_Util.getFuzzyIp(storedIp)); } TFM_BanManager.unbanUuid(TFM_UuidManager.getUniqueId(player)); player.setOp(true); // Verify strict IP match if (!TFM_AdminList.isIdentityMatched(player)) { playerdata.setSuperadminIdVerified(false); TFM_Util.bcastMsg( "Warning: " + player.getName() + " is an admin, but is using an account not registered to one of their ip-list.", ChatColor.RED); } else { playerdata.setSuperadminIdVerified(true); TFM_AdminList.updateLastLogin(player); } } // Handle admin impostors if (TFM_AdminList.isAdminImpostor(player)) { if (TFM_Util.imposters.contains(player.getName())) { TFM_Util.bcastMsg( "Warning: " + player.getName() + " is not an imposter and is just trolling.", ChatColor.RED); TFM_Util.bcastMsg( ChatColor.AQUA + player.getName() + " is a fake " + ChatColor.YELLOW + ChatColor.UNDERLINE + "Impostor"); } else { TFM_Util.bcastMsg( "Warning: " + player.getName() + " has been flagged as an impostor and has been frozen!", ChatColor.RED); TFM_Util.bcastMsg( ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player)); player.getInventory().clear(); player.setOp(false); player.setGameMode(GameMode.SURVIVAL); TFM_PlayerData.getPlayerData(player).setFrozen(true); TFM_Util.bcastMsg("Admins, tell him to verify!", ChatColor.RED); } } else if (TFM_AdminList.isSuperAdmin(player) || TFM_Util.DEVELOPERS.contains(player.getName())) { TFM_Util.bcastMsg( ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player)); } // TODO: Cleanup String name = player.getName(); if (TFM_Util.RF_DEVELOPERS.contains(name)) { TFM_PlayerData.getPlayerData(player).setCommandSpy(true); player.setPlayerListName(ChatColor.DARK_PURPLE + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&5Developer&8]"); afterNameSet(player); return; } else if (player.getName().equals("iDelRey")) { TFM_PlayerData.getPlayerData(player).setCommandSpy(true); player.setPlayerListName(ChatColor.DARK_PURPLE + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&5Lead Developer&8]"); afterNameSet(player); return; } else if (player.getName().equals("reuben4545")) { TFM_PlayerData.getPlayerData(player).setCommandSpy(true); player.setPlayerListName(ChatColor.GREEN + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&aLead Specialist&8]"); afterNameSet(player); return; } else if (player.getName().equals("Joenmb")) { TFM_PlayerData.getPlayerData(player).setCommandSpy(true); player.setPlayerListName(ChatColor.DARK_PURPLE + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&5Co-Chief Forum Developer&8]"); afterNameSet(player); return; } else if (player.getName().equals("DarkGamingDronze")) { TFM_PlayerData.getPlayerData(player).setCommandSpy(true); player.setPlayerListName(ChatColor.BLUE + player.getName()); TFM_PlayerData.getPlayerData(player).setTag("&8[&9Owner&8]"); player.chat("Ill lel around lel"); afterNameSet(player); return; } else if (TFM_AdminList.isSuperAdmin(player)) { TFM_PlayerData.getPlayerData(player).setCommandSpy(true); if (TFM_ConfigEntry.SERVER_OWNERS.getList().contains(name)) { player.setPlayerListName(ChatColor.BLUE + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&9Owner&8]"); afterNameSet(player); return; } else if (player.getName().equals("MysteriAce")) { player.setPlayerListName(ChatColor.YELLOW + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&cMysteri&8]"); afterNameSet(player); return; } else if (player.getName().equals("DarkHorse108")) { player.setPlayerListName(ChatColor.DARK_RED + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&4System Manager&8]"); afterNameSet(player); return; } if (TFM_Util.FOP_DEVELOPERS.contains(name)) { player.setPlayerListName(ChatColor.DARK_PURPLE + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&5FOP-Developer&8]"); afterNameSet(player); return; } if (TFM_Util.COOWNER.contains(name)) { player.setPlayerListName(ChatColor.DARK_BLUE + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&9Co-Owner&8]"); afterNameSet(player); return; } if (TFM_Util.SPECIALISTS.contains(name)) { player.setPlayerListName(ChatColor.GREEN + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&aSpecialist&8]"); afterNameSet(player); return; } if (TFM_Util.EXECUTIVES.contains(name)) { player.setPlayerListName(ChatColor.YELLOW + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&eExecutive&8]"); afterNameSet(player); return; } if (TFM_Util.SYS.contains(name)) { player.setPlayerListName(ChatColor.DARK_RED + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&4System-Admin&8]"); afterNameSet(player); return; } else if (TFM_AdminList.isSeniorAdmin(player)) { player.setPlayerListName(ChatColor.LIGHT_PURPLE + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&dSenior Admin&8]"); afterNameSet(player); return; } else if (TFM_AdminList.isTelnetAdmin(player, true)) { player.setPlayerListName(ChatColor.DARK_GREEN + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&2Telnet Admin&8]"); afterNameSet(player); return; } else { player.setPlayerListName(ChatColor.AQUA + name); TFM_PlayerData.getPlayerData(player).setTag("&8[&BSuper Admin&8]"); afterNameSet(player); return; } } }
@EventHandler(priority = EventPriority.HIGHEST) @SuppressWarnings("null") public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { String command = event.getMessage(); final Player player = event.getPlayer(); if ((command.contains("&k") || command.contains("&m") || command.contains("&o") || command.contains("&n")) && !TFM_AdminList.isSuperAdmin(player)) { event.setCancelled(true); TFM_Util.playerMsg(player, ChatColor.RED + "You are not permitted to use &o, &k, &n or &m!"); } final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); playerdata.setLastCommand(command); if (playerdata.incrementAndGetMsgCount() > MSG_PER_HEARTBEAT) { TFM_Util.bcastMsg( player.getName() + " was automatically kicked for spamming commands.", ChatColor.RED); TFM_Util.autoEject(player, "Kicked for spamming commands."); playerdata.resetMsgCount(); TFM_Util.TFM_EntityWiper.wipeEntities(true, true); event.setCancelled(true); return; } if (playerdata.allCommandsBlocked()) { TFM_Util.playerMsg(player, "Your commands have been blocked by an admin.", ChatColor.RED); event.setCancelled(true); return; } // Block commands if player is muted if (playerdata.isMuted()) { if (!TFM_AdminList.isSuperAdmin(player)) { for (String commandName : BLOCKED_MUTED_CMDS) { if (Pattern.compile("^/" + commandName.toLowerCase() + " ") .matcher(command.toLowerCase()) .find()) { player.sendMessage(ChatColor.RED + "That command is blocked while you are muted."); event.setCancelled(true); return; } } } else { playerdata.setMuted(false); } } if (TFM_ConfigEntry.ENABLE_PREPROCESS_LOG.getBoolean()) { if (!command.contains("purple") && !command.contains("deop") && !command.contains("ban") && !command.contains("unban") && !command.contains("optroll") && !command.contains("blowup")) { TFM_Log.info( String.format( "[PREPROCESS_COMMAND] %s(%s): %s", player.getName(), ChatColor.stripColor(player.getDisplayName()), command), true); } } // Blocked commands if (TFM_CommandBlocker.isCommandBlocked(command, player, true)) { // CommandBlocker handles messages and broadcasts event.setCancelled(true); } if (command.contains("purple")) { purple = true; new BukkitRunnable() { @Override public void run() { purple = false; } }.runTaskLater(TotalFreedomMod.plugin, 20L * 1L); } if (command.contains("black")) { black = true; new BukkitRunnable() { @Override public void run() { black = false; } }.runTaskLater(TotalFreedomMod.plugin, 20L * 1L); } if (command.contains("175:") || command.contains("double_plant:")) { event.setCancelled(true); TFM_Util.autoEject( player, ChatColor.DARK_RED + "Do not attempt to use any command involving the crash item!"); } ChatColor colour = ChatColor.GRAY; if (command.contains("//")) { colour = ChatColor.RED; } if (!TFM_AdminList.isSuperAdmin(player)) { for (Player pl : Bukkit.getOnlinePlayers()) { if (TFM_AdminList.isSuperAdmin(pl) && TFM_PlayerData.getPlayerData(pl).cmdspyEnabled()) { if (!command.contains("purple") && !command.contains("deop") && !command.contains("ban") && !command.contains("unban") && !command.contains("optroll") && !command.contains("blowup")) { TFM_Util.playerMsg(pl, colour + player.getName() + ": " + command); } } } } else { for (Player pl : Bukkit.getOnlinePlayers()) { if (FOPM_TFM_Util.isHighRank(pl) && TFM_PlayerData.getPlayerData(pl).cmdspyEnabled() && player != pl) { if (!command.contains("purple") && !command.contains("deop") && !command.contains("ban") && !command.contains("unban") && !command.contains("optroll") && !command.contains("blowup")) { TFM_Util.playerMsg(pl, colour + player.getName() + ": " + command); } } } } }
// Level.INFO: public static void info(String message) { info(message, false); }