From c5d2772eae14185c886b36f3666b477e97436a4c Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 5 Nov 2016 09:36:19 -0400 Subject: [PATCH] started discriminating against CB Creatives --- .../flairdoor/listeners/PortalListener.java | 14 +++----------- .../CreativeBoundariesModule.java | 7 ++++++- .../creativeboundaries/PlotChangeListener.java | 3 ++- .../creativeboundaries/commands/Cbgm1.java | 8 ++++++++ .../creativeboundaries/commands/SetDickmode.java | 10 +++++----- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/alisolarflare/components/flairdoor/listeners/PortalListener.java b/src/alisolarflare/components/flairdoor/listeners/PortalListener.java index edf7866..82d186d 100644 --- a/src/alisolarflare/components/flairdoor/listeners/PortalListener.java +++ b/src/alisolarflare/components/flairdoor/listeners/PortalListener.java @@ -43,7 +43,6 @@ public class PortalListener implements Listener{ return; } player.sendMessage("-MAY THE FLAIRING COMMENCE-"); - player.sendMessage("Deactivating regular portal behaviour..."); event.setTo(player.getLocation()); //INIT - x,y,z @@ -52,14 +51,9 @@ public class PortalListener implements Listener{ int z = player.getLocation().getBlockZ(); //INIT - Blocks Under Portal - Block HigherBlock = player.getWorld().getBlockAt(x,y-1,z); - Block MiddleBlock = player.getWorld().getBlockAt(x,y-2,z); - Block BottomBlock = player.getWorld().getBlockAt(x,y-3,z); - - player.sendMessage("Blocks being inspected:"); - player.sendMessage(HigherBlock.toString()); - player.sendMessage(MiddleBlock.toString()); - player.sendMessage(BottomBlock.toString()); + Block HigherBlock = player.getWorld().getBlockAt(x,y-2,z); + Block MiddleBlock = player.getWorld().getBlockAt(x,y-3,z); + Block BottomBlock = player.getWorld().getBlockAt(x,y-4,z); //RECOLOUR PLAYER if(HigherBlock.getType() == Material.STONE){ @@ -77,9 +71,7 @@ public class PortalListener implements Listener{ player.sendMessage("WOOL DETECTED M"); MaterialData mData = MiddleBlock.getState().getData(); - player.sendMessage("MATERIAL DATA COLLECTED: "+ mData.toString()); Wool wool = (Wool) mData; - player.sendMessage("WOOL DATA CONVERTED: "+ wool.toString()); recolourPlayer(player, wool.getColor()); diff --git a/src/alisolarflare/creativeboundaries/CreativeBoundariesModule.java b/src/alisolarflare/creativeboundaries/CreativeBoundariesModule.java index 09b6639..6a36180 100644 --- a/src/alisolarflare/creativeboundaries/CreativeBoundariesModule.java +++ b/src/alisolarflare/creativeboundaries/CreativeBoundariesModule.java @@ -1,5 +1,9 @@ package alisolarflare.creativeboundaries; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import alisolarflare.Module; @@ -10,9 +14,10 @@ import alisolarflare.creativeboundaries.commands.SetDickmode; public class CreativeBoundariesModule extends Module{ public boolean dickmode; + public List cbCreatives = new ArrayList(); @Override public void register(JavaPlugin plugin) { - registerCommand(plugin, new Cbgm1()); + registerCommand(plugin, new Cbgm1(this)); registerCommand(plugin, new Cbgm0()); registerCommand(plugin, new SetDickmode(this)); diff --git a/src/alisolarflare/creativeboundaries/PlotChangeListener.java b/src/alisolarflare/creativeboundaries/PlotChangeListener.java index 41c5e5b..c230356 100644 --- a/src/alisolarflare/creativeboundaries/PlotChangeListener.java +++ b/src/alisolarflare/creativeboundaries/PlotChangeListener.java @@ -15,11 +15,12 @@ import com.palmergames.bukkit.towny.object.Town; public class PlotChangeListener implements Listener{ private boolean dickmode; + private List cbCreatives = new ArrayList(); public CreativeBoundariesModule plugin; - public List cbCreatives = new ArrayList(); public PlotChangeListener(CreativeBoundariesModule plugin){ this.plugin = plugin; this.dickmode = plugin.dickmode; + this.cbCreatives = plugin.cbCreatives; } @EventHandler public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){ diff --git a/src/alisolarflare/creativeboundaries/commands/Cbgm1.java b/src/alisolarflare/creativeboundaries/commands/Cbgm1.java index 14c69ce..04fba33 100644 --- a/src/alisolarflare/creativeboundaries/commands/Cbgm1.java +++ b/src/alisolarflare/creativeboundaries/commands/Cbgm1.java @@ -10,10 +10,17 @@ import com.palmergames.bukkit.towny.object.Town; import com.palmergames.bukkit.towny.object.TownBlock; import com.palmergames.bukkit.towny.object.TownyUniverse; +import alisolarflare.creativeboundaries.CreativeBoundariesModule; import buttondevteam.lib.chat.TBMCCommandBase; public class Cbgm1 extends TBMCCommandBase { + private CreativeBoundariesModule module; + + public Cbgm1(CreativeBoundariesModule module) { + this.module = module; + } + @Override public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) { @@ -46,6 +53,7 @@ public class Cbgm1 extends TBMCCommandBase { for(Resident res : town.getResidents()){ if (res.getName().toString().equals(player.getName().toString())){ player.setGameMode(GameMode.CREATIVE); + module.cbCreatives.add(player); return true; } } diff --git a/src/alisolarflare/creativeboundaries/commands/SetDickmode.java b/src/alisolarflare/creativeboundaries/commands/SetDickmode.java index 5cb3b14..3b1654b 100644 --- a/src/alisolarflare/creativeboundaries/commands/SetDickmode.java +++ b/src/alisolarflare/creativeboundaries/commands/SetDickmode.java @@ -6,10 +6,10 @@ import alisolarflare.creativeboundaries.CreativeBoundariesModule; import buttondevteam.lib.chat.TBMCCommandBase; public class SetDickmode extends TBMCCommandBase{ - private CreativeBoundariesModule plugin; + private CreativeBoundariesModule module; - public SetDickmode(CreativeBoundariesModule plugin){ - this.plugin = plugin; + public SetDickmode(CreativeBoundariesModule module){ + this.module = module; } @Override @@ -21,12 +21,12 @@ public class SetDickmode extends TBMCCommandBase{ } if(args[0].equalsIgnoreCase("TRUE") || args[0].equalsIgnoreCase("1")){ sender.sendMessage("Dickmode has been turned on!"); - plugin.dickmode=(true); + module.dickmode=(true); return true; } if(args[0].equalsIgnoreCase("FALSE") || args[0].equalsIgnoreCase("0")){ sender.sendMessage("Dickmode has been turned off!"); - plugin.dickmode=(false); + module.dickmode=(false); return true; } return false;