Merge branch 'clans/world-events' of ssh://184.154.0.242:7999/min/mineplex into clans/world-events

Conflicts:
	Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java
This commit is contained in:
libraryaddict 2015-07-04 03:44:59 +12:00
commit c75f22b5e0
57 changed files with 902 additions and 348 deletions

View File

@ -1,138 +0,0 @@
package mineplex.core.common.block;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.block.Block;
import org.bukkit.plugin.java.JavaPlugin;
public class BlockRestoreMap implements Runnable
{
private HashSet<Block> _changedBlocks;
private HashMap<Block, BlockData>[] _blocks;
public BlockRestoreMap()
{
_changedBlocks = new HashSet<Block>();
_blocks = new HashMap[256];
for (int i = 0; i < 256; i++)
{
_blocks[i] = new HashMap<Block, BlockData>();
}
}
private HashMap<Block, BlockData> getMap(int index)
{
return _blocks[index];
}
public HashSet<Block> getChangedBlocks()
{
return _changedBlocks;
}
public void addBlockData(BlockData blockData)
{
Block block = blockData.Block;
if (!_blocks[block.getY()].containsKey(block))
_blocks[block.getY()].put(block, blockData);
_changedBlocks.add(blockData.Block);
}
public void setBlock(Block block, int material, byte data)
{
addBlockData(new BlockData(block));
block.setTypeIdAndData(material, data, false);
}
public void restoreTopDown(JavaPlugin plugin)
{
BlockDataRunnable run = new BlockDataRunnable(plugin, new RestoreIterator(this), new Runnable()
{
@Override
public void run()
{
clear();
}
});
run.setBlocksPerTick(20);
run.start();
}
private void clear()
{
for (int i = 0; i < 256; i++)
{
_blocks[i].clear();
}
}
@Override
public void run()
{
}
public void restore()
{
for (int i = 0; i < 256; i++)
{
HashMap<Block, BlockData> map = _blocks[i];
for (BlockData data : map.values())
{
data.restore();
}
map.clear();
}
}
private static class RestoreIterator implements Iterator<BlockData>
{
private BlockRestoreMap _map;
private Iterator<BlockData> _currentIterator;
private int _currentIndex;
public RestoreIterator(BlockRestoreMap map)
{
_map = map;
_currentIndex = 255;
updateIterator();
}
private void updateIterator()
{
_currentIterator = _map.getMap(_currentIndex).values().iterator();
}
@Override
public boolean hasNext()
{
while (!_currentIterator.hasNext() && _currentIndex > 0)
{
_currentIndex--;
updateIterator();
}
return _currentIterator.hasNext();
}
@Override
public BlockData next()
{
while (!_currentIterator.hasNext() && _currentIndex > 0)
{
_currentIndex--;
updateIterator();
}
return _currentIterator.next();
}
}
}

View File

