Updates for R3+ and worked on Logging for Arena Resets
This commit is contained in:
parent
63f7ceac4c
commit
fbbafc76f2
@ -3,6 +3,6 @@
|
|||||||
<classpathentry kind="src" path="src"/>
|
<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="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||||
<classpathentry kind="lib" path="C:/Documents and Settings/TJ/Desktop/iConomy.jar"/>
|
<classpathentry kind="lib" path="C:/Documents and Settings/TJ/Desktop/iConomy.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Documents and Settings/TJ/Desktop/bukkit-1.2.5-R1.4-20120509.221906-5.jar"/>
|
<classpathentry kind="lib" path="C:/Documents and Settings/TJ/Desktop/bukkit-1.2.5-R4.1-20120615.060142-9.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
BIN
bin/me/Travja/HungerArena/BlockStorage.class
Normal file
BIN
bin/me/Travja/HungerArena/BlockStorage.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/me/Travja/HungerArena/HaCommands$25.class
Normal file
BIN
bin/me/Travja/HungerArena/HaCommands$25.class
Normal file
Binary file not shown.
BIN
bin/me/Travja/HungerArena/HaCommands$26.class
Normal file
BIN
bin/me/Travja/HungerArena/HaCommands$26.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -19,7 +19,7 @@ Sponsor_Cost:
|
|||||||
Amount: 1
|
Amount: 1
|
||||||
# Whether or not the countdown will start upon warping.
|
# Whether or not the countdown will start upon warping.
|
||||||
Countdown: 'true'
|
Countdown: 'true'
|
||||||
Spawn_coords: 100,100,100
|
Spawn_coords: 100,100,100,world
|
||||||
# If players will only talk to close players of the whole server
|
# If players will only talk to close players of the whole server
|
||||||
ChatClose: 'true'
|
ChatClose: 'true'
|
||||||
# How close the players have to be to talk to them
|
# How close the players have to be to talk to them
|
||||||
@ -56,3 +56,4 @@ Tribute_twentythree_spawn: 100,100,100
|
|||||||
Tribute_twentyfour_spawn: 100,100,100
|
Tribute_twentyfour_spawn: 100,100,100
|
||||||
# If /ha setspawn has been run
|
# If /ha setspawn has been run
|
||||||
Spawn_set: 'false'
|
Spawn_set: 'false'
|
||||||
|
Blocks_Destroyed:
|
289
src/me/Travja/HungerArena/BlockStorage.java
Normal file
289
src/me/Travja/HungerArena/BlockStorage.java
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
package me.Travja.HungerArena;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.block.BlockBurnEvent;
|
||||||
|
import org.bukkit.event.block.BlockFadeEvent;
|
||||||
|
import org.bukkit.event.block.BlockFormEvent;
|
||||||
|
import org.bukkit.event.block.BlockGrowEvent;
|
||||||
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
|
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.block.LeavesDecayEvent;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||||
|
import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||||
|
|
||||||
|
public class BlockStorage implements Listener {
|
||||||
|
public Main plugin;
|
||||||
|
public BlockStorage(Main m) {
|
||||||
|
this.plugin = m;
|
||||||
|
}
|
||||||
|
/*@EventHandler
|
||||||
|
public void creeperExplosion(EntityExplodeEvent event){
|
||||||
|
if(plugin.canjoin== true){
|
||||||
|
for(Block b:event.blockList()){
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
int z = b.getZ();
|
||||||
|
int d = b.getTypeId();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
|
System.out.println("Explode: " + coords);
|
||||||
|
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.config.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void burningBlocks(BlockBurnEvent event){
|
||||||
|
if(plugin.canjoin== true){
|
||||||
|
Block b = event.getBlock();
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
int z = b.getZ();
|
||||||
|
int d = b.getTypeId();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
|
System.out.println("Burn: " + coords);
|
||||||
|
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.config.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void leafDecay(LeavesDecayEvent event){
|
||||||
|
if(plugin.canjoin== true){
|
||||||
|
Block b = event.getBlock();
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
int z = b.getZ();
|
||||||
|
int d = b.getTypeId();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
|
System.out.println("Decay: " + coords);
|
||||||
|
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.config.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void blockPlace(BlockPlaceEvent event){
|
||||||
|
if(plugin.canjoin== true){
|
||||||
|
Block b = event.getBlock();
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
int z = b.getZ();
|
||||||
|
int d = b.getTypeId();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
|
if(!(d== 51) && !(d==12){
|
||||||
|
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) {
|
||||||
|
if (location.getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR) {
|
||||||
|
int i = 0;
|
||||||
|
for (i = location.getBlockY(); i > -1; i --) {
|
||||||
|
location = new Location(location.getWorld(), location.getBlockX(), i, location.getBlockZ());
|
||||||
|
if (location.getBlock().getType() != Material.AIR && location.getBlock().getType() != Material.WATER && location.getBlock().getType() != Material.LAVA) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
event.getPlayer().sendMessage("Block will land at: " + location);
|
||||||
|
System.out.println("Sand Place: " + coords);
|
||||||
|
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.config.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void bucketEmpty(PlayerBucketEmptyEvent event){
|
||||||
|
if(plugin.canjoin== true){
|
||||||
|
Block clicked = event.getBlockClicked();
|
||||||
|
BlockFace face = event.getBlockFace();
|
||||||
|
Block b = clicked.getRelative(face);
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
int z = b.getZ();
|
||||||
|
int d = b.getTypeId();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
|
System.out.println("Bucket Empty: " + coords);
|
||||||
|
List<String> blocks = plugin.config.getStringList("Blocks_Placed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.config.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void bucketFill(PlayerBucketFillEvent event){
|
||||||
|
if(plugin.canjoin== true){
|
||||||
|
Block b = event.getBlockClicked();
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
int z = b.getZ();
|
||||||
|
int d = b.getTypeId();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
|
System.out.println("Bucket Fill: " + coords);
|
||||||
|
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.config.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void blockBreak(BlockBreakEvent event){
|
||||||
|
if(plugin.canjoin== true){
|
||||||
|
Block b = event.getBlock();
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
int z = b.getZ();
|
||||||
|
int d = b.getTypeId();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
|
System.out.println("Break: " + coords);
|
||||||
|
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.config.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void blockMelt(BlockFadeEvent event){
|
||||||
|
if(plugin.canjoin== true){
|
||||||
|
Block b = event.getBlock();
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void blockGrow(BlockGrowEvent event){
|
||||||
|
if(plugin.canjoin== true){
|
||||||
|
Block b = event.getBlock();
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
int z = b.getZ();
|
||||||
|
int d = b.getTypeId();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
|
System.out.println("Grow: " + coords);
|
||||||
|
List<String> blocks = plugin.config.getStringList("Blocks_Placed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.config.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void blockForm(BlockFormEvent event){
|
||||||
|
if(plugin.canjoin== true){
|
||||||
|
Block b = event.getBlock();
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
int z = b.getZ();
|
||||||
|
int d = b.getTypeId();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
|
System.out.println("Snowfall: " + coords);
|
||||||
|
List<String> blocks = plugin.config.getStringList("Blocks_Placed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.config.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void pistonPush(BlockPistonExtendEvent event){
|
||||||
|
if(plugin.canjoin== true){
|
||||||
|
for(Block b:event.getBlocks()){
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
int z = b.getZ();
|
||||||
|
int d = b.getTypeId();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
|
System.out.println("Piston: " + coords);
|
||||||
|
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.config.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void onChange(BlockPhysicsEvent event){
|
||||||
|
Block block = event.getBlock();
|
||||||
|
Material changed = event.getChangedType();
|
||||||
|
if (block.getType() == Material.LAVA){
|
||||||
|
if (changed == Material.LAVA){
|
||||||
|
Block b = event.getBlock();
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
int z = b.getZ();
|
||||||
|
int d = b.getTypeId();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
|
System.out.println("Lava Change: " + coords);
|
||||||
|
List<String> blocks = plugin.config.getStringList("Blocks_Placed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.config.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveConfig();
|
||||||
|
}else if(changed == Material.WATER){
|
||||||
|
Block b = event.getBlock();
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
int z = b.getZ();
|
||||||
|
int d = b.getTypeId();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
|
System.out.println("Water Change: " + coords);
|
||||||
|
List<String> blocks = plugin.config.getStringList("Blocks_Placed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.config.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
}else if (block.getType() == Material.SAND || block.getType() == Material.GRAVEL) {
|
||||||
|
if (changed == Material.AIR) {
|
||||||
|
Block b = event.getBlock();
|
||||||
|
String w = b.getWorld().getName();
|
||||||
|
int x = b.getX();
|
||||||
|
int y = b.getY();
|
||||||
|
int z = b.getZ();
|
||||||
|
int d = b.getTypeId();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
|
System.out.println("Sand/Gravel Fall: " + coords);
|
||||||
|
List<String> blocks = plugin.config.getStringList("Blocks_Placed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.config.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
@ -3,6 +3,7 @@ package me.Travja.HungerArena;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Chest;
|
||||||
@ -10,6 +11,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -24,6 +26,7 @@ public class Chests implements Listener {
|
|||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
if(p.getItemInHand().getType()== Material.BLAZE_ROD && event.getAction() == Action.LEFT_CLICK_BLOCK){
|
if(p.getItemInHand().getType()== Material.BLAZE_ROD && event.getAction() == Action.LEFT_CLICK_BLOCK){
|
||||||
if(block.getState() instanceof Chest){
|
if(block.getState() instanceof Chest){
|
||||||
|
if(p.hasPermission("HungerArena.Chest.Store")){
|
||||||
ItemStack[] itemsinchest = ((Chest) block.getState()).getInventory().getContents();
|
ItemStack[] itemsinchest = ((Chest) block.getState()).getInventory().getContents();
|
||||||
int blockx = block.getX();
|
int blockx = block.getX();
|
||||||
int blocky = block.getY();
|
int blocky = block.getY();
|
||||||
@ -48,6 +51,30 @@ public class Chests implements Listener {
|
|||||||
plugin.getConfig().options().copyDefaults(true);
|
plugin.getConfig().options().copyDefaults(true);
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
p.sendMessage(ChatColor.GREEN + "Chest Stored!");
|
p.sendMessage(ChatColor.GREEN + "Chest Stored!");
|
||||||
|
}else{
|
||||||
|
p.sendMessage(ChatColor.RED + "You don't have permission to store chests!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
|
Player p = event.getPlayer();
|
||||||
|
Block block = event.getBlock();
|
||||||
|
Location blocklocation = event.getBlock().getLocation();
|
||||||
|
if (block.getState() instanceof Chest) {
|
||||||
|
int blockx = blocklocation.getBlockX();
|
||||||
|
int blocky = blocklocation.getBlockY();
|
||||||
|
int blockz = blocklocation.getBlockZ();
|
||||||
|
if (plugin.getConfig().getStringList("StorageXYZ").contains(blockx + "," + blocky + "," + blockz)) {
|
||||||
|
if(p.hasPermission("HungerArena.Chest.Break")){
|
||||||
|
List<String> list2 = plugin.getConfig().getStringList("StorageXYZ");
|
||||||
|
list2.remove(blockx + "," + blocky + "," + blockz);
|
||||||
|
plugin.getConfig().set("StorageXYZ", list2);
|
||||||
|
plugin.getConfig().options().copyDefaults(true);
|
||||||
|
plugin.saveConfig();
|
||||||
|
p.sendMessage("Chest Removed!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,10 @@ public class CommandBlock implements Listener {
|
|||||||
String cmd = event.getMessage();
|
String cmd = event.getMessage();
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
if(!cmd.contains("/ha") && plugin.Playing.contains(p) && plugin.canjoin== true){
|
if(!cmd.contains("/ha") && plugin.Playing.contains(p) && plugin.canjoin== true){
|
||||||
|
if(!p.hasPermission("HungerArena.UseCommands")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
p.sendMessage(ChatColor.RED + "You are only allowed to use /ha commands!");
|
p.sendMessage(ChatColor.RED + "You are only allowed to use /ha commands!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -19,10 +19,12 @@ public class DeathListener implements Listener{
|
|||||||
this.plugin = m;
|
this.plugin = m;
|
||||||
}
|
}
|
||||||
public FileConfiguration config;
|
public FileConfiguration config;
|
||||||
|
int i = 0;
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event){
|
public void onPlayerRespawn(PlayerRespawnEvent event){
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
if(plugin.Dead.contains(p)){
|
String pname = p.getDisplayName();
|
||||||
|
if(plugin.Dead.contains(pname)){
|
||||||
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
|
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
|
||||||
World spawnw = plugin.getServer().getWorld(Spawncoords[3]);
|
World spawnw = plugin.getServer().getWorld(Spawncoords[3]);
|
||||||
double spawnx = Double.parseDouble(Spawncoords[0]);
|
double spawnx = Double.parseDouble(Spawncoords[0]);
|
||||||
@ -36,14 +38,14 @@ public class DeathListener implements Listener{
|
|||||||
public void onPlayerDeath(PlayerDeathEvent event){
|
public void onPlayerDeath(PlayerDeathEvent event){
|
||||||
Player p = event.getEntity();
|
Player p = event.getEntity();
|
||||||
Server s = p.getServer();
|
Server s = p.getServer();
|
||||||
String pname = p.getName();
|
String pname = p.getDisplayName();
|
||||||
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
|
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
|
||||||
World spawnw = plugin.getServer().getWorld(Spawncoords[3]);
|
World spawnw = plugin.getServer().getWorld(Spawncoords[3]);
|
||||||
double spawnx = Double.parseDouble(Spawncoords[0]);
|
double spawnx = Double.parseDouble(Spawncoords[0]);
|
||||||
double spawny = Double.parseDouble(Spawncoords[1]);
|
double spawny = Double.parseDouble(Spawncoords[1]);
|
||||||
double spawnz = Double.parseDouble(Spawncoords[2]);
|
double spawnz = Double.parseDouble(Spawncoords[2]);
|
||||||
Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
|
Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
|
||||||
if(plugin.Playing.contains(p)){
|
if(plugin.Playing.contains(pname)){
|
||||||
if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){
|
if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){
|
||||||
double y = p.getLocation().getY();
|
double y = p.getLocation().getY();
|
||||||
double newy = y+200;
|
double newy = y+200;
|
||||||
@ -52,8 +54,8 @@ public class DeathListener implements Listener{
|
|||||||
Location strike = new Location(p.getWorld(), x, newy, z);
|
Location strike = new Location(p.getWorld(), x, newy, z);
|
||||||
p.getWorld().strikeLightning(strike);
|
p.getWorld().strikeLightning(strike);
|
||||||
}
|
}
|
||||||
plugin.Dead.add(p);
|
plugin.Dead.add(pname);
|
||||||
plugin.Playing.remove(p);
|
plugin.Playing.remove(pname);
|
||||||
String leftmsg = ChatColor.BLUE + "There are now " + plugin.Playing.size() + " tributes left!";
|
String leftmsg = ChatColor.BLUE + "There are now " + plugin.Playing.size() + " tributes left!";
|
||||||
if(p.getKiller() instanceof Player){
|
if(p.getKiller() instanceof Player){
|
||||||
if(p.getKiller().getItemInHand().getType().getId()== 0){
|
if(p.getKiller().getItemInHand().getType().getId()== 0){
|
||||||
@ -63,9 +65,11 @@ public class DeathListener implements Listener{
|
|||||||
s.broadcastMessage(ChatColor.LIGHT_PURPLE + "**BOOM** Tribute " + pname + " was killed by tribute " + killername + " with their FIST!");
|
s.broadcastMessage(ChatColor.LIGHT_PURPLE + "**BOOM** Tribute " + pname + " was killed by tribute " + killername + " with their FIST!");
|
||||||
s.broadcastMessage(leftmsg);
|
s.broadcastMessage(leftmsg);
|
||||||
if(plugin.Playing.size()== 1 && plugin.canjoin== true){
|
if(plugin.Playing.size()== 1 && plugin.canjoin== true){
|
||||||
for(Player winner:plugin.Playing){
|
//Announce winner
|
||||||
String winnername = winner.getName();
|
String winnername = plugin.Playing.get(i++);
|
||||||
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
Player winner = plugin.getServer().getPlayerExact(winnername);
|
||||||
|
String winnername2 = winner.getName();
|
||||||
|
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!");
|
||||||
winner.getInventory().clear();
|
winner.getInventory().clear();
|
||||||
winner.teleport(Spawn);
|
winner.teleport(Spawn);
|
||||||
winner.getInventory().setBoots(null);
|
winner.getInventory().setBoots(null);
|
||||||
@ -73,9 +77,11 @@ public class DeathListener implements Listener{
|
|||||||
winner.getInventory().setHelmet(null);
|
winner.getInventory().setHelmet(null);
|
||||||
winner.getInventory().setLeggings(null);
|
winner.getInventory().setLeggings(null);
|
||||||
winner.getInventory().addItem(plugin.Reward);
|
winner.getInventory().addItem(plugin.Reward);
|
||||||
}
|
|
||||||
plugin.Playing.clear();
|
plugin.Playing.clear();
|
||||||
for(Player spectator:plugin.Watching){
|
//Show spectators
|
||||||
|
if(!plugin.Watching.isEmpty()){
|
||||||
|
String s1 = plugin.Watching.get(i++);
|
||||||
|
Player spectator = plugin.getServer().getPlayerExact(s1);
|
||||||
spectator.setAllowFlight(false);
|
spectator.setAllowFlight(false);
|
||||||
spectator.teleport(Spawn);
|
spectator.teleport(Spawn);
|
||||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
for(Player online:plugin.getServer().getOnlinePlayers()){
|
||||||
@ -95,9 +101,11 @@ public class DeathListener implements Listener{
|
|||||||
s.broadcastMessage(msg);
|
s.broadcastMessage(msg);
|
||||||
s.broadcastMessage(leftmsg);
|
s.broadcastMessage(leftmsg);
|
||||||
if(plugin.Playing.size()== 1 && plugin.canjoin== true){
|
if(plugin.Playing.size()== 1 && plugin.canjoin== true){
|
||||||
for(Player winner:plugin.Playing){
|
//Announce winner
|
||||||
String winnername = winner.getName();
|
String winnername = plugin.Playing.get(i++);
|
||||||
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
Player winner = plugin.getServer().getPlayerExact(winnername);
|
||||||
|
String winnername2 = winner.getName();
|
||||||
|
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!");
|
||||||
winner.getInventory().clear();
|
winner.getInventory().clear();
|
||||||
winner.teleport(Spawn);
|
winner.teleport(Spawn);
|
||||||
winner.getInventory().setBoots(null);
|
winner.getInventory().setBoots(null);
|
||||||
@ -105,9 +113,11 @@ public class DeathListener implements Listener{
|
|||||||
winner.getInventory().setHelmet(null);
|
winner.getInventory().setHelmet(null);
|
||||||
winner.getInventory().setLeggings(null);
|
winner.getInventory().setLeggings(null);
|
||||||
winner.getInventory().addItem(plugin.Reward);
|
winner.getInventory().addItem(plugin.Reward);
|
||||||
}
|
|
||||||
plugin.Playing.clear();
|
plugin.Playing.clear();
|
||||||
for(Player spectator:plugin.Watching){
|
//Show spectators
|
||||||
|
if(!plugin.Watching.isEmpty()){
|
||||||
|
String s1 = plugin.Watching.get(i++);
|
||||||
|
Player spectator = plugin.getServer().getPlayerExact(s1);
|
||||||
spectator.setAllowFlight(false);
|
spectator.setAllowFlight(false);
|
||||||
spectator.teleport(Spawn);
|
spectator.teleport(Spawn);
|
||||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
for(Player online:plugin.getServer().getOnlinePlayers()){
|
||||||
@ -124,9 +134,11 @@ public class DeathListener implements Listener{
|
|||||||
s.broadcastMessage(ChatColor.LIGHT_PURPLE + pname + " died of natural causes!");
|
s.broadcastMessage(ChatColor.LIGHT_PURPLE + pname + " died of natural causes!");
|
||||||
s.broadcastMessage(leftmsg);
|
s.broadcastMessage(leftmsg);
|
||||||
if(plugin.Playing.size()== 1 && plugin.canjoin== true){
|
if(plugin.Playing.size()== 1 && plugin.canjoin== true){
|
||||||
for(Player winner:plugin.Playing){
|
//Announce winner
|
||||||
String winnername = winner.getName();
|
String winnername = plugin.Playing.get(i++);
|
||||||
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
Player winner = plugin.getServer().getPlayerExact(winnername);
|
||||||
|
String winnername2 = winner.getName();
|
||||||
|
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!");
|
||||||
winner.getInventory().clear();
|
winner.getInventory().clear();
|
||||||
winner.teleport(Spawn);
|
winner.teleport(Spawn);
|
||||||
winner.getInventory().setBoots(null);
|
winner.getInventory().setBoots(null);
|
||||||
@ -134,9 +146,11 @@ public class DeathListener implements Listener{
|
|||||||
winner.getInventory().setHelmet(null);
|
winner.getInventory().setHelmet(null);
|
||||||
winner.getInventory().setLeggings(null);
|
winner.getInventory().setLeggings(null);
|
||||||
winner.getInventory().addItem(plugin.Reward);
|
winner.getInventory().addItem(plugin.Reward);
|
||||||
}
|
|
||||||
plugin.Playing.clear();
|
plugin.Playing.clear();
|
||||||
for(Player spectator:plugin.Watching){
|
//Show spectators
|
||||||
|
if(!plugin.Watching.isEmpty()){
|
||||||
|
String s1 = plugin.Watching.get(i++);
|
||||||
|
Player spectator = plugin.getServer().getPlayerExact(s1);
|
||||||
spectator.setAllowFlight(false);
|
spectator.setAllowFlight(false);
|
||||||
spectator.teleport(Spawn);
|
spectator.teleport(Spawn);
|
||||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
for(Player online:plugin.getServer().getOnlinePlayers()){
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
|||||||
package me.Travja.HungerArena;
|
package me.Travja.HungerArena;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -14,22 +15,26 @@ public class JoinAndQuitListener implements Listener {
|
|||||||
public JoinAndQuitListener(Main m) {
|
public JoinAndQuitListener(Main m) {
|
||||||
this.plugin = m;
|
this.plugin = m;
|
||||||
}
|
}
|
||||||
|
int i = 0;
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event){
|
public void onPlayerJoin(PlayerJoinEvent event){
|
||||||
Player p = event.getPlayer();
|
final Player p = event.getPlayer();
|
||||||
final Player player = event.getPlayer();
|
String pname = p.getDisplayName();
|
||||||
for(Player spectator:plugin.Watching){
|
if(!plugin.Watching.isEmpty()){
|
||||||
|
String s = plugin.Watching.get(i++);
|
||||||
|
Player spectator = plugin.getServer().getPlayerExact(s);
|
||||||
p.hidePlayer(spectator);
|
p.hidePlayer(spectator);
|
||||||
}
|
}
|
||||||
if(plugin.Out.contains(p)){
|
if(plugin.Out.contains(pname)){
|
||||||
|
plugin.Playing.add(pname);
|
||||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
||||||
public void run(){
|
public void run(){
|
||||||
player.sendMessage(ChatColor.AQUA + "You have saved yourself from being ejected from the arena!");
|
p.sendMessage(ChatColor.AQUA + "You have saved yourself from being ejected from the arena!");
|
||||||
}
|
}
|
||||||
}, 40L);
|
}, 40L);
|
||||||
plugin.Out.remove(p);
|
plugin.Out.remove(p);
|
||||||
}
|
}
|
||||||
if(plugin.Quit.contains(p) || plugin.Dead.contains(p)){
|
if(plugin.Quit.contains(pname) || plugin.Dead.contains(pname)){
|
||||||
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
|
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
|
||||||
String w = Spawncoords[3];
|
String w = Spawncoords[3];
|
||||||
World spawnw = plugin.getServer().getWorld(w);
|
World spawnw = plugin.getServer().getWorld(w);
|
||||||
@ -39,8 +44,8 @@ public class JoinAndQuitListener implements Listener {
|
|||||||
final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
|
final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
|
||||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
||||||
public void run(){
|
public void run(){
|
||||||
player.teleport(Spawn);
|
p.teleport(Spawn);
|
||||||
player.sendMessage(ChatColor.RED + "You have been teleported to spawn because you quit/forfieted!");
|
p.sendMessage(ChatColor.RED + "You have been teleported to spawn because you quit/forfieted!");
|
||||||
}
|
}
|
||||||
}, 40L);
|
}, 40L);
|
||||||
}
|
}
|
||||||
@ -48,6 +53,7 @@ public class JoinAndQuitListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerQuit(PlayerQuitEvent event){
|
public void onPlayerQuit(PlayerQuitEvent event){
|
||||||
final Player p = event.getPlayer();
|
final Player p = event.getPlayer();
|
||||||
|
final String pname = p.getDisplayName();
|
||||||
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
|
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
|
||||||
String w = Spawncoords[3];
|
String w = Spawncoords[3];
|
||||||
World spawnw = plugin.getServer().getWorld(w);
|
World spawnw = plugin.getServer().getWorld(w);
|
||||||
@ -55,45 +61,46 @@ public class JoinAndQuitListener implements Listener {
|
|||||||
double spawny = Double.parseDouble(Spawncoords[1]);
|
double spawny = Double.parseDouble(Spawncoords[1]);
|
||||||
double spawnz = Double.parseDouble(Spawncoords[2]);
|
double spawnz = Double.parseDouble(Spawncoords[2]);
|
||||||
final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
|
final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
|
||||||
if(plugin.Playing.contains(p)){
|
if(plugin.Playing.contains(pname)){
|
||||||
plugin.Out.add(p);
|
plugin.Out.add(pname);
|
||||||
|
plugin.Playing.remove(pname);
|
||||||
}
|
}
|
||||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
||||||
public void run(){
|
public void run(){
|
||||||
if(plugin.Playing.contains(p) && plugin.Out.contains(p)){
|
if(plugin.Out.contains(pname)){
|
||||||
if(plugin.canjoin== true){
|
if(plugin.canjoin== true){
|
||||||
plugin.Playing.remove(p);
|
plugin.Quit.add(pname);
|
||||||
plugin.Quit.add(p);
|
plugin.Out.remove(pname);
|
||||||
plugin.Out.remove(p);
|
|
||||||
if(plugin.Playing.size()== 1){
|
if(plugin.Playing.size()== 1){
|
||||||
for(Player winner:plugin.Playing){
|
//Announce Winner
|
||||||
String winnername = winner.getName();
|
String winnername = plugin.Playing.get(i++);
|
||||||
p.getServer().broadcastMessage(ChatColor.GREEN + winnername + " is the victor of this Hunger Games!");
|
Player winner = plugin.getServer().getPlayerExact(winnername);
|
||||||
|
String winnername2 = winner.getName();
|
||||||
|
p.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!");
|
||||||
winner.getInventory().clear();
|
winner.getInventory().clear();
|
||||||
winner.getInventory().setBoots(null);
|
winner.getInventory().setBoots(null);
|
||||||
winner.getInventory().setChestplate(null);
|
winner.getInventory().setChestplate(null);
|
||||||
winner.getInventory().setHelmet(null);
|
winner.getInventory().setHelmet(null);
|
||||||
winner.getInventory().setLeggings(null);
|
winner.getInventory().setLeggings(null);
|
||||||
winner.getInventory().addItem(plugin.Reward);
|
winner.getInventory().addItem(plugin.Reward);
|
||||||
}
|
//Make spectators visible
|
||||||
for(Player spectator:plugin.Watching){
|
if(!plugin.Watching.isEmpty()){
|
||||||
|
String s = plugin.Watching.get(i++);
|
||||||
|
Player spectator = plugin.getServer().getPlayerExact(s);
|
||||||
spectator.setAllowFlight(false);
|
spectator.setAllowFlight(false);
|
||||||
spectator.teleport(Spawn);
|
spectator.teleport(Spawn);
|
||||||
|
for(Player online:plugin.getServer().getOnlinePlayers()){
|
||||||
|
online.showPlayer(spectator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
||||||
plugin.Dead.clear();
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
||||||
plugin.Playing.clear();
|
|
||||||
plugin.Quit.clear();
|
|
||||||
plugin.Watching.clear();
|
|
||||||
plugin.Frozen.clear();
|
|
||||||
plugin.canjoin = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if(plugin.canjoin== false){
|
|
||||||
plugin.Playing.remove(p);
|
|
||||||
plugin.Quit.add(p);
|
|
||||||
plugin.Out.remove(p);
|
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
plugin.Quit.add(pname);
|
||||||
|
plugin.Out.remove(pname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 1200L);
|
}, 1200L);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,6 @@ import org.bukkit.event.player.PlayerDropItemEvent;
|
|||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
|
|
||||||
public class SpectatorListener implements Listener {
|
public class SpectatorListener implements Listener {
|
||||||
public Main plugin;
|
public Main plugin;
|
||||||
@ -87,7 +86,6 @@ public class SpectatorListener implements Listener {
|
|||||||
double spawny = Double.parseDouble(Spawncoords[1]);
|
double spawny = Double.parseDouble(Spawncoords[1]);
|
||||||
double spawnz = Double.parseDouble(Spawncoords[2]);
|
double spawnz = Double.parseDouble(Spawncoords[2]);
|
||||||
final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
|
final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
|
||||||
plugin.Watching.remove(p);
|
|
||||||
for(Player everyone:plugin.getServer().getOnlinePlayers()){
|
for(Player everyone:plugin.getServer().getOnlinePlayers()){
|
||||||
everyone.showPlayer(p);
|
everyone.showPlayer(p);
|
||||||
}
|
}
|
||||||
@ -97,6 +95,7 @@ public class SpectatorListener implements Listener {
|
|||||||
player.sendMessage(ChatColor.RED + "You have been teleported to spawn because the game is over!");
|
player.sendMessage(ChatColor.RED + "You have been teleported to spawn because the game is over!");
|
||||||
}
|
}
|
||||||
}, 40L);
|
}, 40L);
|
||||||
|
plugin.Watching.remove(p);
|
||||||
}else{
|
}else{
|
||||||
p.setAllowFlight(true);
|
p.setAllowFlight(true);
|
||||||
p.setFlying(true);
|
p.setFlying(true);
|
||||||
@ -107,13 +106,6 @@ public class SpectatorListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void SpectatorQuit(PlayerQuitEvent event){
|
|
||||||
Player p = event.getPlayer();
|
|
||||||
if(plugin.Watching.contains(p)){
|
|
||||||
System.out.println(p.getName() + " quit while spectating!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@EventHandler
|
|
||||||
public void MobNerf(EntityTargetEvent event){
|
public void MobNerf(EntityTargetEvent event){
|
||||||
Entity target = event.getTarget();
|
Entity target = event.getTarget();
|
||||||
if(target instanceof Player){
|
if(target instanceof Player){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user