valueEntry : map.get(entryValues.getKey()).entrySet()) {
- valueBuilder.appendField(valueEntry.getKey(), valueEntry.getValue());
- allSkipped = false;
- }
- if (!allSkipped) {
- reallyAllSkipped = false;
- valuesBuilder.appendField(entryValues.getKey(), valueBuilder.build());
- }
- }
- if (reallyAllSkipped) {
- // Null = skip the chart
- return null;
- }
- return new JsonObjectBuilder().appendField("values", valuesBuilder.build()).build();
- }
- }
-
- /**
- * An extremely simple JSON builder.
- *
- * While this class is neither feature-rich nor the most performant one, it's sufficient enough
- * for its use-case.
- */
- public static class JsonObjectBuilder {
-
- private StringBuilder builder = new StringBuilder();
-
- private boolean hasAtLeastOneField = false;
-
- public JsonObjectBuilder() {
- builder.append("{");
- }
-
- /**
- * Appends a null field to the JSON.
- *
- * @param key The key of the field.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendNull(String key) {
- appendFieldUnescaped(key, "null");
- return this;
- }
-
- /**
- * Appends a string field to the JSON.
- *
- * @param key The key of the field.
- * @param value The value of the field.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, String value) {
- if (value == null) {
- throw new IllegalArgumentException("JSON value must not be null");
- }
- appendFieldUnescaped(key, "\"" + escape(value) + "\"");
- return this;
- }
-
- /**
- * Appends an integer field to the JSON.
- *
- * @param key The key of the field.
- * @param value The value of the field.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, int value) {
- appendFieldUnescaped(key, String.valueOf(value));
- return this;
- }
-
- /**
- * Appends an object to the JSON.
- *
- * @param key The key of the field.
- * @param object The object.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, JsonObject object) {
- if (object == null) {
- throw new IllegalArgumentException("JSON object must not be null");
- }
- appendFieldUnescaped(key, object.toString());
- return this;
- }
-
- /**
- * Appends a string array to the JSON.
- *
- * @param key The key of the field.
- * @param values The string array.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, String[] values) {
- if (values == null) {
- throw new IllegalArgumentException("JSON values must not be null");
- }
- String escapedValues =
- Arrays.stream(values)
- .map(value -> "\"" + escape(value) + "\"")
- .collect(Collectors.joining(","));
- appendFieldUnescaped(key, "[" + escapedValues + "]");
- return this;
- }
-
- /**
- * Appends an integer array to the JSON.
- *
- * @param key The key of the field.
- * @param values The integer array.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, int[] values) {
- if (values == null) {
- throw new IllegalArgumentException("JSON values must not be null");
- }
- String escapedValues =
- Arrays.stream(values).mapToObj(String::valueOf).collect(Collectors.joining(","));
- appendFieldUnescaped(key, "[" + escapedValues + "]");
- return this;
- }
-
- /**
- * Appends an object array to the JSON.
- *
- * @param key The key of the field.
- * @param values The integer array.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, JsonObject[] values) {
- if (values == null) {
- throw new IllegalArgumentException("JSON values must not be null");
- }
- String escapedValues =
- Arrays.stream(values).map(JsonObject::toString).collect(Collectors.joining(","));
- appendFieldUnescaped(key, "[" + escapedValues + "]");
- return this;
- }
-
- /**
- * Appends a field to the object.
- *
- * @param key The key of the field.
- * @param escapedValue The escaped value of the field.
- */
- private void appendFieldUnescaped(String key, String escapedValue) {
- if (builder == null) {
- throw new IllegalStateException("JSON has already been built");
- }
- if (key == null) {
- throw new IllegalArgumentException("JSON key must not be null");
- }
- if (hasAtLeastOneField) {
- builder.append(",");
- }
- builder.append("\"").append(escape(key)).append("\":").append(escapedValue);
- hasAtLeastOneField = true;
- }
-
- /**
- * Builds the JSON string and invalidates this builder.
- *
- * @return The built JSON string.
- */
- public JsonObject build() {
- if (builder == null) {
- throw new IllegalStateException("JSON has already been built");
- }
- JsonObject object = new JsonObject(builder.append("}").toString());
- builder = null;
- return object;
- }
-
- /**
- * Escapes the given string like stated in https://www.ietf.org/rfc/rfc4627.txt.
- *
- *
This method escapes only the necessary characters '"', '\'. and '\u0000' - '\u001F'.
- * Compact escapes are not used (e.g., '\n' is escaped as "\u000a" and not as "\n").
- *
- * @param value The value to escape.
- * @return The escaped value.
- */
- private static String escape(String value) {
- final StringBuilder builder = new StringBuilder();
- for (int i = 0; i < value.length(); i++) {
- char c = value.charAt(i);
- if (c == '"') {
- builder.append("\\\"");
- } else if (c == '\\') {
- builder.append("\\\\");
- } else if (c <= '\u000F') {
- builder.append("\\u000").append(Integer.toHexString(c));
- } else if (c <= '\u001F') {
- builder.append("\\u00").append(Integer.toHexString(c));
- } else {
- builder.append(c);
- }
- }
- return builder.toString();
- }
-
- /**
- * A super simple representation of a JSON object.
- *
- *
This class only exists to make methods of the {@link JsonObjectBuilder} type-safe and not
- * allow a raw string inputs for methods like {@link JsonObjectBuilder#appendField(String,
- * JsonObject)}.
- */
- public static class JsonObject {
-
- private final String value;
-
- private JsonObject(String value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return value;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java
index 980be33d..ac6c0873 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java
@@ -48,6 +48,7 @@ import me.totalfreedom.totalfreedommod.util.MethodTimer;
import me.totalfreedom.totalfreedommod.world.CleanroomChunkGenerator;
import me.totalfreedom.totalfreedommod.world.WorldManager;
import me.totalfreedom.totalfreedommod.world.WorldRestrictions;
+import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
@@ -214,7 +215,7 @@ public class TotalFreedomMod extends JavaPlugin
FLog.info("Version " + pluginVersion + " for " + ServerInterface.COMPILE_NMS_VERSION + " enabled in " + timer.getTotal() + "ms");
// Metrics @ https://bstats.org/plugin/bukkit/TotalFreedomMod/2966
- new Metrics(this, 2966);
+ Metrics metrics = new Metrics(this, 2966);
// little workaround to stop spigot from autorestarting - causing AMP to detach from process.
SpigotConfig.config.set("settings.restart-on-crash", false);
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLogEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLogEntry.java
index eb056fcb..457c59c4 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLogEntry.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLogEntry.java
@@ -74,10 +74,11 @@ public class ActivityLogEntry implements IConfig
{
// Fix of Array index out of bonds issue: FS-131
String lastLoginString;
- if(timestamps.size() > 1)
+ if (timestamps.size() > 1)
{
lastLoginString = timestamps.get(timestamps.size() - 1);
- }else
+ }
+ else
{
lastLoginString = timestamps.get(0);
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EditBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EditBlocker.java
index 831142aa..35fb4205 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EditBlocker.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EditBlocker.java
@@ -10,23 +10,29 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
-public class EditBlocker extends FreedomService {
+public class EditBlocker extends FreedomService
+{
@Override
- public void onStart() {
+ public void onStart()
+ {
}
@Override
- public void onStop() {
+ public void onStop()
+ {
}
@EventHandler(priority = EventPriority.LOW)
- public void onBlockPlace(BlockPlaceEvent event) {
+ public void onBlockPlace(BlockPlaceEvent event)
+ {
FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer());
- if (!fPlayer.isEditBlocked()) {
+ if (!fPlayer.isEditBlocked())
+ {
return;
}
- if (plugin.al.isAdminSync(event.getPlayer())) {
+ if (plugin.al.isAdminSync(event.getPlayer()))
+ {
fPlayer.setEditBlocked(false);
return;
}
@@ -36,13 +42,16 @@ public class EditBlocker extends FreedomService {
}
@EventHandler(priority = EventPriority.LOW)
- public void onBlockBreak(BlockBreakEvent event) {
+ public void onBlockBreak(BlockBreakEvent event)
+ {
FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer());
- if (!fPlayer.isEditBlocked()) {
+ if (!fPlayer.isEditBlocked())
+ {
return;
}
- if (plugin.al.isAdminSync(event.getPlayer())) {
+ if (plugin.al.isAdminSync(event.getPlayer()))
+ {
fPlayer.setEditBlocked(false);
return;
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java
index 7cde1e49..f50b8985 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java
@@ -11,27 +11,39 @@ import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Shows the amount of coins you have or another player has", usage = "/ [playername]")
-public class Command_coins extends FreedomCommand {
+public class Command_coins extends FreedomCommand
+{
@Override
- public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
- if (!ConfigEntry.SHOP_ENABLED.getBoolean()) {
+ public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
+ {
+ if (!ConfigEntry.SHOP_ENABLED.getBoolean())
+ {
msg("The shop is currently disabled!", ChatColor.RED);
return true;
}
Player p;
final String prefix = FUtil.colorize(ConfigEntry.SHOP_PREFIX.getString() + " ");
- if (args.length > 0) {
- if (getPlayer(args[0]) != null) {
+ if (args.length > 0)
+ {
+ if (getPlayer(args[0]) != null)
+ {
p = getPlayer(args[0]);
- } else {
+ }
+ else
+ {
msg(PLAYER_NOT_FOUND);
return true;
}
- } else {
- if (senderIsConsole) {
+ }
+ else
+ {
+ if (senderIsConsole)
+ {
msg(prefix + ChatColor.RED + "You are not a player, use /coins ");
return true;
- } else {
+ }
+ else
+ {
p = playerSender;
}
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_namehistory.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_namehistory.java
index 43fc2e4e..1bc2033c 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_namehistory.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_namehistory.java
@@ -8,10 +8,13 @@ import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Check the name history of a specified player.", usage = "/ ", aliases = "nh")
-public class Command_namehistory extends FreedomCommand {
+public class Command_namehistory extends FreedomCommand
+{
@Override
- public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
- if (args.length != 1) {
+ public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
+ {
+ if (args.length != 1)
+ {
return false;
}
History.reportHistory(sender, args[0]);
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java
index 153d3a44..9d14fc1e 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java
@@ -405,7 +405,7 @@ public class Discord extends FreedomService
{
return;
}
-
+
if (message.contains("§"))
{
message = StringUtils.remove(message, "§");
@@ -417,7 +417,7 @@ public class Discord extends FreedomService
while (DISCORD_MENTION_MATCHER.find())
{
String mention = DISCORD_MENTION_MATCHER.group(1);
- message = message.replace(mention, mention.replace("@",""));
+ message = message.replace(mention, mention.replace("@", ""));
}
if (enabled && !chat_channel_id.isEmpty())
@@ -439,7 +439,7 @@ public class Discord extends FreedomService
{
return;
}
-
+
if (message.contains("§"))
{
message = StringUtils.remove(message, "§");
@@ -451,7 +451,7 @@ public class Discord extends FreedomService
while (DISCORD_MENTION_MATCHER.find())
{
String mention = DISCORD_MENTION_MATCHER.group(1);
- message = message.replace(mention, mention.replace("@",""));
+ message = message.replace(mention, mention.replace("@", ""));
}
if (enabled && !chat_channel_id.isEmpty())
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToAdminChatListener.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToAdminChatListener.java
index 4e0ff6fb..51521161 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToAdminChatListener.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToAdminChatListener.java
@@ -48,7 +48,7 @@ public class DiscordToAdminChatListener extends ListenerAdapter
if (!msg.getAttachments().isEmpty())
{
-
+
logmessage.append(mediamessage); // Actually for logging...
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/HTTPDaemon.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/HTTPDaemon.java
index 177df52a..4cc44553 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/HTTPDaemon.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/HTTPDaemon.java
@@ -146,7 +146,7 @@ public class HTTPDaemon extends FreedomService
{
super(port);
}
-
+
@Override
public Response serve(HTTPSession session)
{
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java
index d246b19f..ce56d960 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java
@@ -61,7 +61,7 @@ public class RankManager extends FreedomService
{
return Title.EXECUTIVE;
}
-
+
if (ConfigEntry.SERVER_ASSISTANT_EXECUTIVES.getList().contains(player.getName()) && plugin.al.isAdmin(player))
{
return Title.ASSTEXEC;
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
index b22d7eb8..2fc87036 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
@@ -275,7 +275,7 @@ public class FUtil
public static Response sendRequest(String endpoint, String method, List headers, String body) throws IOException
{
URL url = new URL(endpoint);
- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod(method);
@@ -405,7 +405,8 @@ public class FUtil
add("s");
}};
- public static boolean isValidUsername(String s) {
+ public static boolean isValidUsername(String s)
+ {
return s != null && s.matches("^[a-zA-Z0-9_]*$");
}
@@ -413,7 +414,8 @@ public class FUtil
{
StringBuilder sb = new StringBuilder();
- regxList.forEach(obj -> {
+ regxList.forEach(obj ->
+ {
if (parse.endsWith(obj))
{
sb.append(parse.split(obj)[0]);
@@ -572,7 +574,7 @@ public class FUtil
{
Field field = checkClass.getDeclaredField(name);
field.setAccessible(true);
- return (T) field.get(from);
+ return (T)field.get(from);
}
catch (NoSuchFieldException | IllegalAccessException ignored)
@@ -654,7 +656,7 @@ public class FUtil
public static int randomInteger(int min, int max)
{
int range = max - min + 1;
- return (int) (Math.random() * range) + min;
+ return (int)(Math.random() * range) + min;
}
public static String randomString(int length)
@@ -792,7 +794,7 @@ public class FUtil
{
c1values[i] = Math.round(c1values[i] + factor * (c2values[i] - c1values[i]));
}
- return Color.fromRGB((int) c1values[0], (int) c1values[1], (int) c1values[2]);
+ return Color.fromRGB((int)c1values[0], (int)c1values[1], (int)c1values[2]);
}
public static boolean isValidIPv4(String ip)
@@ -890,7 +892,7 @@ public class FUtil
public int getPageCount()
{
- return (int) Math.ceil((double) size() / (double) epp);
+ return (int)Math.ceil((double)size() / (double)epp);
}
public List getPage(int page)
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/TimeUnit.java b/src/main/java/me/totalfreedom/totalfreedommod/util/TimeUnit.java
index 20132d0a..5ffe521d 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/util/TimeUnit.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/util/TimeUnit.java
@@ -12,11 +12,13 @@ public enum TimeUnit
private final long time;
- TimeUnit(long time) {
+ TimeUnit(long time)
+ {
this.time = time;
}
- public long get() {
+ public long get()
+ {
return time;
}
}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 1c2b05ca..82105ed1 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -37,7 +37,7 @@ server:
executives: [ ]
# All players who show up as assistant executive
- assistant_executives: []
+ assistant_executives: [ ]
# All those who can manage the master builder list
master_builder_management: [ ]
@@ -194,7 +194,7 @@ social_links:
Forum: 'https://forum.totalfreedom.me'
Website: 'https://totalfreedom.me'
Discord: 'https://discord.com/invite/PW4savJR9a'
-# Reddit: 'https://reddit.com/r/TotalFreedom'
+ # Reddit: 'https://reddit.com/r/TotalFreedom'
Twitter: 'https://twitter.com/TotalFreedomMC'
Facebook: 'https://facebook.com/TotalFreedomMC'
# Tumblr: 'https://totalfreedom.tumblr.com'
@@ -556,7 +556,7 @@ announcer:
- 'Join our Discord server! https://discord.com/invite/PW4savJR9a'
- 'Remember to save your hotbar, otherwise you may lose your items!'
- 'Link your discord account with &6/linkdiscord for extra features!'
- # - 'Check out our reddit at &6https://www.reddit.com/r/TotalFreedom/ &byou can even link your account!'
+ # - 'Check out our reddit at &6https://www.reddit.com/r/TotalFreedom/ &byou can even link your account!'
- 'Want to see cool builds? Check out our Master Builder World with &6/mbworld'
- 'Be sure to follow our twitter for all the latest updates. &6https://twitter.com/totalfreedommc'
@@ -573,7 +573,7 @@ admininfo:
votinginfo:
- '&bVoting Links:'
- ' &2- https://minecraft-mp.com/server/228386/vote/'
-# - ' &2- https://minecraft-server-list.com/server/443272/vote/'
+ # - ' &2- https://minecraft-server-list.com/server/443272/vote/'
- ' &6- https://topg.org/Minecraft/in-599712'
- ' &2- https://minecraftlist.org/vote/18975'
- ' &6- https://minecraftservers.org/vote/595721'
diff --git a/src/main/resources/indefinitebans.yml b/src/main/resources/indefinitebans.yml
index 4e4404ce..d561ac28 100644
--- a/src/main/resources/indefinitebans.yml
+++ b/src/main/resources/indefinitebans.yml
@@ -12,4 +12,4 @@ badplayer2:
ips:
- 111.111.111.111
badplayer3:
- ips: []
+ ips: [ ]
diff --git a/src/main/resources/permissions.yml b/src/main/resources/permissions.yml
index ae404160..eeecc442 100644
--- a/src/main/resources/permissions.yml
+++ b/src/main/resources/permissions.yml
@@ -68,4 +68,4 @@ admins:
- "bending.*"
# Senior Admin permission nodes
-senior_admins: []
+senior_admins: [ ]
diff --git a/supressions.xml b/supressions.xml
deleted file mode 100644
index 09efa3c8..00000000
--- a/supressions.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file