@ -27,6 +27,11 @@ public class UtilMath
return random.nextInt(i); return random.nextInt(i);
} }
public static int rRange(int min, int max)
{
return min + r(1 + max - min);
}
public static double offset2d(Entity a, Entity b) public static double offset2d(Entity a, Entity b)
{ {
return offset2d(a.getLocation().toVector(), b.getLocation().toVector()); return offset2d(a.getLocation().toVector(), b.getLocation().toVector());

View File

@ -1,4 +1,4 @@
package mineplex.core.common.block; package mineplex.core.blockrestore;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
@ -8,6 +8,8 @@ import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import mineplex.core.common.block.BlockData;
public class BlockDataRunnable implements Runnable public class BlockDataRunnable implements Runnable
{ {
private JavaPlugin _plugin; private JavaPlugin _plugin;
@ -18,12 +20,12 @@ public class BlockDataRunnable implements Runnable
private int _blocksPerTick; private int _blocksPerTick;
private Iterator<BlockData> _blockIterator; private Iterator<BlockData> _blockIterator;
public BlockDataRunnable(JavaPlugin plugin, Iterator<BlockData> blockIterator, Runnable onComplete) public BlockDataRunnable(JavaPlugin plugin, Iterator<BlockData> blockIterator, int blocksPerTick, Runnable onComplete)
{ {
_plugin = plugin; _plugin = plugin;
_changedBlocks = new ArrayList<BlockData>(); _changedBlocks = new ArrayList<BlockData>();
_started = false; _started = false;
_blocksPerTick = 400; _blocksPerTick = blocksPerTick;
_onComplete = onComplete; _onComplete = onComplete;
_blockIterator = blockIterator; _blockIterator = blockIterator;
} }

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -26,28 +27,31 @@ import org.bukkit.plugin.java.JavaPlugin;
public class BlockRestore extends MiniPlugin public class BlockRestore extends MiniPlugin
{ {
private HashMap<Block, BlockRestoreData> _blocks = new HashMap<Block, BlockRestoreData>(); private HashMap<Block, BlockRestoreData> _blocks = new HashMap<Block, BlockRestoreData>();
private LinkedList<BlockRestoreMap> _restoreMaps;
public BlockRestore(JavaPlugin plugin) public BlockRestore(JavaPlugin plugin)
{ {
super("Block Restore", plugin); super("Block Restore", plugin);
_restoreMaps = new LinkedList<BlockRestoreMap>();
} }
@EventHandler(priority=EventPriority.LOW) @EventHandler(priority=EventPriority.LOW)
public void BlockBreak(BlockBreakEvent event) public void blockBreak(BlockBreakEvent event)
{ {
if (Contains(event.getBlock())) if (contains(event.getBlock()))
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler(priority=EventPriority.LOW) @EventHandler(priority=EventPriority.LOW)
public void BlockPlace(BlockPlaceEvent event) public void blockPlace(BlockPlaceEvent event)
{ {
if (Contains(event.getBlockPlaced())) if (contains(event.getBlockPlaced()))
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler(priority=EventPriority.LOW) @EventHandler(priority=EventPriority.LOW)
public void Piston(BlockPistonExtendEvent event) public void piston(BlockPistonExtendEvent event)
{ {
if (event.isCancelled()) if (event.isCancelled())
return; return;
@ -60,7 +64,7 @@ public class BlockRestore extends MiniPlugin
if (push.getType() == Material.AIR) if (push.getType() == Material.AIR)
return; return;
if (Contains(push)) if (contains(push))
{ {
push.getWorld().playEffect(push.getLocation(), Effect.STEP_SOUND, push.getTypeId()); push.getWorld().playEffect(push.getLocation(), Effect.STEP_SOUND, push.getTypeId());
event.setCancelled(true); event.setCancelled(true);
@ -70,7 +74,7 @@ public class BlockRestore extends MiniPlugin
} }
@EventHandler @EventHandler
public void ExpireBlocks(UpdateEvent event) public void expireBlocks(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return; return;
@ -86,15 +90,15 @@ public class BlockRestore extends MiniPlugin
_blocks.remove(cur); _blocks.remove(cur);
} }
public void Restore(Block block) public void restore(Block block)
{ {
if (!Contains(block)) if (!contains(block))
return; return;
_blocks.remove(block).restore(); _blocks.remove(block).restore();
} }
public void RestoreAll() public void restoreAll()
{ {
for (BlockRestoreData data : _blocks.values()) for (BlockRestoreData data : _blocks.values())
data.restore(); data.restore();
@ -102,7 +106,7 @@ public class BlockRestore extends MiniPlugin
_blocks.clear(); _blocks.clear();
} }
public HashSet<Location> RestoreBlockAround(Material type, Location location, int radius) public HashSet<Location> restoreBlockAround(Material type, Location location, int radius)
{ {
HashSet<Location> restored = new HashSet<Location>(); HashSet<Location> restored = new HashSet<Location>();
@ -128,26 +132,26 @@ public class BlockRestore extends MiniPlugin
return restored; return restored;
} }
public void Add(Block block, int toID, byte toData, long expireTime) public void add(Block block, int toID, byte toData, long expireTime)
{ {
Add(block, toID, toData, block.getTypeId(), block.getData(), expireTime); add(block, toID, toData, block.getTypeId(), block.getData(), expireTime);
} }
public void Add(Block block, int toID, byte toData, int fromID, byte fromData, long expireTime) public void add(Block block, int toID, byte toData, int fromID, byte fromData, long expireTime)
{ {
if (!Contains(block)) GetBlocks().put(block, new BlockRestoreData(block, toID, toData, fromID, fromData, expireTime, 0)); if (!contains(block)) getBlocks().put(block, new BlockRestoreData(block, toID, toData, fromID, fromData, expireTime, 0));
else GetData(block).update(toID, toData, expireTime); else getData(block).update(toID, toData, expireTime);
} }
public void Snow(Block block, byte heightAdd, byte heightMax, long expireTime, long meltDelay, int heightJumps) public void snow(Block block, byte heightAdd, byte heightMax, long expireTime, long meltDelay, int heightJumps)
{ {
//Fill Above //Fill Above
if (((block.getTypeId() == 78 && block.getData() >= (byte)7) || block.getTypeId() == 80) && GetData(block) != null) if (((block.getTypeId() == 78 && block.getData() >= (byte)7) || block.getTypeId() == 80) && getData(block) != null)
{ {
GetData(block).update(78, heightAdd, expireTime, meltDelay); getData(block).update(78, heightAdd, expireTime, meltDelay);
if (heightJumps > 0) Snow(block.getRelative(BlockFace.UP), heightAdd, heightMax, expireTime, meltDelay, heightJumps-1); if (heightJumps > 0) snow(block.getRelative(BlockFace.UP), heightAdd, heightMax, expireTime, meltDelay, heightJumps - 1);
if (heightJumps == -1) Snow(block.getRelative(BlockFace.UP), heightAdd, heightMax, expireTime, meltDelay, -1); if (heightJumps == -1) snow(block.getRelative(BlockFace.UP), heightAdd, heightMax, expireTime, meltDelay, -1);
return; return;
} }
@ -187,30 +191,57 @@ public class BlockRestore extends MiniPlugin
heightAdd = 0; heightAdd = 0;
//Snow //Snow
if (!Contains(block)) if (!contains(block))
GetBlocks().put(block, new BlockRestoreData(block, 78, (byte)Math.max(0, heightAdd-1), block.getTypeId(), block.getData(), expireTime, meltDelay)); getBlocks().put(block, new BlockRestoreData(block, 78, (byte) Math.max(0, heightAdd - 1), block.getTypeId(), block.getData(), expireTime, meltDelay));
else else
GetData(block).update(78, heightAdd, expireTime, meltDelay); getData(block).update(78, heightAdd, expireTime, meltDelay);
} }
public boolean Contains(Block block) public boolean contains(Block block)
{ {
if (GetBlocks().containsKey(block)) if (getBlocks().containsKey(block))
return true; return true;
for (BlockRestoreMap restoreMap : _restoreMaps)
{
if (restoreMap.contains(block))
return true;
}
return false; return false;
} }
public BlockRestoreData GetData(Block block) public BlockRestoreData getData(Block block)
{ {
if (_blocks.containsKey(block)) if (_blocks.containsKey(block))
return _blocks.get(block); return _blocks.get(block);
return null; return null;
} }
public HashMap<Block, BlockRestoreData> GetBlocks() public HashMap<Block, BlockRestoreData> getBlocks()
{ {
return _blocks; return _blocks;
} }
public BlockRestoreMap createMap()
{
BlockRestoreMap map = new BlockRestoreMap(this);
_restoreMaps.add(map);
return map;
}
protected void removeMap(BlockRestoreMap blockRestore)
{
_restoreMaps.remove(blockRestore);
}
@Override
public void disable()
{
// Clear all restore maps
for (BlockRestoreMap restoreMap : _restoreMaps)
{
restoreMap.restoreInstant();
}
}
} }

View File

@ -0,0 +1,175 @@
package mineplex.core.blockrestore;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Material;
import org.bukkit.block.Block;
import mineplex.core.common.block.BlockData;
public class BlockRestoreMap
{
private BlockRestore _blockRestore;
// The rate at which we restore blocks
private int _blocksPerTick;
// Easy access to all the blocks we have modified
private HashSet<Block> _changedBlocks;
// A hashmap for each level, so we can quickly restore top down
private HashMap<Block, BlockData>[] _blocks;
protected BlockRestoreMap(BlockRestore blockRestore)
{
this(blockRestore, 200);
}
protected BlockRestoreMap(BlockRestore blockRestore, int blocksPerTick)
{
_blockRestore = blockRestore;
_blocksPerTick = blocksPerTick;
_changedBlocks = new HashSet<Block>();
_blocks = new HashMap[256];
// Populate Array
for (int i = 0; i < 256; i++)
{
_blocks[i] = new HashMap<Block, BlockData>();
}
}
public void addBlockData(BlockData blockData)
{
Block block = blockData.Block;
if (!_blocks[block.getY()].containsKey(block))
_blocks[block.getY()].put(block, blockData);
_changedBlocks.add(blockData.Block);
}
public void set(Block block, Material material)
{
set(block, material, (byte) 0);
}
public void set(Block block, Material material, byte toData)
{
set(block, material.getId(), toData);
}
public void set(Block block, int toId, byte toData)
{
addBlockData(new BlockData(block));
block.setTypeIdAndData(toId, toData, false);
}
public boolean contains(Block block)
{
return _changedBlocks.contains(block);
}
public HashSet<Block> getChangedBlocks()
{
return _changedBlocks;
}
/**
* Restore all the blocks changed in this BlockRestoreMap
* NOTE: You should not use the same BlockRestoreMap instance after you run restore.
* You must initialize a new BlockRestoreMap from BlockRestore
*/
public void restore()
{
// The idea behind this is that the runnable will restore blocks over time
// If the server happens to shutdown while the runnable is running, we will still
// restore all our blocks with restoreInstant (as called by BlockRestore)
BlockDataRunnable runnable = new BlockDataRunnable(_blockRestore.getPlugin(), new RestoreIterator(), _blocksPerTick, new Runnable()
{
@Override
public void run()
{
clearMaps();
_blockRestore.removeMap(BlockRestoreMap.this);
}
});
runnable.start();
}
private void clearMaps()
{
for (int i = 0; i < 256; i++)
{
_blocks[i].clear();
}
_changedBlocks.clear();
}
public void restoreInstant()
{
for (int i = 0; i < 256; i++)
{
HashMap<Block, BlockData> map = _blocks[i];
for (BlockData data : map.values())
{
data.restore();
}
}
clearMaps();
}
public int getBlocksPerTick()
{
return _blocksPerTick;
}
public void setBlocksPerTick(int blocksPerTick)
{
_blocksPerTick = blocksPerTick;
}
private class RestoreIterator implements Iterator<BlockData>
{
private Iterator<BlockData> _currentIterator;
private int _currentIndex;
public RestoreIterator()
{
_currentIndex = 255;
updateIterator();
}
private void updateIterator()
{
_currentIterator = _blocks[_currentIndex].values().iterator();
}
@Override
public boolean hasNext()
{
while (!_currentIterator.hasNext() && _currentIndex > 0)
{
_currentIndex--;
updateIterator();
}
return _currentIterator.hasNext();
}
@Override
public BlockData next()
{
while (!_currentIterator.hasNext() && _currentIndex > 0)
{
_currentIndex--;
updateIterator();
}
return _currentIterator.next();
}
}
}

View File

@ -134,7 +134,7 @@ public class Explosion extends MiniPlugin
else else
{ {
int heightDiff = cur.getLocation().getBlockY() - event.getEntity().getLocation().getBlockY(); int heightDiff = cur.getLocation().getBlockY() - event.getEntity().getLocation().getBlockY();
_blockRestore.Add(cur, 0, (byte)0, (long) (20000 + (heightDiff*3000) + Math.random()*2900)); _blockRestore.add(cur, 0, (byte) 0, (long) (20000 + (heightDiff * 3000) + Math.random() * 2900));
} }
} }
@ -239,7 +239,7 @@ public class Explosion extends MiniPlugin
{ {
if (_temporaryDebris) if (_temporaryDebris)
{ {
_blockRestore.Add(block, cur.getBlockId(), cur.getBlockData(), 10000); _blockRestore.add(block, cur.getBlockId(), cur.getBlockData(), 10000);
} }
else else
{ {

View File

@ -96,9 +96,9 @@ public class ItemPaintballGun extends ItemGadget
continue; continue;
if (block.getType() == Material.CARPET) if (block.getType() == Material.CARPET)
Manager.getBlockRestore().Add(block, 171, color, 4000); Manager.getBlockRestore().add(block, 171, color, 4000);
else else
Manager.getBlockRestore().Add(block, 35, color, 4000); Manager.getBlockRestore().add(block, 35, color, 4000);
} }
} }

View File

@ -100,7 +100,11 @@ public class Clans extends JavaPlugin
new FriendManager(this, _clientManager, preferenceManager, portal); new FriendManager(this, _clientManager, preferenceManager, portal);
new InventoryManager(this, _clientManager); new InventoryManager(this, _clientManager);
_clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), _clientManager, _donationManager, blockRestore, teleport, chat, webServerAddress); // Enable custom-gear related managers
PacketHandler packetHandler = new PacketHandler(this);
GearManager customGear = new GearManager(this, packetHandler);
_clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), _clientManager, _donationManager, blockRestore, teleport, chat, customGear, webServerAddress);
new Recipes(this); new Recipes(this);
new Farming(this); new Farming(this);
new BuildingShop(_clansManager, _clientManager, _donationManager); new BuildingShop(_clansManager, _clientManager, _donationManager);
@ -113,10 +117,6 @@ public class Clans extends JavaPlugin
((CraftWorld) world).getHandle().spigotConfig.itemMerge = 0; ((CraftWorld) world).getHandle().spigotConfig.itemMerge = 0;
} }
// Enable custom-gear related managers
PacketHandler packetHandler = new PacketHandler(this);
GearManager customGear = new GearManager(this, packetHandler);
//Updates //Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);

View File

@ -242,7 +242,7 @@ public class ClansDataAccessLayer
Block down = UtilBlock.getHighest(c.getWorld(), c.getBlock(x, 0, z).getX(), c.getBlock(x, 0, z).getZ()).getRelative(BlockFace.DOWN); Block down = UtilBlock.getHighest(c.getWorld(), c.getBlock(x, 0, z).getX(), c.getBlock(x, 0, z).getZ()).getRelative(BlockFace.DOWN);
if (down.getTypeId() == 1 || down.getTypeId() == 2 || down.getTypeId() == 3 || down.getTypeId() == 12 || down.getTypeId() == 8) if (down.getTypeId() == 1 || down.getTypeId() == 2 || down.getTypeId() == 3 || down.getTypeId() == 12 || down.getTypeId() == 8)
_manager.getBlockRestore().Add(down, 89, (byte)0, 180000); _manager.getBlockRestore().add(down, 89, (byte) 0, 180000);
} }
//Log //Log

View File

