From 398cef14ec67281fae5eee498f089b43186e91fa Mon Sep 17 00:00:00 2001 From: super Date: Thu, 3 Dec 2020 08:38:37 -0500 Subject: [PATCH] optimize imports --- .idea/TFGuilds.iml | 13 +++++++++++-- .idea/compiler.xml | 1 + pom.xml | 8 ++++++++ .../me/totalfreedom/tfguilds/TFGuilds.java | 2 -- .../tfguilds/command/CreateSubcommand.java | 6 ++---- .../tfguilds/command/DisbandSubcommand.java | 1 - .../tfguilds/command/RenameSubcommand.java | 5 ++--- .../tfguilds/command/ToggleTagSubcommand.java | 1 - .../totalfreedom/tfguilds/config/Config.java | 3 +-- .../me/totalfreedom/tfguilds/guild/Guild.java | 2 +- .../totalfreedom/tfguilds/guild/GuildRank.java | 9 ++++----- .../totalfreedom/tfguilds/sql/SQLDatabase.java | 3 +-- .../tfguilds/sql/SQLGuildData.java | 18 +----------------- .../totalfreedom/tfguilds/sql/SQLRankData.java | 5 ----- .../totalfreedom/tfguilds/sql/SQLUserData.java | 11 ----------- .../tfguilds/sql/SQLWorldData.java | 7 +++---- 16 files changed, 35 insertions(+), 60 deletions(-) diff --git a/.idea/TFGuilds.iml b/.idea/TFGuilds.iml index 4742ffe..f11b5de 100644 --- a/.idea/TFGuilds.iml +++ b/.idea/TFGuilds.iml @@ -19,6 +19,8 @@ + + @@ -26,6 +28,15 @@ + + + + + + + + + @@ -55,7 +66,6 @@ - @@ -75,7 +85,6 @@ - diff --git a/.idea/compiler.xml b/.idea/compiler.xml index d04fbec..b4f03dc 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -2,6 +2,7 @@ + diff --git a/pom.xml b/pom.xml index 645f53b..4a6d09d 100644 --- a/pom.xml +++ b/pom.xml @@ -45,6 +45,14 @@ + + org.apache.maven.plugins + maven-jar-plugin + 2.3.1 + + D:\STUFF\116test\plugins + + diff --git a/src/main/java/me/totalfreedom/tfguilds/TFGuilds.java b/src/main/java/me/totalfreedom/tfguilds/TFGuilds.java index 5d014fd..029eb3d 100644 --- a/src/main/java/me/totalfreedom/tfguilds/TFGuilds.java +++ b/src/main/java/me/totalfreedom/tfguilds/TFGuilds.java @@ -14,8 +14,6 @@ import me.totalfreedom.tfguilds.sql.SQLRankData; import me.totalfreedom.tfguilds.sql.SQLUserData; import me.totalfreedom.tfguilds.sql.SQLWorldData; import me.totalfreedom.tfguilds.util.GLog; -import org.bukkit.Bukkit; -import org.bukkit.World; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; diff --git a/src/main/java/me/totalfreedom/tfguilds/command/CreateSubcommand.java b/src/main/java/me/totalfreedom/tfguilds/command/CreateSubcommand.java index df4b932..c1a6a01 100644 --- a/src/main/java/me/totalfreedom/tfguilds/command/CreateSubcommand.java +++ b/src/main/java/me/totalfreedom/tfguilds/command/CreateSubcommand.java @@ -1,10 +1,11 @@ package me.totalfreedom.tfguilds.command; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import me.totalfreedom.tfguilds.Common; import me.totalfreedom.tfguilds.guild.Guild; import me.totalfreedom.tfguilds.util.GUtil; import org.apache.commons.lang.StringUtils; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -12,9 +13,6 @@ import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - public class CreateSubcommand extends Common implements CommandExecutor { @Override diff --git a/src/main/java/me/totalfreedom/tfguilds/command/DisbandSubcommand.java b/src/main/java/me/totalfreedom/tfguilds/command/DisbandSubcommand.java index e52f52a..b12d92e 100644 --- a/src/main/java/me/totalfreedom/tfguilds/command/DisbandSubcommand.java +++ b/src/main/java/me/totalfreedom/tfguilds/command/DisbandSubcommand.java @@ -5,7 +5,6 @@ import me.totalfreedom.tfguilds.guild.Guild; import me.totalfreedom.tfguilds.util.GLog; import me.totalfreedom.tfguilds.util.GUtil; import org.apache.commons.lang.StringUtils; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/src/main/java/me/totalfreedom/tfguilds/command/RenameSubcommand.java b/src/main/java/me/totalfreedom/tfguilds/command/RenameSubcommand.java index e062734..82cd7f1 100644 --- a/src/main/java/me/totalfreedom/tfguilds/command/RenameSubcommand.java +++ b/src/main/java/me/totalfreedom/tfguilds/command/RenameSubcommand.java @@ -1,5 +1,7 @@ package me.totalfreedom.tfguilds.command; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import me.totalfreedom.tfguilds.Common; import me.totalfreedom.tfguilds.guild.Guild; import me.totalfreedom.tfguilds.util.GUtil; @@ -11,9 +13,6 @@ import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - public class RenameSubcommand extends Common implements CommandExecutor { @Override diff --git a/src/main/java/me/totalfreedom/tfguilds/command/ToggleTagSubcommand.java b/src/main/java/me/totalfreedom/tfguilds/command/ToggleTagSubcommand.java index b582601..d544057 100644 --- a/src/main/java/me/totalfreedom/tfguilds/command/ToggleTagSubcommand.java +++ b/src/main/java/me/totalfreedom/tfguilds/command/ToggleTagSubcommand.java @@ -3,7 +3,6 @@ package me.totalfreedom.tfguilds.command; import me.totalfreedom.tfguilds.Common; import me.totalfreedom.tfguilds.guild.Guild; import me.totalfreedom.tfguilds.user.User; -import me.totalfreedom.tfguilds.util.GUtil; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; diff --git a/src/main/java/me/totalfreedom/tfguilds/config/Config.java b/src/main/java/me/totalfreedom/tfguilds/config/Config.java index c577ca6..8e5e4fc 100644 --- a/src/main/java/me/totalfreedom/tfguilds/config/Config.java +++ b/src/main/java/me/totalfreedom/tfguilds/config/Config.java @@ -1,10 +1,9 @@ package me.totalfreedom.tfguilds.config; +import java.io.File; import me.totalfreedom.tfguilds.TFGuilds; import org.bukkit.configuration.file.YamlConfiguration; -import java.io.File; - public class Config extends YamlConfiguration { private final TFGuilds plugin; diff --git a/src/main/java/me/totalfreedom/tfguilds/guild/Guild.java b/src/main/java/me/totalfreedom/tfguilds/guild/Guild.java index 78405bf..c148900 100644 --- a/src/main/java/me/totalfreedom/tfguilds/guild/Guild.java +++ b/src/main/java/me/totalfreedom/tfguilds/guild/Guild.java @@ -5,8 +5,8 @@ import java.util.List; import java.util.UUID; import lombok.Getter; import lombok.Setter; -import me.totalfreedom.tfguilds.TFGuilds; import me.totalfreedom.tfguilds.Common; +import me.totalfreedom.tfguilds.TFGuilds; import me.totalfreedom.tfguilds.config.ConfigEntry; import me.totalfreedom.tfguilds.util.GLog; import me.totalfreedom.tfguilds.util.GUtil; diff --git a/src/main/java/me/totalfreedom/tfguilds/guild/GuildRank.java b/src/main/java/me/totalfreedom/tfguilds/guild/GuildRank.java index f14af20..cb8abac 100644 --- a/src/main/java/me/totalfreedom/tfguilds/guild/GuildRank.java +++ b/src/main/java/me/totalfreedom/tfguilds/guild/GuildRank.java @@ -4,29 +4,28 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; import lombok.Getter; -import lombok.Setter; import me.totalfreedom.tfguilds.TFGuilds; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; public class GuildRank { - private static TFGuilds plugin = TFGuilds.getPlugin(); + private static final TFGuilds plugin = TFGuilds.getPlugin(); @Getter private String iguild; // identifier @Getter - private String identifier; + private final String identifier; // name @Getter - private String name; + private final String name; // members of this rank @Getter - private List members; + private final List members; public GuildRank(String iguild, String identifier, String name, List members) { diff --git a/src/main/java/me/totalfreedom/tfguilds/sql/SQLDatabase.java b/src/main/java/me/totalfreedom/tfguilds/sql/SQLDatabase.java index db9d772..ecae74e 100644 --- a/src/main/java/me/totalfreedom/tfguilds/sql/SQLDatabase.java +++ b/src/main/java/me/totalfreedom/tfguilds/sql/SQLDatabase.java @@ -12,8 +12,7 @@ public class SQLDatabase private static final String DATABASE_FILENAME = "database.db"; private static final TFGuilds plugin = TFGuilds.getPlugin(); - private File file; - private Connection connection; + private final File file; public SQLDatabase() { diff --git a/src/main/java/me/totalfreedom/tfguilds/sql/SQLGuildData.java b/src/main/java/me/totalfreedom/tfguilds/sql/SQLGuildData.java index 785ad60..66af80a 100644 --- a/src/main/java/me/totalfreedom/tfguilds/sql/SQLGuildData.java +++ b/src/main/java/me/totalfreedom/tfguilds/sql/SQLGuildData.java @@ -5,7 +5,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.UUID; @@ -74,7 +73,7 @@ public class SQLGuildData List ranks = new ArrayList<>(); if (set.getString("ranks") != null) { - for (String rankString : Arrays.asList(set.getString("ranks").split(","))) + for (String rankString : set.getString("ranks").split(",")) ranks.add(plugin.rankData.get(identifier, rankString)); } String motd = set.getString("motd"); @@ -121,21 +120,6 @@ public class SQLGuildData return null; } - /* - Guild guild = new Guild(identifier, - name, - owner.getName(), - Collections.singletonList(owner.getName()), - new ArrayList<>(), - ChatColor.DARK_GRAY + "[" + ChatColor.GRAY + name + ChatColor.DARK_GRAY + "]", - GuildState.INVITE_ONLY, - new ArrayList<>(), - null, - null, - System.currentTimeMillis(), - null); - */ - public Guild create(String identifier, String name, Player owner) { try (Connection connection = plugin.sql.getConnection()) diff --git a/src/main/java/me/totalfreedom/tfguilds/sql/SQLRankData.java b/src/main/java/me/totalfreedom/tfguilds/sql/SQLRankData.java index ce97d56..d5aeae3 100644 --- a/src/main/java/me/totalfreedom/tfguilds/sql/SQLRankData.java +++ b/src/main/java/me/totalfreedom/tfguilds/sql/SQLRankData.java @@ -5,16 +5,11 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.UUID; import me.totalfreedom.tfguilds.TFGuilds; -import me.totalfreedom.tfguilds.guild.Guild; import me.totalfreedom.tfguilds.guild.GuildRank; -import me.totalfreedom.tfguilds.guild.GuildState; import org.apache.commons.lang.StringUtils; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; public class SQLRankData { diff --git a/src/main/java/me/totalfreedom/tfguilds/sql/SQLUserData.java b/src/main/java/me/totalfreedom/tfguilds/sql/SQLUserData.java index 46dcfd3..74f0dad 100644 --- a/src/main/java/me/totalfreedom/tfguilds/sql/SQLUserData.java +++ b/src/main/java/me/totalfreedom/tfguilds/sql/SQLUserData.java @@ -4,20 +4,9 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; import java.util.UUID; import me.totalfreedom.tfguilds.TFGuilds; -import me.totalfreedom.tfguilds.guild.Guild; -import me.totalfreedom.tfguilds.guild.GuildRank; -import me.totalfreedom.tfguilds.guild.GuildState; import me.totalfreedom.tfguilds.user.User; -import org.apache.commons.lang.StringUtils; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.Player; public class SQLUserData { diff --git a/src/main/java/me/totalfreedom/tfguilds/sql/SQLWorldData.java b/src/main/java/me/totalfreedom/tfguilds/sql/SQLWorldData.java index d8b91f1..6045af9 100644 --- a/src/main/java/me/totalfreedom/tfguilds/sql/SQLWorldData.java +++ b/src/main/java/me/totalfreedom/tfguilds/sql/SQLWorldData.java @@ -1,13 +1,12 @@ package me.totalfreedom.tfguilds.sql; -import me.totalfreedom.tfguilds.TFGuilds; -import org.bukkit.Bukkit; -import org.bukkit.World; - import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import me.totalfreedom.tfguilds.TFGuilds; +import org.bukkit.Bukkit; +import org.bukkit.World; public class SQLWorldData {