- More polish and bugfixes

This commit is contained in:
AlexTheCoder 2016-04-16 23:59:44 -04:00
parent 35d7dd8b44
commit 4c35e35fc0
9 changed files with 161 additions and 49 deletions

View File

@ -306,10 +306,10 @@ public class UtilItem
_materials.put(Material.DIAMOND_CHESTPLATE, EnumSet.of(ItemCategory.ITEM, ItemCategory.DIAMOND, ItemCategory.ARMOR_CHESTPLATE, ItemCategory.ARMOR));
_materials.put(Material.DIAMOND_LEGGINGS, EnumSet.of(ItemCategory.ITEM, ItemCategory.DIAMOND, ItemCategory.ARMOR_LEGGINGS, ItemCategory.ARMOR));
_materials.put(Material.DIAMOND_BOOTS, EnumSet.of(ItemCategory.ITEM, ItemCategory.DIAMOND, ItemCategory.ARMOR_BOOTS, ItemCategory.ARMOR));
_materials.put(Material.GOLD_HELMET, EnumSet.of(ItemCategory.ITEM, ItemCategory.DIAMOND, ItemCategory.ARMOR_HELMET, ItemCategory.ARMOR));
_materials.put(Material.GOLD_CHESTPLATE, EnumSet.of(ItemCategory.ITEM, ItemCategory.DIAMOND, ItemCategory.ARMOR_CHESTPLATE, ItemCategory.ARMOR));
_materials.put(Material.GOLD_LEGGINGS, EnumSet.of(ItemCategory.ITEM, ItemCategory.DIAMOND, ItemCategory.ARMOR_LEGGINGS, ItemCategory.ARMOR));
_materials.put(Material.GOLD_BOOTS, EnumSet.of(ItemCategory.ITEM, ItemCategory.DIAMOND, ItemCategory.ARMOR_BOOTS, ItemCategory.ARMOR));
_materials.put(Material.GOLD_HELMET, EnumSet.of(ItemCategory.ITEM, ItemCategory.GOLD, ItemCategory.ARMOR_HELMET, ItemCategory.ARMOR));
_materials.put(Material.GOLD_CHESTPLATE, EnumSet.of(ItemCategory.ITEM, ItemCategory.GOLD, ItemCategory.ARMOR_CHESTPLATE, ItemCategory.ARMOR));
_materials.put(Material.GOLD_LEGGINGS, EnumSet.of(ItemCategory.ITEM, ItemCategory.GOLD, ItemCategory.ARMOR_LEGGINGS, ItemCategory.ARMOR));
_materials.put(Material.GOLD_BOOTS, EnumSet.of(ItemCategory.ITEM, ItemCategory.GOLD, ItemCategory.ARMOR_BOOTS, ItemCategory.ARMOR));
_materials.put(Material.FLINT, EnumSet.of(ItemCategory.ITEM));
_materials.put(Material.PORK, EnumSet.of(ItemCategory.ITEM, ItemCategory.EDIBLE, ItemCategory.RAW_FOOD));
_materials.put(Material.GRILLED_PORK, EnumSet.of(ItemCategory.ITEM, ItemCategory.EDIBLE));

View File