@ -156,9 +156,9 @@ public class ClansGame extends MiniPlugin
{ {
public void run() public void run()
{ {
Clans.getBlockRestore().Add(block, 65, block.getData(), 30000); Clans.getBlockRestore().add(block, 65, block.getData(), 30000);
BlockRestoreData data = Clans.getBlockRestore().GetData(block); BlockRestoreData data = Clans.getBlockRestore().getData(block);
if (data != null) if (data != null)
{ {
data.setFromId(0); data.setFromId(0);

View File

@ -40,8 +40,9 @@ import mineplex.game.clans.clans.commands.ClansAllyChatCommand;
import mineplex.game.clans.clans.commands.ClansChatCommand; import mineplex.game.clans.clans.commands.ClansChatCommand;
import mineplex.game.clans.clans.commands.ClansCommand; import mineplex.game.clans.clans.commands.ClansCommand;
import mineplex.game.clans.clans.commands.ServerTimeCommand; import mineplex.game.clans.clans.commands.ServerTimeCommand;
import mineplex.game.clans.clans.map.ItemMapManager;
import mineplex.game.clans.clans.regions.ClansRegions; import mineplex.game.clans.clans.loot.LootManager;
import mineplex.game.clans.clans.map.ItemMapManager;import mineplex.game.clans.clans.regions.ClansRegions;
import mineplex.game.clans.clans.repository.ClanTerritory; import mineplex.game.clans.clans.repository.ClanTerritory;
import mineplex.game.clans.clans.repository.tokens.ClanMemberToken; import mineplex.game.clans.clans.repository.tokens.ClanMemberToken;
import mineplex.game.clans.clans.repository.tokens.ClanTerritoryToken; import mineplex.game.clans.clans.repository.tokens.ClanTerritoryToken;
@ -54,6 +55,7 @@ import mineplex.game.clans.fields.Field;
import mineplex.game.clans.gameplay.Gameplay; import mineplex.game.clans.gameplay.Gameplay;
import mineplex.game.clans.gameplay.safelog.LoggingManager; import mineplex.game.clans.gameplay.safelog.LoggingManager;
import mineplex.game.clans.gameplay.safelog.npc.NPCManager; import mineplex.game.clans.gameplay.safelog.npc.NPCManager;
import mineplex.game.clans.items.GearManager;
import mineplex.game.clans.spawn.Spawn; import mineplex.game.clans.spawn.Spawn;
import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
@ -115,7 +117,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
public String[] denyClan = new String[] { public String[] denyClan = new String[] {
"neut", "neutral", "sethome", "promote", "demote", "admin", "help", "create", "disband", "delete", "invite", "join", "kick", "ally", "trust", "claim", "unclaim", "territory", "home"}; "neut", "neutral", "sethome", "promote", "demote", "admin", "help", "create", "disband", "delete", "invite", "join", "kick", "ally", "trust", "claim", "unclaim", "territory", "home"};
public ClansManager(JavaPlugin plugin, String serverName, CoreClientManager clientManager, DonationManager donationManager, BlockRestore blockRestore, Teleport teleport, Chat chat, String webServerAddress) public ClansManager(JavaPlugin plugin, String serverName, CoreClientManager clientManager, DonationManager donationManager, BlockRestore blockRestore, Teleport teleport, Chat chat, GearManager gearManager, String webServerAddress)
{ {
super("Clans Manager", plugin); super("Clans Manager", plugin);
@ -149,7 +151,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
new Spawn(plugin); new Spawn(plugin);
new NPCManager(this); new NPCManager(this);
new LoggingManager(plugin); new LoggingManager(plugin);
new GoldManager(this, _clientManager, donationManager); GoldManager goldManager = new GoldManager(this, _clientManager, donationManager);
DamageManager damageManager = new DamageManager(plugin, _combatManager, new NpcManager(plugin, creature), disguiseManager); DamageManager damageManager = new DamageManager(plugin, _combatManager, new NpcManager(plugin, creature), disguiseManager);
@ -176,7 +178,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
ClanEnergyManager clanEnergyManager = new ClanEnergyManager(plugin, this, clientManager, donationManager); ClanEnergyManager clanEnergyManager = new ClanEnergyManager(plugin, this, clientManager, donationManager);
_worldEvent = new WorldEventManager(plugin, this, damageManager); LootManager lootManager = new LootManager(gearManager, goldManager);
_worldEvent = new WorldEventManager(plugin, this, damageManager, lootManager, blockRestore);
for (ClanToken token : _clanDataAccess.getRepository().retrieveClans()) for (ClanToken token : _clanDataAccess.getRepository().retrieveClans())
{ {
@ -610,6 +613,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
{ {
// Kind of confusing, Clans.java calls this so that we can pass the disable event to WorldEventManager // Kind of confusing, Clans.java calls this so that we can pass the disable event to WorldEventManager
// This is so that we can prevent any permanent world changes with events // This is so that we can prevent any permanent world changes with events
_blockRestore.onDisable();
_worldEvent.onDisable(); _worldEvent.onDisable();
} }
} }

View File

@ -0,0 +1,21 @@
package mineplex.game.clans.clans.loot;
import org.bukkit.Location;
import mineplex.game.clans.items.GearManager;
public class GearLoot implements ILoot
{
private GearManager _gearManager;
public GearLoot(GearManager gearManager)
{
_gearManager = gearManager;
}
@Override
public void dropLoot(Location location)
{
_gearManager.spawnItem(location);
}
}

View File

@ -0,0 +1,27 @@
package mineplex.game.clans.clans.loot;
import org.bukkit.Location;
import mineplex.core.common.util.UtilMath;
import mineplex.game.clans.economy.GoldManager;
public class GoldLoot implements ILoot
{
private GoldManager _goldManager;
private int _min;
private int _max;
public GoldLoot(GoldManager goldManager, int min, int max)
{
_goldManager = goldManager;
_min = min;
_max = max;
}
@Override
public void dropLoot(Location location)
{
int count = _min + UtilMath.r(_max - _min);
_goldManager.dropGold(location, count);
}
}

View File

@ -0,0 +1,27 @@
package mineplex.game.clans.clans.loot;
import org.bukkit.Location;
import mineplex.core.common.util.UtilMath;
import mineplex.game.clans.items.economy.GoldToken;
public class GoldTokenLoot implements ILoot
{
private int _minGold;
private int _maxGold;
public GoldTokenLoot(int minGold, int maxGold)
{
_minGold = minGold;
_maxGold = maxGold;
}
@Override
public void dropLoot(Location location)
{
int gold = _minGold + UtilMath.r(_maxGold - _minGold);
GoldToken token = new GoldToken(gold);
location.getWorld().dropItemNaturally(location, token.toItemStack());
}
}

View File

@ -0,0 +1,9 @@
package mineplex.game.clans.clans.loot;
import org.bukkit.Location;
public interface ILoot
{
public void dropLoot(Location location);
}

View File

@ -0,0 +1,41 @@
package mineplex.game.clans.clans.loot;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilMath;
public class ItemLoot implements ILoot
{
private Material _material;
private byte _data;
private int _min;
private int _max;
public ItemLoot(Material material)
{
this(material, 1, 1);
}
public ItemLoot(Material material, int min, int max)
{
this(material, (byte) 0, min, max);
}
public ItemLoot(Material material, byte data, int min, int max)
{
_material = material;
_data = data;
_min = min;
_max = max;
}
@Override
public void dropLoot(Location location)
{
int count = UtilMath.rRange(_min, _max);
ItemStack item = new ItemStack(_material, count, (short) 0, _data);
location.getWorld().dropItemNaturally(location, item);
}
}

View File

@ -0,0 +1,68 @@
package mineplex.game.clans.clans.loot;
import org.bukkit.Location;
import org.bukkit.Material;
import mineplex.game.clans.economy.GoldManager;
import mineplex.game.clans.items.GearManager;
import mineplex.game.clans.items.generation.WeightSet;
public class LootManager
{
private GearManager _gearManager;
private GoldManager _goldManager;
private WeightSet<ILoot> _commonSet;
private WeightSet<ILoot> _rareSet;
public LootManager(GearManager gearManager, GoldManager goldManager)
{
_gearManager = gearManager;
_goldManager = goldManager;
_commonSet = new WeightSet<ILoot>();
_rareSet = new WeightSet<ILoot>();
populateCommon();
populateRare();
}
private void populateCommon()
{
// Food
_commonSet.add(5, new ItemLoot(Material.CARROT, 1, 5));
_commonSet.add(5, new ItemLoot(Material.APPLE, 1, 3));
_commonSet.add(5, new ItemLoot(Material.COOKED_BEEF, 1, 3));
_commonSet.add(5, new ItemLoot(Material.RAW_BEEF, 1, 4));
_commonSet.add(5, new ItemLoot(Material.POTATO_ITEM, 1, 5));
// Armor
_commonSet.add(2, new ItemLoot(Material.IRON_HELMET, 1, 1));
_commonSet.add(2, new ItemLoot(Material.IRON_CHESTPLATE, 1, 1));
_commonSet.add(2, new ItemLoot(Material.IRON_LEGGINGS, 1, 1));
_commonSet.add(2, new ItemLoot(Material.IRON_BOOTS, 1, 1));
// Gear
_commonSet.add(1, new GearLoot(_gearManager));
// Gold
// _commonSet.add(5, new GoldLoot(_goldManager, 100, 1000));
_commonSet.add(1, new GoldTokenLoot(100, 1000));
}
private void populateRare()
{
// Gear
_rareSet.add(10, new GearLoot(_gearManager));
}
public void dropCommon(Location location)
{
_commonSet.generateRandom().dropLoot(location);
}
public void dropRare(Location location)
{
_rareSet.generateRandom().dropLoot(location);
}
}

View File

@ -20,6 +20,7 @@ import org.bukkit.inventory.PlayerInventory;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -29,6 +30,7 @@ import mineplex.core.scoreboard.elements.ScoreboardElement;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.loot.LootManager;
import mineplex.game.clans.clans.worldevent.command.WorldEventCommand; import mineplex.game.clans.clans.worldevent.command.WorldEventCommand;
import mineplex.game.clans.clans.worldevent.event.EventState; import mineplex.game.clans.clans.worldevent.event.EventState;
import mineplex.game.clans.clans.worldevent.event.WorldEvent; import mineplex.game.clans.clans.worldevent.event.WorldEvent;
@ -42,11 +44,13 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
private ClansManager _clansManager; private ClansManager _clansManager;
private EventTerrainFinder _terrainFinder; private EventTerrainFinder _terrainFinder;
private DamageManager _damageManager; private DamageManager _damageManager;
private LootManager _lootManager;
private BlockRestore _blockRestore;
private long _lastEventEnd; private long _lastEventEnd;
private long _nextEventStart; private long _nextEventStart;
public WorldEventManager(JavaPlugin plugin, ClansManager clansManager, DamageManager damageManager) public WorldEventManager(JavaPlugin plugin, ClansManager clansManager, DamageManager damageManager, LootManager lootManager, BlockRestore blockRestore)
{ {
super("World Event", plugin); super("World Event", plugin);
@ -54,6 +58,8 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
_terrainFinder = new EventTerrainFinder(this, clansManager); _terrainFinder = new EventTerrainFinder(this, clansManager);
_clansManager = clansManager; _clansManager = clansManager;
_damageManager = damageManager; _damageManager = damageManager;
_lootManager = lootManager;
_blockRestore = blockRestore;
_events = new LinkedList<WorldEvent>(); _events = new LinkedList<WorldEvent>();
_lastEventEnd = System.currentTimeMillis(); _lastEventEnd = System.currentTimeMillis();
updateNextEventTime(); updateNextEventTime();
@ -80,12 +86,14 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
while (iterator.hasNext()) while (iterator.hasNext())
{ {
WorldEvent worldEvent = iterator.next(); WorldEvent worldEvent = iterator.next();
if (worldEvent.getState() == EventState.COMPLETE) if (worldEvent.getState() == EventState.COMPLETE || worldEvent.getState() == EventState.CANCELLED)
{ {
worldEvent.cleanup(false);
HandlerList.unregisterAll(worldEvent); HandlerList.unregisterAll(worldEvent);
iterator.remove(); iterator.remove();
// If the event was cancelled, we don't need to run a cleanup
if (worldEvent.getState() == EventState.COMPLETE) worldEvent.cleanup();
removed = true; removed = true;
_lastEventEnd = System.currentTimeMillis(); _lastEventEnd = System.currentTimeMillis();
} }
@ -119,12 +127,12 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
private void startRandomEvent() private void startRandomEvent()
{ {
Location location = _terrainFinder.findArea(Bukkit.getWorlds().get(0), 30, 30); WorldEventType[] types = WorldEventType.values();
WorldEventType type = types[_random.nextInt(types.length)];
Location location = _terrainFinder.findArea(Bukkit.getWorlds().get(0), type.getAreaNeeded(), type.getAreaNeeded());
if (location != null) if (location != null)
{ {
WorldEventType[] types = WorldEventType.values(); initializeEvent(type.createInstance(this, location));
WorldEvent worldEvent = types[_random.nextInt(types.length)].createInstance(this, location);
initializeEvent(worldEvent);
} }
else else
{ {
@ -179,6 +187,11 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
return _damageManager; return _damageManager;
} }
public LootManager getLoot()
{
return _lootManager;
}
public EventTerrainFinder getTerrainFinder() public EventTerrainFinder getTerrainFinder()
{ {
return _terrainFinder; return _terrainFinder;
@ -227,6 +240,11 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
return output; return output;
} }
public BlockRestore getBlockRestore()
{
return _blockRestore;
}
@EventHandler @EventHandler
public void gear(PlayerCommandPreprocessEvent event) public void gear(PlayerCommandPreprocessEvent event)
{ {

View File

@ -24,6 +24,11 @@ public enum WorldEventType
_areaNeeded = areaNeeded; _areaNeeded = areaNeeded;
} }
public int getAreaNeeded()
{
return _areaNeeded;
}
public WorldEvent createInstance(WorldEventManager eventManager, Location centerLocation) public WorldEvent createInstance(WorldEventManager eventManager, Location centerLocation)
{ {
WorldEvent worldEvent = null; WorldEvent worldEvent = null;

View File

@ -7,6 +7,9 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.event.world.ChunkUnloadEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -246,7 +249,34 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
updateEntityHealth(); updateEntityHealth();
applyDamage(event.GetDamage()); applyDamage(event.GetDamage());
updateName();
_event.updateLastActive(); _event.updateLastActive();
} }
@EventHandler
public void damageType(CustomDamageEvent event)
{
if (_entity == null)
return;
if (!event.GetDamageeEntity().equals(_entity))
return;
DamageCause cause = event.GetCause();
if (cause == DamageCause.DROWNING || cause == DamageCause.FALL || cause == DamageCause.SUFFOCATION)
event.SetCancelled("Cancel");
}
@EventHandler
public void cancelCombust(EntityCombustEvent event)
{
if (_entity == null)
return;
if (!event.getEntity().equals(_entity))
return;
event.setCancelled(true);
}
} }

View File

@ -5,5 +5,6 @@ public enum EventState
PREPARE, PREPARE,
LIVE, LIVE,
UNLOADING, UNLOADING,
COMPLETE COMPLETE,
CANCELLED
} }

View File

@ -1,7 +1,6 @@
package mineplex.game.clans.clans.worldevent.event; package mineplex.game.clans.clans.worldevent.event;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -12,14 +11,16 @@ import org.bukkit.block.Block;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPhysicsEvent;
import mineplex.core.common.block.BlockRestoreMap; import mineplex.core.blockrestore.BlockRestoreMap;
import mineplex.core.common.block.schematic.SchematicRunnable; import mineplex.core.common.block.schematic.SchematicRunnable;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.block.BlockData; import mineplex.core.common.block.BlockData;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.worldevent.EventMap; import mineplex.game.clans.clans.worldevent.EventMap;
@ -61,7 +62,7 @@ public abstract class WorldEvent implements Listener
_ticks = 0; _ticks = 0;
_creatures = new ArrayList<EventCreature>(); _creatures = new ArrayList<EventCreature>();
_blocks = new BlockRestoreMap(); _blocks = eventManager.getBlockRestore().createMap();
_lastActive = System.currentTimeMillis(); _lastActive = System.currentTimeMillis();
} }
@ -72,10 +73,10 @@ public abstract class WorldEvent implements Listener
protected abstract void customStart(); protected abstract void customStart();
public final void cleanup(boolean quick) public final void cleanup()
{ {
clearCreatures(); clearCreatures();
restoreBlocks(quick); restoreBlocks();
customCleanup(); customCleanup();
} }
@ -86,11 +87,16 @@ public abstract class WorldEvent implements Listener
public final void cancel() public final void cancel()
{ {
cleanup(true); cleanup();
setState(EventState.COMPLETE); setState(EventState.CANCELLED);
customCancel(); customCancel();
} }
protected final void triggerEnd()
{
setState(EventState.COMPLETE);
}
protected void customCancel() protected void customCancel()
{ {
@ -131,6 +137,11 @@ public abstract class WorldEvent implements Listener
return _name; return _name;
} }
public void setName(String name)
{
_name = name;
}
protected Random getRandom() protected Random getRandom()
{ {
return _random; return _random;
@ -160,7 +171,9 @@ public abstract class WorldEvent implements Listener
public void announceStart() public void announceStart()
{ {
Bukkit.broadcastMessage(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(getCenterLocation().getX() + " " + getCenterLocation().getZ()))); UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 40, 10);
Bukkit.broadcastMessage(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation()))));
} }
public void clearCreatures() public void clearCreatures()
@ -174,16 +187,9 @@ public abstract class WorldEvent implements Listener
_creatures.clear(); _creatures.clear();
} }
public void restoreBlocks(boolean quick) public void restoreBlocks()
{ {
if (quick) _blocks.restore();
{
_blocks.restore();
}
else
{
_blocks.restoreTopDown(_eventManager.getPlugin());
}
} }
public long getLastActive() public long getLastActive()
@ -234,7 +240,7 @@ public abstract class WorldEvent implements Listener
public void setBlock(Block block, int id, byte data) public void setBlock(Block block, int id, byte data)
{ {
_blocks.setBlock(block, id, data); _blocks.set(block, id, data);
} }
public ArrayList<String> getScoreboardLines() public ArrayList<String> getScoreboardLines()
@ -269,10 +275,16 @@ public abstract class WorldEvent implements Listener
} }
@EventHandler @EventHandler
public void onPhysics(BlockPhysicsEvent event) public void prepareTimeout(UpdateEvent event)
{ {
Bukkit.broadcastMessage(event.getBlock().getType() + "" ); if (event.getType() != UpdateType.SEC)
if (_blocks.getChangedBlocks().contains(event.getBlock())) return;
event.setCancelled(true);
if (getState() != EventState.PREPARE)
return;
// Event was preparing for more than 5 minutes
if (getTicks() > 6000)
cancel();
} }
} }

