From 260368585e817c49c79a40384981ace5e14676a9 Mon Sep 17 00:00:00 2001 From: Paldiu Date: Thu, 7 Jan 2021 13:29:47 -0600 Subject: [PATCH] reformat --- .../totalfreedommod/SavedFlags.java | 1 - .../blocking/command/CommandBlockerRank.java | 1 - .../totalfreedommod/command/Command_gcmd.java | 6 +-- .../totalfreedommod/config/ConfigEntry.java | 1 - .../discord/DiscordToAdminChatListener.java | 10 ++--- .../discord/PrivateMessageListener.java | 1 - .../totalfreedommod/fun/ItemFun.java | 2 +- .../totalfreedommod/fun/Jumppads.java | 2 +- .../totalfreedommod/fun/Trailer.java | 2 +- .../httpd/ModuleExecutable.java | 44 +++++++++---------- .../permissions/PermissionEntry.java | 1 - .../totalfreedommod/player/PlayerData.java | 1 - .../totalfreedommod/util/FUtil.java | 4 +- .../totalfreedommod/util/History.java | 1 - 14 files changed, 35 insertions(+), 42 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/SavedFlags.java b/src/main/java/me/totalfreedom/totalfreedommod/SavedFlags.java index d3e979e4..a86320fa 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/SavedFlags.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/SavedFlags.java @@ -7,7 +7,6 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.HashMap; import java.util.Map; -import java.util.Objects; import me.totalfreedom.totalfreedommod.util.FLog; import static me.totalfreedom.totalfreedommod.util.FUtil.SAVED_FLAGS_FILENAME; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlockerRank.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlockerRank.java index 69058055..c533b96e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlockerRank.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlockerRank.java @@ -1,6 +1,5 @@ package me.totalfreedom.totalfreedommod.blocking.command; -import java.util.Objects; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.rank.Rank; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java index 410fb8b4..7d88d686 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java @@ -2,8 +2,8 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.Rank; import org.apache.commons.lang3.StringUtils; -import org.bukkit.command.Command; import org.bukkit.ChatColor; +import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -33,8 +33,8 @@ public class Command_gcmd extends FreedomCommand { return true; } - - if (plugin.al.isAdmin(player)) + + if (plugin.al.isAdmin(player)) { msg(ChatColor.RED + "You can not use gcmd on admins"); return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java index de923b8e..90aee0ac 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java @@ -1,7 +1,6 @@ package me.totalfreedom.totalfreedommod.config; import java.util.List; -import java.util.Objects; import me.totalfreedom.totalfreedommod.TotalFreedomMod; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToAdminChatListener.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToAdminChatListener.java index 134810f1..8d9be126 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToAdminChatListener.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToAdminChatListener.java @@ -24,6 +24,11 @@ public class DiscordToAdminChatListener extends ListenerAdapter { DiscordToMinecraftListener dtml = new DiscordToMinecraftListener(); + public static net.md_5.bungee.api.ChatColor getColor(Displayable display) + { + return display.getColor(); + } + public void onMessageReceived(MessageReceivedEvent event) { String chat_channel_id = ConfigEntry.DISCORD_ADMINCHAT_CHANNEL_ID.getString(); @@ -87,11 +92,6 @@ public class DiscordToAdminChatListener extends ListenerAdapter } } - public static net.md_5.bungee.api.ChatColor getColor(Displayable display) - { - return display.getColor(); - } - // Needed to display tags in custom AC messages public String getDisplay(Member member) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/PrivateMessageListener.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/PrivateMessageListener.java index 9a596488..aee47a51 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/PrivateMessageListener.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/PrivateMessageListener.java @@ -1,6 +1,5 @@ package me.totalfreedom.totalfreedommod.discord; -import java.util.Objects; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.player.PlayerData; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java index c42a10b3..67a0b86c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java @@ -327,7 +327,7 @@ public class ItemFun extends FreedomService //Redundant Player cast is required to avoid suspicious method calls. if (arrow != null && (arrow.getShooter() instanceof Player) - && explosivePlayers.contains((Player)arrow.getShooter())) + && explosivePlayers.contains(arrow.getShooter())) { Objects.requireNonNull(arrow.getLocation().getWorld()).createExplosion(arrow.getLocation().getX(), arrow.getLocation().getY(), arrow.getLocation().getZ(), ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue(), false, ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()); arrow.remove(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/Jumppads.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/Jumppads.java index b551ea4b..2341272b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/Jumppads.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/Jumppads.java @@ -19,9 +19,9 @@ public class Jumppads extends FreedomService public static final double DAMPING_COEFFICIENT = 0.8; // private final Map pushMap = Maps.newHashMap(); - public HashMap players = new HashMap<>(); // private final double strength = 1 + 0.1F; + public HashMap players = new HashMap<>(); public static double getDampingCoefficient() { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java index 77f2c9fe..012dc4d7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java @@ -2,8 +2,8 @@ package me.totalfreedom.totalfreedommod.fun; import java.util.HashSet; import java.util.Objects; -import java.util.SplittableRandom; import java.util.Set; +import java.util.SplittableRandom; import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.util.Groups; import org.bukkit.Location; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/ModuleExecutable.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/ModuleExecutable.java index 114777b4..873f457a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/ModuleExecutable.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/ModuleExecutable.java @@ -15,28 +15,6 @@ public abstract class ModuleExecutable this.async = async; } - public NanoHTTPD.Response execute(final NanoHTTPD.HTTPSession session) - { - try - { - if (async) - { - return getResponse(session); - } - - // Sync to server thread - return Bukkit.getScheduler().callSyncMethod(TotalFreedomMod.getPlugin(), () -> getResponse(session)).get(); - - } - catch (Exception ex) - { - FLog.severe(ex); - } - return null; - } - - public abstract NanoHTTPD.Response getResponse(NanoHTTPD.HTTPSession session); - public static ModuleExecutable forClass(final TotalFreedomMod plugin, Class clazz, boolean async) { final Constructor cons; @@ -67,6 +45,28 @@ public abstract class ModuleExecutable }; } + public NanoHTTPD.Response execute(final NanoHTTPD.HTTPSession session) + { + try + { + if (async) + { + return getResponse(session); + } + + // Sync to server thread + return Bukkit.getScheduler().callSyncMethod(TotalFreedomMod.getPlugin(), () -> getResponse(session)).get(); + + } + catch (Exception ex) + { + FLog.severe(ex); + } + return null; + } + + public abstract NanoHTTPD.Response getResponse(NanoHTTPD.HTTPSession session); + public boolean isAsync() { return async; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/permissions/PermissionEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/permissions/PermissionEntry.java index 88fe5319..08b16351 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/permissions/PermissionEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/permissions/PermissionEntry.java @@ -1,7 +1,6 @@ package me.totalfreedom.totalfreedommod.permissions; import java.util.List; -import java.util.Objects; import me.totalfreedom.totalfreedommod.TotalFreedomMod; public enum PermissionEntry diff --git a/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerData.java b/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerData.java index dc56badf..942f9db4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerData.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerData.java @@ -7,7 +7,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.shop.ShopItem; import me.totalfreedom.totalfreedommod.util.FLog; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java index 63dabb29..56cac942 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java @@ -21,8 +21,8 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Objects; -import java.util.SplittableRandom; import java.util.Set; +import java.util.SplittableRandom; import java.util.TimeZone; import java.util.UUID; import java.util.regex.Matcher; @@ -148,7 +148,7 @@ public class FUtil return DEVELOPER_NAMES.contains(player.getName()); } } - + public static boolean inDeveloperMode() { return ConfigEntry.DEVELOPER_MODE.getBoolean(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/History.java b/src/main/java/me/totalfreedom/totalfreedommod/util/History.java index adb8a28c..3c5125f2 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/util/History.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/util/History.java @@ -10,7 +10,6 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; -import java.util.Objects; import java.util.UUID; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import org.bukkit.ChatColor;