API Breaker: renamed BSB classes to be just BB

Hopefully, this is the last API breaker. I renamed the classes that
started with BSB to be just BB (bentobox). I now have to fix all the
add-ons I just broke...
This commit is contained in:
tastybento 2018-08-05 20:08:03 -07:00
parent cfdabbb176
commit ba557a1068
37 changed files with 79 additions and 68 deletions

View File

@ -5,13 +5,13 @@ import org.bukkit.World;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import world.bentobox.bentobox.api.configuration.BSBConfig;
import world.bentobox.bentobox.api.configuration.BBConfig;
import world.bentobox.bentobox.api.configuration.WorldSettings;
import world.bentobox.bentobox.api.events.BentoBoxReadyEvent;
import world.bentobox.bentobox.api.placeholders.PlaceholderHandler;
import world.bentobox.bentobox.api.user.Notifier;
import world.bentobox.bentobox.commands.BentoBoxCommand;
import world.bentobox.bentobox.database.BSBDbSetup;
import world.bentobox.bentobox.database.BBDbSetup;
import world.bentobox.bentobox.listeners.BannedVisitorCommands;
import world.bentobox.bentobox.listeners.BlockEndDragon;
import world.bentobox.bentobox.listeners.JoinLeaveListener;
@ -78,7 +78,7 @@ public class BentoBox extends JavaPlugin {
flagsManager = new FlagsManager(instance);
// Load settings from config.yml. This will check if there are any issues with it too.
settings = new BSBConfig<>(this, Settings.class).loadConfigObject("");
settings = new BBConfig<>(this, Settings.class).loadConfigObject("");
// Start Database managers
playersManager = new PlayersManager(this);
// Check if this plugin is now disabled (due to bad database handling)
@ -183,7 +183,7 @@ public class BentoBox extends JavaPlugin {
}
// Save settings
if (settings != null) {
new BSBConfig<>(this, Settings.class).saveConfigObject(settings);
new BBConfig<>(this, Settings.class).saveConfigObject(settings);
}
}
@ -218,7 +218,7 @@ public class BentoBox extends JavaPlugin {
@Override
public String getValue() {
return BSBDbSetup.getDatabase().toString();
return BBDbSetup.getDatabase().toString();
}
});
}

View File