View File

@ -0,0 +1,84 @@
package mineplex.game.clans.clans.worldevent.event.undead;
import mineplex.core.common.util.UtilMath;
public enum CampSize
{
SMALL("Small Camp", 15, 0, 1),
MEDIUM("Medium Camp", 20, 10, 2),
LARGE("Large Camp", 30, 20, 3);
// Base Values
private static final int HUT_MIN = 4;
private static final int HUT_MAX = 8;
private static final int TOWER_MIN = 4;
private static final int TOWER_MAX = 8;
private static final int POLE_MIN = 10;
private static final int POLE_MAX = 20;
private static final int UNDEAD_MIN = 10;
private static final int UNDEAD_MAX = 20;
private String _name;
private int _areaNeeded;
private int _playersNeeded;
private int _modValue;
CampSize(String name, int areaNeeded, int playersNeeded, int modValue)
{
_name = name;
_areaNeeded = areaNeeded;
_playersNeeded = playersNeeded;
_modValue = modValue;
}
public String getName()
{
return _name;
}
public int getAreaNeeded()
{
return _areaNeeded;
}
public int getPlayersNeeded()
{
return _playersNeeded;
}
public int generateHutCount()
{
return _modValue * UtilMath.rRange(HUT_MIN, HUT_MAX);
}
public int generateTowerCount()
{
return _modValue * UtilMath.rRange(TOWER_MIN, TOWER_MAX);
}
public int generatePoleCount()
{
return _modValue * UtilMath.rRange(POLE_MIN, POLE_MAX);
}
public int generateUndeadCount()
{
return _modValue * UtilMath.rRange(UNDEAD_MIN, UNDEAD_MAX);
}
public static CampSize getCampSize(int playerCount)
{
CampSize campSize = CampSize.SMALL;
for (CampSize c : values())
{
if (playerCount >= c.getPlayersNeeded() && (campSize == null || c.getPlayersNeeded() > campSize.getPlayersNeeded()))
campSize = c;
}
return campSize;
}
}

