Removed unused imports. Removed unused classes InventorySave/Store

This commit is contained in:
tastybento 2018-08-15 20:30:34 -07:00
parent 8a687a52c6
commit 68624d2879
22 changed files with 26 additions and 23 deletions

View File

@ -5,7 +5,7 @@
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
<version>FC-0.92</version>
<version>FC-1</version>
<name>BentoBox</name>
<description>BentoBox is an expandable Minecraft Spigot plugin for island-type games like ASkyBlock or AcidIsland.</description>

View File

@ -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();
}

View File

@ -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());

View File

@ -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()) {

View File

@ -20,11 +20,21 @@ public class Database<T> {
private AbstractDatabaseHandler<T> handler;
private Logger logger;
/**
* Construct a database
* @param plugin - plugin
* @param type - to store this type
*/
public Database(BentoBox plugin, Class<T> 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<T> type) {
this.logger = addon.getLogger();
handler = DatabaseSetup.getDatabase().getHandler(type);
@ -64,6 +74,7 @@ public class Database<T> {
/**
* Save config object
* @param instance to save
* @return true if successfully saved
*/
public boolean saveObject(T instance) {
try {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -10,7 +10,7 @@ import world.bentobox.bentobox.database.objects.Island;
* @author tastybento
*
*/
public class IslandGrid {
class IslandGrid {
private TreeMap<Integer, TreeMap<Integer, Island>> grid = new TreeMap<>();
/**

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);