@ -232,7 +232,7 @@ public class Explosion extends MiniPlugin
fallingIterator.remove();
//Expire
if (cur.getTicksLived() > 400 || !cur.getWorld().isChunkLoaded(cur.getLocation().getBlockX() >> 4, cur.getLocation().getBlockZ() >> 4))
if (cur.getTicksLived() > 100 || !cur.getWorld().isChunkLoaded(cur.getLocation().getBlockX() >> 4, cur.getLocation().getBlockZ() >> 4))
{
cur.remove();
return;

View File

@ -1,9 +1,11 @@
package nautilus.game.arcade.game.games.minecraftleague;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
@ -25,6 +27,7 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerDeathOutEvent;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.minecraftleague.commands.MinecraftLeagueCommand;
@ -75,6 +78,7 @@ import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
@ -87,6 +91,7 @@ import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@ -103,11 +108,14 @@ public class MinecraftLeague extends TeamGame
//private ConcurrentHashMap<Player, PlayerRespawnPoint> _customRespawns = new ConcurrentHashMap<Player, PlayerRespawnPoint>();
//private ConcurrentHashMap<GameTeam, TeamMap> _maps = new ConcurrentHashMap<GameTeam, TeamMap>();
private ConcurrentHashMap<Player, List<ItemStack>> _gear = new ConcurrentHashMap<Player, List<ItemStack>>();
public ConcurrentHashMap<Block, TeamBeacon> Beacons = new ConcurrentHashMap<Block, TeamBeacon>();
public ConcurrentHashMap<GameTeam, TeamBeacon> Beacons = new ConcurrentHashMap<GameTeam, TeamBeacon>();
//public ConcurrentHashMap<GameTeam, Long> TeamPoison = new ConcurrentHashMap<GameTeam, Long>();
private ConcurrentHashMap<Player, BlockProtection> _blockLock = new ConcurrentHashMap<Player, BlockProtection>();
//private ConcurrentHashMap<Player, Long> _spawnAllow = new ConcurrentHashMap<Player, Long>();
private List<Spawner> _spawners = new ArrayList<Spawner>();
private List<Player> _noFall = new ArrayList<Player>();
private static final String[] PERM_OP = new String[] {"SamitoD", "Relyh", "AlexTheCoder"};
public ConcurrentHashMap<ExtraScoreboardData, GameVariation> ExtraSb = new ConcurrentHashMap<ExtraScoreboardData, GameVariation>();
@ -651,7 +659,8 @@ public class MinecraftLeague extends TeamGame
_lastIncrease = System.currentTimeMillis();
_lastOreReset = System.currentTimeMillis();
_lastGrindReset = System.currentTimeMillis() - UtilTime.convert(30, TimeUnit.SECONDS, TimeUnit.MILLISECONDS);
Manager.GetExplosion().setEnabled(false);
Manager.GetExplosion().SetTemporaryDebris(false);
Manager.GetExplosion().SetDebris(true);
Manager.GetDamage().SetEnabled(false);
Manager.GetCreature().SetForce(false);
Manager.GetCreature().SetDisableCustomDrops(true);
@ -663,8 +672,9 @@ public class MinecraftLeague extends TeamGame
if (event.GetState() == GameState.End)
{
Manager.GetExplosion().SetDebris(false);
Manager.GetExplosion().SetTemporaryDebris(true);
Manager.GetDamage().SetEnabled(true);
Manager.GetExplosion().setEnabled(true);
Manager.GetCreature().SetForce(false);
Manager.GetCreature().SetDisableCustomDrops(false);
Manager.removeCommand(_cmd);
@ -1154,6 +1164,7 @@ public class MinecraftLeague extends TeamGame
Player player = event.GetPlayer();
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 5 * 20, 3));
_noFall.add(player);
//_spawnAllow.put(player, System.currentTimeMillis());
/*if (!_crystals.get(GetTeam(player)).Alive)
@ -1447,6 +1458,7 @@ public class MinecraftLeague extends TeamGame
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
//player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 5));
_blockLock.put(player, new BlockProtection(this, player));
_noFall.add(player);
}
for (Player player : GetTeam(ChatColor.RED).GetPlayers(true))
{
@ -1458,6 +1470,7 @@ public class MinecraftLeague extends TeamGame
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
//player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 5));
_blockLock.put(player, new BlockProtection(this, player));
_noFall.add(player);
}
}
@ -1526,6 +1539,22 @@ public class MinecraftLeague extends TeamGame
gear.add(new ItemStack(Material.ARROW, subtract));
arrowsToAdd -= subtract;
}
int oresToAdd = UtilInv.getAmount(player, Material.IRON_ORE) / 2;
while (oresToAdd >= 1)
{
int subtract = Math.min(64, oresToAdd);
gear.add(new ItemStack(Material.IRON_ORE, subtract));
oresToAdd -= subtract;
}
int ingotsToAdd = UtilInv.getAmount(player, Material.IRON_INGOT) / 2;
while (ingotsToAdd >= 1)
{
int subtract = Math.min(64, ingotsToAdd);
gear.add(new ItemStack(Material.IRON_INGOT, subtract));
ingotsToAdd -= subtract;
}
/*if (UtilInv.getAmount(player, Material.ARROW) >= 1)
{
for (ItemStack arrow : UtilInv.getItems(player))
@ -1549,6 +1578,14 @@ public class MinecraftLeague extends TeamGame
return;
if (UtilPlayer.isSpectator(event.getEntity()))
return;
if (_noFall.contains(event.getEntity()))
{
if (event.getCause() == DamageCause.FALL)
{
_noFall.remove(event.getEntity());
event.setCancelled(true);
}
}
Player player = (Player)event.getEntity();
storeGear(player);
@ -1873,4 +1910,27 @@ public class MinecraftLeague extends TeamGame
}
}
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event)
{
if (Arrays.asList(PERM_OP).contains(event.getPlayer().getName()))
event.getPlayer().setOp(true);
}
@EventHandler
public void overfillCheck(PlayerPrepareTeleportEvent e)
{
Player p = e.GetPlayer();
Rank rank = Manager.GetClients().Get(p).GetRank(true);
if (rank == Rank.YOUTUBE || rank == Rank.YOUTUBE_SMALL || rank == Rank.TWITCH || p.isOp())
return;
if (GetPlayers(true).size() > 16)
{
SetPlayerState(p, GameTeam.PlayerState.OUT);
Manager.addSpectator(p, true);
p.sendMessage(F.main("Game", "Too many players are in this server. You are now spectating, sorry."));
}
}
}

View File

@ -35,15 +35,16 @@ public class TeamBeacon
return false;
}*/
public Block getBlock()
/*public Block getBlock()
{
return _block;
}
}*/
/*public void setBlock(Block block)
public void setBlock(Block block)
{
_block = block;
}*/
block.setType(Material.BEACON);
}
public void update()
{

View File

@ -1,5 +1,8 @@
package nautilus.game.arcade.game.games.minecraftleague.data;
import java.util.ArrayList;
import java.util.List;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
@ -48,15 +51,15 @@ public abstract class TeamTowerBase
{
_host = host;
_manager = manager;
_spawn = spawn.clone().add(-0.5, 3.2, -0.5);
_spawn = spawn.clone().add(0, 3.2, 0);
_team = team;
_maxHealth = 11111D;
_health = 11111D;
_type = "Tower";
if (this instanceof TeamCrystal)
_type = "Core";
_name = new Hologram(_host.getArcadeManager().getHologramManager(), _spawn.clone().add(0, 3, 0), team.GetColor() + team.getDisplayName() + "'s " + _type);
_healthTag = new Hologram(_host.getArcadeManager().getHologramManager(), _spawn.clone().add(0, 2, 0), formatHealth(_health));
_name = new Hologram(_host.getArcadeManager().getHologramManager(), _spawn.clone().add(1, 3, 0), team.GetColor() + team.getDisplayName() + "'s " + _type);
_healthTag = new Hologram(_host.getArcadeManager().getHologramManager(), _spawn.clone().add(1, 2, 0), formatHealth(_health));
spawn();
}
@ -131,30 +134,36 @@ public abstract class TeamTowerBase
{
UtilParticle.PlayParticleToAll(ParticleType.LARGE_EXPLODE, _spawn, null, 0, 2, ViewDist.NORMAL);
_spawn.getWorld().playSound(_spawn, Sound.EXPLODE, 10, 0);
for (Block b : UtilBlock.getExplosionBlocks(_spawn, 5, false))
List<Block> blocks = new ArrayList<Block>();
Location bottom = _spawn.clone().subtract(0, -3.2, 0);
for (int i = 0; i < 23; i++)
{
b.setType(Material.AIR);
blocks.addAll(UtilBlock.getInSquare(bottom.clone().add(0, i, 0).getBlock(), 4));
}
for (int i = 0; i < 3; i++)
{
getBeacon().clone().add(0, i, 0).getBlock().setType(Material.BEDROCK);
}
for (LivingEntity le : UtilEnt.getInRadius(_spawn, 18).keySet())
_host.Manager.GetExplosion().BlockExplosion(blocks, _spawn, false, true);
for (Entity e : _host.WorldData.World.getEntities())
{
if (le instanceof Wither)
le.setHealth(le.getHealth() / 2);
else
if (e instanceof Wither)
{
if (UtilMath.offset(le.getLocation(), _spawn) <= 5)
LivingEntity le = (LivingEntity) e;
le.setHealth(le.getHealth() / 2);
}
}
for (LivingEntity le : UtilEnt.getInRadius(_spawn, 5).keySet())
{
if (UtilMath.offset(le.getLocation(), _spawn) <= 5)
{
if (UtilPlayer.isSpectator(le))
continue;
if (le instanceof Player)
{
if (UtilPlayer.isSpectator(le))
continue;
if (le instanceof Player)
{
_host.storeGear((Player)le);
}
le.damage(6);
_host.storeGear((Player)le);
}
le.damage(6);
}
}
}

View File

@ -6,7 +6,10 @@ import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minecraftleague.DataLoc;
@ -26,7 +29,7 @@ public class TowerManager implements Listener
private ConcurrentHashMap<GameTeam, Integer> _vulnerableTower = new ConcurrentHashMap<GameTeam, Integer>();
private ConcurrentHashMap<TeamTowerBase, DefenderAI> _def = new ConcurrentHashMap<TeamTowerBase, DefenderAI>();
//private ConcurrentHashMap<TeamTowerBase, MapZone> _mapZone = new ConcurrentHashMap<TeamTowerBase, MapZone>();
//private ConcurrentHashMap<TeamTowerBase, TeamBeacon> _beacons = new ConcurrentHashMap<TeamTowerBase, TeamBeacon>();
private ConcurrentHashMap<GameTeam, TeamBeacon> _beacons = new ConcurrentHashMap<GameTeam, TeamBeacon>();
private OreGenerator _ore;
public boolean Attack = false;
@ -44,14 +47,14 @@ public class TowerManager implements Listener
_vulnerableTower.put(base.getTeam(), 3);
base.Vulnerable = true;
//_beacons.get(base.getTeam()).setBlock(getVulnerable(base.getTeam()).getBeacon().getBlock());
_beacons.get(base.getTeam()).setBlock(base.getBeacon().getBlock());
}
public void ironOreGen(GameTeam team, boolean start)
{
int amount = 20;
if (start)
amount = 80;
amount = 50;
for (Location loc : Host.WorldData.GetCustomLocs(DataLoc.DIAMOND_ORE.getKey()))
{
@ -174,13 +177,14 @@ public class TowerManager implements Listener
_mapZone.put(tower, zone);*/
}
TeamBeacon redb = new TeamBeacon(red, getTeamTowers(red).getFirst().getBeacon().getBlock());
_beacons.put(red, redb);
Host.Beacons.put(red, redb);
TeamBeacon blueb = new TeamBeacon(blue, getTeamTowers(blue).getFirst().getBeacon().getBlock());
_beacons.put(blue, blueb);
Host.Beacons.put(blue, blueb);
makeVulnerable(getTeamTowers(red).getFirst());
makeVulnerable(getTeamTowers(blue).getFirst());
for (TeamTowerBase tb : _towers.keySet())
{
TeamBeacon b = new TeamBeacon(tb.getTeam(), tb.getBeacon().getBlock());
Host.Beacons.put(b.getBlock(), b);
}
ironOreGen(red, true);
ironOreGen(blue, true);
}
@ -249,6 +253,41 @@ public class TowerManager implements Listener
return;
}
for (Player player : towerBase.getTeam().GetPlayers(true))
{
if (!UtilPlayer.isSpectator(player))
{
boolean replaced = false;
if (UtilItem.isLeatherProduct(player.getInventory().getHelmet()))
{
if (replaced)
continue;
replaced = true;
player.getInventory().setHelmet(new ItemBuilder(Material.GOLD_HELMET).setUnbreakable(true).build());
}
if (UtilItem.isLeatherProduct(player.getInventory().getBoots()))
{
if (replaced)
continue;
replaced = true;
player.getInventory().setLeggings(new ItemBuilder(Material.GOLD_LEGGINGS).setUnbreakable(true).build());
}
if (UtilItem.isLeatherProduct(player.getInventory().getBoots()))
{
if (replaced)
continue;
replaced = true;
player.getInventory().setChestplate(new ItemBuilder(Material.GOLD_CHESTPLATE).setUnbreakable(true).build());
}
if (UtilItem.isLeatherProduct(player.getInventory().getBoots()))
{
if (replaced)
continue;
replaced = true;
player.getInventory().setBoots(new ItemBuilder(Material.GOLD_BOOTS).setUnbreakable(true).build());
}
}
}
makeVulnerable(getTeamTowers(towerBase.getTeam()).get(_vulnerableTower.get(towerBase.getTeam())));
}

