From df96b4102b5a1b8978778f546d55672c1573f13f Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Fri, 7 Oct 2016 19:40:45 -0400 Subject: [PATCH] Finished Flairdoors for testing, added debug messages --- .classpath | 8 ++++ .../flairdoors/PortalListener.java | 42 ++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 .classpath diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..cefbd63 --- /dev/null +++ b/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/alisolarflare/flairdoors/PortalListener.java b/src/alisolarflare/flairdoors/PortalListener.java index c362482..bebcc49 100644 --- a/src/alisolarflare/flairdoors/PortalListener.java +++ b/src/alisolarflare/flairdoors/PortalListener.java @@ -19,7 +19,7 @@ import alisolarflare.AliPresents; public class PortalListener implements Listener{ AbstractMap portalMap = new HashMap(); - public List playersToBeFlaired = new ArrayList(); + public static List playersToBeFlaired = new ArrayList(); public AliPresents plugin; //TODO: CREATE - LIST OF PORTALS (only x-z values) @@ -42,6 +42,9 @@ public class PortalListener implements Listener{ if(!(playersToBeFlaired.contains(player.getName()))){ return; } + player.sendMessage("MAY THE FLAIRING COMMENCE"); + player.sendMessage("Deactivating regular portal behaviour..."); + event.setCancelled(true); //INIT - x,y,z int x = player.getLocation().getBlockX(); @@ -53,30 +56,41 @@ public class PortalListener implements Listener{ Block blockMiddle = player.getWorld().getBlockAt(x,y-2,z); Block blockBottom = player.getWorld().getBlockAt(x,y-3,z); + player.sendMessage("Blocks being inspected:"); + player.sendMessage(blockTopper.toString()); + player.sendMessage(blockMiddle.toString()); + player.sendMessage(blockBottom.toString()); + //RECOLOUR PLAYER if(blockTopper.getType() == Material.STONE){ + player.sendMessage("STONE DETECTED"); recolourPlayer(player, DyeColor.GRAY); //TOP BLOCK IS WOOL? }else if(blockTopper.getType() == Material.WOOL){ + player.sendMessage("WOOL DETECTED T"); Wool wool = (Wool) blockTopper; recolourPlayer(player, wool.getColor()); //MIDDLE BLOCK IS WOOL? }else if(blockMiddle.getType() == Material.WOOL){ + + player.sendMessage("WOOL DETECTED M"); Wool wool = (Wool) blockMiddle; recolourPlayer(player, wool.getColor()); //BOTTOM BLOCK IS WOOL? }else if (blockBottom.getType() == Material.WOOL){ + player.sendMessage("WOOL DETECTED B"); Wool wool = (Wool) blockBottom; recolourPlayer(player, wool.getColor()); } } public void recolourPlayer(Player player, DyeColor dyecolour){ - + player.sendMessage("Recolouring Player as..." + dyecolour.toString()); String name = player.getDisplayName(); + player.sendMessage("name:" + name); for(int i = 0; i < name.length(); i++){ if (name.charAt(i) == '&'){ //TODO: Remove all &* symbols @@ -84,17 +98,41 @@ public class PortalListener implements Listener{ } } + player.sendMessage("Adjusted Name: " + name); if(dyecolour == DyeColor.GRAY){ + player.sendMessage("Adding GRAY"); + player.setDisplayName("&7" + name); + }else if(dyecolour == DyeColor.RED){ + player.sendMessage("Adding RED"); + player.setDisplayName("&4" + name); + }else if(dyecolour == DyeColor.ORANGE){ + player.sendMessage("Adding ORANGE"); + player.setDisplayName("&6" + name); + }else if(dyecolour == DyeColor.YELLOW){ + player.sendMessage("Adding YELLOW"); + player.setDisplayName("&e" + name); + }else if(dyecolour == DyeColor.GREEN){ + player.sendMessage("Adding GREEN"); + player.setDisplayName("&a" + name); + }else if(dyecolour == DyeColor.BLUE){ + player.sendMessage("Adding BLUE"); + player.setDisplayName("&9" + name); + }else if(dyecolour == DyeColor.PURPLE){ + player.sendMessage("Adding PURPLE"); + player.setDisplayName("&5" + name); + }else{ + player.sendMessage("ERROR, PORTAL HAS INVALID UNDER-BLOCK"); return; } + player.sendMessage("Your name is now: " + player.getDisplayName() +"! Removing you from playersToBeFlaired..."); playersToBeFlaired.remove(player.getName()); } }