Finished Flairdoors for testing, added debug messages
This commit is contained in:
parent
89d609a3b8
commit
df96b4102b
2 changed files with 48 additions and 2 deletions
8
.classpath
Normal file
8
.classpath
Normal 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>
|
|
@ -19,7 +19,7 @@ import alisolarflare.AliPresents;
|
|||
|
||||
public class PortalListener implements Listener{
|
||||
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;
|
||||
|
||||
//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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue