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:
commit
c75f22b5e0
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -27,6 +27,11 @@ public class UtilMath
|
||||
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)
|
||||
{
|
||||
return offset2d(a.getLocation().toVector(), b.getLocation().toVector());
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.common.block;
|
||||
package mineplex.core.blockrestore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@ -8,6 +8,8 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import mineplex.core.common.block.BlockData;
|
||||
|
||||
public class BlockDataRunnable implements Runnable
|
||||
{
|
||||
private JavaPlugin _plugin;
|
||||
@ -18,12 +20,12 @@ public class BlockDataRunnable implements Runnable
|
||||
private int _blocksPerTick;
|
||||
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;
|
||||
_changedBlocks = new ArrayList<BlockData>();
|
||||
_started = false;
|
||||
_blocksPerTick = 400;
|
||||
_blocksPerTick = blocksPerTick;
|
||||
_onComplete = onComplete;
|
||||
_blockIterator = blockIterator;
|
||||
}
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -26,28 +27,31 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
public class BlockRestore extends MiniPlugin
|
||||
{
|
||||
private HashMap<Block, BlockRestoreData> _blocks = new HashMap<Block, BlockRestoreData>();
|
||||
private LinkedList<BlockRestoreMap> _restoreMaps;
|
||||
|
||||
public BlockRestore(JavaPlugin plugin)
|
||||
{
|
||||
super("Block Restore", plugin);
|
||||
|
||||
_restoreMaps = new LinkedList<BlockRestoreMap>();
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOW)
|
||||
public void Piston(BlockPistonExtendEvent event)
|
||||
public void piston(BlockPistonExtendEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
@ -60,7 +64,7 @@ public class BlockRestore extends MiniPlugin
|
||||
if (push.getType() == Material.AIR)
|
||||
return;
|
||||
|
||||
if (Contains(push))
|
||||
if (contains(push))
|
||||
{
|
||||
push.getWorld().playEffect(push.getLocation(), Effect.STEP_SOUND, push.getTypeId());
|
||||
event.setCancelled(true);
|
||||
@ -70,7 +74,7 @@ public class BlockRestore extends MiniPlugin
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ExpireBlocks(UpdateEvent event)
|
||||
public void expireBlocks(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
@ -86,15 +90,15 @@ public class BlockRestore extends MiniPlugin
|
||||
_blocks.remove(cur);
|
||||
}
|
||||
|
||||
public void Restore(Block block)
|
||||
public void restore(Block block)
|
||||
{
|
||||
if (!Contains(block))
|
||||
if (!contains(block))
|
||||
return;
|
||||
|
||||
_blocks.remove(block).restore();
|
||||
}
|
||||
|
||||
public void RestoreAll()
|
||||
public void restoreAll()
|
||||
{
|
||||
for (BlockRestoreData data : _blocks.values())
|
||||
data.restore();
|
||||
@ -102,7 +106,7 @@ public class BlockRestore extends MiniPlugin
|
||||
_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>();
|
||||
|
||||
@ -128,26 +132,26 @@ public class BlockRestore extends MiniPlugin
|
||||
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));
|
||||
else GetData(block).update(toID, toData, expireTime);
|
||||
if (!contains(block)) getBlocks().put(block, new BlockRestoreData(block, toID, toData, fromID, fromData, expireTime, 0));
|
||||
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
|
||||
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 == -1) Snow(block.getRelative(BlockFace.UP), heightAdd, heightMax, expireTime, meltDelay, -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);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -187,30 +191,57 @@ public class BlockRestore extends MiniPlugin
|
||||
heightAdd = 0;
|
||||
|
||||
//Snow
|
||||
if (!Contains(block))
|
||||
GetBlocks().put(block, new BlockRestoreData(block, 78, (byte)Math.max(0, heightAdd-1), block.getTypeId(), block.getData(), expireTime, meltDelay));
|
||||
if (!contains(block))
|
||||
getBlocks().put(block, new BlockRestoreData(block, 78, (byte) Math.max(0, heightAdd - 1), block.getTypeId(), block.getData(), expireTime, meltDelay));
|
||||
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;
|
||||
|
||||
for (BlockRestoreMap restoreMap : _restoreMaps)
|
||||
{
|
||||
if (restoreMap.contains(block))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public BlockRestoreData GetData(Block block)
|
||||
public BlockRestoreData getData(Block block)
|
||||
{
|
||||
if (_blocks.containsKey(block))
|
||||
return _blocks.get(block);
|
||||
return null;
|
||||
}
|
||||
|
||||
public HashMap<Block, BlockRestoreData> GetBlocks()
|
||||
public HashMap<Block, BlockRestoreData> getBlocks()
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -134,7 +134,7 @@ public class Explosion extends MiniPlugin
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
_blockRestore.Add(block, cur.getBlockId(), cur.getBlockData(), 10000);
|
||||
_blockRestore.add(block, cur.getBlockId(), cur.getBlockData(), 10000);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -96,9 +96,9 @@ public class ItemPaintballGun extends ItemGadget
|
||||
continue;
|
||||
|
||||
if (block.getType() == Material.CARPET)
|
||||
Manager.getBlockRestore().Add(block, 171, color, 4000);
|
||||
Manager.getBlockRestore().add(block, 171, color, 4000);
|
||||
else
|
||||
Manager.getBlockRestore().Add(block, 35, color, 4000);
|
||||
Manager.getBlockRestore().add(block, 35, color, 4000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,11 @@ public class Clans extends JavaPlugin
|
||||
new FriendManager(this, _clientManager, preferenceManager, portal);
|
||||
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 Farming(this);
|
||||
new BuildingShop(_clansManager, _clientManager, _donationManager);
|
||||
@ -113,10 +117,6 @@ public class Clans extends JavaPlugin
|
||||
((CraftWorld) world).getHandle().spigotConfig.itemMerge = 0;
|
||||
}
|
||||
|
||||
// Enable custom-gear related managers
|
||||
PacketHandler packetHandler = new PacketHandler(this);
|
||||
GearManager customGear = new GearManager(this, packetHandler);
|
||||
|
||||
//Updates
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
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
|
||||
|
@ -156,9 +156,9 @@ public class ClansGame extends MiniPlugin
|
||||
{
|
||||
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)
|
||||
{
|
||||
data.setFromId(0);
|
||||
|
@ -40,8 +40,9 @@ import mineplex.game.clans.clans.commands.ClansAllyChatCommand;
|
||||
import mineplex.game.clans.clans.commands.ClansChatCommand;
|
||||
import mineplex.game.clans.clans.commands.ClansCommand;
|
||||
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.tokens.ClanMemberToken;
|
||||
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.safelog.LoggingManager;
|
||||
import mineplex.game.clans.gameplay.safelog.npc.NPCManager;
|
||||
import mineplex.game.clans.items.GearManager;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
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[] {
|
||||
"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);
|
||||
|
||||
@ -149,7 +151,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
new Spawn(plugin);
|
||||
new NPCManager(this);
|
||||
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);
|
||||
|
||||
@ -176,7 +178,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
|
||||
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())
|
||||
{
|
||||
@ -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
|
||||
// This is so that we can prevent any permanent world changes with events
|
||||
_blockRestore.onDisable();
|
||||
_worldEvent.onDisable();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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());
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package mineplex.game.clans.clans.loot;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
public interface ILoot
|
||||
{
|
||||
public void dropLoot(Location location);
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -20,6 +20,7 @@ import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
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.event.UpdateEvent;
|
||||
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.event.EventState;
|
||||
import mineplex.game.clans.clans.worldevent.event.WorldEvent;
|
||||
@ -42,11 +44,13 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
||||
private ClansManager _clansManager;
|
||||
private EventTerrainFinder _terrainFinder;
|
||||
private DamageManager _damageManager;
|
||||
private LootManager _lootManager;
|
||||
private BlockRestore _blockRestore;
|
||||
|
||||
private long _lastEventEnd;
|
||||
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);
|
||||
|
||||
@ -54,6 +58,8 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
||||
_terrainFinder = new EventTerrainFinder(this, clansManager);
|
||||
_clansManager = clansManager;
|
||||
_damageManager = damageManager;
|
||||
_lootManager = lootManager;
|
||||
_blockRestore = blockRestore;
|
||||
_events = new LinkedList<WorldEvent>();
|
||||
_lastEventEnd = System.currentTimeMillis();
|
||||
updateNextEventTime();
|
||||
@ -80,12 +86,14 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
WorldEvent worldEvent = iterator.next();
|
||||
if (worldEvent.getState() == EventState.COMPLETE)
|
||||
if (worldEvent.getState() == EventState.COMPLETE || worldEvent.getState() == EventState.CANCELLED)
|
||||
{
|
||||
worldEvent.cleanup(false);
|
||||
HandlerList.unregisterAll(worldEvent);
|
||||
iterator.remove();
|
||||
|
||||
// If the event was cancelled, we don't need to run a cleanup
|
||||
if (worldEvent.getState() == EventState.COMPLETE) worldEvent.cleanup();
|
||||
|
||||
removed = true;
|
||||
_lastEventEnd = System.currentTimeMillis();
|
||||
}
|
||||
@ -119,12 +127,12 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
||||
|
||||
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)
|
||||
{
|
||||
WorldEventType[] types = WorldEventType.values();
|
||||
WorldEvent worldEvent = types[_random.nextInt(types.length)].createInstance(this, location);
|
||||
initializeEvent(worldEvent);
|
||||
initializeEvent(type.createInstance(this, location));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -179,6 +187,11 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
||||
return _damageManager;
|
||||
}
|
||||
|
||||
public LootManager getLoot()
|
||||
{
|
||||
return _lootManager;
|
||||
}
|
||||
|
||||
public EventTerrainFinder getTerrainFinder()
|
||||
{
|
||||
return _terrainFinder;
|
||||
@ -227,6 +240,11 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
||||
return output;
|
||||
}
|
||||
|
||||
public BlockRestore getBlockRestore()
|
||||
{
|
||||
return _blockRestore;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void gear(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
|
@ -24,6 +24,11 @@ public enum WorldEventType
|
||||
_areaNeeded = areaNeeded;
|
||||
}
|
||||
|
||||
public int getAreaNeeded()
|
||||
{
|
||||
return _areaNeeded;
|
||||
}
|
||||
|
||||
public WorldEvent createInstance(WorldEventManager eventManager, Location centerLocation)
|
||||
{
|
||||
WorldEvent worldEvent = null;
|
||||
|
@ -7,6 +7,9 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
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 mineplex.core.common.util.C;
|
||||
@ -246,7 +249,34 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
|
||||
updateEntityHealth();
|
||||
|
||||
applyDamage(event.GetDamage());
|
||||
updateName();
|
||||
|
||||
_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);
|
||||
}
|
||||
}
|
||||
|
@ -5,5 +5,6 @@ public enum EventState
|
||||
PREPARE,
|
||||
LIVE,
|
||||
UNLOADING,
|
||||
COMPLETE
|
||||
COMPLETE,
|
||||
CANCELLED
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package mineplex.game.clans.clans.worldevent.event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@ -12,14 +11,16 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
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.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
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.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.worldevent.EventMap;
|
||||
@ -61,7 +62,7 @@ public abstract class WorldEvent implements Listener
|
||||
_ticks = 0;
|
||||
|
||||
_creatures = new ArrayList<EventCreature>();
|
||||
_blocks = new BlockRestoreMap();
|
||||
_blocks = eventManager.getBlockRestore().createMap();
|
||||
_lastActive = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@ -72,10 +73,10 @@ public abstract class WorldEvent implements Listener
|
||||
|
||||
protected abstract void customStart();
|
||||
|
||||
public final void cleanup(boolean quick)
|
||||
public final void cleanup()
|
||||
{
|
||||
clearCreatures();
|
||||
restoreBlocks(quick);
|
||||
restoreBlocks();
|
||||
customCleanup();
|
||||
}
|
||||
|
||||
@ -86,11 +87,16 @@ public abstract class WorldEvent implements Listener
|
||||
|
||||
public final void cancel()
|
||||
{
|
||||
cleanup(true);
|
||||
setState(EventState.COMPLETE);
|
||||
cleanup();
|
||||
setState(EventState.CANCELLED);
|
||||
customCancel();
|
||||
}
|
||||
|
||||
protected final void triggerEnd()
|
||||
{
|
||||
setState(EventState.COMPLETE);
|
||||
}
|
||||
|
||||
protected void customCancel()
|
||||
{
|
||||
|
||||
@ -131,6 +137,11 @@ public abstract class WorldEvent implements Listener
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
protected Random getRandom()
|
||||
{
|
||||
return _random;
|
||||
@ -160,7 +171,9 @@ public abstract class WorldEvent implements Listener
|
||||
|
||||
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()
|
||||
@ -174,17 +187,10 @@ public abstract class WorldEvent implements Listener
|
||||
_creatures.clear();
|
||||
}
|
||||
|
||||
public void restoreBlocks(boolean quick)
|
||||
{
|
||||
if (quick)
|
||||
public void restoreBlocks()
|
||||
{
|
||||
_blocks.restore();
|
||||
}
|
||||
else
|
||||
{
|
||||
_blocks.restoreTopDown(_eventManager.getPlugin());
|
||||
}
|
||||
}
|
||||
|
||||
public long getLastActive()
|
||||
{
|
||||
@ -234,7 +240,7 @@ public abstract class WorldEvent implements Listener
|
||||
|
||||
public void setBlock(Block block, int id, byte data)
|
||||
{
|
||||
_blocks.setBlock(block, id, data);
|
||||
_blocks.set(block, id, data);
|
||||
}
|
||||
|
||||
public ArrayList<String> getScoreboardLines()
|
||||
@ -269,10 +275,16 @@ public abstract class WorldEvent implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPhysics(BlockPhysicsEvent event)
|
||||
public void prepareTimeout(UpdateEvent event)
|
||||
{
|
||||
Bukkit.broadcastMessage(event.getBlock().getType() + "" );
|
||||
if (_blocks.getChangedBlocks().contains(event.getBlock()))
|
||||
event.setCancelled(true);
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
if (getState() != EventState.PREPARE)
|
||||
return;
|
||||
|
||||
// Event was preparing for more than 5 minutes
|
||||
if (getTicks() > 6000)
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -5,18 +5,22 @@ import org.bukkit.material.MaterialData;
|
||||
|
||||
public enum CampType
|
||||
{
|
||||
OAK(new MaterialData(Material.LOG, (byte) 0), new MaterialData(Material.WOOD, (byte) 0)),
|
||||
SPRUCE(new MaterialData(Material.LOG, (byte) 1), new MaterialData(Material.WOOD, (byte) 1)),
|
||||
BIRCH(new MaterialData(Material.LOG, (byte) 2), new MaterialData(Material.WOOD, (byte) 2)),
|
||||
JUNGLE(new MaterialData(Material.LOG, (byte) 3), new MaterialData(Material.WOOD, (byte) 3));
|
||||
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), Material.ENDER_CHEST, Material.BURNING_FURNACE),
|
||||
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), Material.ENDER_CHEST, Material.BURNING_FURNACE);
|
||||
|
||||
private MaterialData _log;
|
||||
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;
|
||||
_wood = wood;
|
||||
_chest = chest;
|
||||
_furance = furnace;
|
||||
}
|
||||
|
||||
public MaterialData getLog()
|
||||
@ -28,4 +32,14 @@ public enum CampType
|
||||
{
|
||||
return _wood;
|
||||
}
|
||||
|
||||
public Material getFurnace()
|
||||
{
|
||||
return _furance;
|
||||
}
|
||||
|
||||
public Material getChest()
|
||||
{
|
||||
return _chest;
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,32 @@
|
||||
package mineplex.game.clans.clans.worldevent.event.undead;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.event.EventHandler;
|
||||
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.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.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.event.EventState;
|
||||
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
|
||||
{
|
||||
private int _mod = 4;
|
||||
private int _areaSize = 30;
|
||||
private int _hutLeft = 0;
|
||||
private int _poleLeft = 0;
|
||||
private int _towerLeft = 0;
|
||||
private int _undeadCount = 0;
|
||||
|
||||
private int _hutCur = 0;
|
||||
private int _poleCur = 0;
|
||||
private int _towerCur = 0;
|
||||
|
||||
private int _hutMax = 0;
|
||||
private int _poleMax = 0;
|
||||
private int _towerMax = 0;
|
||||
|
||||
private int _minZombie = 0;
|
||||
|
||||
private CampType _campType;
|
||||
private final CampType _campType;
|
||||
private final CampSize _campSize;
|
||||
private HashSet<Block> _chests;
|
||||
|
||||
public UndeadCamp(WorldEventManager eventManager, Location centerLocation)
|
||||
{
|
||||
super(eventManager, "Undead Camp", centerLocation);
|
||||
|
||||
_areaSize = (int) (8 * _mod);
|
||||
|
||||
_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;
|
||||
_campSize = CampSize.getCampSize(UtilServer.getPlayers().length);
|
||||
_campType = CampType.values()[getRandom().nextInt(CampType.values().length)];
|
||||
_chests = new HashSet<Block>();
|
||||
|
||||
_hutLeft = _campSize.generateHutCount();
|
||||
_poleLeft = _campSize.generatePoleCount();
|
||||
_towerLeft = _campSize.generateTowerCount();
|
||||
_undeadCount = _campSize.generateUndeadCount();
|
||||
|
||||
setName(_campSize.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -60,17 +69,16 @@ public class UndeadCamp extends WorldEvent
|
||||
@Override
|
||||
protected void customTick()
|
||||
{
|
||||
System.out.println("tick");
|
||||
if (getState() == EventState.PREPARE)
|
||||
{
|
||||
if (_hutCur < _hutMax) createHut();
|
||||
else if (getCreatures().size() < _minZombie) createZombie();
|
||||
else if (_towerCur < _towerMax) createTower();
|
||||
else if (_poleCur < _poleMax) createLamp();
|
||||
|
||||
if (_hutLeft > 0) createHut();
|
||||
else if (_towerLeft > 0) createTower();
|
||||
else if (_poleLeft > 0) createLamp();
|
||||
else if (getCreatures().size() < _undeadCount) createUndead();
|
||||
else
|
||||
{
|
||||
System.out.println("Constructed " + getName() + " at " + UtilWorld.locToStrClean(getCenterLocation()) + ".");
|
||||
announceStart();
|
||||
setState(EventState.LIVE);
|
||||
}
|
||||
}
|
||||
@ -84,7 +92,7 @@ public class UndeadCamp extends WorldEvent
|
||||
|
||||
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)
|
||||
return;
|
||||
@ -150,7 +158,7 @@ public class UndeadCamp extends WorldEvent
|
||||
}
|
||||
}
|
||||
|
||||
_hutCur++;
|
||||
_hutLeft--;
|
||||
}
|
||||
|
||||
private void addChest(Block chest)
|
||||
@ -208,21 +216,21 @@ public class UndeadCamp extends WorldEvent
|
||||
|
||||
private void addFurnace(Block chest)
|
||||
{
|
||||
setBlock(chest, 61, (byte) (UtilMath.r(4) + 2));
|
||||
// _chests.add(chest);
|
||||
setBlock(chest, Material.BURNING_FURNACE, (byte) (UtilMath.r(4) + 2));
|
||||
_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)
|
||||
return;
|
||||
|
||||
registerCreature(new UndeadWarrior(this, loc.add(0.5, 0.5, 0.5)));
|
||||
|
||||
_poleCur++;
|
||||
// _poleLeft--;
|
||||
// ResetIdleTicks();
|
||||
}
|
||||
|
||||
@ -234,7 +242,7 @@ public class UndeadCamp extends WorldEvent
|
||||
|
||||
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)
|
||||
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)));
|
||||
}
|
||||
|
||||
_towerCur++;
|
||||
_towerLeft--;
|
||||
}
|
||||
|
||||
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)
|
||||
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).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
|
||||
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))
|
||||
{
|
||||
setBlock(event.getBlock(), Material.AIR);
|
||||
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") + "!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,13 @@
|
||||
package mineplex.game.clans.clans.worldevent.event.undead.creature;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
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.event.WorldEvent;
|
||||
|
||||
@ -16,12 +21,36 @@ public class UndeadArcher extends EventCreature<Skeleton>
|
||||
@Override
|
||||
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
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,17 @@ package mineplex.game.clans.clans.worldevent.event.undead.creature;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
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.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.worldevent.creature.EventCreature;
|
||||
import mineplex.game.clans.clans.worldevent.event.WorldEvent;
|
||||
|
||||
@ -32,23 +38,51 @@ public class UndeadWarrior extends EventCreature<Zombie>
|
||||
public void dieCustom()
|
||||
{
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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));
|
||||
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.IRON_BOOTS));
|
||||
|
||||
for (int i=0 ; i<UtilMath.r(5) + 1 ; i++)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
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.DamageManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
@ -12,7 +11,6 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
@ -24,9 +22,7 @@ import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
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.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Gameplay extends MiniPlugin
|
||||
@ -76,14 +71,14 @@ public class Gameplay extends MiniPlugin
|
||||
if (event.getBucket() == Material.WATER_BUCKET)
|
||||
{
|
||||
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());
|
||||
}
|
||||
|
||||
if (event.getBucket() == Material.LAVA_BUCKET)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@ public class WeightSet<T>
|
||||
|
||||
private Set<Weight<T>> _weights;
|
||||
|
||||
private WeightSet()
|
||||
public WeightSet()
|
||||
{
|
||||
_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()
|
||||
{
|
||||
int total = 0;
|
||||
|
@ -248,7 +248,7 @@ public class WorldManager extends MiniPlugin
|
||||
for (Block block : UtilBlock.getInRadius(player.getLocation(), 3d).keySet())
|
||||
{
|
||||
if (block.getType() == Material.PUMPKIN)
|
||||
Manager.GetBlockRestore().Add(block, 91, block.getData(), 2000);
|
||||
Manager.GetBlockRestore().add(block, 91, block.getData(), 2000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -284,7 +283,7 @@ public class BlockToss extends SkillCharge implements IThrown
|
||||
block.setTypeIdAndData(0, (byte)0, false);
|
||||
|
||||
//Block Replace
|
||||
Factory.BlockRestore().Add(block, fall.getBlockId(), (byte)0, 10000);
|
||||
Factory.BlockRestore().add(block, fall.getBlockId(), (byte) 0, 10000);
|
||||
|
||||
//Effect
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||
|
@ -3,8 +3,6 @@ package mineplex.minecraft.game.classcombat.Skill.Mage;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
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.UtilParticle.ParticleType;
|
||||
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.SkillFactory;
|
||||
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.getLocation().getY() <= cur.getLocation().getY())
|
||||
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
|
||||
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 (!Factory.BlockRestore().Contains(cur.getEyeLocation().getBlock()))
|
||||
if (!Factory.BlockRestore().contains(cur.getEyeLocation().getBlock()))
|
||||
continue;
|
||||
|
||||
Player damager = null;
|
||||
|
@ -181,7 +181,7 @@ public class Blizzard extends SkillActive
|
||||
HashMap<Block, Double> blocks = UtilBlock.getInRadius(target.getLocation(), 2d, 1);
|
||||
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
|
||||
@ -221,7 +221,7 @@ public class Blizzard extends SkillActive
|
||||
if (_snowball.remove(event.getEntity()) == null)
|
||||
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
|
||||
|
@ -127,11 +127,11 @@ public class FissureData
|
||||
}
|
||||
|
||||
//Boost Column
|
||||
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() == 98) Host.Factory.BlockRestore().Add(block, 98, (byte)2, 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() == 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++;
|
||||
|
||||
//Effect
|
||||
|
@ -121,7 +121,7 @@ public class FreezingBlast extends SkillActive implements IThrown
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,9 @@ package mineplex.minecraft.game.classcombat.Skill.Mage;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -154,7 +152,7 @@ public class IcePrison extends SkillActive implements IThrown
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,8 @@
|
||||
package mineplex.minecraft.game.classcombat.Skill.Mage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Item;
|
||||
@ -22,14 +19,10 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
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.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||
@ -297,7 +290,7 @@ public class LifeBonds extends Skill
|
||||
if (cur.getItemStack().getData() != null)
|
||||
data = cur.getItemStack().getData().getData();
|
||||
|
||||
Factory.BlockRestore().Add(block, cur.getItemStack().getTypeId(), data, 2000);
|
||||
Factory.BlockRestore().add(block, cur.getItemStack().getTypeId(), data, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class Web extends ItemUsable
|
||||
if (!UtilBlock.airFoliage(ent.getLocation().getBlock()))
|
||||
return;
|
||||
|
||||
Factory.BlockRestore().Add(ent.getLocation().getBlock(), 30, (byte)0, 6000);
|
||||
Factory.BlockRestore().add(ent.getLocation().getBlock(), 30, (byte) 0, 6000);
|
||||
|
||||
ent.remove();
|
||||
}
|
||||
|
@ -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,
|
||||
ViewDist.LONG, UtilServer.getPlayers());
|
||||
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
|
||||
|
@ -582,7 +582,7 @@ public class DragonEscape extends SoloGame
|
||||
|
||||
_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);
|
||||
}
|
||||
@ -593,7 +593,7 @@ public class DragonEscape extends SoloGame
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
Manager.GetBlockRestore().Add(event.getBlock(),
|
||||
Manager.GetBlockRestore().add(event.getBlock(),
|
||||
event.getPlayer().getItemInHand().getType().getId(), event.getPlayer().getItemInHand().getData().getData(),
|
||||
event.getBlockReplacedState().getTypeId(), event.getBlockReplacedState().getRawData(), 2400);
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
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.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilBlockText;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
|
||||
@ -104,18 +102,18 @@ public abstract class WaveBase
|
||||
|
||||
//Beacon
|
||||
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 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
|
||||
while (block.getY() < 250)
|
||||
{
|
||||
block = block.getRelative(BlockFace.UP);
|
||||
if (block.getType() != Material.AIR)
|
||||
Host.Manager.GetBlockRestore().Add(block, 0, (byte)0, _duration);
|
||||
Host.Manager.GetBlockRestore().add(block, 0, (byte) 0, _duration);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -2109,7 +2108,7 @@ public class MineStrike extends TeamGame
|
||||
|
||||
//Incendiary
|
||||
_incendiary.clear();
|
||||
Manager.GetBlockRestore().RestoreAll();
|
||||
Manager.GetBlockRestore().restoreAll();
|
||||
|
||||
//Restock Ammo
|
||||
for (Gun gun : _gunsEquipped.keySet())
|
||||
|
@ -74,7 +74,7 @@ public abstract class FireGrenadeBase extends Grenade
|
||||
public void run()
|
||||
{
|
||||
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)));
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class Smoke extends Grenade
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class PerkArcticAura extends Perk
|
||||
for (Block block : blocks.keySet())
|
||||
{
|
||||
//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))
|
||||
|
@ -129,6 +129,6 @@ public class PerkBlizzard extends Perk
|
||||
if (_snowball.remove(event.getEntity()) == null)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown
|
||||
if (UtilBlock.usable(grab))
|
||||
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."));
|
||||
return;
|
||||
|
@ -89,7 +89,7 @@ public class PerkIcePath extends Perk
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class PerkIronShell extends Perk
|
||||
if (cur.getY() < block.getLocation().getY())
|
||||
continue;
|
||||
|
||||
Manager.GetBlockRestore().Add(cur, 42, (byte)0, 12000);
|
||||
Manager.GetBlockRestore().add(cur, 42, (byte) 0, 12000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class PerkSpidersNest extends SmashPerk
|
||||
if (block.getY() < player.getLocation().getY() - 10)
|
||||
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
|
||||
|
@ -134,6 +134,6 @@ public class PerkWeb extends Perk implements IThrown
|
||||
Location loc = data.GetThrown().getLocation();
|
||||
data.GetThrown().remove();
|
||||
|
||||
Manager.GetBlockRestore().Add(loc.getBlock(), 30, (byte)0, 4000);
|
||||
Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 4000);
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class PerkWebShot extends SmashPerk implements IThrown
|
||||
{
|
||||
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
|
||||
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
|
||||
@ -126,6 +126,6 @@ public class PerkWebShot extends SmashPerk implements IThrown
|
||||
data.GetThrown().remove();
|
||||
|
||||
if (data.GetThrown().getTicksLived() > 3)
|
||||
Manager.GetBlockRestore().Add(loc.getBlock(), 30, (byte)0, 2000);
|
||||
Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 2000);
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,6 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
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.util.Vector;
|
||||
|
||||
@ -16,10 +14,8 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
@ -106,6 +102,6 @@ public class PerkWitherWeb extends Perk implements IThrown
|
||||
data.GetThrown().remove();
|
||||
|
||||
if (data.GetThrown().getTicksLived() > 3)
|
||||
Manager.GetBlockRestore().Add(loc.getBlock(), 30, (byte)0, 3000);
|
||||
Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 3000);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -166,7 +165,7 @@ public class PerkWoolBomb extends Perk implements IThrown
|
||||
//Make Block
|
||||
Block block = thrown.getLocation().getBlock();
|
||||
|
||||
Manager.GetBlockRestore().Restore(block);
|
||||
Manager.GetBlockRestore().restore(block);
|
||||
|
||||
_active.put(player, new WoolBombData(block));
|
||||
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.kit.SmashPerk;
|
||||
@ -47,7 +46,7 @@ public class PerkZombieRot extends SmashPerk
|
||||
continue;
|
||||
|
||||
//Snow
|
||||
Manager.GetBlockRestore().Add(block, 159, (byte)12, 3000);
|
||||
Manager.GetBlockRestore().add(block, 159, (byte) 12, 3000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import nautilus.game.arcade.kit.perks.PerkFissure;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
@ -134,11 +133,11 @@ public class FissureData
|
||||
}
|
||||
|
||||
//Boost Column
|
||||
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() == 98) Host.Manager.GetBlockRestore().Add(block, 98, (byte)2, 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() == 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++;
|
||||
|
||||
//Effect
|
||||
|
Loading…
Reference in New Issue
Block a user