View File

@ -5,18 +5,22 @@ import org.bukkit.material.MaterialData;
public enum CampType public enum CampType
{ {
OAK(new MaterialData(Material.LOG, (byte) 0), new MaterialData(Material.WOOD, (byte) 0)), OAK(new MaterialData(Material.LOG, (byte) 0), new MaterialData(Material.WOOD, (byte) 0), Material.ENDER_CHEST, Material.BURNING_FURNACE),
SPRUCE(new MaterialData(Material.LOG, (byte) 1), new MaterialData(Material.WOOD, (byte) 1)), SPRUCE(new MaterialData(Material.LOG, (byte) 1), new MaterialData(Material.WOOD, (byte) 1), Material.ENDER_CHEST, Material.BURNING_FURNACE),
BIRCH(new MaterialData(Material.LOG, (byte) 2), new MaterialData(Material.WOOD, (byte) 2)), BIRCH(new MaterialData(Material.LOG, (byte) 2), new MaterialData(Material.WOOD, (byte) 2), Material.ENDER_CHEST, Material.BURNING_FURNACE),
JUNGLE(new MaterialData(Material.LOG, (byte) 3), new MaterialData(Material.WOOD, (byte) 3)); JUNGLE(new MaterialData(Material.LOG, (byte) 3), new MaterialData(Material.WOOD, (byte) 3), Material.ENDER_CHEST, Material.BURNING_FURNACE);
private MaterialData _log; private MaterialData _log;
private MaterialData _wood; private MaterialData _wood;
private Material _chest;
private Material _furance;
CampType(MaterialData log, MaterialData wood) CampType(MaterialData log, MaterialData wood, Material chest, Material furnace)
{ {
_log = log; _log = log;
_wood = wood; _wood = wood;
_chest = chest;
_furance = furnace;
} }
public MaterialData getLog() public MaterialData getLog()
@ -28,4 +32,14 @@ public enum CampType
{ {
return _wood; return _wood;
} }
public Material getFurnace()
{
return _furance;
}
public Material getChest()
{
return _chest;
}
} }

View File

@ -1,17 +1,32 @@
package mineplex.game.clans.clans.worldevent.event.undead; package mineplex.game.clans.clans.worldevent.event.undead;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Effect;
import org.bukkit.Location; 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.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.Chest;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityInteractEvent; import org.bukkit.event.entity.EntityInteractEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilWorld;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.worldevent.WorldEventManager; import mineplex.game.clans.clans.worldevent.WorldEventManager;
import mineplex.game.clans.clans.worldevent.event.EventState; import mineplex.game.clans.clans.worldevent.event.EventState;
import mineplex.game.clans.clans.worldevent.event.WorldEvent; import mineplex.game.clans.clans.worldevent.event.WorldEvent;
@ -20,35 +35,29 @@ import mineplex.game.clans.clans.worldevent.event.undead.creature.UndeadWarrior;
public class UndeadCamp extends WorldEvent public class UndeadCamp extends WorldEvent
{ {
private int _mod = 4; private int _hutLeft = 0;
private int _areaSize = 30; private int _poleLeft = 0;
private int _towerLeft = 0;
private int _undeadCount = 0;
private int _hutCur = 0; private final CampType _campType;
private int _poleCur = 0; private final CampSize _campSize;
private int _towerCur = 0;
private int _hutMax = 0;
private int _poleMax = 0;
private int _towerMax = 0;
private int _minZombie = 0;
private CampType _campType;
private HashSet<Block> _chests; private HashSet<Block> _chests;
public UndeadCamp(WorldEventManager eventManager, Location centerLocation) public UndeadCamp(WorldEventManager eventManager, Location centerLocation)
{ {
super(eventManager, "Undead Camp", centerLocation); super(eventManager, "Undead Camp", centerLocation);
_areaSize = (int) (8 * _mod); _campSize = CampSize.getCampSize(UtilServer.getPlayers().length);
_campType = CampType.values()[getRandom().nextInt(CampType.values().length)];
_hutMax = (int) (_mod * _mod * (UtilMath.r(4) + 1));
_towerMax = (int) (_mod * _mod * (UtilMath.r(4) + 3));
_poleMax = (int) (_mod * _mod * (UtilMath.r(11) + 10));
_minZombie = (int) (_mod * (UtilMath.r(9) + 8));
_campType = CampType.JUNGLE;
_chests = new HashSet<Block>(); _chests = new HashSet<Block>();
_hutLeft = _campSize.generateHutCount();
_poleLeft = _campSize.generatePoleCount();
_towerLeft = _campSize.generateTowerCount();
_undeadCount = _campSize.generateUndeadCount();
setName(_campSize.getName());
} }
@Override @Override
@ -60,17 +69,16 @@ public class UndeadCamp extends WorldEvent
@Override @Override
protected void customTick() protected void customTick()
{ {
System.out.println("tick");
if (getState() == EventState.PREPARE) if (getState() == EventState.PREPARE)
{ {
if (_hutCur < _hutMax) createHut(); if (_hutLeft > 0) createHut();
else if (getCreatures().size() < _minZombie) createZombie(); else if (_towerLeft > 0) createTower();
else if (_towerCur < _towerMax) createTower(); else if (_poleLeft > 0) createLamp();
else if (_poleCur < _poleMax) createLamp(); else if (getCreatures().size() < _undeadCount) createUndead();
else else
{ {
System.out.println("Constructed " + getName() + " at " + UtilWorld.locToStrClean(getCenterLocation()) + "."); System.out.println("Constructed " + getName() + " at " + UtilWorld.locToStrClean(getCenterLocation()) + ".");
announceStart();
setState(EventState.LIVE); setState(EventState.LIVE);
} }
} }
@ -84,7 +92,7 @@ public class UndeadCamp extends WorldEvent
int buffer = Math.max(hutX, hutZ)/2 + 1; int buffer = Math.max(hutX, hutZ)/2 + 1;
Location loc = getEventManager().getTerrainFinder().locateSpace(getCenterLocation(), _areaSize-buffer, hutX, hutY+2, hutZ, true, false, getBlocks().getChangedBlocks()); Location loc = getEventManager().getTerrainFinder().locateSpace(getCenterLocation(), _campSize.getAreaNeeded()-buffer, hutX, hutY+2, hutZ, true, false, getBlocks().getChangedBlocks());
if (loc == null) if (loc == null)
return; return;
@ -150,7 +158,7 @@ public class UndeadCamp extends WorldEvent
} }
} }
_hutCur++; _hutLeft--;
} }
private void addChest(Block chest) private void addChest(Block chest)
@ -208,21 +216,21 @@ public class UndeadCamp extends WorldEvent
private void addFurnace(Block chest) private void addFurnace(Block chest)
{ {
setBlock(chest, 61, (byte) (UtilMath.r(4) + 2)); setBlock(chest, Material.BURNING_FURNACE, (byte) (UtilMath.r(4) + 2));
// _chests.add(chest); _chests.add(chest);
} }
private void createZombie() private void createUndead()
{ {
Location loc = getEventManager().getTerrainFinder().locateSpace(getCenterLocation(), _areaSize, 0, 3, 0, false, true, getBlocks().getChangedBlocks()); Location loc = getEventManager().getTerrainFinder().locateSpace(getCenterLocation(), _campSize.getAreaNeeded(), 0, 3, 0, false, true, getBlocks().getChangedBlocks());
if (loc == null) if (loc == null)
return; return;
registerCreature(new UndeadWarrior(this, loc.add(0.5, 0.5, 0.5))); registerCreature(new UndeadWarrior(this, loc.add(0.5, 0.5, 0.5)));
_poleCur++; // _poleLeft--;
// ResetIdleTicks(); // ResetIdleTicks();
} }
@ -234,7 +242,7 @@ public class UndeadCamp extends WorldEvent
int buffer = Math.max(towerX, towerZ)/2 + 1; int buffer = Math.max(towerX, towerZ)/2 + 1;
Location loc = getEventManager().getTerrainFinder().locateSpace(getCenterLocation(), _areaSize - buffer, towerX, towerY + 2, towerZ, false, true, getBlocks().getChangedBlocks()); Location loc = getEventManager().getTerrainFinder().locateSpace(getCenterLocation(), _campSize.getAreaNeeded() - buffer, towerX, towerY + 2, towerZ, false, true, getBlocks().getChangedBlocks());
if (loc == null) if (loc == null)
return; return;
@ -315,12 +323,12 @@ public class UndeadCamp extends WorldEvent
registerCreature(new UndeadArcher(this, block.getRelative(BlockFace.UP).getLocation().add(0.5, 0.5, 0.5))); registerCreature(new UndeadArcher(this, block.getRelative(BlockFace.UP).getLocation().add(0.5, 0.5, 0.5)));
} }
_towerCur++; _towerLeft--;
} }
private void createLamp() private void createLamp()
{ {
Location loc = getEventManager().getTerrainFinder().locateSpace(getCenterLocation(), _areaSize, 0, 4, 0, false, true, getBlocks().getChangedBlocks()); Location loc = getEventManager().getTerrainFinder().locateSpace(getCenterLocation(), _campSize.getAreaNeeded(), 0, 4, 0, false, true, getBlocks().getChangedBlocks());
if (loc == null) if (loc == null)
return; return;
@ -329,18 +337,88 @@ public class UndeadCamp extends WorldEvent
setBlock(loc.getBlock().getRelative(BlockFace.UP), 85, (byte) 0); setBlock(loc.getBlock().getRelative(BlockFace.UP), 85, (byte) 0);
setBlock(loc.getBlock().getRelative(BlockFace.UP).getRelative(BlockFace.UP), 50, (byte)0); setBlock(loc.getBlock().getRelative(BlockFace.UP).getRelative(BlockFace.UP), 50, (byte)0);
_poleCur++; _poleLeft--;
}
private void openChest(Block block)
{
_chests.remove(block);
// Effect
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.ENDER_CHEST.getId());
setBlock(block, Material.AIR);
// Loot
int count = 1 + UtilMath.r(3);
for (int i = 0; i < count; i++)
getEventManager().getLoot().dropCommon(block.getLocation().add(0.5, 0.5, 0.5));
}
private void openFurnace(Block block)
{
_chests.remove(block);
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.BURNING_FURNACE.getId());
setBlock(block, Material.AIR);
for (int i=0 ; i<UtilMath.r(25) ; i++)
block.getWorld().dropItemNaturally(block.getLocation().add(0.5, 0.5, 0.5),
ItemStackFactory.Instance.CreateStack(Material.IRON_INGOT));
for (int i=0 ; i<UtilMath.r(25) ; i++)
block.getWorld().dropItemNaturally(block.getLocation().add(0.5, 0.5, 0.5),
ItemStackFactory.Instance.CreateStack(Material.GOLD_INGOT));
for (int i=0 ; i<UtilMath.r(25) ; i++)
block.getWorld().dropItemNaturally(block.getLocation().add(0.5, 0.5, 0.5),
ItemStackFactory.Instance.CreateStack(Material.DIAMOND));
for (int i=0 ; i<UtilMath.r(25) ; i++)
block.getWorld().dropItemNaturally(block.getLocation().add(0.5, 0.5, 0.5),
ItemStackFactory.Instance.CreateStack(Material.LEATHER));
} }
@EventHandler @EventHandler
public void onChestOpen(EntityInteractEvent event) public void checkEnd(UpdateEvent event)
{ {
Block block = event.getBlock(); if (event.getType() != UpdateType.SEC)
return;
// Remove any broken chests/furnaces
Iterator<Block> it = _chests.iterator();
while (it.hasNext())
{
Block block = it.next();
if (block.getType() != _campType.getChest() && block.getType() != _campType.getFurnace())
it.remove();
}
if (_chests.size() == 0)
{
triggerEnd();
}
}
@EventHandler
public void onChestOpen(PlayerInteractEvent event)
{
Block block = event.getClickedBlock();
if (_chests.contains(block)) if (_chests.contains(block))
{ {
setBlock(event.getBlock(), Material.AIR);
event.setCancelled(true); event.setCancelled(true);
_chests.remove(block);
if (!Recharge.Instance.use(event.getPlayer(), "Loot Chest", 60000, true, false))
return;
if (block.getType() == Material.ENDER_CHEST) openChest(block);
else if (block.getType() == Material.FURNACE || block.getType() == Material.BURNING_FURNACE) openFurnace(block);
updateLastActive();
UtilPlayer.message(event.getPlayer(), F.main(getName(), "You smash open an " + F.elem("Undead Chest") + "!"));
} }
} }
} }