@ -8,7 +8,7 @@ import java.util.Set;
import world.bentobox.bentobox.api.configuration.ConfigComment;
import world.bentobox.bentobox.api.configuration.ConfigEntry;
import world.bentobox.bentobox.api.configuration.StoreAt;
import world.bentobox.bentobox.database.BSBDbSetup.DatabaseType;
import world.bentobox.bentobox.database.BBDbSetup.DatabaseType;
import world.bentobox.bentobox.database.objects.DataObject;
/**

View File

@ -17,17 +17,17 @@ import world.bentobox.bentobox.database.flatfile.FlatFileDatabase;
*
* @param <T>
*/
public class BSBConfig<T> {
public class BBConfig<T> {
private AbstractDatabaseHandler<T> handler;
private Logger logger;
public BSBConfig(BentoBox plugin, Class<T> type) {
public BBConfig(BentoBox plugin, Class<T> type) {
this.logger = plugin.getLogger();
handler = new FlatFileDatabase().getHandler(type);
}
public BSBConfig(Addon addon, Class<T> type) {
public BBConfig(Addon addon, Class<T> type) {
this.logger = addon.getLogger();
handler = new FlatFileDatabase().getHandler(type);
}
@ -64,6 +64,14 @@ public class BSBConfig<T> {
return null;
}
/**
* Loads a config object
* @return the object or null if it cannot be loaded
*/
public T loadConfigObject() {
return loadConfigObject("");
}
/**
* Save config object
* @param instance to save

View File

@ -15,19 +15,19 @@ import world.bentobox.bentobox.api.addons.Addon;
*
* @param <T>
*/
public class BSBDatabase<T> {
public class BBDatabase<T> {
private AbstractDatabaseHandler<T> handler;
private Logger logger;
public BSBDatabase(BentoBox plugin, Class<T> type) {
public BBDatabase(BentoBox plugin, Class<T> type) {
this.logger = plugin.getLogger();
handler = BSBDbSetup.getDatabase().getHandler(type);
handler = BBDbSetup.getDatabase().getHandler(type);
}
public BSBDatabase(Addon addon, Class<T> type) {
public BBDatabase(Addon addon, Class<T> type) {
this.logger = addon.getLogger();
handler = BSBDbSetup.getDatabase().getHandler(type);
handler = BBDbSetup.getDatabase().getHandler(type);
}

View File

@ -5,14 +5,14 @@ import world.bentobox.bentobox.database.flatfile.FlatFileDatabase;
import world.bentobox.bentobox.database.mongodb.MongoDBDatabase;
import world.bentobox.bentobox.database.mysql.MySQLDatabase;
public abstract class BSBDbSetup {
public abstract class BBDbSetup {
/**
* Gets the type of database being used. Currently supported options are
* FLATFILE and MYSQL. Default is FLATFILE
* @return Database type
*/
public static BSBDbSetup getDatabase(){
public static BBDbSetup getDatabase(){
for(DatabaseType type : DatabaseType.values()){
if(type == BentoBox.getInstance().getSettings().getDatabaseType()) {
return type.database;
@ -26,9 +26,9 @@ public abstract class BSBDbSetup {
MYSQL(new MySQLDatabase()),
MONGO(new MongoDBDatabase());
BSBDbSetup database;
BBDbSetup database;
DatabaseType(BSBDbSetup database){
DatabaseType(BBDbSetup database){
this.database = database;
}
}

View File

@ -2,9 +2,9 @@ package world.bentobox.bentobox.database.flatfile;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.AbstractDatabaseHandler;
import world.bentobox.bentobox.database.BSBDbSetup;
import world.bentobox.bentobox.database.BBDbSetup;
public class FlatFileDatabase extends BSBDbSetup{
public class FlatFileDatabase extends BBDbSetup{
/**
* Get the config

View File

@ -2,10 +2,10 @@ package world.bentobox.bentobox.database.mongodb;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.AbstractDatabaseHandler;
import world.bentobox.bentobox.database.BSBDbSetup;
import world.bentobox.bentobox.database.BBDbSetup;
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
public class MongoDBDatabase extends BSBDbSetup{
public class MongoDBDatabase extends BBDbSetup{
@Override
public <T> AbstractDatabaseHandler<T> getHandler(Class<T> type) {

View File

@ -2,10 +2,10 @@ package world.bentobox.bentobox.database.mysql;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.AbstractDatabaseHandler;
import world.bentobox.bentobox.database.BSBDbSetup;
import world.bentobox.bentobox.database.BBDbSetup;
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
public class MySQLDatabase extends BSBDbSetup{
public class MySQLDatabase extends BBDbSetup{
/* (non-Javadoc)

View File

@ -25,7 +25,7 @@ import org.bukkit.util.Vector;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.BSBDatabase;
import world.bentobox.bentobox.database.BBDatabase;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.lists.Flags;
import world.bentobox.bentobox.managers.island.IslandCache;
@ -50,7 +50,7 @@ public class IslandsManager {
*/
private Map<World, Island> spawn;
private BSBDatabase<Island> handler;
private BBDatabase<Island> handler;
/**
* The last locations where an island were put.
@ -73,7 +73,7 @@ public class IslandsManager {
public IslandsManager(BentoBox plugin){
this.plugin = plugin;
// Set up the database handler to store and retrieve Island classes
handler = new BSBDatabase<>(plugin, Island.class);
handler = new BBDatabase<>(plugin, Island.class);
islandCache = new IslandCache();
spawn = new HashMap<>();
last = new HashMap<>();

View File

@ -14,15 +14,15 @@ import org.bukkit.World;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.BSBDatabase;
import world.bentobox.bentobox.database.BBDatabase;
import world.bentobox.bentobox.database.objects.Names;
import world.bentobox.bentobox.database.objects.Players;
public class PlayersManager {
private BentoBox plugin;
private BSBDatabase<Players> handler;
private BSBDatabase<Names> names;
private BBDatabase<Players> handler;
private BBDatabase<Names> names;
private Map<UUID, Players> playerCache;
private Set<UUID> inTeleport;
@ -37,9 +37,9 @@ public class PlayersManager {
public PlayersManager(BentoBox plugin){
this.plugin = plugin;
// Set up the database handler to store and retrieve Players classes
handler = new BSBDatabase<>(plugin, Players.class);
handler = new BBDatabase<>(plugin, Players.class);
// Set up the names database
names = new BSBDatabase<>(plugin, Names.class);
names = new BBDatabase<>(plugin, Names.class);
playerCache = new HashMap<>();
inTeleport = new HashSet<>();
}
@ -48,7 +48,7 @@ public class PlayersManager {
* Used only for testing. Sets the database to a mock database.
* @param handler - handler
*/
public void setHandler(BSBDatabase<Players> handler) {
public void setHandler(BBDatabase<Players> handler) {
this.handler = handler;
}

View File

@ -23,7 +23,6 @@ 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.commands.admin.AdminClearResetsAllCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.managers.CommandsManager;
import world.bentobox.bentobox.managers.IslandWorldManager;

View File

@ -29,7 +29,6 @@ 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.commands.admin.AdminInfoCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.CommandsManager;

View File

@ -16,7 +16,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;

View File

@ -17,7 +17,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
@ -27,7 +26,6 @@ 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.commands.admin.range.AdminRangeDisplayCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.managers.CommandsManager;
import world.bentobox.bentobox.managers.IslandWorldManager;

View File

@ -20,7 +20,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;

View File

@ -20,7 +20,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;

View File

@ -26,7 +26,6 @@ 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.commands.admin.team.AdminTeamAddCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.CommandsManager;

View File

@ -28,7 +28,6 @@ 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.commands.admin.team.AdminTeamDisbandCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.CommandsManager;

View File

@ -30,7 +30,6 @@ 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.commands.admin.team.AdminTeamKickCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.CommandsManager;

View File

@ -28,7 +28,6 @@ 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.commands.admin.team.AdminTeamMakeLeaderCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.CommandsManager;

View File

@ -8,7 +8,17 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
@ -18,7 +28,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
@ -28,7 +37,6 @@ 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.commands.island.IslandBanCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;

View File

@ -8,7 +8,13 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -17,7 +23,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
@ -27,7 +32,6 @@ 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.commands.island.IslandBanlistCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.CommandsManager;

View File

@ -29,7 +29,6 @@ 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.commands.island.IslandGoCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;

View File

@ -30,7 +30,6 @@ 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.commands.island.IslandResetCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.CommandsManager;

View File

@ -8,7 +8,16 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -25,7 +34,6 @@ 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.commands.island.IslandUnbanCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;

View File

@ -29,7 +29,6 @@ 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.commands.island.team.IslandTeamLeaveCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.managers.CommandsManager;
import world.bentobox.bentobox.managers.IslandWorldManager;

View File

@ -26,7 +26,6 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;

View File

@ -23,7 +23,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

View File

@ -39,7 +39,6 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;

View File

@ -31,7 +31,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;

View File

@ -28,7 +28,6 @@ import org.bukkit.entity.Slime;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.plugin.PluginManager;
import org.junit.Before;

View File

@ -27,7 +27,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;

View File

@ -10,7 +10,14 @@ import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -41,7 +48,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;

View File

@ -43,7 +43,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;

View File

@ -42,7 +42,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;

View File

@ -34,7 +34,7 @@ import org.powermock.reflect.Whitebox;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.Settings;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.BSBDatabase;
import world.bentobox.bentobox.database.BBDatabase;
import world.bentobox.bentobox.database.objects.Players;
import world.bentobox.bentobox.util.Util;
@ -54,7 +54,7 @@ public class PlayersManagerTest {
private World nether;
private World end;
@Mock
private BSBDatabase<Players> db;
private BBDatabase<Players> db;
/**
* @throws java.lang.Exception

View File

@ -21,7 +21,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;