started discriminating against CB Creatives

This commit is contained in:
alisolarflare 2016-11-05 09:36:19 -04:00
parent a83683b68e
commit c5d2772eae
5 changed files with 24 additions and 18 deletions

View file

@ -43,7 +43,6 @@ public class PortalListener implements Listener{
return; return;
} }
player.sendMessage("-MAY THE FLAIRING COMMENCE-"); player.sendMessage("-MAY THE FLAIRING COMMENCE-");
player.sendMessage("Deactivating regular portal behaviour...");
event.setTo(player.getLocation()); event.setTo(player.getLocation());
//INIT - x,y,z //INIT - x,y,z
@ -52,14 +51,9 @@ public class PortalListener implements Listener{
int z = player.getLocation().getBlockZ(); int z = player.getLocation().getBlockZ();
//INIT - Blocks Under Portal //INIT - Blocks Under Portal
Block HigherBlock = player.getWorld().getBlockAt(x,y-1,z); Block HigherBlock = player.getWorld().getBlockAt(x,y-2,z);
Block MiddleBlock = player.getWorld().getBlockAt(x,y-2,z); Block MiddleBlock = player.getWorld().getBlockAt(x,y-3,z);
Block BottomBlock = player.getWorld().getBlockAt(x,y-3,z); Block BottomBlock = player.getWorld().getBlockAt(x,y-4,z);
player.sendMessage("Blocks being inspected:");
player.sendMessage(HigherBlock.toString());
player.sendMessage(MiddleBlock.toString());
player.sendMessage(BottomBlock.toString());
//RECOLOUR PLAYER //RECOLOUR PLAYER
if(HigherBlock.getType() == Material.STONE){ if(HigherBlock.getType() == Material.STONE){
@ -77,9 +71,7 @@ public class PortalListener implements Listener{
player.sendMessage("WOOL DETECTED M"); player.sendMessage("WOOL DETECTED M");
MaterialData mData = MiddleBlock.getState().getData(); MaterialData mData = MiddleBlock.getState().getData();
player.sendMessage("MATERIAL DATA COLLECTED: "+ mData.toString());
Wool wool = (Wool) mData; Wool wool = (Wool) mData;
player.sendMessage("WOOL DATA CONVERTED: "+ wool.toString());
recolourPlayer(player, wool.getColor()); recolourPlayer(player, wool.getColor());

View file

@ -1,5 +1,9 @@
package alisolarflare.creativeboundaries; package alisolarflare.creativeboundaries;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module; import alisolarflare.Module;
@ -10,9 +14,10 @@ import alisolarflare.creativeboundaries.commands.SetDickmode;
public class CreativeBoundariesModule extends Module{ public class CreativeBoundariesModule extends Module{
public boolean dickmode; public boolean dickmode;
public List<Player> cbCreatives = new ArrayList<Player>();
@Override @Override
public void register(JavaPlugin plugin) { public void register(JavaPlugin plugin) {
registerCommand(plugin, new Cbgm1()); registerCommand(plugin, new Cbgm1(this));
registerCommand(plugin, new Cbgm0()); registerCommand(plugin, new Cbgm0());
registerCommand(plugin, new SetDickmode(this)); registerCommand(plugin, new SetDickmode(this));

View file

@ -15,11 +15,12 @@ import com.palmergames.bukkit.towny.object.Town;
public class PlotChangeListener implements Listener{ public class PlotChangeListener implements Listener{
private boolean dickmode; private boolean dickmode;
private List<Player> cbCreatives = new ArrayList<Player>();
public CreativeBoundariesModule plugin; public CreativeBoundariesModule plugin;
public List<Player> cbCreatives = new ArrayList<Player>();
public PlotChangeListener(CreativeBoundariesModule plugin){ public PlotChangeListener(CreativeBoundariesModule plugin){
this.plugin = plugin; this.plugin = plugin;
this.dickmode = plugin.dickmode; this.dickmode = plugin.dickmode;
this.cbCreatives = plugin.cbCreatives;
} }
@EventHandler @EventHandler
public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){ public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){

View file

@ -10,10 +10,17 @@ import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock; import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.TownyUniverse; import com.palmergames.bukkit.towny.object.TownyUniverse;
import alisolarflare.creativeboundaries.CreativeBoundariesModule;
import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.chat.TBMCCommandBase;
public class Cbgm1 extends TBMCCommandBase { public class Cbgm1 extends TBMCCommandBase {
private CreativeBoundariesModule module;
public Cbgm1(CreativeBoundariesModule module) {
this.module = module;
}
@Override @Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) { public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
@ -46,6 +53,7 @@ public class Cbgm1 extends TBMCCommandBase {
for(Resident res : town.getResidents()){ for(Resident res : town.getResidents()){
if (res.getName().toString().equals(player.getName().toString())){ if (res.getName().toString().equals(player.getName().toString())){
player.setGameMode(GameMode.CREATIVE); player.setGameMode(GameMode.CREATIVE);
module.cbCreatives.add(player);
return true; return true;
} }
} }

View file

@ -6,10 +6,10 @@ import alisolarflare.creativeboundaries.CreativeBoundariesModule;
import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.chat.TBMCCommandBase;
public class SetDickmode extends TBMCCommandBase{ public class SetDickmode extends TBMCCommandBase{
private CreativeBoundariesModule plugin; private CreativeBoundariesModule module;
public SetDickmode(CreativeBoundariesModule plugin){ public SetDickmode(CreativeBoundariesModule module){
this.plugin = plugin; this.module = module;
} }
@Override @Override
@ -21,12 +21,12 @@ public class SetDickmode extends TBMCCommandBase{
} }
if(args[0].equalsIgnoreCase("TRUE") || args[0].equalsIgnoreCase("1")){ if(args[0].equalsIgnoreCase("TRUE") || args[0].equalsIgnoreCase("1")){
sender.sendMessage("Dickmode has been turned on!"); sender.sendMessage("Dickmode has been turned on!");
plugin.dickmode=(true); module.dickmode=(true);
return true; return true;
} }
if(args[0].equalsIgnoreCase("FALSE") || args[0].equalsIgnoreCase("0")){ if(args[0].equalsIgnoreCase("FALSE") || args[0].equalsIgnoreCase("0")){
sender.sendMessage("Dickmode has been turned off!"); sender.sendMessage("Dickmode has been turned off!");
plugin.dickmode=(false); module.dickmode=(false);
return true; return true;
} }
return false; return false;