mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00:00
Fix compile, avoid hardcoding tree values
This commit is contained in:
parent
d63e342f78
commit
0c8695a888
2 changed files with 11 additions and 31 deletions
|
@ -148,7 +148,6 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
|||
getLogger().warning(tl("versionMismatch", plugin.getDescription().getName()));
|
||||
}
|
||||
}
|
||||
execTimer.mark("BukkitCheck");
|
||||
|
||||
for (Method method : Server.class.getDeclaredMethods()) {
|
||||
if (method.getName().endsWith("getOnlinePlayers") && method.getReturnType() == Player[].class) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.Essentials;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.LocationUtil;
|
||||
import org.bukkit.Location;
|
||||
|
@ -9,7 +8,6 @@ import org.bukkit.TreeType;
|
|||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class Commandtree extends EssentialsCommand {
|
||||
public Commandtree() {
|
||||
super("tree");
|
||||
|
@ -17,36 +15,19 @@ public class Commandtree extends EssentialsCommand {
|
|||
|
||||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
||||
TreeType tree = TreeType.BIRCH;
|
||||
try // update check
|
||||
{
|
||||
if (args.length < 1) {
|
||||
throw new NotEnoughArgumentsException();
|
||||
} else if (args[0].equalsIgnoreCase("birch")) {
|
||||
tree = TreeType.BIRCH;
|
||||
} else if (args[0].equalsIgnoreCase("redwood")) {
|
||||
tree = TreeType.REDWOOD;
|
||||
} else if (args[0].equalsIgnoreCase("tree")) {
|
||||
tree = TreeType.TREE;
|
||||
} else if (args[0].equalsIgnoreCase("redmushroom")) {
|
||||
tree = TreeType.RED_MUSHROOM;
|
||||
} else if (args[0].equalsIgnoreCase("brownmushroom")) {
|
||||
tree = TreeType.BROWN_MUSHROOM;
|
||||
} else if (args[0].equalsIgnoreCase("jungle")) {
|
||||
tree = TreeType.SMALL_JUNGLE;
|
||||
} else if (args[0].equalsIgnoreCase("junglebush")) {
|
||||
tree = TreeType.JUNGLE_BUSH;
|
||||
} else if (args[0].equalsIgnoreCase("swamp")) {
|
||||
tree = TreeType.SWAMP;
|
||||
} else if (args[0].equalsIgnoreCase("acacia")) {
|
||||
tree = TreeType.ACACIA;
|
||||
} else if (args[0].equalsIgnoreCase("darkoak")) {
|
||||
tree = TreeType.DARK_OAK;
|
||||
} else {
|
||||
TreeType tree = null;
|
||||
if (args.length < 1) {
|
||||
throw new NotEnoughArgumentsException();
|
||||
} else {
|
||||
for (TreeType type : TreeType.values()) {
|
||||
if (type.name().replace("_", "").equalsIgnoreCase(args[0])) {
|
||||
tree = type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tree == null) {
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
} catch (java.lang.NoSuchFieldError e) {
|
||||
Essentials.wrongVersion();
|
||||
}
|
||||
|
||||
final Location loc = LocationUtil.getTarget(user.getBase());
|
||||
|
|
Loading…
Reference in a new issue