diff --git a/pom.xml b/pom.xml index 4efa36702..c530e0ad0 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ world.bentobox bentobox - FC-0.92 + FC-1 BentoBox BentoBox is an expandable Minecraft Spigot plugin for island-type games like ASkyBlock or AcidIsland. diff --git a/src/main/java/world/bentobox/bentobox/Metrics.java b/src/main/java/world/bentobox/bentobox/Metrics.java index 14cc5faff..04a942eae 100644 --- a/src/main/java/world/bentobox/bentobox/Metrics.java +++ b/src/main/java/world/bentobox/bentobox/Metrics.java @@ -6,6 +6,7 @@ import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -310,7 +311,7 @@ public class Metrics { } ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); GZIPOutputStream gzip = new GZIPOutputStream(outputStream); - gzip.write(str.getBytes("UTF-8")); + gzip.write(str.getBytes(StandardCharsets.UTF_8)); gzip.close(); return outputStream.toByteArray(); } diff --git a/src/main/java/world/bentobox/bentobox/api/addons/AddonClassLoader.java b/src/main/java/world/bentobox/bentobox/api/addons/AddonClassLoader.java index 60be2cccb..3256cb8cb 100644 --- a/src/main/java/world/bentobox/bentobox/api/addons/AddonClassLoader.java +++ b/src/main/java/world/bentobox/bentobox/api/addons/AddonClassLoader.java @@ -15,7 +15,6 @@ import org.bukkit.plugin.InvalidDescriptionException; import org.bukkit.util.permissions.DefaultPermissions; import world.bentobox.bentobox.api.addons.AddonDescription.AddonDescriptionBuilder; -import world.bentobox.bentobox.api.addons.exception.InvalidAddonFormatException; import world.bentobox.bentobox.api.addons.exception.InvalidAddonInheritException; import world.bentobox.bentobox.managers.AddonsManager; @@ -32,7 +31,6 @@ public class AddonClassLoader extends URLClassLoader { public AddonClassLoader(AddonsManager addonsManager, YamlConfiguration data, File path, ClassLoader parent) throws InvalidAddonInheritException, MalformedURLException, - InvalidAddonFormatException, InvalidDescriptionException, InstantiationException, IllegalAccessException { @@ -45,7 +43,7 @@ public class AddonClassLoader extends URLClassLoader { String mainClass = data.getString("main"); javaClass = Class.forName(mainClass, true, this); if(mainClass.startsWith("world.bentobox.bentobox")){ - throw new InvalidAddonFormatException("Packages declaration cannot start with 'world.bentobox.bentobox'"); + throw new Exception("Packages declaration cannot start with 'world.bentobox.bentobox'"); } } catch (Exception e) { throw new InvalidDescriptionException("Could not load '" + path.getName() + "' in folder '" + path.getParent() + "' - " + e.getMessage()); diff --git a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandSetnameCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandSetnameCommand.java index faca9a9ad..fa7e6beef 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandSetnameCommand.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandSetnameCommand.java @@ -2,7 +2,6 @@ package world.bentobox.bentobox.api.commands.island; import java.util.List; import java.util.UUID; -import java.util.stream.Collectors; import org.bukkit.ChatColor; @@ -48,7 +47,7 @@ public class IslandSetnameCommand extends CompositeCommand { } // Naming the island - join all the arguments with spaces. - String name = args.stream().collect(Collectors.joining( " " )); + String name = String.join(" ", args); // Check if the name isn't too short or too long if (name.length() < getSettings().getNameMinLength()) { diff --git a/src/main/java/world/bentobox/bentobox/database/Database.java b/src/main/java/world/bentobox/bentobox/database/Database.java index a50e5262b..6bb652674 100644 --- a/src/main/java/world/bentobox/bentobox/database/Database.java +++ b/src/main/java/world/bentobox/bentobox/database/Database.java @@ -20,11 +20,21 @@ public class Database { private AbstractDatabaseHandler handler; private Logger logger; + /** + * Construct a database + * @param plugin - plugin + * @param type - to store this type + */ public Database(BentoBox plugin, Class type) { this.logger = plugin.getLogger(); handler = DatabaseSetup.getDatabase().getHandler(type); } + /** + * Construct a database + * @param addon - addon requesting + * @param type - to store this type + */ public Database(Addon addon, Class type) { this.logger = addon.getLogger(); handler = DatabaseSetup.getDatabase().getHandler(type); @@ -64,6 +74,7 @@ public class Database { /** * Save config object * @param instance to save + * @return true if successfully saved */ public boolean saveObject(T instance) { try { diff --git a/src/main/java/world/bentobox/bentobox/database/mongodb/MongoDBDatabase.java b/src/main/java/world/bentobox/bentobox/database/mongodb/MongoDBDatabase.java index 75fa342d6..983db9617 100644 --- a/src/main/java/world/bentobox/bentobox/database/mongodb/MongoDBDatabase.java +++ b/src/main/java/world/bentobox/bentobox/database/mongodb/MongoDBDatabase.java @@ -2,8 +2,8 @@ package world.bentobox.bentobox.database.mongodb; import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.database.AbstractDatabaseHandler; -import world.bentobox.bentobox.database.DatabaseSetup; import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl; +import world.bentobox.bentobox.database.DatabaseSetup; public class MongoDBDatabase implements DatabaseSetup { diff --git a/src/main/java/world/bentobox/bentobox/database/mongodb/MongoDBDatabaseConnector.java b/src/main/java/world/bentobox/bentobox/database/mongodb/MongoDBDatabaseConnector.java index f984f85c2..4062d75a1 100644 --- a/src/main/java/world/bentobox/bentobox/database/mongodb/MongoDBDatabaseConnector.java +++ b/src/main/java/world/bentobox/bentobox/database/mongodb/MongoDBDatabaseConnector.java @@ -10,8 +10,8 @@ import com.mongodb.MongoCredential; import com.mongodb.ServerAddress; import com.mongodb.client.MongoDatabase; -import world.bentobox.bentobox.database.DatabaseConnector; import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl; +import world.bentobox.bentobox.database.DatabaseConnector; public class MongoDBDatabaseConnector implements DatabaseConnector { diff --git a/src/main/java/world/bentobox/bentobox/database/mysql/MySQLDatabase.java b/src/main/java/world/bentobox/bentobox/database/mysql/MySQLDatabase.java index 74604a7ed..55e74422e 100644 --- a/src/main/java/world/bentobox/bentobox/database/mysql/MySQLDatabase.java +++ b/src/main/java/world/bentobox/bentobox/database/mysql/MySQLDatabase.java @@ -2,8 +2,8 @@ package world.bentobox.bentobox.database.mysql; import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.database.AbstractDatabaseHandler; -import world.bentobox.bentobox.database.DatabaseSetup; import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl; +import world.bentobox.bentobox.database.DatabaseSetup; public class MySQLDatabase implements DatabaseSetup { diff --git a/src/main/java/world/bentobox/bentobox/database/mysql/MySQLDatabaseConnector.java b/src/main/java/world/bentobox/bentobox/database/mysql/MySQLDatabaseConnector.java index be961adca..45a7a0aa7 100644 --- a/src/main/java/world/bentobox/bentobox/database/mysql/MySQLDatabaseConnector.java +++ b/src/main/java/world/bentobox/bentobox/database/mysql/MySQLDatabaseConnector.java @@ -8,8 +8,8 @@ import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; -import world.bentobox.bentobox.database.DatabaseConnector; import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl; +import world.bentobox.bentobox.database.DatabaseConnector; public class MySQLDatabaseConnector implements DatabaseConnector { diff --git a/src/main/java/world/bentobox/bentobox/managers/island/IslandGrid.java b/src/main/java/world/bentobox/bentobox/managers/island/IslandGrid.java index 25a34ae58..0c648c46b 100644 --- a/src/main/java/world/bentobox/bentobox/managers/island/IslandGrid.java +++ b/src/main/java/world/bentobox/bentobox/managers/island/IslandGrid.java @@ -10,7 +10,7 @@ import world.bentobox.bentobox.database.objects.Island; * @author tastybento * */ -public class IslandGrid { +class IslandGrid { private TreeMap> grid = new TreeMap<>(); /** diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminInfoCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminInfoCommandTest.java index ca79ea5e2..da5f86f5c 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminInfoCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminInfoCommandTest.java @@ -27,7 +27,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; import world.bentobox.bentobox.BentoBox; -import world.bentobox.bentobox.Settings; import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.database.objects.Island; diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminRegisterCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminRegisterCommandTest.java index b503c5ef1..ce4715244 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminRegisterCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminRegisterCommandTest.java @@ -26,7 +26,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; import world.bentobox.bentobox.BentoBox; -import world.bentobox.bentobox.Settings; import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.database.objects.Island; diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminUnregisterCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminUnregisterCommandTest.java index 1e8581cf8..c6bd16a01 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminUnregisterCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminUnregisterCommandTest.java @@ -25,7 +25,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; import world.bentobox.bentobox.BentoBox; -import world.bentobox.bentobox.Settings; import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.database.objects.Island; diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeCommandTest.java index d4f34a4f4..841f7c5c2 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeCommandTest.java @@ -23,7 +23,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; import world.bentobox.bentobox.BentoBox; -import world.bentobox.bentobox.Settings; import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.managers.CommandsManager; diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeDisplayCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeDisplayCommandTest.java index ab55a15b6..523367052 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeDisplayCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeDisplayCommandTest.java @@ -24,7 +24,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; import world.bentobox.bentobox.BentoBox; -import world.bentobox.bentobox.Settings; import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.managers.CommandsManager; diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeResetCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeResetCommandTest.java index 06b11bfb3..0974f6c9a 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeResetCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeResetCommandTest.java @@ -27,7 +27,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; import world.bentobox.bentobox.BentoBox; -import world.bentobox.bentobox.Settings; import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.localization.TextVariables; import world.bentobox.bentobox.api.user.User; diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeSetCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeSetCommandTest.java index d0308130e..2716a71a9 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeSetCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeSetCommandTest.java @@ -27,7 +27,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; import world.bentobox.bentobox.BentoBox; -import world.bentobox.bentobox.Settings; import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.localization.TextVariables; import world.bentobox.bentobox.api.user.User; diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamAddCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamAddCommandTest.java index d0cbba268..5e7b63345 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamAddCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamAddCommandTest.java @@ -24,7 +24,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; import world.bentobox.bentobox.BentoBox; -import world.bentobox.bentobox.Settings; import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.database.objects.Island; diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamDisbandCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamDisbandCommandTest.java index 68190f216..92338e511 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamDisbandCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamDisbandCommandTest.java @@ -26,7 +26,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; import world.bentobox.bentobox.BentoBox; -import world.bentobox.bentobox.Settings; import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.database.objects.Island; diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamKickCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamKickCommandTest.java index e18221b8a..ca3147a8e 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamKickCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamKickCommandTest.java @@ -28,7 +28,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; import world.bentobox.bentobox.BentoBox; -import world.bentobox.bentobox.Settings; import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.database.objects.Island; diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamMakeLeaderCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamMakeLeaderCommandTest.java index 39cff8e25..f24caa172 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamMakeLeaderCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamMakeLeaderCommandTest.java @@ -26,7 +26,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; import world.bentobox.bentobox.BentoBox; -import world.bentobox.bentobox.Settings; import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.database.objects.Island; diff --git a/src/test/java/world/bentobox/bentobox/listeners/flags/CleanSuperFlatListenerTest.java b/src/test/java/world/bentobox/bentobox/listeners/flags/CleanSuperFlatListenerTest.java index b0e32b7f9..cbe98596f 100644 --- a/src/test/java/world/bentobox/bentobox/listeners/flags/CleanSuperFlatListenerTest.java +++ b/src/test/java/world/bentobox/bentobox/listeners/flags/CleanSuperFlatListenerTest.java @@ -96,6 +96,7 @@ public class CleanSuperFlatListenerTest { /** * Test method for {@link world.bentobox.bentobox.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. */ + @SuppressWarnings("deprecation") @Test public void testOnChunkLoadNotBedrockNoFlsg() { when(block.getType()).thenReturn(Material.AIR); @@ -109,6 +110,7 @@ public class CleanSuperFlatListenerTest { /** * Test method for {@link world.bentobox.bentobox.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. */ + @SuppressWarnings("deprecation") @Test public void testOnChunkLoadBedrock() { ChunkLoadEvent e = new ChunkLoadEvent(chunk, false); @@ -119,6 +121,7 @@ public class CleanSuperFlatListenerTest { /** * Test method for {@link world.bentobox.bentobox.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. */ + @SuppressWarnings("deprecation") @Test public void testOnChunkLoadBedrockNoClean() { Flags.CLEAN_SUPER_FLAT.setSetting(world, false); @@ -131,6 +134,7 @@ public class CleanSuperFlatListenerTest { /** * Test method for {@link world.bentobox.bentobox.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. */ + @SuppressWarnings("deprecation") @Test public void testOnChunkLoadBedrockNether() { when(world.getEnvironment()).thenReturn(World.Environment.NETHER); @@ -150,6 +154,7 @@ public class CleanSuperFlatListenerTest { /** * Test method for {@link world.bentobox.bentobox.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. */ + @SuppressWarnings("deprecation") @Test public void testOnChunkLoadBedrockEnd() { when(world.getEnvironment()).thenReturn(World.Environment.THE_END);