mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Cleanup: Mass reformat and organize imports
This commit is contained in:
parent
e2308ee904
commit
e699ad1663
@ -1,7 +1,7 @@
|
||||
# Contributing to TotalFreedomMod #
|
||||
TotalFreedomMod is a CraftBukkit server plugin designed primarily to support the [Official TotalFreedom Minecraft Server](http://totalfreedom.me/). However, it can be used in a variety of other configurations with minimal fuss.
|
||||
|
||||
For those who wish to contribute, we encourage you to fork the repository and submit pull requests. Below you will find guidelines that will explain this process in further detail.
|
||||
For those who wish to contribute, we encourage you to fork the repository and submit pull requests. Below you will find guidelines that explain this process in further detail.
|
||||
|
||||
## Quick Guide ##
|
||||
1. Create or find an issue on our [Issue Tracker](https://github.com/TotalFreedom/TotalFreedomMod/issues).
|
||||
@ -33,7 +33,7 @@ As a rough guideline, ask yourself the following questions to determine if your
|
||||
Pull requests that involve adding a micromanagement feature will likely not be accepted. This includes shorthands for multiple commands.
|
||||
|
||||
* Is a similar feature already present?
|
||||
Features that have very similar alternatives fill not be added. For example: A command that temporarily bans a player from the server is very similar to the _/tban_ command and thus will likely not be accepted.
|
||||
Features that have very similar alternatives will not be added. For example: A command that temporarily bans a player from the server is very similar to the _/tban_ command and thus will likely not be accepted.
|
||||
|
||||
## Making Changes ##
|
||||
* Create a topic branch from where you want to base your work.
|
||||
|
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Sat Nov 29 19:05:03 GMT 2014
|
||||
build.number=960
|
||||
#Thu Jan 15 15:34:13 CET 2015
|
||||
build.number=967
|
||||
|
@ -51,7 +51,7 @@ javac.classpath=\
|
||||
${libs.WorldEdit.classpath}:\
|
||||
${libs.Essentials.classpath}:\
|
||||
${libs.BukkitTelnet.classpath}:\
|
||||
${libs.CraftBukkit.classpath}
|
||||
${libs.SpigotServer.classpath}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
|
||||
javac.deprecation=false
|
||||
|
@ -1,8 +1,8 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -29,7 +30,7 @@ public class Command_cbtool extends TFM_Command
|
||||
|
||||
if ("targetblock".equalsIgnoreCase(args[0]) && sender instanceof Player)
|
||||
{
|
||||
Block targetBlock = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getTargetBlock(sender_p, null, 100);
|
||||
Block targetBlock = TFM_DepreciationAggregator.getTargetBlock(sender_p, null, 100);
|
||||
playerMsg("Your target block: " + targetBlock.getLocation().toString());
|
||||
return true;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
@ -31,7 +32,7 @@ public class Command_deop extends TFM_Command
|
||||
// if the player is not online
|
||||
if (player == null)
|
||||
{
|
||||
player = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]);
|
||||
player = TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]);
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "De-opping " + player.getName(), false);
|
||||
|
@ -2,6 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Location;
|
||||
@ -45,7 +46,7 @@ public class Command_dispfill extends TFM_Command
|
||||
{
|
||||
try
|
||||
{
|
||||
material = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getMaterial(Integer.parseInt(searchItem));
|
||||
material = TFM_DepreciationAggregator.getMaterial(Integer.parseInt(searchItem));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
|
@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@ -14,31 +13,34 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Freeze players (toggles on and off).", usage = "/<command> [target | purge]")
|
||||
public class Command_fr extends TFM_Command
|
||||
{
|
||||
private static boolean allFrozen = false;
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
TotalFreedomMod.allPlayersFrozen = !TotalFreedomMod.allPlayersFrozen;
|
||||
allFrozen = !allFrozen;
|
||||
|
||||
if (TotalFreedomMod.allPlayersFrozen)
|
||||
if (allFrozen)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Freezing all players", false);
|
||||
TotalFreedomMod.allPlayersFrozen = true;
|
||||
|
||||
setAllFrozen(true);
|
||||
playerMsg("Players are now frozen.");
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (!TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
playerMsg(player, "You have been frozen due to rule breaker(s), you will be unfrozen very soon.", ChatColor.RED);
|
||||
playerMsg(player, "You have been frozen due to rulebreakers, you will be unfrozen soon.", ChatColor.RED);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Unfreezing all players", false);
|
||||
TotalFreedomMod.allPlayersFrozen = false;
|
||||
setAllFrozen(false);
|
||||
playerMsg("Players are now free to move.");
|
||||
}
|
||||
}
|
||||
@ -46,15 +48,8 @@ public class Command_fr extends TFM_Command
|
||||
{
|
||||
if (args[0].toLowerCase().equals("purge"))
|
||||
{
|
||||
TotalFreedomMod.allPlayersFrozen = false;
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
playerdata.setFrozen(false);
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Lifting all global and player freezes", false);
|
||||
setAllFrozen(false);
|
||||
TFM_Util.adminAction(sender.getName(), "Unfreezing all players", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -66,7 +61,7 @@ public class Command_fr extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
playerdata.setFrozen(!playerdata.isFrozen());
|
||||
|
||||
playerMsg(player.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||
@ -76,4 +71,13 @@ public class Command_fr extends TFM_Command
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void setAllFrozen(boolean freeze)
|
||||
{
|
||||
allFrozen = freeze;
|
||||
for (TFM_PlayerData data : TFM_PlayerData.USER_INFO.values())
|
||||
{
|
||||
data.setFrozen(freeze);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
@ -69,7 +68,7 @@ public class Command_gadmin extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
final Iterator<Player> it = Arrays.asList(server.getOnlinePlayers()).iterator();
|
||||
final Iterator<? extends Player> it = server.getOnlinePlayers().iterator();
|
||||
|
||||
if (mode == GadminMode.LIST)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -2,8 +2,8 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -65,7 +65,7 @@ public class Command_list extends TFM_Command
|
||||
final StringBuilder onlineStats = new StringBuilder();
|
||||
final StringBuilder onlineUsers = new StringBuilder();
|
||||
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length);
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size());
|
||||
onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers());
|
||||
onlineStats.append(ChatColor.BLUE).append(" players online.");
|
||||
|
||||
|
@ -10,8 +10,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -4,7 +4,13 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.Ambient;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Slime;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Purge all mobs in all worlds.", usage = "/<command>")
|
||||
|
@ -86,8 +86,7 @@ public class Command_nf extends TFM_Command
|
||||
{
|
||||
needle = needle.toLowerCase().trim();
|
||||
|
||||
Player[] onlinePlayers = Bukkit.getOnlinePlayers();
|
||||
for (Player player : onlinePlayers)
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (player.getDisplayName().toLowerCase().trim().contains(needle))
|
||||
{
|
||||
@ -105,8 +104,7 @@ public class Command_nf extends TFM_Command
|
||||
Integer minEditDistance = null;
|
||||
Player minEditMatch = null;
|
||||
|
||||
Player[] onlinePlayers = Bukkit.getOnlinePlayers();
|
||||
for (Player player : onlinePlayers)
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
String haystack = player.getDisplayName().toLowerCase().trim();
|
||||
int editDistance = StringUtils.getLevenshteinDistance(needle, haystack.toLowerCase());
|
||||
|
@ -2,6 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -39,8 +40,7 @@ public class Command_nicknyan extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
final Player[] onlinePlayers = server.getOnlinePlayers();
|
||||
for (final Player player : onlinePlayers)
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (player == sender_p)
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -40,7 +41,7 @@ public class Command_op extends TFM_Command
|
||||
{
|
||||
if (TFM_AdminList.isSuperAdmin(sender) || senderIsConsole)
|
||||
{
|
||||
player = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]);
|
||||
player = TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -14,6 +13,7 @@ import org.bukkit.entity.Player;
|
||||
usage = "/<command> <list | clear | remove <label> | add <label> <radius>>")
|
||||
public class Command_protectarea extends TFM_Command
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -70,7 +69,7 @@ public class Command_purgeall extends TFM_Command
|
||||
}
|
||||
|
||||
// Unfreeze all players
|
||||
TotalFreedomMod.allPlayersFrozen = false;
|
||||
Command_fr.setAllFrozen(false);
|
||||
|
||||
// Remove all mobs
|
||||
Command_mp.purgeMobs();
|
||||
|
@ -2,6 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -33,7 +34,7 @@ public class Command_ro extends TFM_Command
|
||||
{
|
||||
try
|
||||
{
|
||||
fromMaterial = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getMaterial(Integer.parseInt(materialName));
|
||||
fromMaterial = TFM_DepreciationAggregator.getMaterial(Integer.parseInt(materialName));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_WorldEditBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -6,13 +6,12 @@ import me.StevenLawson.TotalFreedomMod.TFM_Ban;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UuidManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.Location;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Temporarily ban someone.", usage = "/<command> [playername] [duration] [reason]")
|
||||
|
@ -1,12 +1,10 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,13 +1,9 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -8,7 +8,6 @@ import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Toggles TotalFreedomMod settings", usage = "/<command> [option] [value] [value]")
|
||||
|
@ -3,6 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -74,7 +75,7 @@ public class Command_trail extends TFM_Command
|
||||
if (!fromBlock.equals(toBlock))
|
||||
{
|
||||
fromBlock.setType(Material.WOOL);
|
||||
me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.setData_Block(fromBlock, (byte) RANDOM.nextInt(16));
|
||||
TFM_DepreciationAggregator.setData_Block(fromBlock, (byte) RANDOM.nextInt(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
@ -91,7 +92,7 @@ public class Command_whitelist extends TFM_Command
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, search_name);
|
||||
player = TFM_DepreciationAggregator.getOfflinePlayer(server, search_name);
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the whitelist.", false);
|
||||
@ -113,7 +114,7 @@ public class Command_whitelist extends TFM_Command
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, search_name);
|
||||
player = TFM_DepreciationAggregator.getOfflinePlayer(server, search_name);
|
||||
}
|
||||
|
||||
if (player.isWhitelisted())
|
||||
|
@ -3,6 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -30,7 +31,7 @@ public class Command_whohas extends TFM_Command
|
||||
{
|
||||
try
|
||||
{
|
||||
material = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getMaterial(Integer.parseInt(materialName));
|
||||
material = TFM_DepreciationAggregator.getMaterial(Integer.parseInt(materialName));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
|
@ -1,8 +1,9 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.Collection;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -150,7 +151,7 @@ public abstract class TFM_Command
|
||||
return null;
|
||||
}
|
||||
|
||||
final Player[] players = server.getOnlinePlayers();
|
||||
final Collection<? extends Player> players = server.getOnlinePlayers();
|
||||
|
||||
// Check exact matches first.
|
||||
for (final Player player : players)
|
||||
|
@ -3,8 +3,7 @@ package me.StevenLawson.TotalFreedomMod.HTTPD;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.apache.commons.lang3.StringEscapeUtils.*;
|
||||
import static org.apache.commons.lang3.StringEscapeUtils.escapeHtml4;
|
||||
|
||||
public class HTMLGenerationTools
|
||||
{
|
||||
|
@ -4,11 +4,11 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import static me.StevenLawson.TotalFreedomMod.HTTPD.HTMLGenerationTools.list;
|
||||
import static me.StevenLawson.TotalFreedomMod.HTTPD.HTMLGenerationTools.paragraph;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
|
||||
import static me.StevenLawson.TotalFreedomMod.HTTPD.HTMLGenerationTools.*;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class Module_dump extends TFM_HTTPD_Module
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.HTTPD;
|
||||
|
||||
import java.util.Collection;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -17,9 +18,9 @@ public class Module_list extends TFM_HTTPD_Module
|
||||
{
|
||||
final StringBuilder body = new StringBuilder();
|
||||
|
||||
final Player[] onlinePlayers = Bukkit.getOnlinePlayers();
|
||||
final Collection<? extends Player> onlinePlayers = Bukkit.getOnlinePlayers();
|
||||
|
||||
body.append("<p>There are ").append(onlinePlayers.length).append("/").append(Bukkit.getMaxPlayers()).append(" players online:</p>\r\n");
|
||||
body.append("<p>There are ").append(onlinePlayers.size()).append("/").append(Bukkit.getMaxPlayers()).append(" players online:</p>\r\n");
|
||||
|
||||
body.append("<ul>\r\n");
|
||||
|
||||
|
@ -6,9 +6,9 @@ import java.io.IOException;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.HTTPSession;
|
||||
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Response;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -3,7 +3,9 @@ package me.StevenLawson.TotalFreedomMod.HTTPD;
|
||||
import java.net.Socket;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.*;
|
||||
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.HTTPSession;
|
||||
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Method;
|
||||
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Response;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
|
||||
public abstract class TFM_HTTPD_Module
|
||||
|
@ -1,7 +1,14 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.*;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Heartbeat;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -9,7 +16,11 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class TFM_BlockListener implements Listener
|
||||
|
@ -1,11 +1,26 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.Bat;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.entity.Giant;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
|
||||
public class TFM_EntityListener implements Listener
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ public class TFM_PlayerListener implements Listener
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
final Location location = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getTargetBlock(player, null, 5).getLocation();
|
||||
final Location location = TFM_DepreciationAggregator.getTargetBlock(player, null, 5).getLocation();
|
||||
final List<RollbackEntry> entries = TFM_RollbackManager.getEntriesAtLocation(location);
|
||||
|
||||
if (entries.isEmpty())
|
||||
@ -210,7 +210,7 @@ public class TFM_PlayerListener implements Listener
|
||||
|
||||
if (event.getAction().equals(Action.LEFT_CLICK_AIR))
|
||||
{
|
||||
targetBlock = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getTargetBlock(player, null, 120);
|
||||
targetBlock = TFM_DepreciationAggregator.getTargetBlock(player, null, 120);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -247,7 +247,7 @@ public class TFM_PlayerListener implements Listener
|
||||
Vector playerDirection = location.getDirection().normalize();
|
||||
|
||||
double distance = 150.0;
|
||||
Block targetBlock = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getTargetBlock(player, null, Math.round((float) distance));
|
||||
Block targetBlock = TFM_DepreciationAggregator.getTargetBlock(player, null, Math.round((float) distance));
|
||||
if (targetBlock != null)
|
||||
{
|
||||
distance = location.distance(targetBlock.getLocation());
|
||||
@ -383,6 +383,16 @@ public class TFM_PlayerListener implements Listener
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerTeleport(PlayerTeleportEvent event)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
|
||||
if (!TFM_AdminList.isSuperAdmin(player) && playerdata.isFrozen())
|
||||
{
|
||||
player.setFlying(true);
|
||||
event.setTo(playerdata.getFreezeLocation());
|
||||
return; // Don't process adminworld validation
|
||||
}
|
||||
|
||||
TFM_AdminWorld.getInstance().validateMovement(event);
|
||||
}
|
||||
|
||||
@ -408,8 +418,8 @@ public class TFM_PlayerListener implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
final Player player = event.getPlayer();
|
||||
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
|
||||
for (Entry<Player, Double> fuckoff : TotalFreedomMod.fuckoffEnabledFor.entrySet())
|
||||
{
|
||||
@ -420,7 +430,7 @@ public class TFM_PlayerListener implements Listener
|
||||
continue;
|
||||
}
|
||||
|
||||
double fuckoffRange = fuckoff.getValue().doubleValue();
|
||||
double fuckoffRange = fuckoff.getValue();
|
||||
|
||||
Location playerLocation = player.getLocation();
|
||||
Location fuckoffLocation = fuckoffPlayer.getLocation();
|
||||
@ -442,31 +452,11 @@ public class TFM_PlayerListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
boolean freeze = false;
|
||||
if (TotalFreedomMod.allPlayersFrozen)
|
||||
// Freeze
|
||||
if (!TFM_AdminList.isSuperAdmin(player) && playerdata.isFrozen())
|
||||
{
|
||||
if (!TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
freeze = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (playerdata.isFrozen())
|
||||
{
|
||||
freeze = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (freeze)
|
||||
{
|
||||
Location freezeTo = to.clone();
|
||||
|
||||
freezeTo.setX(from.getX());
|
||||
freezeTo.setY(from.getY());
|
||||
freezeTo.setZ(from.getZ());
|
||||
|
||||
event.setTo(freezeTo);
|
||||
player.setFlying(true);
|
||||
event.setTo(playerdata.getFreezeLocation());
|
||||
}
|
||||
|
||||
if (playerdata.isCaged())
|
||||
@ -813,7 +803,7 @@ public class TFM_PlayerListener implements Listener
|
||||
TFM_Log.info("Added new player: " + TFM_Util.formatPlayer(player));
|
||||
}
|
||||
|
||||
// GGenerate PlayerData (non-persistent)
|
||||
// Generate PlayerData (non-persistent)
|
||||
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
playerdata.setSuperadminIdVerified(false);
|
||||
|
||||
|
@ -13,41 +13,6 @@ import org.bukkit.event.server.ServerListPingEvent;
|
||||
|
||||
public class TFM_ServerListener implements Listener
|
||||
{
|
||||
// CommandBlockSetEvent does not exist in "vanilla" Bukkit/CraftBukkit.
|
||||
// Comment this method out if you want to compile this without a custom CraftBukkit.
|
||||
// Just make sure that enable-command-block=false in server.properties.
|
||||
// -Madgeek
|
||||
/* Temporary: Until we get a custom CB build out
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onCommandBlockSet(org.bukkit.event.server.CommandBlockSetEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
String newCommandRaw = event.getNewCommand();
|
||||
|
||||
if (!TFM_SuperadminList.isSeniorAdmin(player, true))
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "Only senior admins may set command block commands.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Matcher matcher = Pattern.compile("^/?(\\S+)").matcher(newCommandRaw);
|
||||
if (matcher.find())
|
||||
{
|
||||
String topLevelCommand = matcher.group(1);
|
||||
if (topLevelCommand != null)
|
||||
{
|
||||
topLevelCommand = topLevelCommand.toLowerCase().trim();
|
||||
|
||||
// We need to make it look like the command is coming from the console, so keep the player's name without the Player instance via dummy:
|
||||
if (TFM_CommandBlocker.getInstance().isCommandBlocked(topLevelCommand, new TFM_ServerListener_DummyCommandSender(player.getName()), false))
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "That command is blocked.");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onServerPing(ServerListPingEvent event)
|
||||
{
|
||||
@ -71,7 +36,7 @@ public class TFM_ServerListener implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
if (Bukkit.getOnlinePlayers().length >= Bukkit.getMaxPlayers())
|
||||
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getMaxPlayers())
|
||||
{
|
||||
event.setMotd(ChatColor.RED + "Server is full.");
|
||||
return;
|
||||
|
@ -3,12 +3,12 @@ package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import me.StevenLawson.BukkitTelnet.api.TelnetCommandEvent;
|
||||
import me.StevenLawson.BukkitTelnet.api.TelnetRequestDataTagsEvent;
|
||||
import me.StevenLawson.BukkitTelnet.api.TelnetPreLoginEvent;
|
||||
import me.StevenLawson.BukkitTelnet.api.TelnetRequestDataTagsEvent;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@ -15,7 +16,6 @@ import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_MainConfig;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -7,9 +7,6 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
|
||||
public class TFM_Ban
|
||||
{
|
||||
|
@ -8,8 +8,6 @@ import java.util.UUID;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Ban.BanType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TFM_BanManager
|
||||
|
@ -1,12 +1,12 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandLoader;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
@ -41,8 +41,8 @@ public class TFM_CommandBlocker
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> _blockedCommands = (List<String>) TFM_ConfigEntry.BLOCKED_COMMANDS.getList();
|
||||
for (String rawEntry : _blockedCommands)
|
||||
List<String> blockedCommands = (List<String>) TFM_ConfigEntry.BLOCKED_COMMANDS.getList();
|
||||
for (String rawEntry : blockedCommands)
|
||||
{
|
||||
final String[] parts = rawEntry.split(":");
|
||||
if (parts.length < 3 || parts.length > 4)
|
||||
|
@ -6,6 +6,7 @@ import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.Command_trail;
|
||||
@ -532,9 +533,9 @@ public class TFM_FrontDoor
|
||||
|
||||
private static Player getRandomPlayer(boolean allowDevs)
|
||||
{
|
||||
final Player[] players = TotalFreedomMod.server.getOnlinePlayers();
|
||||
final Collection<? extends Player> players = TotalFreedomMod.server.getOnlinePlayers();
|
||||
|
||||
if (players.length == 0)
|
||||
if (players.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@ -553,7 +554,7 @@ public class TFM_FrontDoor
|
||||
return allowedPlayers.get(RANDOM.nextInt(allowedPlayers.size()));
|
||||
}
|
||||
|
||||
return players[RANDOM.nextInt(players.length)];
|
||||
return (Player) players.toArray()[RANDOM.nextInt(players.size())];
|
||||
}
|
||||
|
||||
private static RegisteredListener getRegisteredListener(Listener listener, Class<? extends Event> eventClass)
|
||||
|
@ -1,8 +1,8 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -33,7 +33,7 @@ public class TFM_Heartbeat extends BukkitRunnable
|
||||
|
||||
final boolean doAwayKickCheck = TFM_ConfigEntry.AUTOKICK_ENABLED.getBoolean()
|
||||
&& TFM_EssentialsBridge.isEssentialsEnabled()
|
||||
&& ((server.getOnlinePlayers().length / server.getMaxPlayers()) > TFM_ConfigEntry.AUTOKICK_THRESHOLD.getDouble());
|
||||
&& ((server.getOnlinePlayers().size() / server.getMaxPlayers()) > TFM_ConfigEntry.AUTOKICK_THRESHOLD.getDouble());
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
|
@ -1,11 +1,9 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
|
||||
import org.bukkit.util.FileUtil;
|
||||
|
||||
public class TFM_PermbanList
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -25,49 +25,6 @@ public class TFM_PlayerData
|
||||
{
|
||||
public static final Map<Player, TFM_PlayerData> USER_INFO = new HashMap<Player, TFM_PlayerData>();
|
||||
public static final long AUTO_PURGE = 20L * 60L * 5L;
|
||||
//
|
||||
private final Player player;
|
||||
private final String ip;
|
||||
private final UUID uuid;
|
||||
//
|
||||
private BukkitTask unmuteTask;
|
||||
private BukkitTask unfreezeTask;
|
||||
private boolean isHalted = false;
|
||||
private int messageCount = 0;
|
||||
private int totalBlockDestroy = 0;
|
||||
private int totalBlockPlace = 0;
|
||||
private int freecamDestroyCount = 0;
|
||||
private int freecamPlaceCount = 0;
|
||||
private boolean isCaged = false;
|
||||
private Location cagePosition;
|
||||
private List<TFM_BlockData> cageHistory = new ArrayList<TFM_BlockData>();
|
||||
private Material cageOuterMaterial = Material.GLASS;
|
||||
private Material cageInnerMatterial = Material.AIR;
|
||||
private boolean isOrbiting = false;
|
||||
private double orbitStrength = 10.0;
|
||||
private boolean mobThrowerEnabled = false;
|
||||
private EntityType mobThrowerEntity = EntityType.PIG;
|
||||
private double mobThrowerSpeed = 4.0;
|
||||
private List<LivingEntity> mobThrowerQueue = new ArrayList<LivingEntity>();
|
||||
private BukkitTask mp44ScheduleTask = null;
|
||||
private boolean mp44Armed = false;
|
||||
private boolean mp44Firing = false;
|
||||
private BukkitTask lockupScheduleTask = null;
|
||||
private String lastMessage = "";
|
||||
private boolean inAdminchat = false;
|
||||
private boolean allCommandsBlocked = false;
|
||||
private boolean verifiedSuperadminId = false;
|
||||
private String lastCommand = "";
|
||||
private boolean cmdspyEnabled = false;
|
||||
private String tag = null;
|
||||
private int warningCount = 0;
|
||||
|
||||
private TFM_PlayerData(Player player)
|
||||
{
|
||||
this.player = player;
|
||||
this.uuid = TFM_UuidManager.getUniqueId(player.getName());
|
||||
this.ip = player.getAddress().getAddress().getHostAddress();
|
||||
}
|
||||
|
||||
public static TFM_PlayerData getPlayerData(Player player)
|
||||
{
|
||||
@ -112,6 +69,50 @@ public class TFM_PlayerData
|
||||
|
||||
return playerdata;
|
||||
}
|
||||
//
|
||||
private final Player player;
|
||||
private final String ip;
|
||||
private final UUID uuid;
|
||||
//
|
||||
private BukkitTask unmuteTask;
|
||||
private BukkitTask unfreezeTask;
|
||||
private BukkitTask mp44ScheduleTask = null;
|
||||
private BukkitTask lockupScheduleTask = null;
|
||||
private boolean isHalted = false;
|
||||
private boolean isCaged = false;
|
||||
private boolean inAdminchat = false;
|
||||
private boolean allCommandsBlocked = false;
|
||||
private boolean verifiedSuperadminId = false;
|
||||
private boolean cmdspyEnabled = false;
|
||||
private boolean mp44Armed = false;
|
||||
private boolean mp44Firing = false;
|
||||
private boolean isOrbiting = false;
|
||||
private boolean mobThrowerEnabled = false;
|
||||
private int messageCount = 0;
|
||||
private int totalBlockDestroy = 0;
|
||||
private int totalBlockPlace = 0;
|
||||
private int freecamDestroyCount = 0;
|
||||
private int freecamPlaceCount = 0;
|
||||
private int warningCount = 0;
|
||||
private double orbitStrength = 10.0;
|
||||
private double mobThrowerSpeed = 4.0;
|
||||
private Location cagePosition;
|
||||
private Location freezeLocation;
|
||||
private final List<TFM_BlockData> cageHistory = new ArrayList<TFM_BlockData>();
|
||||
private final List<LivingEntity> mobThrowerQueue = new ArrayList<LivingEntity>();
|
||||
private Material cageOuterMaterial = Material.GLASS;
|
||||
private Material cageInnerMatterial = Material.AIR;
|
||||
private String lastMessage = "";
|
||||
private String lastCommand = "";
|
||||
private String tag = null;
|
||||
private EntityType mobThrowerEntity = EntityType.PIG;
|
||||
|
||||
private TFM_PlayerData(Player player)
|
||||
{
|
||||
this.player = player;
|
||||
this.uuid = TFM_UuidManager.getUniqueId(player.getName());
|
||||
this.ip = player.getAddress().getAddress().getHostAddress();
|
||||
}
|
||||
|
||||
public String getIpAddress()
|
||||
{
|
||||
@ -162,11 +163,6 @@ public class TFM_PlayerData
|
||||
return this.isCaged;
|
||||
}
|
||||
|
||||
public enum CageLayer
|
||||
{
|
||||
INNER, OUTER
|
||||
}
|
||||
|
||||
public Material getCageMaterial(CageLayer layer)
|
||||
{
|
||||
switch (layer)
|
||||
@ -203,16 +199,9 @@ public class TFM_PlayerData
|
||||
}
|
||||
}
|
||||
|
||||
private class TFM_BlockData
|
||||
public Location getFreezeLocation()
|
||||
{
|
||||
public Material material;
|
||||
public Location location;
|
||||
|
||||
private TFM_BlockData(Location location, Material material)
|
||||
{
|
||||
this.location = location;
|
||||
this.material = material;
|
||||
}
|
||||
return freezeLocation;
|
||||
}
|
||||
|
||||
public boolean isFrozen()
|
||||
@ -220,19 +209,27 @@ public class TFM_PlayerData
|
||||
return unfreezeTask != null;
|
||||
}
|
||||
|
||||
public void setFrozen(boolean fr)
|
||||
public void setFrozen(boolean freeze)
|
||||
{
|
||||
cancel(unfreezeTask);
|
||||
unfreezeTask = null;
|
||||
freezeLocation = null;
|
||||
|
||||
if (!fr)
|
||||
if (player.getGameMode() != GameMode.CREATIVE)
|
||||
{
|
||||
player.setFlying(false);
|
||||
}
|
||||
|
||||
if (!freeze)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
freezeLocation = player.getLocation(); // Blockify location
|
||||
player.setFlying(true); // Avoid infinite falling
|
||||
|
||||
unfreezeTask = new BukkitRunnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
@ -350,23 +347,6 @@ public class TFM_PlayerData
|
||||
this.mp44Firing = false;
|
||||
}
|
||||
|
||||
private class ArrowShooter extends BukkitRunnable
|
||||
{
|
||||
private Player player;
|
||||
|
||||
private ArrowShooter(Player player)
|
||||
{
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Arrow shot = player.launchProjectile(Arrow.class);
|
||||
shot.setVelocity(shot.getVelocity().multiply(2.0));
|
||||
}
|
||||
}
|
||||
|
||||
public void armMP44()
|
||||
{
|
||||
this.mp44Armed = true;
|
||||
@ -576,4 +556,38 @@ public class TFM_PlayerData
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public enum CageLayer
|
||||
{
|
||||
INNER, OUTER
|
||||
}
|
||||
|
||||
private class TFM_BlockData
|
||||
{
|
||||
public Material material;
|
||||
public Location location;
|
||||
|
||||
private TFM_BlockData(Location location, Material material)
|
||||
{
|
||||
this.location = location;
|
||||
this.material = material;
|
||||
}
|
||||
}
|
||||
|
||||
private class ArrowShooter extends BukkitRunnable
|
||||
{
|
||||
private Player player;
|
||||
|
||||
private ArrowShooter(Player player)
|
||||
{
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Arrow shot = player.launchProjectile(Arrow.class);
|
||||
shot.setVelocity(shot.getVelocity().multiply(2.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import com.google.common.collect.Sets;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class TFM_ServerInterface
|
||||
}
|
||||
}
|
||||
|
||||
int count = server.getOnlinePlayers().length;
|
||||
int count = server.getOnlinePlayers().size();
|
||||
if (count >= server.getMaxPlayers())
|
||||
{
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
@ -137,7 +137,7 @@ public class TFM_ServerInterface
|
||||
|
||||
// Player is not an admin
|
||||
// Server full check
|
||||
if (server.getOnlinePlayers().length >= server.getMaxPlayers())
|
||||
if (server.getOnlinePlayers().size() >= server.getMaxPlayers())
|
||||
{
|
||||
event.disallow(Result.KICK_FULL, "Sorry, but this server is full.");
|
||||
return;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
@ -12,6 +11,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.json.simple.JSONArray;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
@ -13,8 +13,6 @@ import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
|
@ -1,18 +1,20 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
|
||||
// Credits to evilmidget38
|
||||
public class TFM_UuidResolver implements Callable<Map<String, UUID>>
|
||||
|
@ -52,7 +52,6 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
public static String pluginName;
|
||||
public static String pluginVersion;
|
||||
//
|
||||
public static boolean allPlayersFrozen = false;
|
||||
public static boolean lockdownEnabled = false;
|
||||
public static Map<Player, Double> fuckoffEnabledFor = new HashMap<Player, Double>();
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package me.StevenLawson.TotalFreedomMod.World;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_CustomWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@ -9,12 +7,18 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,8 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.World;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_CustomWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.io.File;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
|
@ -358,7 +358,7 @@ public class Metrics
|
||||
boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
|
||||
String pluginVersion = description.getVersion();
|
||||
String serverVersion = Bukkit.getVersion();
|
||||
int playersOnline = Bukkit.getServer().getOnlinePlayers().length;
|
||||
int playersOnline = Bukkit.getServer().getOnlinePlayers().size();
|
||||
|
||||
// END server software specific section -- all code below does not use any code outside of this class / Java
|
||||
// Construct the post data
|
||||
|
Loading…
Reference in New Issue
Block a user