Finished Flairdoors for testing, added debug messages

This commit is contained in:
alisolarflare 2016-10-07 19:40:45 -04:00
parent 89d609a3b8
commit df96b4102b
2 changed files with 48 additions and 2 deletions

8
.classpath Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="C:/Users/Alisolarflare/Personal/Hobbies/The Button Rebirth/Button Plugin/Minecraft Test Server/craftbukkit-1.9.2.jar"/>
<classpathentry kind="lib" path="C:/Users/Alisolarflare/Personal/Hobbies/The Button Rebirth/Button Plugin/Minecraft Test Server/spigot-1.9.2.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -19,7 +19,7 @@ import alisolarflare.AliPresents;
public class PortalListener implements Listener{ public class PortalListener implements Listener{
AbstractMap<String,Location> portalMap = new HashMap<String,Location>(); AbstractMap<String,Location> portalMap = new HashMap<String,Location>();
public List<String> playersToBeFlaired = new ArrayList<String>(); public static List<String> playersToBeFlaired = new ArrayList<String>();
public AliPresents plugin; public AliPresents plugin;
//TODO: CREATE - LIST OF PORTALS (only x-z values) //TODO: CREATE - LIST OF PORTALS (only x-z values)
@ -42,6 +42,9 @@ public class PortalListener implements Listener{
if(!(playersToBeFlaired.contains(player.getName()))){ if(!(playersToBeFlaired.contains(player.getName()))){
return; return;
} }
player.sendMessage("MAY THE FLAIRING COMMENCE");
player.sendMessage("Deactivating regular portal behaviour...");
event.setCancelled(true);
//INIT - x,y,z //INIT - x,y,z
int x = player.getLocation().getBlockX(); int x = player.getLocation().getBlockX();
@ -53,30 +56,41 @@ public class PortalListener implements Listener{
Block blockMiddle = player.getWorld().getBlockAt(x,y-2,z); Block blockMiddle = player.getWorld().getBlockAt(x,y-2,z);
Block blockBottom = player.getWorld().getBlockAt(x,y-3,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 //RECOLOUR PLAYER
if(blockTopper.getType() == Material.STONE){ if(blockTopper.getType() == Material.STONE){
player.sendMessage("STONE DETECTED");
recolourPlayer(player, DyeColor.GRAY); recolourPlayer(player, DyeColor.GRAY);
//TOP BLOCK IS WOOL? //TOP BLOCK IS WOOL?
}else if(blockTopper.getType() == Material.WOOL){ }else if(blockTopper.getType() == Material.WOOL){
player.sendMessage("WOOL DETECTED T");
Wool wool = (Wool) blockTopper; Wool wool = (Wool) blockTopper;
recolourPlayer(player, wool.getColor()); recolourPlayer(player, wool.getColor());
//MIDDLE BLOCK IS WOOL? //MIDDLE BLOCK IS WOOL?
}else if(blockMiddle.getType() == Material.WOOL){ }else if(blockMiddle.getType() == Material.WOOL){
player.sendMessage("WOOL DETECTED M");
Wool wool = (Wool) blockMiddle; Wool wool = (Wool) blockMiddle;
recolourPlayer(player, wool.getColor()); recolourPlayer(player, wool.getColor());
//BOTTOM BLOCK IS WOOL? //BOTTOM BLOCK IS WOOL?
}else if (blockBottom.getType() == Material.WOOL){ }else if (blockBottom.getType() == Material.WOOL){
player.sendMessage("WOOL DETECTED B");
Wool wool = (Wool) blockBottom; Wool wool = (Wool) blockBottom;
recolourPlayer(player, wool.getColor()); recolourPlayer(player, wool.getColor());
} }
} }
public void recolourPlayer(Player player, DyeColor dyecolour){ public void recolourPlayer(Player player, DyeColor dyecolour){
player.sendMessage("Recolouring Player as..." + dyecolour.toString());
String name = player.getDisplayName(); String name = player.getDisplayName();
player.sendMessage("name:" + name);
for(int i = 0; i < name.length(); i++){ for(int i = 0; i < name.length(); i++){
if (name.charAt(i) == '&'){ if (name.charAt(i) == '&'){
//TODO: Remove all &* symbols //TODO: Remove all &* symbols
@ -84,17 +98,41 @@ public class PortalListener implements Listener{
} }
} }
player.sendMessage("Adjusted Name: " + name);
if(dyecolour == DyeColor.GRAY){ if(dyecolour == DyeColor.GRAY){
player.sendMessage("Adding GRAY");
player.setDisplayName("&7" + name);
}else if(dyecolour == DyeColor.RED){ }else if(dyecolour == DyeColor.RED){
player.sendMessage("Adding RED");
player.setDisplayName("&4" + name);
}else if(dyecolour == DyeColor.ORANGE){ }else if(dyecolour == DyeColor.ORANGE){
player.sendMessage("Adding ORANGE");
player.setDisplayName("&6" + name);
}else if(dyecolour == DyeColor.YELLOW){ }else if(dyecolour == DyeColor.YELLOW){
player.sendMessage("Adding YELLOW");
player.setDisplayName("&e" + name);
}else if(dyecolour == DyeColor.GREEN){ }else if(dyecolour == DyeColor.GREEN){
player.sendMessage("Adding GREEN");
player.setDisplayName("&a" + name);
}else if(dyecolour == DyeColor.BLUE){ }else if(dyecolour == DyeColor.BLUE){
player.sendMessage("Adding BLUE");
player.setDisplayName("&9" + name);
}else if(dyecolour == DyeColor.PURPLE){ }else if(dyecolour == DyeColor.PURPLE){
player.sendMessage("Adding PURPLE");
player.setDisplayName("&5" + name);
}else{ }else{
player.sendMessage("ERROR, PORTAL HAS INVALID UNDER-BLOCK");
return; return;
} }
player.sendMessage("Your name is now: " + player.getDisplayName() +"! Removing you from playersToBeFlaired...");
playersToBeFlaired.remove(player.getName()); playersToBeFlaired.remove(player.getName());
} }
} }