diff --git a/.classpath b/.classpath index 4ca58eb..8724855 100644 --- a/.classpath +++ b/.classpath @@ -2,7 +2,7 @@ - + diff --git a/bin/me/Travja/HungerArena/BlockStorage.class b/bin/me/Travja/HungerArena/BlockStorage.class index 9b80152..1fcf791 100644 Binary files a/bin/me/Travja/HungerArena/BlockStorage.class and b/bin/me/Travja/HungerArena/BlockStorage.class differ diff --git a/bin/me/Travja/HungerArena/ChatListener.class b/bin/me/Travja/HungerArena/ChatListener.class index 189688d..b100e2b 100644 Binary files a/bin/me/Travja/HungerArena/ChatListener.class and b/bin/me/Travja/HungerArena/ChatListener.class differ diff --git a/bin/me/Travja/HungerArena/DeathListener.class b/bin/me/Travja/HungerArena/DeathListener.class index bd96962..cb1ef80 100644 Binary files a/bin/me/Travja/HungerArena/DeathListener.class and b/bin/me/Travja/HungerArena/DeathListener.class differ diff --git a/src/me/travja/hungerarena/BlockStorage.java b/src/me/travja/hungerarena/BlockStorage.java index ff6b675..fe44d63 100644 --- a/src/me/travja/hungerarena/BlockStorage.java +++ b/src/me/travja/hungerarena/BlockStorage.java @@ -2,6 +2,7 @@ package me.Travja.HungerArena; import java.util.List; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -26,7 +27,7 @@ public class BlockStorage implements Listener { public BlockStorage(Main m) { this.plugin = m; } - /*@EventHandler + @EventHandler public void creeperExplosion(EntityExplodeEvent event){ if(plugin.canjoin== true){ for(Block b:event.blockList()){ @@ -88,15 +89,34 @@ public class BlockStorage implements Listener { int z = b.getZ(); int d = b.getTypeId(); String coords = w + "," + x + "," + y + "," + z + "," + d; - if(!(d== 51) && !(d==12){ + if(!(d== 51) && !(d==12) && !(d==13)){ System.out.println("Place: " + coords); List blocks = plugin.config.getStringList("Blocks_Placed"); blocks.add(coords); plugin.config.set("Blocks_Placed", blocks); plugin.saveConfig(); - } - Location location = b.getLocation(); - if (b.getType() == Material.SAND || b.getType() == Material.GRAVEL) { + }else if (d == 12 || d == 13) { + System.out.println("Sand/Gravel"); + int newy = y; + int replaced = 0; + Location l = b.getLocation(); + while(l.getBlock().getRelative(BlockFace.DOWN).getType()== Material.AIR){ + newy = newy-1; + replaced = 0; + System.out.println(newy); + } + while(l.getBlock().getRelative(BlockFace.DOWN).getType()== Material.WATER){ + newy = newy-1; + replaced = 8; + } + while(l.getBlock().getRelative(BlockFace.DOWN).getType()== Material.LAVA){ + newy = newy-1; + replaced = 10; + } + if(l.getBlock().getRelative(BlockFace.DOWN).getType()!= Material.AIR || l.getBlock().getRelative(BlockFace.DOWN).getType()!= Material.WATER || l.getBlock().getRelative(BlockFace.DOWN).getType()!= Material.LAVA){ + event.getPlayer().sendMessage(ChatColor.GREEN + "Block will land at " + x + ", " + newy + ", " + z + " and replaced " + replaced); + } + /*Location location = b.getLocation(); if (location.getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR) { int i = 0; for (i = location.getBlockY(); i > -1; i --) { @@ -105,13 +125,13 @@ public class BlockStorage implements Listener { break; } event.getPlayer().sendMessage("Block will land at: " + location); - System.out.println("Sand Place: " + coords); + System.out.println("Sand/Gravel Place: " + coords); List blocks = plugin.config.getStringList("Blocks_Destroyed"); blocks.add(coords); plugin.config.set("Blocks_Destroyed", blocks); plugin.saveConfig(); } - } + }*/ } } } @@ -178,11 +198,13 @@ public class BlockStorage implements Listener { int z = b.getZ(); int d = b.getTypeId(); String coords = w + "," + x + "," + y + "," + z + "," + d; - System.out.println("Fade: " + coords); - List blocks = plugin.config.getStringList("Blocks_Destroyed"); - blocks.add(coords); - plugin.config.set("Blocks_Destroyed", blocks); - plugin.saveConfig(); + if(d != 51 && d != 2){ + System.out.println("Fade: " + coords); + List blocks = plugin.config.getStringList("Blocks_Destroyed"); + blocks.add(coords); + plugin.config.set("Blocks_Destroyed", blocks); + plugin.saveConfig(); + } } } @EventHandler @@ -237,7 +259,7 @@ public class BlockStorage implements Listener { } } } - @EventHandler + /*@EventHandler public void onChange(BlockPhysicsEvent event){ Block block = event.getBlock(); Material changed = event.getChangedType(); diff --git a/src/me/travja/hungerarena/ChatListener.java b/src/me/travja/hungerarena/ChatListener.java index 6a762b0..a2f4212 100644 --- a/src/me/travja/hungerarena/ChatListener.java +++ b/src/me/travja/hungerarena/ChatListener.java @@ -7,7 +7,7 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerChatEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; public class ChatListener implements Listener { public Main plugin; @@ -15,7 +15,7 @@ public class ChatListener implements Listener { this.plugin = m; } @EventHandler - public void TributeChat(PlayerChatEvent event){ + public void TributeChat(AsyncPlayerChatEvent event){ Player p = event.getPlayer(); String pname = p.getName(); if(plugin.Playing.contains(pname)){ diff --git a/src/me/travja/hungerarena/DeathListener.java b/src/me/travja/hungerarena/DeathListener.java index 2398c2b..948cb70 100644 --- a/src/me/travja/hungerarena/DeathListener.java +++ b/src/me/travja/hungerarena/DeathListener.java @@ -34,13 +34,22 @@ public class DeathListener implements Listener{ Player p = event.getEntity(); Server s = p.getServer(); String pname = p.getName(); - String leftmsg = ChatColor.BLUE + "There are now " + plugin.Playing.size() + " tributes left!"; + int players = plugin.Playing.size()-1; + String leftmsg = ChatColor.BLUE + "There are now " + players + " tributes left!"; String[] Spawncoords = plugin.config.getString("Spawn_coords").split(","); World spawnw = plugin.getServer().getWorld(Spawncoords[3]); double spawnx = Double.parseDouble(Spawncoords[0]); double spawny = Double.parseDouble(Spawncoords[1]); double spawnz = Double.parseDouble(Spawncoords[2]); Location Spawn = new Location(spawnw, spawnx, spawny, spawnz); + if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){ + double y = p.getLocation().getY(); + double newy = y+200; + double x = p.getLocation().getX(); + double z = p.getLocation().getZ(); + Location strike = new Location(p.getWorld(), x, newy, z); + p.getWorld().strikeLightning(strike); + } if(plugin.Frozen.contains(pname) && plugin.Playing.contains(pname)){ event.setDeathMessage(""); p.getServer().broadcastMessage(pname + ChatColor.LIGHT_PURPLE + " Stepped off their pedestal too early!"); @@ -48,7 +57,7 @@ public class DeathListener implements Listener{ plugin.Playing.remove(pname); plugin.Dead.add(pname); s.broadcastMessage(leftmsg); - if(plugin.Playing.size()== 1 && plugin.canjoin== true){ + if(plugin.Playing.size()== 1 && plugin.canjoin== false){ //Announce winner String winnername = plugin.Playing.get(i++); Player winner = plugin.getServer().getPlayerExact(winnername);