Updated to 1.3

This commit is contained in:
travja 2012-08-08 22:11:05 -06:00
parent 6721deef13
commit 368b69f0f2
7 changed files with 49 additions and 18 deletions

View File

@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="C:/Users/Travja/Documents/Projects/bukkit-1.2.5-R4.1-20120716.060315-25.jar"/>
<classpathentry kind="lib" path="C:/Users/Travja/Documents/Projects/Vault.jar"/>
<classpathentry kind="lib" path="C:/Users/Travja/Downloads/bukkit-1.3.1-R1.1-20120809.005103-3.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -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<String> 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<String> 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<String> 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<String> 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();

View File

@ -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)){

View File

@ -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);