Fixed BedsCommand.

This commit is contained in:
Jos van 't Hof
2012-06-05 08:41:52 +02:00
parent ee6b8a6c2b
commit 5ea6d54c97

View File

@@ -2,12 +2,10 @@ package me.Josvth.RandomSpawn.Commands;
import java.util.List;
import me.Josvth.RandomSpawn.RandomSpawnCommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class BedsCommand extends RandomSpawnCommandExecutor{
public class BedsCommand extends AbstractCommand{
public BedsCommand(){
name = "usebeds";
@@ -23,11 +21,13 @@ public class BedsCommand extends RandomSpawnCommandExecutor{
if (args.size() == 0){
if (randomSpawnFlags.contains("bedrespawn")){
randomSpawnFlags.remove("bedrespawn");
plugin.yamlHandler.worlds.set(worldName + ".randomspawnon", randomSpawnFlags);
plugin.playerInfo((Player)sender, "Beds are now disabled.");
plugin.yamlHandler.saveWorlds();
return true;
}else{
randomSpawnFlags.add("bedspawn");
randomSpawnFlags.add("bedrespawn");
plugin.yamlHandler.worlds.set(worldName + ".randomspawnon", randomSpawnFlags);
plugin.playerInfo((Player)sender, "Beds will now work like normal.");
plugin.yamlHandler.saveWorlds();
return true;
@@ -36,13 +36,15 @@ public class BedsCommand extends RandomSpawnCommandExecutor{
if (args.size() == 1){
if (args.get(0).matches("true")){
randomSpawnFlags.add("bedspawn");
randomSpawnFlags.add("bedrespawn");
plugin.yamlHandler.worlds.set(worldName + ".randomspawnon", randomSpawnFlags);
plugin.playerInfo((Player)sender, "Beds will now work like normal.");
plugin.yamlHandler.saveWorlds();
return true;
}
if (args.get(0).matches("false")){
randomSpawnFlags.remove("bedrespawn");
plugin.yamlHandler.worlds.set(worldName + ".randomspawnon", randomSpawnFlags);
plugin.playerInfo((Player)sender, "Beds are now disabled.");
plugin.yamlHandler.saveWorlds();
return true;