From 6a9004ea13c85c9d2f18745d907b52603d40ae45 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Wed, 30 Nov 2016 00:32:04 -0500 Subject: [PATCH] Anyways, it's time for me to sleep, --- .../creativeboundaries/commands/Cbgm1.java | 49 +------------------ 1 file changed, 2 insertions(+), 47 deletions(-) diff --git a/src/alisolarflare/components/creativeboundaries/commands/Cbgm1.java b/src/alisolarflare/components/creativeboundaries/commands/Cbgm1.java index cf0dd7d..b4602ff 100644 --- a/src/alisolarflare/components/creativeboundaries/commands/Cbgm1.java +++ b/src/alisolarflare/components/creativeboundaries/commands/Cbgm1.java @@ -1,59 +1,14 @@ package alisolarflare.components.creativeboundaries.commands; -import java.util.List; - -import org.bukkit.GameMode; import org.bukkit.entity.Player; -import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; -import com.palmergames.bukkit.towny.object.Resident; -import com.palmergames.bukkit.towny.object.Town; -import com.palmergames.bukkit.towny.object.TownBlock; -import com.palmergames.bukkit.towny.object.TownyUniverse; - import alisolarflare.architecture.commands.PlayerCommand; -import alisolarflare.components.creativeboundaries.CreativeBoundariesComponent; +import alisolarflare.components.creativeboundaries.CreativeBoundariesAPI; public class Cbgm1 extends PlayerCommand { - - List cbCreatives; - - public Cbgm1(CreativeBoundariesComponent component) { - this.cbCreatives = component.cbCreatives; - } - @Override public boolean OnCommand(Player player, String arg2, String[] arg3) { - TownBlock tb = TownyUniverse.getTownBlock(player.getLocation()); - - if (tb == null) { - player.sendMessage("Some error occured."); - player.sendMessage("TownBlock is null."); - return false; - } - Town town; - try { - town = tb.getTown(); - } catch (NotRegisteredException e) { - player.sendMessage("You aren't standing in a town, head to your home town to use this command."); - return false; - } - - boolean playerIsInTown = false; - for(Resident res : town.getResidents()){ - if (res.getName().toString().equals(player.getName().toString())){ - playerIsInTown = true; - break; - } - } - if (!playerIsInTown){ - player.sendMessage("Sorry, you're not part of this town"); - return false; - } - - player.setGameMode(GameMode.CREATIVE); - cbCreatives.add(player); - return true; + return CreativeBoundariesAPI.toCreative(player); } @Override public String[] GetHelpText(String alias){