Merge branch 'master' of ssh://dev.mineplex.com:7999/min/Mineplex
This commit is contained in:
commit
31517d679a
|
@ -105,7 +105,7 @@ public class HungerGames extends SoloGame
|
|||
|
||||
private HashMap<Integer, HashMap<Integer, HashSet<Integer>>> _redMap = new HashMap<Integer, HashMap<Integer, HashSet<Integer>>>();
|
||||
private HashMap<Player, ArrayList<ChunkChange>> _redChunks = new HashMap<Player, ArrayList<ChunkChange>>();
|
||||
|
||||
|
||||
//Supply Drop
|
||||
private ArrayList<Location> _supplyLocations = new ArrayList<Location>();
|
||||
private Location _supplyCurrent = null;
|
||||
|
@ -116,7 +116,7 @@ public class HungerGames extends SoloGame
|
|||
private boolean _deathmatchCountdown = false;
|
||||
private boolean _deathmatchLive = false;
|
||||
private long _deathmatchTime = 0;
|
||||
|
||||
|
||||
//Debug
|
||||
private long totalTime = 0;
|
||||
|
||||
|
@ -148,7 +148,7 @@ public class HungerGames extends SoloGame
|
|||
});
|
||||
|
||||
Manager.GetAntiStack().SetEnabled(false);
|
||||
|
||||
|
||||
this.WorldTimeSet = 0;
|
||||
|
||||
this.SpawnDistanceRequirement = 48;
|
||||
|
@ -162,11 +162,11 @@ public class HungerGames extends SoloGame
|
|||
this.ItemPickup = true;
|
||||
|
||||
this.CompassEnabled = false; //XXX
|
||||
|
||||
|
||||
//Blocks
|
||||
this.BlockBreakAllow.add(46); //TNT
|
||||
this.BlockPlaceAllow.add(46);
|
||||
|
||||
|
||||
this.BlockBreakAllow.add(30); //Web
|
||||
this.BlockPlaceAllow.add(30);
|
||||
|
||||
|
@ -184,7 +184,7 @@ public class HungerGames extends SoloGame
|
|||
|
||||
this.BlockBreakAllow.add(69); //Lever
|
||||
this.BlockPlaceAllow.add(69);
|
||||
|
||||
|
||||
this.BlockBreakAllow.add(18); //Leaves
|
||||
|
||||
//SPREAD
|
||||
|
@ -232,14 +232,14 @@ public class HungerGames extends SoloGame
|
|||
public void ParseData()
|
||||
{
|
||||
_spawn = UtilWorld.averageLocation(this.GetTeamList().get(0).GetSpawns());
|
||||
|
||||
|
||||
for (Location loc : this.GetTeamList().get(0).GetSpawns())
|
||||
loc.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(loc, _spawn)));
|
||||
|
||||
|
||||
CreateChestCraftEnchant();
|
||||
|
||||
_supplyLocations = WorldData.GetDataLocs("WHITE");
|
||||
|
||||
|
||||
if (!WorldData.GetCustomLocs("VARS").isEmpty())
|
||||
_maxSpreadRate = WorldData.GetCustomLocs("VARS").get(0).getBlockX();
|
||||
}
|
||||
|
@ -267,13 +267,13 @@ public class HungerGames extends SoloGame
|
|||
}
|
||||
|
||||
int spawn = 0;
|
||||
|
||||
|
||||
//Chests
|
||||
System.out.println("Chests: " + Math.min(250, chests.size()));
|
||||
for (int i=0 ; i<250 && !chests.isEmpty() ; i++)
|
||||
{
|
||||
Location loc = chests.remove(UtilMath.r(chests.size()));
|
||||
|
||||
|
||||
if (UtilMath.offset2d(loc, _spawn) < 8)
|
||||
spawn++;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ public class HungerGames extends SoloGame
|
|||
spawn++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
loc.getBlock().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ public class HungerGames extends SoloGame
|
|||
|
||||
if (GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
|
||||
if (_openedChest.contains(event.getClickedBlock().getLocation()))
|
||||
return;
|
||||
|
||||
|
@ -347,7 +347,7 @@ public class HungerGames extends SoloGame
|
|||
if (Math.random() > 0.65) count++;
|
||||
if (Math.random() > 0.80) count++;
|
||||
if (Math.random() > 0.95) count++;
|
||||
|
||||
|
||||
if (UtilMath.offset(chest.getLocation(), _spawn) < 8)
|
||||
count += 3;
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
count += UtilMath.r(3);
|
||||
}
|
||||
|
||||
|
||||
if (_supplyChests.contains(event.getClickedBlock()))
|
||||
{
|
||||
count = 2;
|
||||
|
@ -378,7 +378,7 @@ public class HungerGames extends SoloGame
|
|||
for (int i = 0; i < 3; i++) _baseChestLoot.add(new ItemStack(Material.IRON_CHESTPLATE));
|
||||
for (int i = 0; i < 5; i++) _baseChestLoot.add(new ItemStack(Material.IRON_LEGGINGS));
|
||||
for (int i = 0; i < 10; i++) _baseChestLoot.add(new ItemStack(Material.IRON_BOOTS));
|
||||
|
||||
|
||||
for (int i = 0; i < 30; i++) _baseChestLoot.add(new ItemStack(Material.CHAINMAIL_HELMET));
|
||||
for (int i = 0; i < 20; i++) _baseChestLoot.add(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
|
||||
for (int i = 0; i < 25; i++) _baseChestLoot.add(new ItemStack(Material.CHAINMAIL_LEGGINGS));
|
||||
|
@ -393,24 +393,24 @@ public class HungerGames extends SoloGame
|
|||
for (int i = 0; i < 90; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_CHESTPLATE));
|
||||
for (int i = 0; i < 85; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_LEGGINGS));
|
||||
for (int i = 0; i < 100; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_BOOTS));
|
||||
|
||||
|
||||
//Weapons
|
||||
for (int i = 0; i < 70; i++) _baseChestLoot.add(new ItemStack(Material.WOOD_AXE));
|
||||
for (int i = 0; i < 45; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_AXE));
|
||||
for (int i = 0; i < 35; i++) _baseChestLoot.add(new ItemStack(Material.STONE_AXE));
|
||||
for (int i = 0; i < 15; i++) _baseChestLoot.add(new ItemStack(Material.IRON_AXE));
|
||||
|
||||
|
||||
for (int i = 0; i < 60; i++) _baseChestLoot.add(new ItemStack(Material.WOOD_SWORD));
|
||||
for (int i = 0; i < 35; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_SWORD));
|
||||
for (int i = 0; i < 25; i++) _baseChestLoot.add(new ItemStack(Material.STONE_SWORD));
|
||||
for (int i = 0; i < 8; i++) _baseChestLoot.add(new ItemStack(Material.IRON_SWORD));
|
||||
|
||||
|
||||
for (int i = 0; i < 45; i++) _baseChestLoot.add(new ItemStack(Material.BOW));
|
||||
for (int i = 0; i < 55; i++) _baseChestLoot.add(new ItemStack(Material.ARROW, 4));
|
||||
|
||||
|
||||
for (int i = 0; i < 15; i++) _baseChestLoot.add(new ItemStack(Material.TNT, 1));
|
||||
for (int i = 0; i < 30; i++) _baseChestLoot.add(new ItemStack(Material.WEB, 2));
|
||||
|
||||
|
||||
//Food
|
||||
for (int i = 0; i < 30; i++) _baseChestLoot.add(new ItemStack(Material.MUSHROOM_SOUP));
|
||||
for (int i = 0; i < 40; i++) _baseChestLoot.add(new ItemStack(Material.COOKED_CHICKEN));
|
||||
|
@ -420,7 +420,7 @@ public class HungerGames extends SoloGame
|
|||
for (int i = 0; i < 40; i++) _baseChestLoot.add(new ItemStack(Material.PUMPKIN_PIE));
|
||||
for (int i = 0; i < 50; i++) _baseChestLoot.add(new ItemStack(Material.COOKIE));
|
||||
for (int i = 0; i < 50; i++) _baseChestLoot.add(new ItemStack(Material.ROTTEN_FLESH));
|
||||
|
||||
|
||||
for (int i = 0; i < 80; i++) _baseChestLoot.add(new ItemStack(Material.WHEAT, 6));
|
||||
|
||||
//Misc
|
||||
|
@ -434,16 +434,16 @@ public class HungerGames extends SoloGame
|
|||
for (int i = 0; i < 80; i++) _baseChestLoot.add(new ItemStack(Material.FEATHER, 6));
|
||||
for (int i = 0; i < 40; i++) _baseChestLoot.add(new ItemStack(Material.BOAT));
|
||||
for (int i = 0; i < 70; i++) _baseChestLoot.add(new ItemStack(Material.FISHING_ROD));
|
||||
|
||||
|
||||
//Building Supplies
|
||||
for (int i = 0; i < 45; i++) _baseChestLoot.add(new ItemStack(Material.PISTON_BASE, 4));
|
||||
for (int i = 0; i < 45; i++) _baseChestLoot.add(new ItemStack(Material.STRING, 4));
|
||||
for (int i = 0; i < 45; i++) _baseChestLoot.add(new ItemStack(Material.TRIPWIRE_HOOK, 4));
|
||||
|
||||
|
||||
/*
|
||||
String material = _baseChestLoot.get(0).getType().toString();
|
||||
double count = 0;
|
||||
|
||||
|
||||
for (int i = 0; i < _baseChestLoot.size(); i++)
|
||||
{
|
||||
if (!_baseChestLoot.get(i).getType().toString().equalsIgnoreCase(material))
|
||||
|
@ -457,9 +457,9 @@ public class HungerGames extends SoloGame
|
|||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
System.out.println(material + " " + (count / _baseChestLoot.size() * 100) + "%");
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
if (_superChestLoot.isEmpty())
|
||||
|
@ -468,12 +468,12 @@ public class HungerGames extends SoloGame
|
|||
for (int i = 0; i < 1; i++) _superChestLoot.add(new ItemStack(Material.DIAMOND_CHESTPLATE));
|
||||
for (int i = 0; i < 2; i++) _superChestLoot.add(new ItemStack(Material.DIAMOND_LEGGINGS));
|
||||
for (int i = 0; i < 3; i++) _superChestLoot.add(new ItemStack(Material.DIAMOND_BOOTS));
|
||||
|
||||
|
||||
for (int i = 0; i < 30; i++) _superChestLoot.add(new ItemStack(Material.IRON_HELMET));
|
||||
for (int i = 0; i < 24; i++) _superChestLoot.add(new ItemStack(Material.IRON_CHESTPLATE));
|
||||
for (int i = 0; i < 27; i++) _superChestLoot.add(new ItemStack(Material.IRON_LEGGINGS));
|
||||
for (int i = 0; i < 30; i++) _superChestLoot.add(new ItemStack(Material.IRON_BOOTS));
|
||||
|
||||
|
||||
for (int i = 0; i < 24; i++) _superChestLoot.add(new ItemStack(Material.IRON_SWORD));
|
||||
for (int i = 0; i < 8; i++) _superChestLoot.add(new ItemStack(Material.DIAMOND_SWORD));
|
||||
for (int i = 0; i < 16; i++) _superChestLoot.add(new ItemStack(Material.DIAMOND_AXE));
|
||||
|
@ -488,7 +488,7 @@ public class HungerGames extends SoloGame
|
|||
|
||||
if (stack.getType().getMaxStackSize() > 1)
|
||||
amount = Math.max(1, UtilMath.r(stack.getAmount()));
|
||||
|
||||
|
||||
if (stack.getTypeId() == 33)
|
||||
return ItemStackFactory.Instance.CreateStack(stack.getTypeId(), (byte)0, amount, "Barricade");
|
||||
|
||||
|
@ -505,7 +505,7 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
Manager.GetCondition().Factory().Speed("Start Speed", player, player, 30, 1, false, false, false);
|
||||
Manager.GetCondition().Factory().HealthBoost("Start Health", player, player, 30, 1, false, false, false);
|
||||
|
||||
|
||||
player.setHealth(player.getMaxHealth());
|
||||
}
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ public class HungerGames extends SoloGame
|
|||
_redLocations.add(block.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int RedMax()
|
||||
{
|
||||
return _maxSpreadRate;// + (24 - GetPlayers(true).size())*2;
|
||||
|
@ -582,7 +582,7 @@ public class HungerGames extends SoloGame
|
|||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
|
||||
if (_redLocations.isEmpty())
|
||||
|
@ -663,11 +663,11 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
if (block == null || block.getType() == Material.AIR)
|
||||
return false;
|
||||
|
||||
|
||||
//Inside Boundary
|
||||
if (UtilMath.offset(_spawn, block.getLocation()) < 48)
|
||||
return false;
|
||||
|
||||
if (UtilMath.offset(_spawn, block.getLocation()) < 48)
|
||||
return false;
|
||||
|
||||
//Liquid
|
||||
if (block.isLiquid())
|
||||
{
|
||||
|
@ -689,12 +689,12 @@ public class HungerGames extends SoloGame
|
|||
}
|
||||
if (surroundedByWater)
|
||||
return false;
|
||||
|
||||
|
||||
//Dont Spread to Moving
|
||||
if (block.getTypeId() == 9)
|
||||
if (block.getData() != 0)
|
||||
return false;
|
||||
|
||||
|
||||
//Dont spread near moving
|
||||
for (Block other : UtilBlock.getSurrounding(block, false))
|
||||
{
|
||||
|
@ -750,7 +750,7 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
|
||||
MapUtil.ChunkBlockChange(loc, id, data);
|
||||
|
||||
//Old Style
|
||||
|
@ -764,14 +764,14 @@ public class HungerGames extends SoloGame
|
|||
|
||||
if (Math.abs(player.getLocation().getChunk().getZ() - loc.getChunk().getZ()) > UtilServer.getServer().getViewDistance())
|
||||
continue;
|
||||
|
||||
|
||||
player.sendBlockChange(loc, id, data);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
*/
|
||||
|
||||
//Non-Queue
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
|
@ -780,10 +780,10 @@ public class HungerGames extends SoloGame
|
|||
|
||||
if (Math.abs(player.getLocation().getChunk().getZ() - loc.getChunk().getZ()) > UtilServer.getServer().getViewDistance())
|
||||
continue;
|
||||
|
||||
|
||||
if (!_redChunks.containsKey(player))
|
||||
_redChunks.put(player, new ArrayList<ChunkChange>());
|
||||
|
||||
|
||||
boolean added = false;
|
||||
for (ChunkChange change : _redChunks.get(player))
|
||||
{
|
||||
|
@ -804,10 +804,10 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
|
||||
for (Player player : _redChunks.keySet())
|
||||
{
|
||||
//Remove Far Away
|
||||
|
@ -815,31 +815,31 @@ public class HungerGames extends SoloGame
|
|||
while (chunkIterator.hasNext())
|
||||
{
|
||||
ChunkChange change = chunkIterator.next();
|
||||
|
||||
|
||||
if (Math.abs(player.getLocation().getChunk().getX() - change.Chunk.getX()) > UtilServer.getServer().getViewDistance() ||
|
||||
Math.abs(player.getLocation().getChunk().getZ() - change.Chunk.getZ()) > UtilServer.getServer().getViewDistance())
|
||||
Math.abs(player.getLocation().getChunk().getZ() - change.Chunk.getZ()) > UtilServer.getServer().getViewDistance())
|
||||
{
|
||||
chunkIterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (_redChunks.get(player).isEmpty())
|
||||
continue;
|
||||
|
||||
|
||||
//Get Fittest Chunk to Update
|
||||
int bestId = -1;
|
||||
double bestScore = 0;
|
||||
|
||||
|
||||
for (int i=0 ; i<_redChunks.get(player).size() ; i++)
|
||||
{
|
||||
ChunkChange change = _redChunks.get(player).get(i);
|
||||
|
||||
|
||||
//Base Score, 1 per block
|
||||
double score = change.Changes.size();
|
||||
|
||||
|
||||
//Time Score, multiply block score by 1 + 0.5 per second
|
||||
score = score * (1 + (System.currentTimeMillis() - change.Time)/200d);
|
||||
|
||||
|
||||
//Distance Divisor
|
||||
double dist = 0.5;
|
||||
if (!player.getLocation().getChunk().equals(change.Chunk))
|
||||
|
@ -849,20 +849,20 @@ public class HungerGames extends SoloGame
|
|||
dist = Math.sqrt(x*x + z*z);
|
||||
}
|
||||
score = score/(dist*dist);
|
||||
|
||||
|
||||
if (bestId == -1 || score > bestScore)
|
||||
{
|
||||
bestId = i;
|
||||
bestScore = score;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (bestId == -1)
|
||||
continue;
|
||||
|
||||
|
||||
//Send MultiBlock or Chunk Update for Fittest Chunk
|
||||
ChunkChange change = _redChunks.get(player).remove(bestId);
|
||||
|
||||
|
||||
if (change.DirtyCount > 63)
|
||||
MapUtil.SendChunkForPlayer(change.Chunk.getX(), change.Chunk.getZ(), player);
|
||||
else
|
||||
|
@ -874,10 +874,10 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
if (!_redMap.containsKey(block.getX()))
|
||||
return false;
|
||||
|
||||
|
||||
if (!_redMap.get(block.getX()).containsKey(block.getY()))
|
||||
return false;
|
||||
|
||||
|
||||
return _redMap.get(block.getX()).get(block.getY()).contains(block.getZ());
|
||||
}
|
||||
|
||||
|
@ -889,9 +889,9 @@ public class HungerGames extends SoloGame
|
|||
|
||||
if (!_redMap.get(loc.getBlockX()).containsKey(loc.getBlockY()))
|
||||
_redMap.get(loc.getBlockX()).put(loc.getBlockY(), new HashSet<Integer>());
|
||||
|
||||
|
||||
_redMap.get(loc.getBlockX()).get(loc.getBlockY()).add(loc.getBlockZ());
|
||||
|
||||
|
||||
//Red
|
||||
if (_spreadType == 0)
|
||||
{
|
||||
|
@ -902,7 +902,7 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
if (loc.getBlock().getType() == Material.LEAVES) //RedChangeBlock(loc, 79, (byte)0);
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else if (loc.getBlock().getTypeId() == 8 || loc.getBlock().getTypeId() == 9) RedChangeBlock(loc, 79, (byte)0);
|
||||
else if (loc.getBlock().getTypeId() == 10 || loc.getBlock().getTypeId() == 11) RedChangeBlock(loc, 49, (byte)0);
|
||||
|
@ -954,7 +954,7 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
if (Math.random() > 0.95)
|
||||
player.playEffect(block.getLocation().add(0, 1, 0), Effect.STEP_SOUND, Material.SNOW_BLOCK);
|
||||
|
||||
|
||||
if (Math.random() > 0.8)
|
||||
{
|
||||
Vector traj = UtilAlg.getTrajectory(block.getLocation().add(0.5, 1.5, 0.5), player.getLocation());
|
||||
|
@ -989,7 +989,7 @@ public class HungerGames extends SoloGame
|
|||
near = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!near)
|
||||
{
|
||||
if (_deathmatchLive && UtilMath.offset(player.getLocation(), _spawn) > 48)
|
||||
|
@ -999,7 +999,7 @@ public class HungerGames extends SoloGame
|
|||
if (near)
|
||||
{
|
||||
player.getWorld().playSound(player.getLocation(), Sound.AMBIENCE_RAIN, 0.5f, 0f);
|
||||
|
||||
|
||||
if (!_redOutTime.containsKey(player))
|
||||
{
|
||||
_redOutTime.put(player, System.currentTimeMillis());
|
||||
|
@ -1075,7 +1075,7 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
if (_supplyLocations.isEmpty())
|
||||
return;
|
||||
|
||||
|
||||
_supplyCurrent = _supplyLocations.remove(UtilMath.r(_supplyLocations.size()));
|
||||
|
||||
//Remove Prior
|
||||
|
@ -1153,28 +1153,28 @@ public class HungerGames extends SoloGame
|
|||
UtilParticle.PlayParticle(ParticleType.SPELL, block.getLocation().add(0.5, 0.5, 0.5), 0.3f, 0.3f, 0.3f, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void DeathmatchUpdate(UpdateEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
|
||||
if (_deathmatchLive)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
|
||||
if (_deathmatchTime <= 0)
|
||||
return;
|
||||
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
for (Player other : GetPlayers(true))
|
||||
{
|
||||
player.hidePlayer(other);
|
||||
player.showPlayer(other);
|
||||
}
|
||||
|
||||
|
||||
Announce(C.cRed + C.Bold + "Deathmatch in " + _deathmatchTime + "...");
|
||||
_deathmatchTime--;
|
||||
}
|
||||
|
@ -1183,7 +1183,7 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
|
||||
long timeLeft = 60000 - (System.currentTimeMillis() - _deathmatchTime);
|
||||
|
||||
if (timeLeft > 0)
|
||||
|
@ -1198,14 +1198,14 @@ public class HungerGames extends SoloGame
|
|||
ChatColor.WHITE + "§lDeathmatch");
|
||||
|
||||
_deathmatchLive = true;
|
||||
|
||||
|
||||
GetTeamList().get(0).SpawnTeleport();
|
||||
|
||||
|
||||
_redLocations.clear();
|
||||
|
||||
|
||||
for (Block block : UtilBlock.getInRadius(_spawn, 52d).keySet())
|
||||
RedSpread(block);
|
||||
|
||||
|
||||
_deathmatchTime = 10;
|
||||
}
|
||||
}
|
||||
|
@ -1213,122 +1213,122 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
|
||||
if (!UtilTime.elapsed(GetStateTime(), 360000))
|
||||
return;
|
||||
|
||||
|
||||
if (GetPlayers(true).size() > 4)
|
||||
return;
|
||||
|
||||
|
||||
if (!UtilTime.elapsed(_deathmatchTime, 60000))
|
||||
return;
|
||||
|
||||
|
||||
Announce(C.cGreen + C.Bold + "Type " + ChatColor.RESET + C.Bold + "/dm" + C.cGreen + C.Bold + " to start Deathmatch!");
|
||||
|
||||
|
||||
_deathmatchTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void DeathmatchMoveCancel(PlayerMoveEvent event)
|
||||
{
|
||||
if (!_deathmatchLive)
|
||||
return;
|
||||
|
||||
|
||||
if (_deathmatchTime <= 0)
|
||||
return;
|
||||
|
||||
|
||||
if (UtilMath.offset2d(event.getFrom(), event.getTo()) == 0)
|
||||
return;
|
||||
|
||||
|
||||
if (!IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
|
||||
event.setTo(event.getFrom());
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void DeathmatchDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (!_deathmatchLive)
|
||||
return;
|
||||
|
||||
|
||||
if (_deathmatchTime <= 0)
|
||||
return;
|
||||
|
||||
|
||||
event.SetCancelled("Deathmatch");
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void DeathmatchStart(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (!event.getMessage().equalsIgnoreCase("/dm"))
|
||||
return;
|
||||
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
|
||||
if (!IsLive())
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "Deathmatch cannot be started now."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!UtilTime.elapsed(GetStateTime(), 360000))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "Deathmatch cannot be started now."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (GetPlayers(true).size() > 4)
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "Deathmatch cannot be started now."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (_deathmatchCountdown)
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "Deathmatch cannot be started now."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_deathmatchCountdown = true;
|
||||
|
||||
|
||||
Announce(C.cGreen + C.Bold + event.getPlayer().getName() + " has initiated Deathmatch!");
|
||||
Announce(C.cGreen + C.Bold + "Deathmatch starting in 60 seconds...");
|
||||
_deathmatchTime = System.currentTimeMillis();
|
||||
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void CropTrample(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() != Action.PHYSICAL)
|
||||
return;
|
||||
|
||||
|
||||
if (event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.SOIL)
|
||||
return;
|
||||
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void CompassUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
|
||||
//Night Time > Drop Target
|
||||
if (WorldData.World.getTime() > 14000 && WorldData.World.getTime() < 23000 && _supplyCurrent != null)
|
||||
{
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
player.setCompassTarget(_supplyCurrent);
|
||||
|
||||
|
||||
for (int i : player.getInventory().all(Material.COMPASS).keySet())
|
||||
{
|
||||
ItemStack stack = player.getInventory().getItem(i);
|
||||
|
@ -1337,7 +1337,7 @@ public class HungerGames extends SoloGame
|
|||
itemMeta.setDisplayName(
|
||||
C.cWhite + C.Bold + "Supply Drop Location: " + C.cYellow + UtilMath.trim(1, UtilMath.offset(player.getLocation(), _supplyCurrent)));
|
||||
stack.setItemMeta(itemMeta);
|
||||
|
||||
|
||||
player.getInventory().setItem(i, stack);
|
||||
}
|
||||
}
|
||||
|
@ -1349,28 +1349,28 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
Player target = null;
|
||||
double bestDist = 0;
|
||||
|
||||
|
||||
for (Player other : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (other.equals(player))
|
||||
continue;
|
||||
|
||||
|
||||
if (other.isSneaking())
|
||||
continue;
|
||||
|
||||
|
||||
double dist = UtilMath.offset(player, other);
|
||||
|
||||
|
||||
if (target == null || dist < bestDist)
|
||||
{
|
||||
target = other;
|
||||
bestDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
player.setCompassTarget(target.getLocation());
|
||||
|
||||
|
||||
for (int i : player.getInventory().all(Material.COMPASS).keySet())
|
||||
{
|
||||
ItemStack stack = player.getInventory().getItem(i);
|
||||
|
@ -1381,25 +1381,26 @@ public class HungerGames extends SoloGame
|
|||
" " + C.cWhite + C.Bold + "Nearest Player: " + C.cYellow + target.getName() +
|
||||
" " + C.cWhite + C.Bold + "Distance: " + C.cYellow + UtilMath.trim(1, bestDist));
|
||||
stack.setItemMeta(itemMeta);
|
||||
|
||||
|
||||
player.getInventory().setItem(i, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void DisallowBrewFurnace(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getClickedBlock() == null)
|
||||
return;
|
||||
|
||||
|
||||
if (event.getClickedBlock().getType() == Material.BREWING_STAND ||
|
||||
event.getClickedBlock().getType() == Material.FURNACE)
|
||||
event.getClickedBlock().getType() == Material.FURNACE ||
|
||||
event.getClickedBlock().getType() == Material.BURNING_FURNACE)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void CancelItemFrameBreak(HangingBreakEvent event)
|
||||
{
|
||||
|
@ -1414,17 +1415,17 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
Recharge.Instance.useForce(player, "Throw TNT", 30000);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void TNTThrow(PlayerInteractEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.L))
|
||||
return;
|
||||
|
||||
|
@ -1434,7 +1435,7 @@ public class HungerGames extends SoloGame
|
|||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
|
||||
if (!Recharge.Instance.use(player, "Throw TNT", 0, true))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot use " + F.item("Throw TNT") + " yet."));
|
||||
|
@ -1478,14 +1479,14 @@ public class HungerGames extends SoloGame
|
|||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (event.getItemInHand().getType() == Material.PISTON_BASE)
|
||||
{
|
||||
_placedBlocks.add(event.getBlock().getLocation());
|
||||
event.setCancelled(false);
|
||||
|
||||
|
||||
final Block block = event.getBlock();
|
||||
|
||||
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
|
@ -1530,7 +1531,7 @@ public class HungerGames extends SoloGame
|
|||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void PlayerKillAward(CombatDeathEvent event)
|
||||
{
|
||||
|
@ -1539,11 +1540,11 @@ public class HungerGames extends SoloGame
|
|||
|
||||
if (!(event.GetEvent().getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
|
||||
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.RED).with(Type.BALL_LARGE).trail(false).build();
|
||||
for (int i=0 ; i<3 ; i++)
|
||||
UtilFirework.launchFirework(event.GetEvent().getEntity().getLocation(), effect, null, 3);
|
||||
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
|
@ -1556,25 +1557,25 @@ public class HungerGames extends SoloGame
|
|||
|
||||
killer.giveExpLevels(1);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void DisableDamageLevel(CustomDamageEvent event)
|
||||
{
|
||||
event.SetDamageToLevel(false);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void ExplosionDamageRemove(EntityExplodeEvent event)
|
||||
{
|
||||
event.blockList().clear();
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void FixClean(PlayerQuitEvent event)
|
||||
{
|
||||
_redChunks.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
|
||||
private long _helpTimer = 0;
|
||||
private int _helpIndex = 0;
|
||||
private String[] _help = new String[]
|
||||
|
|
|
@ -200,7 +200,7 @@ public class PerkWolfPet extends Perk
|
|||
if (event.getPlayer().getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
|
||||
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE") && !event.getPlayer().getItemInHand().getType().toString().contains("_SWORD"))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
|
Loading…
Reference in New Issue