View File

@ -1,8 +1,13 @@
package mineplex.game.clans.clans.worldevent.event.undead.creature; package mineplex.game.clans.clans.worldevent.event.undead.creature;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Zombie;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilMath;
import mineplex.game.clans.clans.worldevent.creature.EventCreature; import mineplex.game.clans.clans.worldevent.creature.EventCreature;
import mineplex.game.clans.clans.worldevent.event.WorldEvent; import mineplex.game.clans.clans.worldevent.event.WorldEvent;
@ -16,12 +21,36 @@ public class UndeadArcher extends EventCreature<Skeleton>
@Override @Override
protected void spawnCustom() protected void spawnCustom()
{ {
Skeleton entity = getEntity();
EntityEquipment eq = entity.getEquipment();
eq.setItemInHand(new ItemStack(Material.BOW));
eq.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
eq.setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
eq.setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
eq.setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
} }
@Override @Override
public void dieCustom() public void dieCustom()
{ {
if (Math.random() > 0.97)
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_HELMET));
if (Math.random() > 0.97)
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_CHESTPLATE));
if (Math.random() > 0.97)
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_LEGGINGS));
if (Math.random() > 0.97)
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_BOOTS));
if (Math.random() > 0.90)
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.BOW));
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.ARROW, UtilMath.r(12) + 1));
for (int i=0 ; i<UtilMath.r(5) + 1 ; i++)
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.EMERALD));
} }
} }

View File

@ -2,11 +2,17 @@ package mineplex.game.clans.clans.worldevent.event.undead.creature;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Zombie; import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.EntityEquipment; import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.worldevent.creature.EventCreature; import mineplex.game.clans.clans.worldevent.creature.EventCreature;
import mineplex.game.clans.clans.worldevent.event.WorldEvent; import mineplex.game.clans.clans.worldevent.event.WorldEvent;
@ -32,23 +38,51 @@ public class UndeadWarrior extends EventCreature<Zombie>
public void dieCustom() public void dieCustom()
{ {
if (Math.random() > 0.97) if (Math.random() > 0.97)
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_HELMET)); getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.IRON_HELMET));
if (Math.random() > 0.97) if (Math.random() > 0.97)
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_CHESTPLATE)); getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.IRON_CHESTPLATE));
if (Math.random() > 0.97) if (Math.random() > 0.97)
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_LEGGINGS)); getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.IRON_LEGGINGS));
if (Math.random() > 0.97) if (Math.random() > 0.97)
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_BOOTS)); getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.IRON_BOOTS));
if (Math.random() > 0.90)
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.BOW));
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.ARROW, UtilMath.r(12) + 1));
for (int i=0 ; i<UtilMath.r(5) + 1 ; i++) for (int i=0 ; i<UtilMath.r(5) + 1 ; i++)
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.EMERALD)); getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.EMERALD));
} }
@EventHandler
public void leap(UpdateEvent event)
{
if (getEntity() == null)
return;
if (event.getType() != UpdateType.FAST)
return;
if (Math.random() < 0.9)
return;
Zombie zombie = getEntity();
if (zombie.getTarget() == null)
return;
double dist = UtilMath.offset(zombie.getTarget(), zombie);
if (dist <= 3 || dist > 16)
return;
double power = 0.8 + (1.2 * ((dist-3)/13d));
//Leap
UtilAction.velocity(zombie, UtilAlg.getTrajectory(zombie, zombie.getTarget()),
power, false, 0, 0.2, 1, true);
//Effect
zombie.getWorld().playSound(zombie.getLocation(), Sound.ZOMBIE_HURT, 1f, 2f);
}
} }

View File

@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
@ -12,7 +11,6 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
@ -24,9 +22,7 @@ import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
@ -46,7 +42,6 @@ import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class Gameplay extends MiniPlugin public class Gameplay extends MiniPlugin
@ -76,14 +71,14 @@ public class Gameplay extends MiniPlugin
if (event.getBucket() == Material.WATER_BUCKET) if (event.getBucket() == Material.WATER_BUCKET)
{ {
block.setTypeIdAndData(8, (byte)1, true); block.setTypeIdAndData(8, (byte)1, true);
_blockRestore.Add(event.getBlockClicked().getRelative(event.getBlockFace()), 8, (byte)0, 1000); _blockRestore.add(event.getBlockClicked().getRelative(event.getBlockFace()), 8, (byte) 0, 1000);
_bucketWater.put(block, System.currentTimeMillis()); _bucketWater.put(block, System.currentTimeMillis());
} }
if (event.getBucket() == Material.LAVA_BUCKET) if (event.getBucket() == Material.LAVA_BUCKET)
{ {
block.setTypeIdAndData(10, (byte)6, true); block.setTypeIdAndData(10, (byte)6, true);
_blockRestore.Add(event.getBlockClicked().getRelative(event.getBlockFace()), 10, (byte)0, 2000); _blockRestore.add(event.getBlockClicked().getRelative(event.getBlockFace()), 10, (byte) 0, 2000);
} }

View File

@ -12,7 +12,7 @@ public class WeightSet<T>
private Set<Weight<T>> _weights; private Set<Weight<T>> _weights;
private WeightSet() public WeightSet()
{ {
_weights = new HashSet<Weight<T>>(); _weights = new HashSet<Weight<T>>();
} }
@ -49,6 +49,11 @@ public class WeightSet<T>
} }
} }
public void add(int weight, T element)
{
_weights.add(new Weight<T>(weight, element));
}
private int getTotalWeight() private int getTotalWeight()
{ {
int total = 0; int total = 0;

View File

@ -248,7 +248,7 @@ public class WorldManager extends MiniPlugin
for (Block block : UtilBlock.getInRadius(player.getLocation(), 3d).keySet()) for (Block block : UtilBlock.getInRadius(player.getLocation(), 3d).keySet())
{ {
if (block.getType() == Material.PUMPKIN) if (block.getType() == Material.PUMPKIN)
Manager.GetBlockRestore().Add(block, 91, block.getData(), 2000); Manager.GetBlockRestore().add(block, 91, block.getData(), 2000);
} }
} }

