Updated to 1.1-SNAPSHOT

Removed deprecated command classes.
This commit is contained in:
tastybento 2019-01-13 18:51:46 -08:00
parent 8510f413f5
commit d0305e3d7e
6 changed files with 11 additions and 223 deletions

View File

@ -6,7 +6,7 @@
<groupId>world.bentobox</groupId>
<artifactId>level</artifactId>
<version>0.4.0-SNAPSHOT</version>
<version>1.1-SNAPSHOT</version>
<name>Level</name>
<description>Level is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.</description>
@ -86,7 +86,7 @@
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
<version>0.18.0-SNAPSHOT</version>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -1,51 +0,0 @@
package world.bentobox.level.commands;
import java.util.List;
import java.util.UUID;
import world.bentobox.level.Level;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
/**
* @deprecated Renamed and moved to {@link world.bentobox.level.commands.admin.AdminLevelCommand}.
*/
@Deprecated
public class AdminLevel extends CompositeCommand {
private final Level levelPlugin;
public AdminLevel(Level levelPlugin, CompositeCommand parent) {
super(parent, "level");
this.levelPlugin = levelPlugin;
}
@Override
public boolean execute(User user, String label, List<String> args) {
if (args.size() == 1) {
// Asking for another player's level?
// Convert name to a UUID
final UUID playerUUID = getPlugin().getPlayers().getUUID(args.get(0));
if (playerUUID == null) {
user.sendMessage("general.errors.unknown-player");
return true;
} else {
levelPlugin.calculateIslandLevel(getWorld(), user, playerUUID);
}
return true;
} else {
showHelp(this, user);
return false;
}
}
@Override
public void setup() {
this.setPermission("admin.level");
this.setOnlyPlayer(false);
this.setParametersHelp("admin.level.parameters");
this.setDescription("admin.level.description");
}
}

View File

@ -1,73 +0,0 @@
package world.bentobox.level.commands;
import java.util.List;
import java.util.Map.Entry;
import java.util.UUID;
import org.bukkit.World;
import world.bentobox.level.Level;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
/**
* @deprecated Renamed and moved to {@link world.bentobox.level.commands.admin.AdminTopCommand}.
*/
@Deprecated
public class AdminTop extends CompositeCommand {
private final Level levelPlugin;
public AdminTop(Level levelPlugin, CompositeCommand parent) {
super(parent, "top", "topten");
this.levelPlugin = levelPlugin;
}
@Override
public boolean execute(User user, String label, List<String> args) {
// Get world
World world;
if (args.isEmpty()) {
if (getPlugin().getIWM().getOverWorlds().size() == 1) {
world = getPlugin().getIWM().getOverWorlds().get(0);
} else {
showHelp(this, user);
return false;
}
} else {
if (getPlugin().getIWM().isOverWorld(args.get(0))) {
world = getPlugin().getIWM().getIslandWorld(args.get(0));
} else {
user.sendMessage("commands.admin.top.unknown-world");
return false;
}
}
int rank = 0;
for (Entry<UUID, Long> topTen : levelPlugin.getTopTen().getTopTenList(world).getTopTen().entrySet()) {
Island island = getPlugin().getIslands().getIsland(world, topTen.getKey());
if (island != null) {
rank++;
String item = user.getTranslation("admin.topten",
"[rank]",
"[name]",
"[level]",
String.valueOf(rank),
this.getPlugin().getPlayers().getUser(island.getOwner()).getName(),
String.valueOf(topTen.getValue()));
user.sendRawMessage(item);
}
}
return true;
}
@Override
public void setup() {
this.setPermission("admin.top");
this.setOnlyPlayer(false);
this.setDescription("admin.top.description");
}
}

View File

@ -1,54 +0,0 @@
package world.bentobox.level.commands;
import java.util.List;
import java.util.UUID;
import world.bentobox.level.Level;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
/**
* @deprecated Renamed and moved to {@link world.bentobox.level.commands.island.IslandLevelCommand}.
*/
@Deprecated
public class IslandLevel extends CompositeCommand {
private final Level levelPlugin;
public IslandLevel(Level levelPlugin, CompositeCommand parent) {
super(parent, "level");
this.levelPlugin = levelPlugin;
}
@Override
public boolean execute(User user, String label, List<String> args) {
if (!args.isEmpty()) {
// Asking for another player's level?
// Convert name to a UUID
final UUID playerUUID = getPlugin().getPlayers().getUUID(args.get(0));
if (playerUUID == null) {
user.sendMessage("general.errors.unknown-player");
return true;
} else if (user.getUniqueId().equals(playerUUID) ) {
// Self level request
levelPlugin.calculateIslandLevel(getWorld(), user, user.getUniqueId());
} else {
user.sendMessage("island.level.island-level-is", "[level]", String.valueOf(levelPlugin.getIslandLevel(getWorld(), playerUUID)));
return true;
}
} else {
// Self level request
levelPlugin.calculateIslandLevel(getWorld(), user, user.getUniqueId());
}
return false;
}
@Override
public void setup() {
this.setPermission("island.level");
this.setParametersHelp("island.level.parameters");
this.setDescription("island.level.description");
this.setOnlyPlayer(true);
}
}

View File

@ -1,34 +0,0 @@
package world.bentobox.level.commands;
import java.util.List;
import world.bentobox.level.Level;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
/**
* @deprecated Renamed and moved to {@link world.bentobox.level.commands.island.IslandTopCommand}.
*/
@Deprecated
public class IslandTop extends CompositeCommand {
private final Level plugin;
public IslandTop(Level plugin, CompositeCommand parent) {
super(parent, "top", "topten");
this.plugin = plugin;
}
@Override
public void setup() {
setPermission("island.top");
setDescription("island.top.description");
setOnlyPlayer(true);
}
@Override
public boolean execute(User user, String label, List<String> list) {
plugin.getTopTen().getGUI(getWorld(), user, getPermissionPrefix());
return true;
}
}

View File

@ -1,15 +1,16 @@
package world.bentobox.level.commands.admin;
import org.bukkit.World;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.level.Level;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.World;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.level.Level;
public class AdminTopCommand extends CompositeCommand {
private final Level levelPlugin;
@ -38,9 +39,8 @@ public class AdminTopCommand extends CompositeCommand {
return false;
}
} else {
if (getPlugin().getIWM().isOverWorld(args.get(0))) {
world = getPlugin().getIWM().getIslandWorld(args.get(0));
} else {
world = getPlugin().getIWM().getIslandWorld(args.get(0));
if (world == null) {
user.sendMessage("commands.admin.top.unknown-world");
return false;
}