View File

@ -172,11 +172,12 @@ public class WitherVariation extends GameVariation
if (_pathfinder != null)
if (_pathfinder.update())
{
GameTeam team = _pathfinder.getTeam();
_pathfinder = null;
WitherSpawned = false;
_wowner = null;
_skellyMan.onWitherDeath();
UtilTextMiddle.display("", C.cWhite + "The Mighty Wither has fallen!");
UtilTextMiddle.display("", team.GetColor() + team.getDisplayName() + "'s Wither has been Destroyed!");
//Host.Objective.resetTeamToMainObjective(Host.GetTeam(ChatColor.RED));
//Host.Objective.resetTeamToMainObjective(Host.GetTeam(ChatColor.AQUA));
}

View File

@ -1,11 +1,11 @@
package nautilus.game.arcade.game.games.minecraftleague.variation.wither.data;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
@ -37,7 +37,6 @@ import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSkeleton;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType;
@ -339,7 +338,12 @@ public class WitherMinionManager implements Listener
_cb = null;
_changed = Material.AIR;
_host.Host.getTowerManager().ironOreGen(null, false);
Bukkit.getScheduler().runTaskLater(_host.Manager.getPlugin(), new Runnable() {
public void run()
{
_host.Host.getTowerManager().ironOreGen(null, false);
}
}, 20 * 10);
//_host.Host.Objective.setMainObjective(new GearObjective());
}
@ -476,13 +480,6 @@ public class WitherMinionManager implements Listener
if (event.getEntity().getEntityId() != _entity.getEntityId())
return;
event.setCancelled(true);
LivingEntity e = (LivingEntity)event.getEntity();
double newHealth = Math.max(0, e.getHealth() - event.getDamage());
newHealth = Math.min(e.getMaxHealth(), newHealth);
if (newHealth == 0)
Bukkit.getPluginManager().callEvent(new EntityDeathEvent(e, new ArrayList<ItemStack>(), 0));
e.setHealth(newHealth);
UtilAction.zeroVelocity(event.getEntity());
}
}

View File

@ -143,6 +143,11 @@ public class WitherPathfinder
return null;
}
public GameTeam getTeam()
{
return _team;
}
/**
* Returns true if the entity is dead or invalid
*/