View File

@ -26,7 +26,6 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -284,7 +283,7 @@ public class BlockToss extends SkillCharge implements IThrown
block.setTypeIdAndData(0, (byte)0, false); block.setTypeIdAndData(0, (byte)0, false);
//Block Replace //Block Replace
Factory.BlockRestore().Add(block, fall.getBlockId(), (byte)0, 10000); Factory.BlockRestore().add(block, fall.getBlockId(), (byte) 0, 10000);
//Effect //Effect
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());

View File

@ -3,8 +3,6 @@ package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -27,7 +25,6 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
@ -158,10 +155,10 @@ public class ArcticArmor extends Skill
if (!block.getRelative(BlockFace.UP).isLiquid()) if (!block.getRelative(BlockFace.UP).isLiquid())
if (block.getLocation().getY() <= cur.getLocation().getY()) if (block.getLocation().getY() <= cur.getLocation().getY())
if (block.getTypeId() == 8 || block.getTypeId() == 9 || block.getTypeId() == 79) if (block.getTypeId() == 8 || block.getTypeId() == 9 || block.getTypeId() == 79)
Factory.BlockRestore().Add(block, 79, (byte)0, (long)(duration * (1 + blocks.get(block)))); Factory.BlockRestore().add(block, 79, (byte) 0, (long) (duration * (1 + blocks.get(block))));
//Snow //Snow
Factory.BlockRestore().Snow(block, (byte)0, (byte)0, (long)(duration * (1 + blocks.get(block))), 250, 0); Factory.BlockRestore().snow(block, (byte) 0, (byte) 0, (long) (duration * (1 + blocks.get(block))), 250, 0);
} }
} }
} }
@ -194,7 +191,7 @@ public class ArcticArmor extends Skill
if (cur.getEyeLocation().getBlock().getType() == Material.ICE) if (cur.getEyeLocation().getBlock().getType() == Material.ICE)
{ {
if (!Factory.BlockRestore().Contains(cur.getEyeLocation().getBlock())) if (!Factory.BlockRestore().contains(cur.getEyeLocation().getBlock()))
continue; continue;
Player damager = null; Player damager = null;

View File

@ -181,7 +181,7 @@ public class Blizzard extends SkillActive
HashMap<Block, Double> blocks = UtilBlock.getInRadius(target.getLocation(), 2d, 1); HashMap<Block, Double> blocks = UtilBlock.getInRadius(target.getLocation(), 2d, 1);
for (Block block : blocks.keySet()) for (Block block : blocks.keySet())
{ {
Factory.BlockRestore().Snow(block, (byte)(1 + (int)(2*blocks.get(block))), (byte)(7*level), 2500, 250, 3); Factory.BlockRestore().snow(block, (byte) (1 + (int) (2 * blocks.get(block))), (byte) (7 * level), 2500, 250, 3);
} }
//Effect //Effect
@ -221,7 +221,7 @@ public class Blizzard extends SkillActive
if (_snowball.remove(event.getEntity()) == null) if (_snowball.remove(event.getEntity()) == null)
return; return;
Factory.BlockRestore().Snow(event.getEntity().getLocation().getBlock(), (byte)1, (byte)7, 2000, 250, 0); Factory.BlockRestore().snow(event.getEntity().getLocation().getBlock(), (byte) 1, (byte) 7, 2000, 250, 0);
} }
@EventHandler @EventHandler

View File

@ -127,11 +127,11 @@ public class FissureData
} }
//Boost Column //Boost Column
if (block.getTypeId() == 1) Host.Factory.BlockRestore().Add(block, 4, block.getData(), 14000); if (block.getTypeId() == 1) Host.Factory.BlockRestore().add(block, 4, block.getData(), 14000);
if (block.getTypeId() == 2) Host.Factory.BlockRestore().Add(block, 3, block.getData(), 14000); if (block.getTypeId() == 2) Host.Factory.BlockRestore().add(block, 3, block.getData(), 14000);
if (block.getTypeId() == 98) Host.Factory.BlockRestore().Add(block, 98, (byte)2, 14000); if (block.getTypeId() == 98) Host.Factory.BlockRestore().add(block, 98, (byte) 2, 14000);
Host.Factory.BlockRestore().Add(up, block.getTypeId(), block.getData(), 10000 - (1000 * _height)); Host.Factory.BlockRestore().add(up, block.getTypeId(), block.getData(), 10000 - (1000 * _height));
_height++; _height++;
//Effect //Effect

View File

@ -121,7 +121,7 @@ public class FreezingBlast extends SkillActive implements IThrown
{ {
if (UtilBlock.airFoliage(cur) && UtilBlock.solid(cur.getRelative(BlockFace.DOWN))) if (UtilBlock.airFoliage(cur) && UtilBlock.solid(cur.getRelative(BlockFace.DOWN)))
{ {
Factory.BlockRestore().Snow(cur, (byte)(7 * blocks.get(cur)), (byte)7, (long)(15000 * (1 + blocks.get(cur))), 1000, 0); Factory.BlockRestore().snow(cur, (byte) (7 * blocks.get(cur)), (byte) 7, (long) (15000 * (1 + blocks.get(cur))), 1000, 0);
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 80); cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 80);
} }
} }

View File

@ -3,11 +3,9 @@ package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashMap; import java.util.HashMap;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -154,7 +152,7 @@ public class IcePrison extends SkillActive implements IThrown
time -= yDiff * 1000 - Math.random() * 1000; time -= yDiff * 1000 - Math.random() * 1000;
Factory.BlockRestore().Add(freeze, 79, (byte)0, time); Factory.BlockRestore().add(freeze, 79, (byte) 0, time);
freeze.getWorld().playEffect(freeze.getLocation(), Effect.STEP_SOUND, 79); freeze.getWorld().playEffect(freeze.getLocation(), Effect.STEP_SOUND, 79);
} }

View File

@ -1,11 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Mage; package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
@ -22,14 +19,10 @@ import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
@ -297,7 +290,7 @@ public class LifeBonds extends Skill
if (cur.getItemStack().getData() != null) if (cur.getItemStack().getData() != null)
data = cur.getItemStack().getData().getData(); data = cur.getItemStack().getData().getData();
Factory.BlockRestore().Add(block, cur.getItemStack().getTypeId(), data, 2000); Factory.BlockRestore().add(block, cur.getItemStack().getTypeId(), data, 2000);
} }
} }

View File

@ -74,7 +74,7 @@ public class Web extends ItemUsable
if (!UtilBlock.airFoliage(ent.getLocation().getBlock())) if (!UtilBlock.airFoliage(ent.getLocation().getBlock()))
return; return;
Factory.BlockRestore().Add(ent.getLocation().getBlock(), 30, (byte)0, 6000); Factory.BlockRestore().add(ent.getLocation().getBlock(), 30, (byte) 0, 6000);
ent.remove(); ent.remove();
} }

View File

@ -884,7 +884,7 @@ public class CastleSiege extends TeamGame
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, event.getClickedBlock().getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1, UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, event.getClickedBlock().getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1,
ViewDist.LONG, UtilServer.getPlayers()); ViewDist.LONG, UtilServer.getPlayers());
event.getClickedBlock().getWorld().playSound(event.getClickedBlock().getLocation(), Sound.NOTE_STICKS, 2f, 1f); event.getClickedBlock().getWorld().playSound(event.getClickedBlock().getLocation(), Sound.NOTE_STICKS, 2f, 1f);
Manager.GetBlockRestore().Add(event.getClickedBlock(), 0, (byte)0, 1000); Manager.GetBlockRestore().add(event.getClickedBlock(), 0, (byte) 0, 1000);
} }
@EventHandler @EventHandler

View File

@ -582,7 +582,7 @@ public class DragonEscape extends SoloGame
_tunneled.put(new BlockData(event.getBlock()), player); _tunneled.put(new BlockData(event.getBlock()), player);
Manager.GetBlockRestore().Add(event.getBlock(), 0, (byte)0, 2400); Manager.GetBlockRestore().add(event.getBlock(), 0, (byte) 0, 2400);
UtilInv.remove(player, Material.DIAMOND_PICKAXE, (byte)0, 1); UtilInv.remove(player, Material.DIAMOND_PICKAXE, (byte)0, 1);
} }
@ -593,7 +593,7 @@ public class DragonEscape extends SoloGame
if (event.isCancelled()) if (event.isCancelled())
return; return;
Manager.GetBlockRestore().Add(event.getBlock(), Manager.GetBlockRestore().add(event.getBlock(),
event.getPlayer().getItemInHand().getType().getId(), event.getPlayer().getItemInHand().getData().getData(), event.getPlayer().getItemInHand().getType().getId(), event.getPlayer().getItemInHand().getData().getData(),
event.getBlockReplacedState().getTypeId(), event.getBlockReplacedState().getRawData(), 2400); event.getBlockReplacedState().getTypeId(), event.getBlockReplacedState().getRawData(), 2400);
} }

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -15,7 +14,6 @@ import nautilus.game.arcade.game.games.halloween.HalloweenAudio;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilBlockText;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
@ -104,18 +102,18 @@ public abstract class WaveBase
//Beacon //Beacon
Block block = total.toLocation(locs.get(0).getWorld()).getBlock().getRelative(BlockFace.DOWN); Block block = total.toLocation(locs.get(0).getWorld()).getBlock().getRelative(BlockFace.DOWN);
Host.Manager.GetBlockRestore().Add(block, 138, (byte)0, _duration); Host.Manager.GetBlockRestore().add(block, 138, (byte) 0, _duration);
for (int x=-1 ; x<=1 ; x++) for (int x=-1 ; x<=1 ; x++)
for (int z=-1 ; z<=1 ; z++) for (int z=-1 ; z<=1 ; z++)
Host.Manager.GetBlockRestore().Add(block.getRelative(x, -1, z), 42, (byte)0, _duration); Host.Manager.GetBlockRestore().add(block.getRelative(x, -1, z), 42, (byte) 0, _duration);
//Clear Laser //Clear Laser
while (block.getY() < 250) while (block.getY() < 250)
{ {
block = block.getRelative(BlockFace.UP); block = block.getRelative(BlockFace.UP);
if (block.getType() != Material.AIR) if (block.getType() != Material.AIR)
Host.Manager.GetBlockRestore().Add(block, 0, (byte)0, _duration); Host.Manager.GetBlockRestore().add(block, 0, (byte) 0, _duration);
} }
} }

