mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 13:33:54 +00:00
I'm tired of seeing prs that make small code reformats so im doing a commit to fix it all at once
This commit is contained in:
@ -154,10 +154,10 @@ public class ChatManager extends FreedomService
|
||||
Admin admin = plugin.al.getAdmin(player);
|
||||
if (!Strings.isNullOrEmpty(admin.getAcFormat()))
|
||||
{
|
||||
String format = admin.getAcFormat();
|
||||
ChatColor color = getColor(admin, display);
|
||||
String msg = format.replace("%name%", sender.getName()).replace("%rank%", display.getAbbr()).replace("%rankcolor%", color.toString()).replace("%msg%", message);
|
||||
player.sendMessage(FUtil.colorize(msg));
|
||||
String format = admin.getAcFormat();
|
||||
ChatColor color = getColor(admin, display);
|
||||
String msg = format.replace("%name%", sender.getName()).replace("%rank%", display.getAbbr()).replace("%rankcolor%", color.toString()).replace("%msg%", message);
|
||||
player.sendMessage(FUtil.colorize(msg));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -500,9 +500,9 @@ public class FrontDoor extends FreedomService
|
||||
book.setTitle(ChatColor.DARK_GREEN + "Why you should go to TotalFreedom instead");
|
||||
book.addPage(
|
||||
ChatColor.DARK_GREEN + "Why you should go to TotalFreedom instead\n"
|
||||
+ ChatColor.DARK_GRAY + "---------\n"
|
||||
+ ChatColor.BLACK + "TotalFreedom is the original TotalFreedomMod server. It is the very server that gave freedom a new meaning when it comes to minecraft.\n"
|
||||
+ ChatColor.BLUE + "Join now! " + ChatColor.RED + "play.totalfreedom.me");
|
||||
+ ChatColor.DARK_GRAY + "---------\n"
|
||||
+ ChatColor.BLACK + "TotalFreedom is the original TotalFreedomMod server. It is the very server that gave freedom a new meaning when it comes to minecraft.\n"
|
||||
+ ChatColor.BLUE + "Join now! " + ChatColor.RED + "play.totalfreedom.me");
|
||||
bookStack.setItemMeta(book);
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
|
@ -108,7 +108,7 @@ public class LoginProcess extends FreedomService
|
||||
final int forceIpPort = ConfigEntry.FORCE_IP_PORT.getInteger();
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER,
|
||||
ConfigEntry.FORCE_IP_KICKMSG.getString()
|
||||
.replace("%address%", ConfigEntry.SERVER_ADDRESS.getString() + (forceIpPort == DEFAULT_PORT ? "" : ":" + forceIpPort)));
|
||||
.replace("%address%", ConfigEntry.SERVER_ADDRESS.getString() + (forceIpPort == DEFAULT_PORT ? "" : ":" + forceIpPort)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -205,8 +205,8 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
ak = services.registerService(AutoKick.class);
|
||||
ae = services.registerService(AutoEject.class);
|
||||
mo = services.registerService(Monitors.class);
|
||||
|
||||
|
||||
|
||||
|
||||
mv = services.registerService(MovementValidator.class);
|
||||
ew = services.registerService(EntityWiper.class);
|
||||
fd = services.registerService(FrontDoor.class);
|
||||
|
@ -18,7 +18,7 @@ public class AMP extends FreedomService
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
if(!plugin.config.getBoolean(ConfigEntry.AMP_ENABLED))
|
||||
if (!plugin.config.getBoolean(ConfigEntry.AMP_ENABLED))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -41,7 +41,8 @@ public class AMP extends FreedomService
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
protected void onStop()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package me.totalfreedom.totalfreedommod.amp;
|
||||
|
||||
public enum AMPEndpoints
|
||||
{
|
||||
LOGIN("/API/Core/Login" , "{username:\"%s\", password:\"%s\", token:\"\", rememberMe:false}"),
|
||||
LOGIN("/API/Core/Login", "{username:\"%s\", password:\"%s\", token:\"\", rememberMe:false}"),
|
||||
RESTART("/API/Core/Restart", "{SESSIONID:\"%s\"}");
|
||||
|
||||
private final String text;
|
||||
@ -20,6 +20,7 @@ public enum AMPEndpoints
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
public String getParameters()
|
||||
{
|
||||
return parameters;
|
||||
|
@ -22,7 +22,10 @@ public class AMPManager
|
||||
|
||||
public AMPManager(TotalFreedomMod plugin, String url, String username, String password)
|
||||
{
|
||||
this.plugin = plugin; this.url = url; this.username = username; this.password = password;
|
||||
this.plugin = plugin;
|
||||
this.url = url;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public void connectAsync(final LoginCallback callback)
|
||||
@ -38,7 +41,7 @@ public class AMPManager
|
||||
try
|
||||
{
|
||||
LoginResult resp = new Gson().fromJson(postRequestToEndpoint(apiEndpoint, body), LoginResult.class);
|
||||
if(!resp.getSuccess())
|
||||
if (!resp.getSuccess())
|
||||
{
|
||||
FLog.severe("AMP login unsuccessful. Check if login details are correct.");
|
||||
sessionID = "";
|
||||
@ -48,7 +51,7 @@ public class AMPManager
|
||||
sessionID = resp.getSessionID();
|
||||
callback.loginDone(true);
|
||||
}
|
||||
catch(IOException ex)
|
||||
catch (IOException ex)
|
||||
{
|
||||
FLog.severe("Could not login to AMP. Check if URL is correct. Stacktrace: " + ex.getMessage());
|
||||
sessionID = "";
|
||||
@ -71,7 +74,7 @@ public class AMPManager
|
||||
try
|
||||
{
|
||||
String resp = postRequestToEndpoint(apiEndpoint, body);
|
||||
if(resp.contains("Unauthorized Access"))
|
||||
if (resp.contains("Unauthorized Access"))
|
||||
{
|
||||
//try connecting one more time
|
||||
LoginCallback callback = new LoginCallback()
|
||||
@ -79,7 +82,7 @@ public class AMPManager
|
||||
@Override
|
||||
public void loginDone(boolean success)
|
||||
{
|
||||
if(!success)
|
||||
if (!success)
|
||||
{
|
||||
FLog.severe("Failed to connect to AMP. Did the panel go down? Were panel user details changed/deleted? Check for more info above. Connection was successful when plugin started, but unsuccessful now." +
|
||||
" Using server.shutdown() instead.");
|
||||
@ -89,7 +92,7 @@ public class AMPManager
|
||||
try
|
||||
{
|
||||
String response = postRequestToEndpoint(apiEndpoint, body);
|
||||
if(response.contains("Unauthorized Access"))
|
||||
if (response.contains("Unauthorized Access"))
|
||||
{
|
||||
FLog.severe("Contact a developer. Panel gives Session ID but trying to use it gives a no perms error. The panel user set in config doesn't" +
|
||||
" have perms to restart server. Using server.shutdown() instead. ");
|
||||
@ -107,7 +110,7 @@ public class AMPManager
|
||||
plugin.amp.ampManager.connectAsync(callback);
|
||||
}
|
||||
}
|
||||
catch(IOException ex)
|
||||
catch (IOException ex)
|
||||
{
|
||||
FLog.severe("Could not restart. Using server.shutdown() instead. Stacktrace: " + ex.getMessage());
|
||||
plugin.getServer().shutdown();
|
||||
@ -120,7 +123,7 @@ public class AMPManager
|
||||
private String postRequestToEndpoint(String endpoint, String body) throws IOException
|
||||
{
|
||||
URL url = new URL(endpoint);
|
||||
if(endpoint.startsWith("https://"))
|
||||
if (endpoint.startsWith("https://"))
|
||||
{
|
||||
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("POST");
|
||||
@ -157,7 +160,8 @@ public class AMPManager
|
||||
String inputLine;
|
||||
StringBuffer response = new StringBuffer();
|
||||
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
while ((inputLine = in.readLine()) != null)
|
||||
{
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
|
@ -49,9 +49,9 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable
|
||||
{
|
||||
this(username,
|
||||
new String[]
|
||||
{
|
||||
ip
|
||||
},
|
||||
{
|
||||
ip
|
||||
},
|
||||
by,
|
||||
expire,
|
||||
reason);
|
||||
@ -80,9 +80,9 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable
|
||||
public static Ban forPlayerIp(Player player, CommandSender by, Date expiry, String reason)
|
||||
{
|
||||
return new Ban(null, new String[]
|
||||
{
|
||||
Ips.getIp(player)
|
||||
}, by.getName(), expiry, reason);
|
||||
{
|
||||
Ips.getIp(player)
|
||||
}, by.getName(), expiry, reason);
|
||||
}
|
||||
|
||||
public static Ban forPlayerIp(String ip, CommandSender by, Date expiry, String reason)
|
||||
|
@ -275,7 +275,7 @@ public class BanManager extends FreedomService
|
||||
private void updateViews()
|
||||
{
|
||||
// Remove expired bans
|
||||
for (Iterator<Ban> it = bans.iterator(); it.hasNext();)
|
||||
for (Iterator<Ban> it = bans.iterator(); it.hasNext(); )
|
||||
{
|
||||
if (it.next().isExpired())
|
||||
{
|
||||
|
@ -66,8 +66,8 @@ public class PermbanList extends FreedomService
|
||||
{
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER,
|
||||
ChatColor.RED + "Your IP address is permanently banned from this server.\n"
|
||||
+ "Release procedures are available at\n"
|
||||
+ ChatColor.GOLD + ConfigEntry.SERVER_PERMBAN_URL.getString());
|
||||
+ "Release procedures are available at\n"
|
||||
+ ChatColor.GOLD + ConfigEntry.SERVER_PERMBAN_URL.getString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -79,8 +79,8 @@ public class PermbanList extends FreedomService
|
||||
{
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER,
|
||||
ChatColor.RED + "Your username is permanently banned from this server.\n"
|
||||
+ "Release procedures are available at\n"
|
||||
+ ChatColor.GOLD + ConfigEntry.SERVER_PERMBAN_URL.getString());
|
||||
+ "Release procedures are available at\n"
|
||||
+ ChatColor.GOLD + ConfigEntry.SERVER_PERMBAN_URL.getString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class MobBlocker extends FreedomService
|
||||
protected void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//fixes crash mobs, credit to Mafrans
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onEntitySpawn(EntitySpawnEvent e)
|
||||
|
@ -36,7 +36,7 @@ public class PVPBlocker extends FreedomService
|
||||
Player target = null;
|
||||
if (event.getEntity() instanceof Player)
|
||||
{
|
||||
target = (Player)event.getEntity();
|
||||
target = (Player) event.getEntity();
|
||||
if (event.getDamager() instanceof Player)
|
||||
{
|
||||
player = (Player) event.getDamager();
|
||||
@ -59,7 +59,7 @@ public class PVPBlocker extends FreedomService
|
||||
}
|
||||
}
|
||||
|
||||
if (player != null &! plugin.al.isAdmin(player))
|
||||
if (player != null & !plugin.al.isAdmin(player))
|
||||
{
|
||||
if (player.getGameMode() == GameMode.CREATIVE)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ public class PotionBlocker extends FreedomService
|
||||
Player player = null;
|
||||
if (projectileSource instanceof Player)
|
||||
{
|
||||
player = (Player)projectileSource;
|
||||
player = (Player) projectileSource;
|
||||
}
|
||||
|
||||
if (isDeathPotion(potion.getEffects()))
|
||||
@ -64,7 +64,7 @@ public class PotionBlocker extends FreedomService
|
||||
Player player = null;
|
||||
if (projectileSource instanceof Player)
|
||||
{
|
||||
player = (Player)projectileSource;
|
||||
player = (Player) projectileSource;
|
||||
}
|
||||
|
||||
if (isDeathPotion(potion.getEffects()))
|
||||
|
@ -20,12 +20,12 @@ public class CommandBlockerEntry
|
||||
private final String subCommand;
|
||||
@Getter
|
||||
private final String message;
|
||||
|
||||
|
||||
public CommandBlockerEntry(CommandBlockerRank rank, CommandBlockerAction action, String command, String message)
|
||||
{
|
||||
this(rank, action, command, null, message);
|
||||
}
|
||||
|
||||
|
||||
public CommandBlockerEntry(CommandBlockerRank rank, CommandBlockerAction action, String command, String subCommand, String message)
|
||||
{
|
||||
this.rank = rank;
|
||||
@ -34,12 +34,12 @@ public class CommandBlockerEntry
|
||||
this.subCommand = ((subCommand == null) ? null : subCommand.toLowerCase().trim());
|
||||
this.message = ((message == null || message.equals("_")) ? "That command is blocked." : message);
|
||||
}
|
||||
|
||||
|
||||
public void doActions(CommandSender sender)
|
||||
{
|
||||
if (action == CommandBlockerAction.BLOCK_AND_EJECT && sender instanceof Player)
|
||||
{
|
||||
TotalFreedomMod.plugin().ae.autoEject((Player)sender, "You used a prohibited command: " + command);
|
||||
TotalFreedomMod.plugin().ae.autoEject((Player) sender, "You used a prohibited command: " + command);
|
||||
FUtil.bcastMsg(sender.getName() + " was automatically kicked for using harmful commands.", ChatColor.RED);
|
||||
return;
|
||||
}
|
||||
@ -50,27 +50,27 @@ public class CommandBlockerEntry
|
||||
}
|
||||
FUtil.playerMsg(sender, FUtil.colorize(message));
|
||||
}
|
||||
|
||||
|
||||
public CommandBlockerRank getRank()
|
||||
{
|
||||
return rank;
|
||||
}
|
||||
|
||||
|
||||
public CommandBlockerAction getAction()
|
||||
{
|
||||
return action;
|
||||
}
|
||||
|
||||
|
||||
public String getCommand()
|
||||
{
|
||||
return command;
|
||||
}
|
||||
|
||||
|
||||
public String getSubCommand()
|
||||
{
|
||||
return subCommand;
|
||||
}
|
||||
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return message;
|
||||
|
@ -64,7 +64,7 @@ public class CageData
|
||||
buildHistory(location, 2, fPlayer);
|
||||
regenerate();
|
||||
}
|
||||
|
||||
|
||||
public void cage(Location location, Material outer, Material inner, String input)
|
||||
{
|
||||
if (isCaged())
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.AreaEffectCloud;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Clears lingering potion area effect clouds.", usage = "/<command>", aliases="aec")
|
||||
@CommandParameters(description = "Clears lingering potion area effect clouds.", usage = "/<command>", aliases = "aec")
|
||||
public class Command_aeclear extends FreedomCommand
|
||||
{
|
||||
|
||||
|
@ -15,7 +15,7 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Place a cage around someone.", usage = "/<command> <purge | off | <partialname> [skull | block] [blockname | playername]")
|
||||
public class Command_cage extends FreedomCommand
|
||||
{
|
||||
|
||||
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
|
@ -17,7 +17,8 @@ import java.util.List;
|
||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -i | -f | -v]", aliases = "who")
|
||||
public class Command_list extends FreedomCommand
|
||||
{
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) {
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 1)
|
||||
{
|
||||
return false;
|
||||
@ -152,13 +153,13 @@ public class Command_list extends FreedomCommand
|
||||
|
||||
return color + prefix;
|
||||
}
|
||||
|
||||
|
||||
private enum ListFilter
|
||||
{
|
||||
PLAYERS,
|
||||
ADMINS,
|
||||
VANISHED_ADMINS,
|
||||
FAMOUS_PLAYERS,
|
||||
PLAYERS,
|
||||
ADMINS,
|
||||
VANISHED_ADMINS,
|
||||
FAMOUS_PLAYERS,
|
||||
IMPOSTORS
|
||||
}
|
||||
}
|
||||
|
@ -46,9 +46,9 @@ public class Command_onlinemode extends FreedomCommand
|
||||
|
||||
try
|
||||
{
|
||||
plugin.si.setOnlineMode(onlineMode);
|
||||
plugin.si.setOnlineMode(onlineMode);
|
||||
|
||||
if (onlineMode)
|
||||
if (onlineMode)
|
||||
{
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
|
@ -160,9 +160,9 @@ public class Command_potion extends FreedomCommand
|
||||
target.addPotionEffect(new_effect, true);
|
||||
msg(
|
||||
"Added potion effect: " + new_effect.getType().getName()
|
||||
+ ", Duration: " + new_effect.getDuration()
|
||||
+ ", Amplifier: " + new_effect.getAmplifier()
|
||||
+ (!target.equals(playerSender) ? " to player " + target.getName() + "." : " to yourself."), ChatColor.AQUA);
|
||||
+ ", Duration: " + new_effect.getDuration()
|
||||
+ ", Amplifier: " + new_effect.getAmplifier()
|
||||
+ (!target.equals(playerSender) ? " to player " + target.getName() + "." : " to yourself."), ChatColor.AQUA);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class Command_premium extends FreedomCommand
|
||||
final URLConnection urlConnection = getUrl.openConnection();
|
||||
final String message;
|
||||
try ( // Read the response
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())))
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())))
|
||||
{
|
||||
message = (!"PREMIUM".equalsIgnoreCase(in.readLine()) ? ChatColor.RED + "No" : ChatColor.DARK_GREEN + "Yes");
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class Command_rainbownick extends FreedomCommand
|
||||
msg("That nickname contains invalid characters.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (nickPlain.length() < 4 || nickPlain.length() > 30)
|
||||
{
|
||||
msg("Your nickname must be between 4 and 30 characters long.");
|
||||
@ -48,9 +48,9 @@ public class Command_rainbownick extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final String newNick = FUtil.rainbowify(ChatColor.stripColor(FUtil.colorize(nickPlain)));
|
||||
|
||||
|
||||
plugin.esb.setNickname(sender.getName(), newNick);
|
||||
|
||||
msg("Your nickname is now: " + newNick);
|
||||
|
@ -17,7 +17,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Spawn an entity.", usage = "/<command> <entitytype> [amount]", aliases="spawnentity")
|
||||
@CommandParameters(description = "Spawn an entity.", usage = "/<command> <entitytype> [amount]", aliases = "spawnentity")
|
||||
public class Command_spawnmob extends FreedomCommand
|
||||
{
|
||||
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Quickly spectate someone.", usage = "/<command> <playername>", aliases="spec")
|
||||
@CommandParameters(description = "Quickly spectate someone.", usage = "/<command> <playername>", aliases = "spec")
|
||||
public class Command_spectate extends FreedomCommand
|
||||
{
|
||||
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import static me.totalfreedom.totalfreedommod.util.FUtil.DEVELOPERS:
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Sets yourself a prefix", usage = "/<command> [-s[ave]] <set <tag..> | off | clear <player> | clearall>")
|
||||
|
@ -15,11 +15,11 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Gives you a tag with random colors", usage = "/<command> <tag>", aliases = "tn")
|
||||
public class Command_tagnyan extends FreedomCommand
|
||||
{
|
||||
|
||||
|
||||
public static final List<String> FORBIDDEN_WORDS = Arrays.asList(new String[]
|
||||
{
|
||||
"admin", "owner", "moderator", "developer", "console", "SRA", "TCA", "SA"
|
||||
});
|
||||
{
|
||||
"admin", "owner", "moderator", "developer", "console", "SRA", "TCA", "SA"
|
||||
});
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
|
@ -55,7 +55,7 @@ public class Command_toggle extends FreedomCommand
|
||||
{
|
||||
toggle("Lava placement is", ConfigEntry.ALLOW_LAVA_PLACE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("fluidspread"))
|
||||
{
|
||||
toggle("Fluid spread is", ConfigEntry.ALLOW_FLUID_SPREAD);
|
||||
@ -155,7 +155,7 @@ public class Command_toggle extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void toggle(final String name, final ConfigEntry entry)
|
||||
{
|
||||
msg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled."));
|
||||
|
@ -20,7 +20,8 @@ public class Command_vanish extends FreedomCommand
|
||||
{
|
||||
public static ArrayList<Player> VANISHED = new ArrayList<>();
|
||||
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) {
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
||||
{
|
||||
Displayable display = plugin.rm.getDisplay(playerSender);
|
||||
String loginMsg = display.getColoredLoginMessage();
|
||||
String displayName = display.getColor() + playerSender.getName();
|
||||
|
@ -52,7 +52,8 @@ public class HTTPDaemon extends FreedomService
|
||||
return;
|
||||
}
|
||||
|
||||
port = ConfigEntry.HTTPD_PORT.getInteger();;
|
||||
port = ConfigEntry.HTTPD_PORT.getInteger();
|
||||
;
|
||||
httpd = new HTTPD(port);
|
||||
|
||||
// Modules
|
||||
@ -168,7 +169,7 @@ public class HTTPDaemon extends FreedomService
|
||||
{
|
||||
mimetype = MIME_DEFAULT_BINARY;
|
||||
}
|
||||
|
||||
|
||||
// Some browsers like firefox download the file for text/yaml mime types
|
||||
if (FilenameUtils.getExtension(file.getName()).equals("yml"))
|
||||
{
|
||||
|
@ -239,7 +239,8 @@ public abstract class NanoHTTPD
|
||||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
} while (!myServerSocket.isClosed());
|
||||
}
|
||||
while (!myServerSocket.isClosed());
|
||||
}
|
||||
});
|
||||
myThread.setDaemon(true);
|
||||
@ -284,15 +285,15 @@ public abstract class NanoHTTPD
|
||||
* <p/>
|
||||
* (By default, this delegates to serveFile() and allows directory listing.)
|
||||
*
|
||||
* @param uri Percent-decoded URI without parameters, for example "/index.cgi"
|
||||
* @param method "GET", "POST" etc.
|
||||
* @param parms Parsed, percent decoded parameters from URI and, in case of POST, data.
|
||||
* @param uri Percent-decoded URI without parameters, for example "/index.cgi"
|
||||
* @param method "GET", "POST" etc.
|
||||
* @param parms Parsed, percent decoded parameters from URI and, in case of POST, data.
|
||||
* @param headers Header entries, percent decoded
|
||||
* @return HTTP response, see class Response for details
|
||||
*/
|
||||
@Deprecated
|
||||
public Response serve(String uri, Method method, Map<String, String> headers, Map<String, String> parms,
|
||||
Map<String, String> files)
|
||||
Map<String, String> files)
|
||||
{
|
||||
return new Response(Response.Status.NOT_FOUND, MIME_PLAINTEXT, "Not Found");
|
||||
}
|
||||
@ -397,6 +398,7 @@ public abstract class NanoHTTPD
|
||||
// Threading Strategy.
|
||||
//
|
||||
// ------------------------------------------------------------------------------- //
|
||||
|
||||
/**
|
||||
* Pluggable strategy for asynchronously executing requests.
|
||||
*
|
||||
@ -412,6 +414,7 @@ public abstract class NanoHTTPD
|
||||
// Temp file handling strategy.
|
||||
//
|
||||
// ------------------------------------------------------------------------------- //
|
||||
|
||||
/**
|
||||
* Pluggable strategy for creating and cleaning up temporary files.
|
||||
*
|
||||
@ -462,6 +465,7 @@ public abstract class NanoHTTPD
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------- //
|
||||
|
||||
/**
|
||||
* Temp file manager.
|
||||
* <p/>
|
||||
@ -823,9 +827,9 @@ public abstract class NanoHTTPD
|
||||
{
|
||||
|
||||
OK(200, "OK"), CREATED(201, "Created"), ACCEPTED(202, "Accepted"), NO_CONTENT(204, "No Content"), PARTIAL_CONTENT(206, "Partial Content"), REDIRECT(301,
|
||||
"Moved Permanently"), NOT_MODIFIED(304, "Not Modified"), BAD_REQUEST(400, "Bad Request"), UNAUTHORIZED(401,
|
||||
"Unauthorized"), FORBIDDEN(403, "Forbidden"), NOT_FOUND(404, "Not Found"), RANGE_NOT_SATISFIABLE(416,
|
||||
"Requested Range Not Satisfiable"), INTERNAL_ERROR(500, "Internal Server Error");
|
||||
"Moved Permanently"), NOT_MODIFIED(304, "Not Modified"), BAD_REQUEST(400, "Bad Request"), UNAUTHORIZED(401,
|
||||
"Unauthorized"), FORBIDDEN(403, "Forbidden"), NOT_FOUND(404, "Not Found"), RANGE_NOT_SATISFIABLE(416,
|
||||
"Requested Range Not Satisfiable"), INTERNAL_ERROR(500, "Internal Server Error");
|
||||
private final int requestStatus;
|
||||
private final String description;
|
||||
|
||||
@ -1181,7 +1185,7 @@ public abstract class NanoHTTPD
|
||||
* Decodes the Multipart Body data and put it into Key/Value pairs.
|
||||
*/
|
||||
private void decodeMultipartData(String boundary, ByteBuffer fbuf, BufferedReader in, Map<String, String> parms,
|
||||
Map<String, String> files) throws ResponseException
|
||||
Map<String, String> files) throws ResponseException
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -1261,7 +1265,8 @@ public abstract class NanoHTTPD
|
||||
do
|
||||
{
|
||||
mpline = in.readLine();
|
||||
} while (mpline != null && !mpline.contains(boundary));
|
||||
}
|
||||
while (mpline != null && !mpline.contains(boundary));
|
||||
}
|
||||
parms.put(pname, value);
|
||||
}
|
||||
@ -1544,8 +1549,8 @@ public abstract class NanoHTTPD
|
||||
/**
|
||||
* Sets a cookie.
|
||||
*
|
||||
* @param name The cookie's name.
|
||||
* @param value The cookie's value.
|
||||
* @param name The cookie's name.
|
||||
* @param value The cookie's value.
|
||||
* @param expires How many days until the cookie expires.
|
||||
*/
|
||||
public void set(String name, String value, int expires)
|
||||
|
@ -42,7 +42,7 @@ public class Module_help extends HTTPDModule
|
||||
final StringBuilder responseBody = new StringBuilder()
|
||||
.append(heading("Command Help", 1))
|
||||
.append(paragraph(
|
||||
"This page is an automatically generated listing of all plugin commands that are currently live on the server. "
|
||||
"This page is an automatically generated listing of all plugin commands that are currently live on the server. "
|
||||
+ "Please note that it does not include vanilla server commands."));
|
||||
|
||||
final Collection<Command> knownCommands = ((SimpleCommandMap) map).getCommands();
|
||||
@ -102,19 +102,19 @@ public class Module_help extends HTTPDModule
|
||||
|
||||
sb.append(
|
||||
"<li><span class=\"commandName\">{$CMD_NAME}</span> - Usage: <span class=\"commandUsage\">{$CMD_USAGE}</span>"
|
||||
.replace("{$CMD_NAME}", escapeHtml4(command.getName().trim()))
|
||||
.replace("{$CMD_USAGE}", escapeHtml4(command.getUsage().trim())));
|
||||
.replace("{$CMD_NAME}", escapeHtml4(command.getName().trim()))
|
||||
.replace("{$CMD_USAGE}", escapeHtml4(command.getUsage().trim())));
|
||||
|
||||
if (!command.getAliases().isEmpty())
|
||||
{
|
||||
sb.append(
|
||||
" - Aliases: <span class=\"commandAliases\">{$CMD_ALIASES}</span>"
|
||||
.replace("{$CMD_ALIASES}", escapeHtml4(StringUtils.join(command.getAliases(), ", "))));
|
||||
.replace("{$CMD_ALIASES}", escapeHtml4(StringUtils.join(command.getAliases(), ", "))));
|
||||
}
|
||||
|
||||
sb.append(
|
||||
"<br><span class=\"commandDescription\">{$CMD_DESC}</span></li>\r\n"
|
||||
.replace("{$CMD_DESC}", escapeHtml4(command.getDescription().trim())));
|
||||
.replace("{$CMD_DESC}", escapeHtml4(command.getDescription().trim())));
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -23,10 +23,10 @@ public class Module_logfile extends HTTPDModule
|
||||
|
||||
private static final File LOG_FOLDER = new File("./logs/");
|
||||
private static final String[] LOG_FILTER = new String[]
|
||||
{
|
||||
"log",
|
||||
"gz"
|
||||
};
|
||||
{
|
||||
"log",
|
||||
"gz"
|
||||
};
|
||||
|
||||
public Module_logfile(TotalFreedomMod plugin, NanoHTTPD.HTTPSession session)
|
||||
{
|
||||
|
@ -30,9 +30,9 @@ public class Module_schematic extends HTTPDModule
|
||||
private static final String REQUEST_FORM_FILE_ELEMENT_NAME = "schematicFile";
|
||||
private static final Pattern SCHEMATIC_FILENAME_LC = Pattern.compile("^[a-z0-9_'!,\\-]{1,30}\\.schematic$");
|
||||
private static final String[] SCHEMATIC_FILTER = new String[]
|
||||
{
|
||||
"schematic"
|
||||
};
|
||||
{
|
||||
"schematic"
|
||||
};
|
||||
private static final String UPLOAD_FORM = "<form method=\"post\" name=\"schematicForm\" id=\"schematicForm\" action=\"/schematic/upload/\" enctype=\"multipart/form-data\">\n"
|
||||
+ "<p>Select a schematic file to upload. Filenames must be alphanumeric, between 1 and 30 characters long (inclusive), and have a .schematic extension.</p>\n"
|
||||
+ "<input type=\"file\" id=\"schematicFile\" name=\"schematicFile\" />\n"
|
||||
|
@ -81,7 +81,7 @@ public class MasterBuilderList extends FreedomService
|
||||
}
|
||||
|
||||
masterBuilders.put(key, masterBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
updateTables();
|
||||
FLog.info("Loaded " + masterBuilders.size() + " master builders with " + ipTable.size() + " IPs)");
|
||||
|
@ -1,4 +1,5 @@
|
||||
package me.totalfreedom.totalfreedommod.punishments;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.ArrayList;
|
||||
|
@ -163,12 +163,12 @@ public class FUtil
|
||||
{
|
||||
Pattern timePattern = Pattern.compile(
|
||||
"(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?"
|
||||
+ "(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?"
|
||||
+ "(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?"
|
||||
+ "(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?"
|
||||
+ "(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?"
|
||||
+ "(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?"
|
||||
+ "(?:([0-9]+)\\s*(?:s[a-z]*)?)?", Pattern.CASE_INSENSITIVE);
|
||||
+ "(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?"
|
||||
+ "(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?"
|
||||
+ "(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?"
|
||||
+ "(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?"
|
||||
+ "(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?"
|
||||
+ "(?:([0-9]+)\\s*(?:s[a-z]*)?)?", Pattern.CASE_INSENSITIVE);
|
||||
Matcher m = timePattern.matcher(time);
|
||||
int years = 0;
|
||||
int months = 0;
|
||||
@ -362,7 +362,8 @@ public class FUtil
|
||||
catch (NoSuchFieldException | IllegalAccessException ex)
|
||||
{
|
||||
}
|
||||
} while (checkClass.getSuperclass() != Object.class
|
||||
}
|
||||
while (checkClass.getSuperclass() != Object.class
|
||||
&& ((checkClass = checkClass.getSuperclass()) != null));
|
||||
|
||||
return null;
|
||||
|
@ -64,7 +64,6 @@ public class Flatlands extends CustomWorld
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void wipeFlatlandsIfFlagged()
|
||||
{
|
||||
boolean doFlatlandsWipe = false;
|
||||
|
Reference in New Issue
Block a user