Fixed portal breaking with Frost horse.
Added memory clean up for disguises
This commit is contained in:
parent
a02ca4513e
commit
79de7f2bfc
@ -205,6 +205,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
@EventHandler
|
||||
public void ChunkUnload(ChunkUnloadEvent event)
|
||||
{
|
||||
long timeStart = System.currentTimeMillis();
|
||||
for (Entity entity : event.getChunk().getEntities())
|
||||
{
|
||||
Iterator<Entry<Integer, DisguiseBase>> spawnPacketMapIterator = _spawnPacketMap.entrySet().iterator();
|
||||
@ -252,6 +253,27 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void clearOldDisguises(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
Iterator<Entry<Integer, DisguiseBase>> spawnPacketMapIterator = _spawnPacketMap.entrySet().iterator();
|
||||
while (spawnPacketMapIterator.hasNext())
|
||||
{
|
||||
Entry<Integer, DisguiseBase> entry = spawnPacketMapIterator.next();
|
||||
|
||||
if (!entry.getValue().GetEntity().isAlive() || !entry.getValue().GetEntity().valid)
|
||||
{
|
||||
_movePacketMap.remove(entry.getValue().GetEntity().id);
|
||||
_moveTempMap.remove(entry.getValue().GetEntity().id);
|
||||
_entityDisguiseMap.remove(entry.getValue().GetEntity().getUniqueID().toString());
|
||||
spawnPacketMapIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerQuit(PlayerQuitEvent event)
|
||||
|
@ -719,7 +719,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
public boolean CanPortal(Player player)
|
||||
{
|
||||
//Riding
|
||||
if (player.getVehicle() != null || player.getPassenger() != null)
|
||||
if (player.getVehicle() != null || player.getPassenger() != null)
|
||||
return false;
|
||||
|
||||
//Portal Delay
|
||||
|
@ -1,6 +1,8 @@
|
||||
package mineplex.hub.mount.types;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@ -69,10 +71,27 @@ public class Frost extends HorseMount
|
||||
//Blocks
|
||||
double duration = 2000;
|
||||
HashMap<Block, Double> blocks = UtilBlock.getInRadius(horse.getLocation(), 2.5d);
|
||||
for (Block block : blocks.keySet())
|
||||
{
|
||||
//Snow
|
||||
Manager.Manager.GetBlockRestore().Snow(block, (byte)1, (byte)1, (long)(duration * (1 + blocks.get(block))), 250, 0);
|
||||
|
||||
for (Iterator<Entry<Block, Double>> blockIterator = blocks.entrySet().iterator(); blockIterator.hasNext();)
|
||||
{
|
||||
Block block = blockIterator.next().getKey();
|
||||
HashMap<Block, Double> snowBlocks = UtilBlock.getInRadius(block.getLocation(), 2d);
|
||||
|
||||
boolean addSnow = true;
|
||||
|
||||
for (Block surroundingBlock : snowBlocks.keySet())
|
||||
{
|
||||
if (surroundingBlock.getType() == Material.PORTAL || surroundingBlock.getType() == Material.CACTUS)
|
||||
{
|
||||
blockIterator.remove();
|
||||
addSnow = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (addSnow)
|
||||
Manager.Manager.GetBlockRestore().Snow(block, (byte)1, (byte)1, (long)(duration * (1 + blocks.get(block))), 250, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user