Updated to latest BSB API's

This commit is contained in:
Tastybento 2018-03-11 17:36:33 -07:00
parent 78d3999451
commit 2273aaab81
8 changed files with 21 additions and 23 deletions

View File

@ -2,7 +2,6 @@ package bskyblock.addon.level;
import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@ -17,9 +16,9 @@ import bskyblock.addon.level.database.object.LevelsData;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.api.addons.Addon;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.AbstractDatabaseHandler;
import us.tastybento.bskyblock.database.BSBDatabase;
import us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler;
/**
* Addon to BSkyBlock that enables island level scoring and top ten functionality
@ -82,7 +81,7 @@ public class Level extends Addon {
levelsCache.put(targetPlayer, level.getLevel());
return level.getLevel();
} catch (InstantiationException | IllegalAccessException | InvocationTargetException
| ClassNotFoundException | IntrospectionException | SQLException e) {
| ClassNotFoundException | IntrospectionException e) {
getLogger().severe("Could not load player's level! " + e.getMessage());
}
return 0;
@ -105,7 +104,7 @@ public class Level extends Addon {
levelsCache.put(UUID.fromString(level.getUniqueId()), level.getLevel());
}
} catch (InstantiationException | IllegalAccessException | InvocationTargetException
| ClassNotFoundException | IntrospectionException | SQLException e) {
| ClassNotFoundException | IntrospectionException e) {
getLogger().severe("Could not load levels cache data! " + e.getMessage());
}
}
@ -166,8 +165,7 @@ public class Level extends Addon {
lv.setUniqueId(en.getKey().toString());
handler.saveObject(lv);
}
} catch (IllegalAccessException | InvocationTargetException
| InstantiationException | NoSuchMethodException | IntrospectionException | SQLException e) {
} catch (IllegalAccessException | InvocationTargetException | IntrospectionException e) {
getLogger().severe("Could not save levels async! " + e.getMessage());
}
};

View File

@ -26,7 +26,7 @@ import com.google.common.collect.Multisets;
import bskyblock.addon.level.event.IslandPostLevelEvent;
import bskyblock.addon.level.event.IslandPreLevelEvent;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.util.Pair;

View File

@ -5,7 +5,7 @@ import java.util.HashMap;
import java.util.UUID;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.api.user.User;
public class LevelPresenter extends LevelPlugin {

View File

@ -18,14 +18,14 @@ import bskyblock.addin.warps.Warp;
import bskyblock.addon.level.database.object.LevelsData;
import bskyblock.addon.level.database.object.TopTenData;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.api.panels.ClickType;
import us.tastybento.bskyblock.api.panels.PanelItem;
import us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler;
import us.tastybento.bskyblock.api.panels.builders.PanelBuilder;
import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.AbstractDatabaseHandler;
import us.tastybento.bskyblock.database.BSBDatabase;
import us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler;
/**
* Handles all Top Ten List functions
@ -95,7 +95,7 @@ public class TopTen implements Listener {
}
}
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| SecurityException | ClassNotFoundException | IntrospectionException | SQLException e) {
| SecurityException | ClassNotFoundException | IntrospectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
@ -116,8 +116,8 @@ public class TopTen implements Listener {
if (topTenList == null) create();
PanelBuilder panel = new PanelBuilder()
.setName(user.getTranslation("island.top.gui-title"))
.setUser(user);
.name(user.getTranslation("island.top.gui-title"))
.user(user);
int i = 1;
Iterator<Entry<UUID, Long>> it = topTenList.getTopTen().entrySet().iterator();
@ -140,7 +140,7 @@ public class TopTen implements Listener {
}
if (show) {
panel.addItem(SLOTS[i-1], getHead(i, m.getValue(), topTenUUID, user));
panel.item(SLOTS[i-1], getHead(i, m.getValue(), topTenUUID, user));
if (i++ == 10) break;
}
}
@ -177,9 +177,9 @@ public class TopTen implements Listener {
// If welcome warps is present then add warping
addon.getAddonByName("BSkyBlock-WelcomeWarps").ifPresent(warp -> {
if (((Warp)warp).getWarpSignsManager().hasWarp(playerUUID)) {
builder.clickHandler(new ClickHandler() {
@Override
@ -213,7 +213,7 @@ public class TopTen implements Listener {
topTenList = new TopTenData();
}
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| SecurityException | ClassNotFoundException | IntrospectionException | SQLException e) {
| SecurityException | ClassNotFoundException | IntrospectionException e) {
e.printStackTrace();
}
}
@ -267,7 +267,7 @@ public class TopTen implements Listener {
try {
handler.saveObject(topTenList);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | SecurityException
| InstantiationException | NoSuchMethodException | IntrospectionException | SQLException e) {
| IntrospectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

View File

@ -6,7 +6,7 @@ import java.util.UUID;
import bskyblock.addon.level.Level;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.api.user.User;
public class AdminLevel extends CompositeCommand {

View File

@ -8,7 +8,7 @@ import bskyblock.addon.level.Level;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.api.user.User;
public class AdminTop extends CompositeCommand {

View File

@ -6,7 +6,7 @@ import java.util.UUID;
import bskyblock.addon.level.Level;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.api.user.User;
public class IslandLevel extends CompositeCommand {

View File

@ -5,7 +5,7 @@ import java.util.List;
import bskyblock.addon.level.Level;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.api.user.User;
public class IslandTop extends CompositeCommand {