Moved to addon API.

This commit is contained in:
Tastybento 2017-12-27 19:17:44 -08:00
parent eb715afcda
commit b240fce328
9 changed files with 83 additions and 52 deletions

View File

@ -4,8 +4,6 @@ version: 0.1
authors: [tastybento] authors: [tastybento]
depend: [BSkyBlock]
permissions: permissions:
bskyblock.intopten: bskyblock.intopten:
description: Player is in the top ten. description: Player is in the top ten.

View File

@ -8,7 +8,6 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import org.bukkit.Chunk;
import org.bukkit.ChunkSnapshot; import org.bukkit.ChunkSnapshot;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
@ -34,14 +33,14 @@ import us.tastybento.bskyblock.database.objects.Island;
public class ChunkScanner { public class ChunkScanner {
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
protected static final boolean LEVEL_LOGGING = false; protected static final boolean LEVEL_LOGGING = false;
private final Level plugin; private final Level addon;
private final Set<ChunkSnapshot> finalChunk; private final Set<ChunkSnapshot> finalChunk;
private final Results result; private final Results result;
private final Optional<User> asker; private final Optional<User> asker;
public ChunkScanner(Level plugin, Island island) { public ChunkScanner(Level plugin, Island island) {
this.plugin = plugin; this.addon = plugin;
// Get the chunks to scan // Get the chunks to scan
finalChunk = getIslandChunks(island); finalChunk = getIslandChunks(island);
this.asker = Optional.empty(); this.asker = Optional.empty();
@ -52,12 +51,12 @@ public class ChunkScanner {
/** /**
* Calculates the level of an island * Calculates the level of an island
* @param plugin * @param addon
* @param island - island that is being calculated * @param island - island that is being calculated
* @param asker - the user who wants the report * @param asker - the user who wants the report
*/ */
public ChunkScanner(Level plugin, Island island, User asker) { public ChunkScanner(Level addon, Island island, User asker) {
this.plugin = plugin; this.addon = addon;
// Get the chunks to scan // Get the chunks to scan
finalChunk = getIslandChunks(island); finalChunk = getIslandChunks(island);
this.asker = Optional.of(asker); this.asker = Optional.of(asker);
@ -68,7 +67,7 @@ public class ChunkScanner {
private void runAsyncCount(Island island) { private void runAsyncCount(Island island) {
// Run AsyncTask to count blocks in the chunk snapshots // Run AsyncTask to count blocks in the chunk snapshots
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { addon.getServer().getScheduler().runTaskAsynchronously(addon.getBSkyBlock(), new Runnable() {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
@ -81,14 +80,14 @@ public class ChunkScanner {
// Check if the block coord is inside the protection zone and if not, don't count it // Check if the block coord is inside the protection zone and if not, don't count it
if (chunk.getX() * 16 + x < island.getMinProtectedX() || chunk.getX() * 16 + x >= island.getMinProtectedX() + (island.getProtectionRange() * 2)) { if (chunk.getX() * 16 + x < island.getMinProtectedX() || chunk.getX() * 16 + x >= island.getMinProtectedX() + (island.getProtectionRange() * 2)) {
if (DEBUG) if (DEBUG)
plugin.getLogger().info("Block is outside protected area - x = " + (chunk.getX() * 16 + x)); addon.getLogger().info("Block is outside protected area - x = " + (chunk.getX() * 16 + x));
continue; continue;
} }
for (int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
// Check if the block coord is inside the protection zone and if not, don't count it // Check if the block coord is inside the protection zone and if not, don't count it
if (chunk.getZ() * 16 + z < island.getMinProtectedZ() || chunk.getZ() * 16 + z >= island.getMinProtectedZ() + (island.getProtectionRange() * 2)) { if (chunk.getZ() * 16 + z < island.getMinProtectedZ() || chunk.getZ() * 16 + z >= island.getMinProtectedZ() + (island.getProtectionRange() * 2)) {
if (DEBUG) if (DEBUG)
plugin.getLogger().info("Block is outside protected area - z = " + (chunk.getZ() * 16 + z)); addon.getLogger().info("Block is outside protected area - z = " + (chunk.getZ() * 16 + z));
continue; continue;
} }
@ -99,13 +98,13 @@ public class ChunkScanner {
MaterialData generic = new MaterialData(type); MaterialData generic = new MaterialData(type);
if (!type.equals(Material.AIR)) { // AIR if (!type.equals(Material.AIR)) { // AIR
if (DEBUG) if (DEBUG)
plugin.getLogger().info("Block is inside protected area " + (chunk.getX() * 16) + "," + (chunk.getZ() * 16 + z)); addon.getLogger().info("Block is inside protected area " + (chunk.getX() * 16) + "," + (chunk.getZ() * 16 + z));
if (DEBUG) if (DEBUG)
plugin.getLogger().info("Block is " + md + "[" + generic +"]"); addon.getLogger().info("Block is " + md + "[" + generic +"]");
if (limitCount.containsKey(md) && Settings.blockValues.containsKey(md)) { if (limitCount.containsKey(md) && Settings.blockValues.containsKey(md)) {
int count = limitCount.get(md); int count = limitCount.get(md);
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: Count for non-generic " + md + " is " + count); addon.getLogger().info("DEBUG: Count for non-generic " + md + " is " + count);
if (count > 0) { if (count > 0) {
limitCount.put(md, --count); limitCount.put(md, --count);
if (Settings.seaHeight > 0 && y<=Settings.seaHeight) { if (Settings.seaHeight > 0 && y<=Settings.seaHeight) {
@ -121,7 +120,7 @@ public class ChunkScanner {
} else if (limitCount.containsKey(generic) && Settings.blockValues.containsKey(generic)) { } else if (limitCount.containsKey(generic) && Settings.blockValues.containsKey(generic)) {
int count = limitCount.get(generic); int count = limitCount.get(generic);
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: Count for generic " + generic + " is " + count); addon.getLogger().info("DEBUG: Count for generic " + generic + " is " + count);
if (count > 0) { if (count > 0) {
limitCount.put(generic, --count); limitCount.put(generic, --count);
if (Settings.seaHeight > 0 && y<=Settings.seaHeight) { if (Settings.seaHeight > 0 && y<=Settings.seaHeight) {
@ -136,7 +135,7 @@ public class ChunkScanner {
} }
} else if (Settings.blockValues.containsKey(md)) { } else if (Settings.blockValues.containsKey(md)) {
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: Adding " + md + " = " + Settings.blockValues.get(md)); addon.getLogger().info("DEBUG: Adding " + md + " = " + Settings.blockValues.get(md));
if (Settings.seaHeight > 0 && y<=Settings.seaHeight) { if (Settings.seaHeight > 0 && y<=Settings.seaHeight) {
result.underWaterBlockCount += Settings.blockValues.get(md); result.underWaterBlockCount += Settings.blockValues.get(md);
result.uwCount.add(md); result.uwCount.add(md);
@ -146,7 +145,7 @@ public class ChunkScanner {
} }
} else if (Settings.blockValues.containsKey(generic)) { } else if (Settings.blockValues.containsKey(generic)) {
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: Adding " + generic + " = " + Settings.blockValues.get(generic)); addon.getLogger().info("DEBUG: Adding " + generic + " = " + Settings.blockValues.get(generic));
if (Settings.seaHeight > 0 && y<=Settings.seaHeight) { if (Settings.seaHeight > 0 && y<=Settings.seaHeight) {
result.underWaterBlockCount += Settings.blockValues.get(generic); result.underWaterBlockCount += Settings.blockValues.get(generic);
result.uwCount.add(md); result.uwCount.add(md);
@ -165,14 +164,14 @@ public class ChunkScanner {
result.rawBlockCount += (long)((double)result.underWaterBlockCount * Settings.underWaterMultiplier); result.rawBlockCount += (long)((double)result.underWaterBlockCount * Settings.underWaterMultiplier);
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: block count = "+result.rawBlockCount); addon.getLogger().info("DEBUG: block count = "+result.rawBlockCount);
// Set the death penalty // Set the death penalty
result.deathHandicap = BSkyBlock.getPlugin().getPlayers().getDeaths(island.getOwner()) * Settings.deathpenalty; result.deathHandicap = BSkyBlock.getInstance().getPlayers().getDeaths(island.getOwner()) * Settings.deathpenalty;
// Set final score // Set final score
result.score = (result.rawBlockCount / Settings.levelCost) - result.deathHandicap; result.score = (result.rawBlockCount / Settings.levelCost) - result.deathHandicap;
// Return to main thread // Return to main thread
plugin.getServer().getScheduler().runTask(plugin, new Runnable() { addon.getServer().getScheduler().runTask(addon.getBSkyBlock(), new Runnable() {
@Override @Override
public void run() { public void run() {
@ -302,7 +301,7 @@ public class ChunkScanner {
final World world = island.getWorld(); final World world = island.getWorld();
// Get the chunks // Get the chunks
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: Getting chunks. Protection range = " + island.getProtectionRange()); addon.getLogger().info("DEBUG: Getting chunks. Protection range = " + island.getProtectionRange());
//long nano = System.nanoTime(); //long nano = System.nanoTime();
Set<ChunkSnapshot> chunkSnapshot = new HashSet<ChunkSnapshot>(); Set<ChunkSnapshot> chunkSnapshot = new HashSet<ChunkSnapshot>();
for (int x = island.getMinProtectedX(); x < (island.getMinProtectedX() + (island.getProtectionRange() *2) + 16); x += 16) { for (int x = island.getMinProtectedX(); x < (island.getMinProtectedX() + (island.getProtectionRange() *2) + 16); x += 16) {
@ -315,11 +314,11 @@ public class ChunkScanner {
chunkSnapshot.add(world.getBlockAt(x, 0, z).getChunk().getChunkSnapshot()); chunkSnapshot.add(world.getBlockAt(x, 0, z).getChunk().getChunkSnapshot());
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: getting chunk at " + x + ", " + z); addon.getLogger().info("DEBUG: getting chunk at " + x + ", " + z);
} }
} }
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: size of chunk snapshot = " + chunkSnapshot.size()); addon.getLogger().info("DEBUG: size of chunk snapshot = " + chunkSnapshot.size());
return chunkSnapshot; return chunkSnapshot;
} }

View File

@ -7,7 +7,6 @@ import java.util.HashMap;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.UUID; import java.util.UUID;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import bskyblock.addin.level.commands.AdminLevel; import bskyblock.addin.level.commands.AdminLevel;
@ -17,6 +16,7 @@ import bskyblock.addin.level.commands.IslandTop;
import bskyblock.addin.level.config.PluginConfig; import bskyblock.addin.level.config.PluginConfig;
import bskyblock.addin.level.database.object.Levels; import bskyblock.addin.level.database.object.Levels;
import us.tastybento.bskyblock.BSkyBlock; import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.addons.AddOn;
import us.tastybento.bskyblock.api.commands.CompositeCommand; import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.commands.User; import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.config.Settings; import us.tastybento.bskyblock.config.Settings;
@ -28,7 +28,7 @@ import us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler;
* @author tastybento * @author tastybento
* *
*/ */
public class Level extends JavaPlugin { public class Level extends AddOn {
// The BSkyBlock plugin instance. // The BSkyBlock plugin instance.
@ -60,7 +60,7 @@ public class Level extends JavaPlugin {
// Load the plugin's config // Load the plugin's config
new PluginConfig(this); new PluginConfig(this);
// Get the BSkyBlock plugin. This will be available because this plugin depends on it in plugin.yml. // Get the BSkyBlock plugin. This will be available because this plugin depends on it in plugin.yml.
bSkyBlock = BSkyBlock.getPlugin(); bSkyBlock = BSkyBlock.getInstance();
// Check if it is enabled - it might be loaded, but not enabled. // Check if it is enabled - it might be loaded, but not enabled.
if (!bSkyBlock.isEnabled()) { if (!bSkyBlock.isEnabled()) {
this.setEnabled(false); this.setEnabled(false);
@ -73,18 +73,20 @@ public class Level extends JavaPlugin {
handler = (AbstractDatabaseHandler<Levels>) database.getHandler(bSkyBlock, Levels.class); handler = (AbstractDatabaseHandler<Levels>) database.getHandler(bSkyBlock, Levels.class);
// Initialize the cache // Initialize the cache
levelsCache = new HashMap<>(); levelsCache = new HashMap<>();
// Load all the levels
load();
// Load the calculator // Load the calculator
levelCalc = new LevelPresenter(this); levelCalc = new LevelPresenter(this);
// Start the top ten and register it for clicks // Start the top ten and register it for clicks
topTen = new TopTen(this); topTen = new TopTen(this);
getServer().getPluginManager().registerEvents(topTen, this); registerListener(topTen);
// Local locales // Local locales
//localeManager = new LocaleManager(this); //localeManager = new LocaleManager(this);
// Register commands // Register commands
CompositeCommand bsbIslandCmd = (CompositeCommand) BSkyBlock.getPlugin().getCommandsManager().getCommand(Settings.ISLANDCOMMAND); CompositeCommand bsbIslandCmd = (CompositeCommand) BSkyBlock.getInstance().getCommandsManager().getCommand(Settings.ISLANDCOMMAND);
new IslandLevel(this, bsbIslandCmd); new IslandLevel(this, bsbIslandCmd);
new IslandTop(this, bsbIslandCmd); new IslandTop(this, bsbIslandCmd);
CompositeCommand bsbAdminCmd = (CompositeCommand) BSkyBlock.getPlugin().getCommandsManager().getCommand(Settings.ADMINCOMMAND); CompositeCommand bsbAdminCmd = (CompositeCommand) BSkyBlock.getInstance().getCommandsManager().getCommand(Settings.ADMINCOMMAND);
new AdminLevel(this, bsbAdminCmd); new AdminLevel(this, bsbAdminCmd);
new AdminTop(this, bsbAdminCmd); new AdminTop(this, bsbAdminCmd);
// Done // Done
@ -98,6 +100,18 @@ public class Level extends JavaPlugin {
} }
} }
public void load() {
try {
for (Levels level : handler.loadObjects()) {
levelsCache.put(UUID.fromString(level.getUniqueId()), level.getLevel());
}
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| SecurityException | ClassNotFoundException | IntrospectionException | SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/** /**
* Save the levels to the database * Save the levels to the database
* @param async - if true, saving will be done async * @param async - if true, saving will be done async
@ -118,7 +132,7 @@ public class Level extends JavaPlugin {
} }
}; };
if(async){ if(async){
getServer().getScheduler().runTaskAsynchronously(this, save); getServer().getScheduler().runTaskAsynchronously(getBSkyBlock(), save);
} else { } else {
save.run(); save.run();
} }

View File

@ -15,7 +15,7 @@ public abstract class LevelPlugin {
public LevelPlugin(Level plugin) { public LevelPlugin(Level plugin) {
this.plugin = plugin; this.plugin = plugin;
this.bSkyBlock = BSkyBlock.getPlugin(); this.bSkyBlock = BSkyBlock.getInstance();
} }
public final Logger getLogger() { public final Logger getLogger() {

View File

@ -45,7 +45,6 @@ import bskyblock.addin.level.database.object.Levels;
import bskyblock.addin.level.database.object.TopTenList; import bskyblock.addin.level.database.object.TopTenList;
import bskyblock.addin.level.event.TopTenClick; import bskyblock.addin.level.event.TopTenClick;
import us.tastybento.bskyblock.BSkyBlock; import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.config.Settings; import us.tastybento.bskyblock.config.Settings;
import us.tastybento.bskyblock.database.BSBDatabase; import us.tastybento.bskyblock.database.BSBDatabase;
import us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler; import us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler;
@ -75,7 +74,7 @@ public class TopTen implements Listener {
database = BSBDatabase.getDatabase(); database = BSBDatabase.getDatabase();
// Set up the database handler to store and retrieve the TopTenList class // Set up the database handler to store and retrieve the TopTenList class
// Note that these are saved in the BSkyBlock database // Note that these are saved in the BSkyBlock database
handler = (AbstractDatabaseHandler<TopTenList>) database.getHandler(BSkyBlock.getPlugin(), TopTenList.class); handler = (AbstractDatabaseHandler<TopTenList>) database.getHandler(BSkyBlock.getInstance(), TopTenList.class);
loadTopTen(); loadTopTen();
} }
@ -116,7 +115,7 @@ public class TopTen implements Listener {
// Convert to UUID // Convert to UUID
UUID playerUUID = UUID.fromString(lv.getUniqueId()); UUID playerUUID = UUID.fromString(lv.getUniqueId());
// Check if the player is an owner or team leader // Check if the player is an owner or team leader
if (BSkyBlock.getPlugin().getIslands().isOwner(playerUUID)) { if (BSkyBlock.getInstance().getIslands().isOwner(playerUUID)) {
topTenList.addLevel(playerUUID, lv.getLevel()); topTenList.addLevel(playerUUID, lv.getLevel());
} }
} }
@ -183,25 +182,25 @@ public class TopTen implements Listener {
private ItemStack getSkull(int rank, Long long1, UUID player){ private ItemStack getSkull(int rank, Long long1, UUID player){
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: Getting the skull"); plugin.getLogger().info("DEBUG: Getting the skull");
String playerName = BSkyBlock.getPlugin().getPlayers().getName(player); String playerName = BSkyBlock.getInstance().getPlayers().getName(player);
if (DEBUG) { if (DEBUG) {
plugin.getLogger().info("DEBUG: playername = " + playerName); plugin.getLogger().info("DEBUG: playername = " + playerName);
plugin.getLogger().info("DEBUG: second chance = " + BSkyBlock.getPlugin().getPlayers().getName(player)); plugin.getLogger().info("DEBUG: second chance = " + BSkyBlock.getInstance().getPlayers().getName(player));
} }
ItemStack playerSkull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); ItemStack playerSkull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
if (playerName == null) return null; if (playerName == null) return null;
SkullMeta meta = (SkullMeta) playerSkull.getItemMeta(); SkullMeta meta = (SkullMeta) playerSkull.getItemMeta();
//meta.setOwningPlayer(plugin.getServer().getOfflinePlayer(player)); //meta.setOwningPlayer(plugin.getServer().getOfflinePlayer(player));
meta.setOwner(playerName); meta.setOwner(playerName);
meta.setDisplayName(("topten.guiHeading".replace("[name]", BSkyBlock.getPlugin().getIslands().getIslandName(player))).replace("[rank]", String.valueOf(rank))); meta.setDisplayName(("topten.guiHeading".replace("[name]", BSkyBlock.getInstance().getIslands().getIslandName(player))).replace("[rank]", String.valueOf(rank)));
//meta.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD + "<!> " + ChatColor.YELLOW + "Island: " + ChatColor.GOLD + ChatColor.UNDERLINE + plugin.getGrid().getIslandName(player) + ChatColor.GRAY + " (#" + rank + ")"); //meta.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD + "<!> " + ChatColor.YELLOW + "Island: " + ChatColor.GOLD + ChatColor.UNDERLINE + plugin.getGrid().getIslandName(player) + ChatColor.GRAY + " (#" + rank + ")");
List<String> lore = new ArrayList<String>(); List<String> lore = new ArrayList<String>();
lore.add(ChatColor.YELLOW + "topten.islandLevel".replace("[level]", String.valueOf(long1))); lore.add(ChatColor.YELLOW + "topten.islandLevel".replace("[level]", String.valueOf(long1)));
if (BSkyBlock.getPlugin().getPlayers().inTeam(player)) { if (BSkyBlock.getInstance().getPlayers().inTeam(player)) {
List<String> memberList = new ArrayList<>(); List<String> memberList = new ArrayList<>();
for (UUID members : BSkyBlock.getPlugin().getIslands().getMembers(player)) { for (UUID members : BSkyBlock.getInstance().getIslands().getMembers(player)) {
memberList.add(ChatColor.AQUA + BSkyBlock.getPlugin().getPlayers().getName(members)); memberList.add(ChatColor.AQUA + BSkyBlock.getInstance().getPlayers().getName(members));
} }
lore.addAll(memberList); lore.addAll(memberList);
} }

View File

@ -15,9 +15,6 @@ public class AdminLevel extends CompositeCommand {
public AdminLevel(Level levelPlugin, CompositeCommand parent) { public AdminLevel(Level levelPlugin, CompositeCommand parent) {
super(parent, "level"); super(parent, "level");
this.levelPlugin = levelPlugin; this.levelPlugin = levelPlugin;
this.setPermission(Settings.PERMPREFIX + "admin.level");
this.setOnlyPlayer(false);
this.setUsage("admin.level.usage");
} }
@Override @Override
@ -41,4 +38,13 @@ public class AdminLevel extends CompositeCommand {
return true; return true;
} }
@Override
public void setup() {
this.setPermission(Settings.PERMPREFIX + "admin.level");
this.setOnlyPlayer(false);
this.setParameters("admin.level.parameters");
this.setDescription("admin.level.description");
}
} }

View File

@ -17,9 +17,6 @@ public class AdminTop extends CompositeCommand {
public AdminTop(Level levelPlugin, CompositeCommand parent) { public AdminTop(Level levelPlugin, CompositeCommand parent) {
super(parent, "top", "topten"); super(parent, "top", "topten");
this.levelPlugin = levelPlugin; this.levelPlugin = levelPlugin;
this.setPermission(Settings.PERMPREFIX + "admin.top");
this.setOnlyPlayer(false);
this.setUsage("admin.top.usage");
} }
@Override @Override
@ -28,7 +25,7 @@ public class AdminTop extends CompositeCommand {
for (Entry<UUID, Long> topTen : levelPlugin.getTopTen().getTopTenList().getTopTen().entrySet()) { for (Entry<UUID, Long> topTen : levelPlugin.getTopTen().getTopTenList().getTopTen().entrySet()) {
UUID player = topTen.getKey(); UUID player = topTen.getKey();
rank++; rank++;
String item = String.valueOf(rank) + ":" + BSkyBlock.getPlugin().getIslands().getIslandName(player) + " " String item = String.valueOf(rank) + ":" + BSkyBlock.getInstance().getIslands().getIslandName(player) + " "
+ "topten.islandLevel" + String.valueOf(topTen.getValue()); + "topten.islandLevel" + String.valueOf(topTen.getValue());
user.sendLegacyMessage(item); user.sendLegacyMessage(item);
} }
@ -36,4 +33,11 @@ public class AdminTop extends CompositeCommand {
return true; return true;
} }
@Override
public void setup() {
this.setPermission(Settings.PERMPREFIX + "admin.top");
this.setOnlyPlayer(false);
this.setParameters("admin.top.usage");
}
} }

View File

@ -15,9 +15,6 @@ public class IslandLevel extends CompositeCommand {
public IslandLevel(Level levelPlugin, CompositeCommand parent) { public IslandLevel(Level levelPlugin, CompositeCommand parent) {
super(parent, "level"); super(parent, "level");
this.levelPlugin = levelPlugin; this.levelPlugin = levelPlugin;
this.setPermission(Settings.PERMPREFIX + "island.level");
this.setUsage("island.level.usage");
this.setOnlyPlayer(true);
} }
@Override @Override
@ -45,4 +42,12 @@ public class IslandLevel extends CompositeCommand {
return false; return false;
} }
@Override
public void setup() {
this.setPermission(Settings.PERMPREFIX + "island.level");
this.setParameters("island.level.parameters");
this.setDescription("island.level.description");
this.setOnlyPlayer(true);
}
} }

View File

@ -14,8 +14,6 @@ public class IslandTop extends CompositeCommand {
public IslandTop(Level plugin, CompositeCommand parent) { public IslandTop(Level plugin, CompositeCommand parent) {
super(parent, "top", "topten"); super(parent, "top", "topten");
this.plugin = plugin; this.plugin = plugin;
this.setPermission(Settings.PERMPREFIX + "island.top");
this.setUsage("island.top.usage");
} }
@Override @Override
@ -24,4 +22,12 @@ public class IslandTop extends CompositeCommand {
return false; return false;
} }
@Override
public void setup() {
this.setPermission(Settings.PERMPREFIX + "island.top");
this.setDescription("island.top.description");
}
} }