View File

@ -10,7 +10,6 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -2109,7 +2108,7 @@ public class MineStrike extends TeamGame
//Incendiary //Incendiary
_incendiary.clear(); _incendiary.clear();
Manager.GetBlockRestore().RestoreAll(); Manager.GetBlockRestore().restoreAll();
//Restock Ammo //Restock Ammo
for (Gun gun : _gunsEquipped.keySet()) for (Gun gun : _gunsEquipped.keySet())

View File

@ -74,7 +74,7 @@ public abstract class FireGrenadeBase extends Grenade
public void run() public void run()
{ {
if (round == game.getRound() && !game.isFreezeTime()) if (round == game.getRound() && !game.isFreezeTime())
game.Manager.GetBlockRestore().Add(block, 51, (byte)0, (long) (_baseTime + blocks.get(block) * _baseTime)); game.Manager.GetBlockRestore().add(block, 51, (byte) 0, (long) (_baseTime + blocks.get(block) * _baseTime));
} }
}, 60 - (int)(60d * blocks.get(block))); }, 60 - (int)(60d * blocks.get(block)));
} }

View File

@ -36,7 +36,7 @@ public class Smoke extends Grenade
ent.getWorld().playSound(ent.getLocation(), Sound.FIZZ, 0.1f, 0.1f); ent.getWorld().playSound(ent.getLocation(), Sound.FIZZ, 0.1f, 0.1f);
for (Location loc : game.Manager.GetBlockRestore().RestoreBlockAround(Material.FIRE, ent.getLocation(), 5)) for (Location loc : game.Manager.GetBlockRestore().restoreBlockAround(Material.FIRE, ent.getLocation(), 5))
{ {
loc.getWorld().playSound(loc, Sound.FIZZ, 1f, 1f); loc.getWorld().playSound(loc, Sound.FIZZ, 1f, 1f);
} }

View File

@ -443,7 +443,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (dist < radius) if (dist < radius)
{ {
Manager.GetBlockRestore().Add(data.Block, 0, (byte)0, data.Material.getId(), data.Data, (long) (6000 * (dist/radius))); Manager.GetBlockRestore().add(data.Block, 0, (byte) 0, data.Material.getId(), data.Data, (long) (6000 * (dist / radius)));
dataIt.remove(); dataIt.remove();
} }
} }

View File

@ -41,7 +41,7 @@ public class PerkArcticAura extends Perk
for (Block block : blocks.keySet()) for (Block block : blocks.keySet())
{ {
//Snow //Snow
Manager.GetBlockRestore().Snow(block, (byte)1, (byte)1, (long)(duration * (1 + blocks.get(block))), 250, 0); Manager.GetBlockRestore().snow(block, (byte) 1, (byte) 1, (long) (duration * (1 + blocks.get(block))), 250, 0);
} }
for (Player other : Manager.GetGame().GetPlayers(true)) for (Player other : Manager.GetGame().GetPlayers(true))

View File

@ -129,6 +129,6 @@ public class PerkBlizzard extends Perk
if (_snowball.remove(event.getEntity()) == null) if (_snowball.remove(event.getEntity()) == null)
return; return;
Manager.GetBlockRestore().Snow(event.getEntity().getLocation().getBlock(), (byte)1, (byte)7, 2000, 250, 0); Manager.GetBlockRestore().snow(event.getEntity().getLocation().getBlock(), (byte) 1, (byte) 7, 2000, 250, 0);
} }
} }

View File

@ -75,7 +75,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown
if (UtilBlock.usable(grab)) if (UtilBlock.usable(grab))
return; return;
if (!UtilBlock.airFoliage(grab.getRelative(BlockFace.UP)) || Manager.GetBlockRestore().Contains(grab.getRelative(BlockFace.UP))) if (!UtilBlock.airFoliage(grab.getRelative(BlockFace.UP)) || Manager.GetBlockRestore().contains(grab.getRelative(BlockFace.UP)))
{ {
UtilPlayer.message(player, F.main("Game", "You can only pick up blocks with Air above them.")); UtilPlayer.message(player, F.main("Game", "You can only pick up blocks with Air above them."));
return; return;

View File

@ -89,7 +89,7 @@ public class PerkIcePath extends Perk
else else
{ {
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 79); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 79);
Manager.GetBlockRestore().Add(block, 79, (byte)0, 6000); Manager.GetBlockRestore().add(block, 79, (byte) 0, 6000);
} }
} }
} }

View File

@ -66,7 +66,7 @@ public class PerkIronShell extends Perk
if (cur.getY() < block.getLocation().getY()) if (cur.getY() < block.getLocation().getY())
continue; continue;
Manager.GetBlockRestore().Add(cur, 42, (byte)0, 12000); Manager.GetBlockRestore().add(cur, 42, (byte) 0, 12000);
} }

View File

@ -48,7 +48,7 @@ public class PerkSpidersNest extends SmashPerk
if (block.getY() < player.getLocation().getY() - 10) if (block.getY() < player.getLocation().getY() - 10)
continue; continue;
Manager.GetBlockRestore().Add(block, 30, (byte)0, (long) (30000 + 5000 * Math.random())); Manager.GetBlockRestore().add(block, 30, (byte) 0, (long) (30000 + 5000 * Math.random()));
} }
//Regen //Regen

View File

@ -134,6 +134,6 @@ public class PerkWeb extends Perk implements IThrown
Location loc = data.GetThrown().getLocation(); Location loc = data.GetThrown().getLocation();
data.GetThrown().remove(); data.GetThrown().remove();
Manager.GetBlockRestore().Add(loc.getBlock(), 30, (byte)0, 4000); Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 4000);
} }
} }

View File

@ -93,7 +93,7 @@ public class PerkWebShot extends SmashPerk implements IThrown
{ {
data.GetThrown().remove(); data.GetThrown().remove();
Manager.GetBlockRestore().Add(target.getLocation().getBlock(), 30, (byte)0, 3000); Manager.GetBlockRestore().add(target.getLocation().getBlock(), 30, (byte) 0, 3000);
//Damage Event //Damage Event
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
@ -126,6 +126,6 @@ public class PerkWebShot extends SmashPerk implements IThrown
data.GetThrown().remove(); data.GetThrown().remove();
if (data.GetThrown().getTicksLived() > 3) if (data.GetThrown().getTicksLived() > 3)
Manager.GetBlockRestore().Add(loc.getBlock(), 30, (byte)0, 2000); Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 2000);
} }
} }

View File

@ -7,8 +7,6 @@ import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -16,10 +14,8 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
@ -106,6 +102,6 @@ public class PerkWitherWeb extends Perk implements IThrown
data.GetThrown().remove(); data.GetThrown().remove();
if (data.GetThrown().getTicksLived() > 3) if (data.GetThrown().getTicksLived() > 3)
Manager.GetBlockRestore().Add(loc.getBlock(), 30, (byte)0, 3000); Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 3000);
} }
} }

View File

@ -22,7 +22,6 @@ import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -166,7 +165,7 @@ public class PerkWoolBomb extends Perk implements IThrown
//Make Block //Make Block
Block block = thrown.getLocation().getBlock(); Block block = thrown.getLocation().getBlock();
Manager.GetBlockRestore().Restore(block); Manager.GetBlockRestore().restore(block);
_active.put(player, new WoolBombData(block)); _active.put(player, new WoolBombData(block));

View File

@ -10,7 +10,6 @@ import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.kit.SmashPerk;
@ -47,7 +46,7 @@ public class PerkZombieRot extends SmashPerk
continue; continue;
//Snow //Snow
Manager.GetBlockRestore().Add(block, 159, (byte)12, 3000); Manager.GetBlockRestore().add(block, 159, (byte) 12, 3000);
} }
} }

View File

@ -9,7 +9,6 @@ import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilWorld;
import nautilus.game.arcade.kit.perks.PerkFissure; import nautilus.game.arcade.kit.perks.PerkFissure;
import org.bukkit.Effect; import org.bukkit.Effect;
@ -134,11 +133,11 @@ public class FissureData
} }
//Boost Column //Boost Column
if (block.getTypeId() == 1) Host.Manager.GetBlockRestore().Add(block, 4, block.getData(), 14000); if (block.getTypeId() == 1) Host.Manager.GetBlockRestore().add(block, 4, block.getData(), 14000);
if (block.getTypeId() == 2) Host.Manager.GetBlockRestore().Add(block, 3, block.getData(), 14000); if (block.getTypeId() == 2) Host.Manager.GetBlockRestore().add(block, 3, block.getData(), 14000);
if (block.getTypeId() == 98) Host.Manager.GetBlockRestore().Add(block, 98, (byte)2, 14000); if (block.getTypeId() == 98) Host.Manager.GetBlockRestore().add(block, 98, (byte) 2, 14000);
Host.Manager.GetBlockRestore().Add(up, block.getTypeId(), block.getData(), 10000 - (1000 * _height)); Host.Manager.GetBlockRestore().add(up, block.getTypeId(), block.getData(), 10000 - (1000 * _height));
_height++; _height++;
//Effect //Effect