HG lag fixes
item frames cannot be broken creep damage messages
This commit is contained in:
parent
25782813f4
commit
6f06ac2018
@ -56,6 +56,14 @@ public class CombatComponent
|
|||||||
|
|
||||||
return _damage;
|
return _damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String GetReason()
|
||||||
|
{
|
||||||
|
if (_damage.isEmpty())
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return _damage.get(0).GetName();
|
||||||
|
}
|
||||||
|
|
||||||
public long GetLastDamage()
|
public long GetLastDamage()
|
||||||
{
|
{
|
||||||
|
@ -240,7 +240,7 @@ public class CombatManager extends MiniPlugin
|
|||||||
|
|
||||||
String source = "?";
|
String source = "?";
|
||||||
String reason = "-";
|
String reason = "-";
|
||||||
|
|
||||||
if (cause == DamageCause.BLOCK_EXPLOSION)
|
if (cause == DamageCause.BLOCK_EXPLOSION)
|
||||||
{
|
{
|
||||||
source = "Explosion";
|
source = "Explosion";
|
||||||
@ -326,7 +326,10 @@ public class CombatManager extends MiniPlugin
|
|||||||
source = "Wither";
|
source = "Wither";
|
||||||
reason = "-";
|
reason = "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.GetReason() != null)
|
||||||
|
reason = event.GetReason();
|
||||||
|
|
||||||
Get(event.GetDamageePlayer()).Attacked(source,
|
Get(event.GetDamageePlayer()).Attacked(source,
|
||||||
(int) event.GetDamage(), null, reason);
|
(int) event.GetDamage(), null, reason);
|
||||||
}
|
}
|
||||||
@ -420,15 +423,33 @@ public class CombatManager extends MiniPlugin
|
|||||||
UtilPlayer.message(cur, F.main("Death", deadPlayer
|
UtilPlayer.message(cur, F.main("Death", deadPlayer
|
||||||
+ C.cGray + " has died."));
|
+ C.cGray + " has died."));
|
||||||
else
|
else
|
||||||
UtilPlayer.message(
|
{
|
||||||
cur,
|
if (log.GetLastDamager() != null && log.GetLastDamager().GetReason() != null && log.GetLastDamager().GetReason().length() > 1)
|
||||||
F.main("Death",
|
{
|
||||||
deadPlayer
|
UtilPlayer.message(
|
||||||
+ C.cGray
|
cur,
|
||||||
+ " killed by "
|
F.main("Death",
|
||||||
+ F.name(log.GetAttackers()
|
deadPlayer
|
||||||
.getFirst().GetName()))
|
+ C.cGray
|
||||||
+ C.cGray + ".");
|
+ " killed by "
|
||||||
|
+ F.name(log.GetLastDamager()
|
||||||
|
.GetReason()))
|
||||||
|
+ C.cGray + ".");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UtilPlayer.message(
|
||||||
|
cur,
|
||||||
|
F.main("Death",
|
||||||
|
deadPlayer
|
||||||
|
+ C.cGray
|
||||||
|
+ " killed by "
|
||||||
|
+ F.name(log.GetAttackers()
|
||||||
|
.getFirst().GetName()))
|
||||||
|
+ C.cGray + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,9 +311,6 @@ public class DamageManager extends MiniPlugin
|
|||||||
for (String cur : event.GetCancellers())
|
for (String cur : event.GetCancellers())
|
||||||
UtilPlayer.message(player, F.elem("Cancel ") + cur);
|
UtilPlayer.message(player, F.elem("Cancel ") + cur);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Chest;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Firework;
|
import org.bukkit.entity.Firework;
|
||||||
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Snowball;
|
import org.bukkit.entity.Snowball;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
@ -32,10 +33,13 @@ import org.bukkit.event.block.BlockFadeEvent;
|
|||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.block.BlockSpreadEvent;
|
import org.bukkit.event.block.BlockSpreadEvent;
|
||||||
import org.bukkit.event.block.LeavesDecayEvent;
|
import org.bukkit.event.block.LeavesDecayEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||||
|
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
@ -264,8 +268,8 @@ public class HungerGames extends SoloGame
|
|||||||
int spawn = 0;
|
int spawn = 0;
|
||||||
|
|
||||||
//Chests
|
//Chests
|
||||||
System.out.println("Chests: " + Math.min(220, chests.size()));
|
System.out.println("Chests: " + Math.min(250, chests.size()));
|
||||||
for (int i=0 ; i<220 && !chests.isEmpty() ; i++)
|
for (int i=0 ; i<250 && !chests.isEmpty() ; i++)
|
||||||
{
|
{
|
||||||
Location loc = chests.remove(UtilMath.r(chests.size()));
|
Location loc = chests.remove(UtilMath.r(chests.size()));
|
||||||
|
|
||||||
@ -300,7 +304,7 @@ public class HungerGames extends SoloGame
|
|||||||
|
|
||||||
int done = 0;
|
int done = 0;
|
||||||
|
|
||||||
while (done < 30)
|
while (done < 40)
|
||||||
{
|
{
|
||||||
|
|
||||||
Block block = UtilBlock.getHighest(WorldData.World, WorldData.MinX + UtilMath.r(xDiff), WorldData.MinZ + UtilMath.r(zDiff), ignore);
|
Block block = UtilBlock.getHighest(WorldData.World, WorldData.MinX + UtilMath.r(xDiff), WorldData.MinZ + UtilMath.r(zDiff), ignore);
|
||||||
@ -684,6 +688,20 @@ public class HungerGames extends SoloGame
|
|||||||
}
|
}
|
||||||
if (surroundedByWater)
|
if (surroundedByWater)
|
||||||
return false;
|
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))
|
||||||
|
{
|
||||||
|
if (other.getTypeId() == 9 && other.getData() != 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Ignore Signs
|
//Ignore Signs
|
||||||
@ -733,7 +751,7 @@ public class HungerGames extends SoloGame
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
MapUtil.ChunkBlockChange(loc, id, data);
|
MapUtil.ChunkBlockChange(loc, id, data);
|
||||||
|
|
||||||
//Save Red
|
//Save Red
|
||||||
if (!_redMap.containsKey(loc.getBlockX()))
|
if (!_redMap.containsKey(loc.getBlockX()))
|
||||||
_redMap.put(loc.getBlockX(), new HashMap<Integer, HashSet<Integer>>());
|
_redMap.put(loc.getBlockX(), new HashMap<Integer, HashSet<Integer>>());
|
||||||
@ -742,7 +760,26 @@ public class HungerGames extends SoloGame
|
|||||||
_redMap.get(loc.getBlockX()).put(loc.getBlockY(), new HashSet<Integer>());
|
_redMap.get(loc.getBlockX()).put(loc.getBlockY(), new HashSet<Integer>());
|
||||||
|
|
||||||
_redMap.get(loc.getBlockX()).get(loc.getBlockY()).add(loc.getBlockZ());
|
_redMap.get(loc.getBlockX()).get(loc.getBlockY()).add(loc.getBlockZ());
|
||||||
|
|
||||||
|
//Old Style
|
||||||
|
/*
|
||||||
|
if (true)
|
||||||
|
{
|
||||||
|
for (Player player : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
if (Math.abs(player.getLocation().getChunk().getX() - loc.getChunk().getX()) > UtilServer.getServer().getViewDistance())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (Math.abs(player.getLocation().getChunk().getZ() - loc.getChunk().getZ()) > UtilServer.getServer().getViewDistance())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
player.sendBlockChange(loc, id, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//Non-Queue
|
//Non-Queue
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
@ -758,7 +795,7 @@ public class HungerGames extends SoloGame
|
|||||||
boolean added = false;
|
boolean added = false;
|
||||||
for (ChunkChange change : _redChunks.get(player))
|
for (ChunkChange change : _redChunks.get(player))
|
||||||
{
|
{
|
||||||
if (change.Chunk.equals(loc.getChunk()) && change.DirtyCount < 63)
|
if (change.Chunk.equals(loc.getChunk()))// && change.DirtyCount < 63)
|
||||||
{
|
{
|
||||||
change.AddChange(loc, id, data);
|
change.AddChange(loc, id, data);
|
||||||
added = true;
|
added = true;
|
||||||
@ -773,7 +810,7 @@ public class HungerGames extends SoloGame
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void RedChunkUpdate(UpdateEvent event)
|
public void RedChunkUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.FASTER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
@ -830,7 +867,7 @@ public class HungerGames extends SoloGame
|
|||||||
//Send MultiBlock or Chunk Update for Fittest Chunk
|
//Send MultiBlock or Chunk Update for Fittest Chunk
|
||||||
ChunkChange change = _redChunks.get(player).remove(bestId);
|
ChunkChange change = _redChunks.get(player).remove(bestId);
|
||||||
|
|
||||||
if (change.DirtyCount >= 63)
|
if (change.DirtyCount > 63)
|
||||||
MapUtil.SendChunkForPlayer(change.Chunk.getX(), change.Chunk.getZ(), player);
|
MapUtil.SendChunkForPlayer(change.Chunk.getX(), change.Chunk.getZ(), player);
|
||||||
else
|
else
|
||||||
MapUtil.SendMultiBlockForPlayer(change.Chunk.getX(), change.Chunk.getZ(), change.DirtyBlocks, change.DirtyCount, change.Chunk.getWorld(), player);
|
MapUtil.SendMultiBlockForPlayer(change.Chunk.getX(), change.Chunk.getZ(), change.DirtyBlocks, change.DirtyCount, change.Chunk.getWorld(), player);
|
||||||
@ -914,7 +951,7 @@ public class HungerGames extends SoloGame
|
|||||||
Snowball ball = player.getWorld().spawn(block.getLocation().add(0.5, 1.5, 0.5).subtract(traj.clone().multiply(8 + UtilMath.r(8))), Snowball.class);
|
Snowball ball = player.getWorld().spawn(block.getLocation().add(0.5, 1.5, 0.5).subtract(traj.clone().multiply(8 + UtilMath.r(8))), Snowball.class);
|
||||||
|
|
||||||
ball.setVelocity(UtilAlg.getTrajectory(ball.getLocation(), player.getEyeLocation().add(0, 3, 0)).add(new Vector(Math.random()-0.5, Math.random()-0.5, Math.random()-0.5).multiply(0.1)));
|
ball.setVelocity(UtilAlg.getTrajectory(ball.getLocation(), player.getEyeLocation().add(0, 3, 0)).add(new Vector(Math.random()-0.5, Math.random()-0.5, Math.random()-0.5).multiply(0.1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Nether
|
//Nether
|
||||||
@ -950,14 +987,16 @@ public class HungerGames extends SoloGame
|
|||||||
|
|
||||||
if (near)
|
if (near)
|
||||||
{
|
{
|
||||||
|
player.getWorld().playSound(player.getLocation(), Sound.AMBIENCE_RAIN, 0.2f, 0f);
|
||||||
|
|
||||||
if (!_redOutTime.containsKey(player))
|
if (!_redOutTime.containsKey(player))
|
||||||
{
|
{
|
||||||
_redOutTime.put(player, System.currentTimeMillis());
|
_redOutTime.put(player, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (UtilTime.elapsed(_redOutTime.get(player), 5000))
|
if (UtilTime.elapsed(_redOutTime.get(player), 5000))
|
||||||
{
|
{
|
||||||
Manager.GetDamage().NewDamageEvent(player, null, null,
|
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||||
DamageCause.VOID, 1, false, true, false,
|
DamageCause.VOID, 1, false, true, false,
|
||||||
"Hunger Games", _spreadName);
|
"Hunger Games", _spreadName);
|
||||||
@ -1117,7 +1156,14 @@ public class HungerGames extends SoloGame
|
|||||||
|
|
||||||
if (_deathmatchTime <= 0)
|
if (_deathmatchTime <= 0)
|
||||||
return;
|
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 + "...");
|
Announce(C.cRed + C.Bold + "Deathmatch in " + _deathmatchTime + "...");
|
||||||
_deathmatchTime--;
|
_deathmatchTime--;
|
||||||
}
|
}
|
||||||
@ -1331,6 +1377,26 @@ public class HungerGames extends SoloGame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void DisallowBrewFurnace(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
if (event.getClickedBlock() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.getClickedBlock().getType() == Material.BREWING_STAND ||
|
||||||
|
event.getClickedBlock().getType() == Material.FURNACE)
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void CancelItemFrameBreak(HangingBreakEvent event)
|
||||||
|
{
|
||||||
|
if (event.getEntity() instanceof ItemFrame)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void TNTDelay(GameStateChangeEvent event)
|
public void TNTDelay(GameStateChangeEvent event)
|
||||||
@ -1531,4 +1597,6 @@ public class HungerGames extends SoloGame
|
|||||||
|
|
||||||
_helpIndex = (_helpIndex + 1)%_help.length;
|
_helpIndex = (_helpIndex + 1)%_help.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user