More s k y w a r s
This commit is contained in:
parent
0aef15992a
commit
0934239e0c
@ -17,7 +17,6 @@ import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowball;
|
||||
@ -38,8 +37,6 @@ import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.ItemDespawnEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -51,19 +48,12 @@ import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
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.UtilEvent;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.explosion.ExplosionEvent;
|
||||
import mineplex.core.loot.ChestLoot;
|
||||
import mineplex.core.loot.RandomItem;
|
||||
@ -88,8 +78,11 @@ import nautilus.game.arcade.game.games.skywars.kits.KitEarth;
|
||||
import nautilus.game.arcade.game.games.skywars.kits.KitFire;
|
||||
import nautilus.game.arcade.game.games.skywars.kits.KitIce;
|
||||
import nautilus.game.arcade.game.games.skywars.kits.KitMetal;
|
||||
import nautilus.game.arcade.game.modules.compass.CompassModule;
|
||||
import nautilus.game.arcade.game.games.skywars.modes.kits.KitElementalist;
|
||||
import nautilus.game.arcade.game.games.skywars.module.ZombieGuardianModule;
|
||||
import nautilus.game.arcade.game.modules.EnderPearlModule;
|
||||
import nautilus.game.arcade.game.modules.MapCrumbleModule;
|
||||
import nautilus.game.arcade.game.modules.compass.CompassModule;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.ore.OreHider;
|
||||
|
||||
@ -140,23 +133,23 @@ public abstract class Skywars extends Game
|
||||
private ChestLoot _middleBooks = new ChestLoot();
|
||||
private ChestLoot _middleMisc = new ChestLoot();
|
||||
|
||||
private Enchantment[] _armorEnchantments = new Enchantment[] { Enchantment.PROTECTION_ENVIRONMENTAL, Enchantment.PROTECTION_PROJECTILE, Enchantment.PROTECTION_FIRE, Enchantment.THORNS };
|
||||
private Enchantment[] _toolEnchantments = new Enchantment[] { Enchantment.DIG_SPEED, Enchantment.DURABILITY, Enchantment.LOOT_BONUS_BLOCKS };
|
||||
private Enchantment[] _swordEnchantments = new Enchantment[] { Enchantment.DAMAGE_ALL, Enchantment.FIRE_ASPECT, Enchantment.KNOCKBACK };
|
||||
private Enchantment[] _bowEnchantments = new Enchantment[] { Enchantment.ARROW_DAMAGE, Enchantment.ARROW_FIRE, Enchantment.ARROW_KNOCKBACK };
|
||||
private Enchantment[] _armorEnchantments = new Enchantment[] {Enchantment.PROTECTION_ENVIRONMENTAL, Enchantment.PROTECTION_PROJECTILE, Enchantment.PROTECTION_FIRE, Enchantment.THORNS};
|
||||
private Enchantment[] _toolEnchantments = new Enchantment[] {Enchantment.DIG_SPEED, Enchantment.DURABILITY, Enchantment.LOOT_BONUS_BLOCKS};
|
||||
private Enchantment[] _swordEnchantments = new Enchantment[] {Enchantment.DAMAGE_ALL, Enchantment.FIRE_ASPECT, Enchantment.KNOCKBACK};
|
||||
private Enchantment[] _bowEnchantments = new Enchantment[] {Enchantment.ARROW_DAMAGE, Enchantment.ARROW_FIRE, Enchantment.ARROW_KNOCKBACK};
|
||||
|
||||
private HashMap<Enchantment, Integer> _commonBookEnchantments = new HashMap<Enchantment, Integer>();
|
||||
private HashMap<Enchantment, Integer> _rareBookEnchantments = new HashMap<Enchantment, Integer>();
|
||||
|
||||
public Skywars(ArcadeManager manager, GameType type, String[] description)
|
||||
{
|
||||
this(manager, new Kit[] {
|
||||
new KitIce(manager),
|
||||
new KitFire(manager),
|
||||
new KitAir(manager),
|
||||
this(manager, new Kit[] {
|
||||
new KitIce(manager),
|
||||
new KitFire(manager),
|
||||
new KitAir(manager),
|
||||
new KitMetal(manager),
|
||||
new KitEarth(manager),
|
||||
}, type, description);
|
||||
new KitEarth(manager),
|
||||
}, type, description);
|
||||
}
|
||||
|
||||
public Skywars(ArcadeManager manager, Kit[] kits, GameType type, String[] description)
|
||||
@ -203,7 +196,7 @@ public abstract class Skywars extends Game
|
||||
PrepareTime = 10000L;
|
||||
|
||||
DontAllowOverfill = true;
|
||||
|
||||
|
||||
StrictAntiHack = true;
|
||||
|
||||
_oreHider = new OreHider();
|
||||
@ -212,6 +205,9 @@ public abstract class Skywars extends Game
|
||||
|
||||
};
|
||||
|
||||
new EnderPearlModule()
|
||||
.register(this);
|
||||
|
||||
setAlreadyAnnounced(false);
|
||||
setupBookEnchantments();
|
||||
setupPlayerLoot();
|
||||
@ -228,6 +224,14 @@ public abstract class Skywars extends Game
|
||||
parseCreatePlayerChests();
|
||||
parseCreatePlayerWebs();
|
||||
|
||||
new MapCrumbleModule()
|
||||
.setEnabled(true)
|
||||
.register(this);
|
||||
|
||||
new ZombieGuardianModule()
|
||||
.addSpawns(WorldData.GetDataLocs("RED"))
|
||||
.register(this);
|
||||
|
||||
for (Location oreLoc : WorldData.GetCustomLocs("56"))
|
||||
{
|
||||
oreLoc.getBlock().setType(Material.STONE);
|
||||
@ -245,50 +249,21 @@ public abstract class Skywars extends Game
|
||||
_tntGen = new TNTGenerator(this, loc);
|
||||
}
|
||||
|
||||
// Register Blocks
|
||||
for (int y = WorldData.MinY; y < WorldData.MaxY; y++)
|
||||
{
|
||||
for (int x = WorldData.MinX; x < WorldData.MaxX; x++)
|
||||
{
|
||||
for (int z = WorldData.MinZ; z < WorldData.MaxZ; z++)
|
||||
{
|
||||
Block block = WorldData.World.getBlockAt(x, y, z);
|
||||
if ((block.getType() != Material.AIR) && (!block.isLiquid()))
|
||||
{
|
||||
_worldBlocks.add(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void parseCreateZombieSpawns()
|
||||
{
|
||||
// Zombies
|
||||
for (Location loc : WorldData.GetDataLocs("RED"))
|
||||
{
|
||||
// Spawn
|
||||
CreatureAllowOverride = true;
|
||||
Zombie zombie = (Zombie) loc.getWorld().spawn(loc, Zombie.class);
|
||||
zombie.setRemoveWhenFarAway(false);
|
||||
zombie.setCustomName(C.cDRed + "Zombie Guardian");
|
||||
zombie.setCustomNameVisible(true);
|
||||
zombie.setMaxHealth(15);
|
||||
zombie.setHealth(15);
|
||||
CreatureAllowOverride = false;
|
||||
|
||||
// Armor - Make sure the player can't get it!
|
||||
zombie.getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET));
|
||||
zombie.getEquipment().setHelmetDropChance(0F);
|
||||
zombie.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE));
|
||||
zombie.getEquipment().setChestplateDropChance(0F);
|
||||
zombie.getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS));
|
||||
zombie.getEquipment().setLeggingsDropChance(0F);
|
||||
zombie.getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS));
|
||||
zombie.getEquipment().setBootsDropChance(0F);
|
||||
|
||||
_zombies.put(zombie, loc);
|
||||
}
|
||||
// // Register Blocks
|
||||
// for (int y = WorldData.MinY; y < WorldData.MaxY; y++)
|
||||
// {
|
||||
// for (int x = WorldData.MinX; x < WorldData.MaxX; x++)
|
||||
// {
|
||||
// for (int z = WorldData.MinZ; z < WorldData.MaxZ; z++)
|
||||
// {
|
||||
// Block block = WorldData.World.getBlockAt(x, y, z);
|
||||
// if ((block.getType() != Material.AIR) && (!block.isLiquid()))
|
||||
// {
|
||||
// _worldBlocks.add(block);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void parseCreateMiddleChests()
|
||||
@ -309,16 +284,16 @@ public abstract class Skywars extends Game
|
||||
private void parseCreateConnectorChests()
|
||||
{
|
||||
Iterator<Location> iterator = WorldData.GetDataLocs("GRAY").iterator();
|
||||
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Location loc = iterator.next();
|
||||
|
||||
|
||||
loc.getBlock().setTypeIdAndData(Material.CHEST.getId(), (byte) UtilMath.r(4), true);
|
||||
|
||||
_connectorChests.add(loc.getBlock());
|
||||
_worldBlocks.add(loc.getBlock());
|
||||
|
||||
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
@ -416,136 +391,27 @@ public abstract class Skywars extends Game
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdateCrumble(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_worldBlocks.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilTime.elapsed(GetStateTime(), _crumbleTime))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!alreadyAnnounced())
|
||||
{
|
||||
Announce(C.cGreenB + "As time passes, the world begins to crumble...");
|
||||
Player[] arrayOfPlayer;
|
||||
int j = (arrayOfPlayer = UtilServer.getPlayers()).length;
|
||||
for (int i = 0; i < j; i++)
|
||||
{
|
||||
Player player = arrayOfPlayer[i];
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 3.0F, 1.0F);
|
||||
}
|
||||
setAlreadyAnnounced(true);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Block bestBlock = null;
|
||||
double bestDist = 0.0D;
|
||||
for (Block block : _worldBlocks)
|
||||
{
|
||||
double dist = UtilMath.offset2d(GetSpectatorLocation(), block.getLocation().add(0.5D, 0.5D, 0.5D));
|
||||
if ((bestBlock == null) || (dist > bestDist))
|
||||
{
|
||||
bestBlock = block;
|
||||
bestDist = dist;
|
||||
}
|
||||
}
|
||||
while (bestBlock.getRelative(BlockFace.DOWN).getType() != Material.AIR)
|
||||
{
|
||||
bestBlock = bestBlock.getRelative(BlockFace.DOWN);
|
||||
}
|
||||
_worldBlocks.remove(bestBlock);
|
||||
if (bestBlock.getWorld() == WorldData.World && bestBlock.getType() != Material.AIR)
|
||||
{
|
||||
if (Math.random() > 0.95D)
|
||||
{
|
||||
bestBlock.getWorld().spawnFallingBlock(bestBlock.getLocation().add(0.5D, 0.5D, 0.5D), bestBlock.getType(), bestBlock.getData());
|
||||
}
|
||||
if (bestBlock.getType() == Material.WOODEN_DOOR || bestBlock.getType() == Material.IRON_DOOR_BLOCK)
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(bestBlock.getRelative(BlockFace.UP).getLocation(), Material.AIR);
|
||||
}
|
||||
MapUtil.QuickChangeBlockAt(bestBlock.getLocation(), Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdateChickens(UpdateEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
if (!UtilTime.elapsed(_lastChicken, 45000))
|
||||
return;
|
||||
|
||||
if (!UtilTime.elapsed(this.GetStateTime(), 5000))
|
||||
return;
|
||||
|
||||
CreatureAllowOverride = true;
|
||||
for (Location loc : GetTeamList().get(0).GetSpawns())
|
||||
{
|
||||
Chicken chicken = loc.getWorld().spawn(loc.clone().add(0, 1, 0), Chicken.class);
|
||||
|
||||
if (Math.random() > 0.75)
|
||||
chicken.setBaby();
|
||||
|
||||
chicken.setMaxHealth(4);
|
||||
chicken.setHealth(4);
|
||||
}
|
||||
CreatureAllowOverride = false;
|
||||
|
||||
_lastChicken = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameStateChangeLeap(GameStateChangeEvent event)
|
||||
public void informLeapCooldown(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String message = F.main("Game", "Your " + F.skill("Leap") + " is on a 30 second cooldown.");
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (GetKit(player) instanceof KitAir || GetKit(player) instanceof KitElementalist)
|
||||
Kit kit = GetKit(player);
|
||||
|
||||
if (kit instanceof KitAir || kit instanceof KitElementalist)
|
||||
{
|
||||
player.sendMessage(F.main("Game", "Your " + F.skill("Leap") + " is on a 30 second cooldown."));
|
||||
player.sendMessage(message);
|
||||
Recharge.Instance.use(player, "Leap", 30000, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameStateChangeMapWarning(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
if (WorldData.MapName.equals("Sahara"))
|
||||
{
|
||||
UtilTextMiddle.display(C.cRed + "Warning", "Red Sand is Unstable", 10, 60, 20);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameStateChangeCreateOres(GameStateChangeEvent event)
|
||||
{
|
||||
@ -702,12 +568,6 @@ public abstract class Skywars extends Game
|
||||
_tntMap.put(tnt, player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onItemDespawn(ItemDespawnEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdateTNTCannon(UpdateEvent e)
|
||||
{
|
||||
@ -720,60 +580,6 @@ public abstract class Skywars extends Game
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdateZombie(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
Iterator<Zombie> zombieIter = _zombies.keySet().iterator();
|
||||
|
||||
while (zombieIter.hasNext())
|
||||
{
|
||||
Zombie zombie = zombieIter.next();
|
||||
|
||||
if (!zombie.isValid())
|
||||
{
|
||||
zombieIter.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
Location loc = _zombies.get(zombie);
|
||||
|
||||
if (zombie.getTarget() == null || UtilMath.offset(zombie.getLocation(), loc) > 8)
|
||||
{
|
||||
zombie.setTarget(null);
|
||||
UtilEnt.CreatureMove(zombie, loc, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityTargetLivingEntity(EntityTargetLivingEntityEvent event)
|
||||
{
|
||||
if (event.getTarget() != null && event.getEntity() instanceof Zombie && _zombies.containsKey((Zombie) event.getEntity()))
|
||||
{
|
||||
Zombie zombie = (Zombie) event.getEntity();
|
||||
Location loc = _zombies.get(zombie);
|
||||
|
||||
if (UtilMath.offset(event.getTarget().getLocation(), loc) > 8)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
zombie.setTarget(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityCombust(EntityCombustEvent event)
|
||||
{
|
||||
if ((event.getEntity() instanceof Zombie))
|
||||
{
|
||||
event.setDuration(0);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBurn(BlockBurnEvent event)
|
||||
{
|
||||
@ -926,7 +732,7 @@ public abstract class Skywars extends Game
|
||||
event.AddMod(event.GetDamagerPlayer(true).getName(), (event.GetProjectile() instanceof Egg ? "Egg" : "Snowball"), 2, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void fillChest(Player looter, Block block)
|
||||
{
|
||||
_lootedBlocks.add(block.getLocation());
|
||||
@ -944,12 +750,12 @@ public abstract class Skywars extends Game
|
||||
for (int i = 0; i < 1 + UtilMath.r(2); i++)
|
||||
{
|
||||
ItemStack itemStack = _playerArmor.getLoot();
|
||||
|
||||
|
||||
for (Enchantment enchantment : Enchantment.values())
|
||||
{
|
||||
itemStack.removeEnchantment(enchantment);
|
||||
}
|
||||
|
||||
|
||||
if (UtilMath.r(2) == 0)
|
||||
{
|
||||
itemStack.addEnchantment(_armorEnchantments[UtilMath.r(_armorEnchantments.length - 1)], UtilMath.r(2) + 1);
|
||||
@ -965,12 +771,12 @@ public abstract class Skywars extends Game
|
||||
for (int i = 0; i < 1 + UtilMath.r(2); i++)
|
||||
{
|
||||
ItemStack itemStack = _playerTool.getLoot();
|
||||
|
||||
|
||||
for (Enchantment enchantment : Enchantment.values())
|
||||
{
|
||||
itemStack.removeEnchantment(enchantment);
|
||||
}
|
||||
|
||||
|
||||
if (UtilMath.r(2) == 0)
|
||||
{
|
||||
if (UtilItem.isSword(itemStack))
|
||||
@ -983,7 +789,7 @@ public abstract class Skywars extends Game
|
||||
}
|
||||
else if (UtilItem.isAxe(itemStack))
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else if (UtilItem.isTool(itemStack))
|
||||
{
|
||||
@ -1012,12 +818,12 @@ public abstract class Skywars extends Game
|
||||
for (int i = 0; i < 1 + UtilMath.r(2); i++)
|
||||
{
|
||||
ItemStack itemStack = _connectorArmor.getLoot();
|
||||
|
||||
|
||||
for (Enchantment enchantment : Enchantment.values())
|
||||
{
|
||||
itemStack.removeEnchantment(enchantment);
|
||||
}
|
||||
|
||||
|
||||
if (UtilMath.r(2) == 0)
|
||||
{
|
||||
itemStack.addEnchantment(_armorEnchantments[UtilMath.r(_armorEnchantments.length - 1)], UtilMath.r(2) + 1);
|
||||
@ -1329,58 +1135,6 @@ public abstract class Skywars extends Game
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onProjectileLaunch(ProjectileLaunchEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (!(event.getEntity() instanceof EnderPearl))
|
||||
return;
|
||||
|
||||
if (event.getEntity().getShooter() == null)
|
||||
return;
|
||||
|
||||
if (!(event.getEntity().getShooter() instanceof Player))
|
||||
return;
|
||||
|
||||
Player shooter = (Player) event.getEntity().getShooter();
|
||||
|
||||
_pearlMap.put(event.getEntity(), shooter);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onProjectileHit(ProjectileHitEvent event)
|
||||
{
|
||||
if (_pearlMap.get(event.getEntity()) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = _pearlMap.get(event.getEntity());
|
||||
Location playerLocation = player.getLocation();
|
||||
Location entityLocation = event.getEntity().getLocation();
|
||||
float yaw = playerLocation.getYaw();
|
||||
float pitch = playerLocation.getPitch();
|
||||
|
||||
player.setFallDistance(0);
|
||||
player.teleport(new Location(player.getWorld(), entityLocation.getX(), entityLocation.getY(), entityLocation.getZ(), yaw, pitch));
|
||||
|
||||
_pearlMap.remove(event.getEntity());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdatePeral(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Entity entity : _pearlMap.keySet())
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, entity.getLocation(), 0f, 0f, 0f, 0f, 1, ViewDist.MAX, UtilServer.getPlayers());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCombatDeathEventLevels(CombatDeathEvent event)
|
||||
{
|
||||
|
@ -21,8 +21,6 @@ import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.world.WorldData;
|
||||
|
||||
public class MapCrumbleModule extends Module
|
||||
@ -38,14 +36,9 @@ public class MapCrumbleModule extends Module
|
||||
_worldBlocks = new HashSet<>(100000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void readWorld(GameStateChangeEvent event)
|
||||
@Override
|
||||
protected void setup()
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WorldData worldData = getGame().WorldData;
|
||||
|
||||
getGame().getArcadeManager().runSyncTimer(new BukkitRunnable()
|
||||
@ -72,7 +65,7 @@ public class MapCrumbleModule extends Module
|
||||
|
||||
Bukkit.broadcastMessage("Blocks = " + _worldBlocks.size() + " - " + y);
|
||||
|
||||
if (++y == worldData.MaxY)
|
||||
if (y++ == worldData.MaxY)
|
||||
{
|
||||
cancel();
|
||||
Bukkit.broadcastMessage("Done");
|
||||
@ -100,7 +93,10 @@ public class MapCrumbleModule extends Module
|
||||
|
||||
public MapCrumbleModule addWorldBlock(Block block)
|
||||
{
|
||||
_worldBlocks.add(block);
|
||||
if (block.getWorld().equals(getGame().WorldData.World))
|
||||
{
|
||||
_worldBlocks.add(block);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -117,7 +113,7 @@ public class MapCrumbleModule extends Module
|
||||
for (int i = 0; i < _rate; i++)
|
||||
{
|
||||
Block bestBlock = null;
|
||||
double bestDist = 0.0D;
|
||||
double bestDist = 0;
|
||||
|
||||
for (Block block : _worldBlocks)
|
||||
{
|
||||
@ -168,7 +164,7 @@ public class MapCrumbleModule extends Module
|
||||
return;
|
||||
}
|
||||
|
||||
_worldBlocks.add(event.getBlock());
|
||||
addWorldBlock(event.getBlock());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -190,6 +186,6 @@ public class MapCrumbleModule extends Module
|
||||
return;
|
||||
}
|
||||
|
||||
_worldBlocks.add(event.getBlock());
|
||||
addWorldBlock(event.getBlock());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
package nautilus.game.arcade.game.modules.generator;
|
||||
|
||||
public class Generator
|
||||
{
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package nautilus.game.arcade.game.modules.generator;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
|
||||
import nautilus.game.arcade.game.modules.Module;
|
||||
|
||||
public class GeneratorModule extends Module
|
||||
{
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package nautilus.game.arcade.game.modules.generator;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
|
||||
public class GeneratorType
|
||||
{
|
||||
|
||||
private final ItemStack _itemStack;
|
||||
private final ChatColor _colour;
|
||||
private final boolean _flashName;
|
||||
private final FireworkEffect _effect;
|
||||
|
||||
public GeneratorType(ItemStack itemStack, ChatColor chatColour, Color bukkitColour, boolean flashName)
|
||||
{
|
||||
_itemStack = itemStack;
|
||||
_colour = chatColour;
|
||||
_flashName = flashName;
|
||||
_effect = FireworkEffect.builder()
|
||||
.with(Type.BURST)
|
||||
.withColor(bukkitColour)
|
||||
.build();
|
||||
}
|
||||
|
||||
final void collect(Generator generator)
|
||||
{
|
||||
Location location =
|
||||
UtilFirework.playFirework(ge, _effect);
|
||||
}
|
||||
|
||||
public void collect(Player player)
|
||||
{
|
||||
player.getInventory().addItem(_itemStack);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user