mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
fixed setup command (it wasn't working)
This commit is contained in:
parent
e0c5c285bb
commit
560921ebc5
@ -31,7 +31,7 @@ public enum C {
|
||||
SETUP_STEP("&cStep &6%s&c: %s &c<Expecting: &6%s&c, Default: &6%s&c>"),
|
||||
SETUP_INVALID_ARG("&c%s is not a valid argument for step %s. To cancel setup use: /plot setup cancel"),
|
||||
SETUP_VALID_ARG("&cValue &6%s &cset for step %s"),
|
||||
SETUP_FINISHED("&cFinished setup for world &c%s. To create it, type &6/plots setup create"),
|
||||
SETUP_FINISHED("&cFinished setup for world &c%s.\n&4If you are using MULTIVERSE or MULTIWORLD you will need to import this world. Otherwise you will need to add this world to the 'bukkit.yml' file (See installation tutorial for more info)"),
|
||||
SETUP_WORLD_TAKEN("&c%s is already a registered plotworld"),
|
||||
SETUP_MISSING_WORLD("&cYou need to specify a world name (&6/p setup {world}&c)\n&6Additional commands:\n&c - &6/p setup <value>\n&c - &6/p setup back\n&c - &6/p setup cancel"),
|
||||
/*
|
||||
|
@ -69,6 +69,7 @@ public class WorldGenerator extends ChunkGenerator {
|
||||
}
|
||||
|
||||
public WorldGenerator(String world) {
|
||||
|
||||
YamlConfiguration config = PlotMain.config;
|
||||
this.plotworld = new PlotWorld();
|
||||
Map<String, Object> options = new HashMap<String, Object>();
|
||||
|
@ -42,6 +42,7 @@ import sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -91,7 +92,7 @@ public class Setup extends SubCommand implements Listener {
|
||||
value = Float.parseFloat(string);
|
||||
break;
|
||||
case "biome":
|
||||
value = Biome.valueOf(string.toUpperCase());
|
||||
value = (string.toUpperCase());
|
||||
break;
|
||||
case "block":
|
||||
value = string;
|
||||
@ -160,6 +161,9 @@ public class Setup extends SubCommand implements Listener {
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
if (this.value instanceof String[]) {
|
||||
return (List<String>)(List<?>) Arrays.asList((String[]) this.value);
|
||||
}
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@ -168,6 +172,9 @@ public class Setup extends SubCommand implements Listener {
|
||||
}
|
||||
|
||||
public Object getDefaultValue() {
|
||||
if (this.default_value instanceof String[]) {
|
||||
return StringUtils.join((String[]) this.default_value,",");
|
||||
}
|
||||
return this.default_value;
|
||||
}
|
||||
|
||||
@ -230,7 +237,7 @@ public class Setup extends SubCommand implements Listener {
|
||||
SetupStep[] steps = object.step;
|
||||
String world = object.world;
|
||||
for (SetupStep step:steps) {
|
||||
PlotMain.config.set("worlds."+world+"."+step.constant, step.value);
|
||||
PlotMain.config.set("worlds."+world+"."+step.constant, step.getValue());
|
||||
}
|
||||
try {
|
||||
PlotMain.config.save(PlotMain.configFile);
|
||||
@ -238,8 +245,8 @@ public class Setup extends SubCommand implements Listener {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
World newWorld = WorldCreator.name(world).generator(new WorldGenerator(world)).createWorld();
|
||||
plr.teleport(newWorld.getSpawnLocation());
|
||||
// World newWorld = WorldCreator.name(world).generator(new WorldGenerator(world)).createWorld();
|
||||
// plr.teleport(newWorld.getSpawnLocation());
|
||||
|
||||
setupMap.remove(plr.getName());
|
||||
|
||||
@ -272,11 +279,17 @@ public class Setup extends SubCommand implements Listener {
|
||||
sendMessage(plr, C.SETUP_VALID_ARG, step.getConstant(), args[0]);
|
||||
step.setValue(args[0]);
|
||||
object.current++;
|
||||
if(object.getCurrent() == object.getMax()) {
|
||||
execute(plr, args);
|
||||
return true;
|
||||
}
|
||||
step = object.step[object.current];
|
||||
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType(), step.getDefaultValue() + "");
|
||||
return true;
|
||||
} else {
|
||||
sendMessage(plr, C.SETUP_INVALID_ARG, args[0], step.getConstant());
|
||||
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType(), step.getDefaultValue() + "");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -300,7 +313,6 @@ public class Setup extends SubCommand implements Listener {
|
||||
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType(), step.getDefaultValue() + "");
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user