- Huuuuuuuge amount of changes for chiss

This commit is contained in:
AlexTheCoder 2016-04-14 22:45:21 -04:00
parent 4ae4f056ea
commit 33b557eb10
24 changed files with 766 additions and 224 deletions

View File

@ -1,5 +1,6 @@
package mineplex.core.common.util;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Projectile;
import org.bukkit.event.block.Action;
@ -46,6 +47,15 @@ public class UtilEvent
return false;
}
public static boolean isBowDamage(EntityDamageEvent event)
{
if (!(event instanceof EntityDamageByEntityEvent))
return false;
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent)event;
return e.getDamager() instanceof Arrow;
}
public static LivingEntity GetDamagerEntity(EntityDamageEvent event, boolean ranged)
{
if (!(event instanceof EntityDamageByEntityEvent))

View File

@ -164,6 +164,25 @@ public enum Achievement
new int[]{10},
AchievementCategory.UHC),
//Minecraft League
MINECRAFT_LEAGUE_STRIKE("First Strike", 600,
new String[] {"Minecraft League.FirstStrike"},
new String[] {"Earn 30 First Bloods"},
new int[] {30},
AchievementCategory.MINECRAFT_LEAGUE),
MINECRAFT_LEAGUE_HEAD("Head Hunter", 600,
new String[] {"Minecraft League.HeadHunter"},
new String[] {"Grab 25 Wither Skulls"},
new int[] {25},
AchievementCategory.MINECRAFT_LEAGUE),
MINECRAFT_LEAGUE_ALTAR("Altar Builder", 600,
new String[] {"Minecraft League.AltarBuilder"},
new String[] {"Place 50 Wither Skulls", "on your Altar"},
new int[] {50},
AchievementCategory.MINECRAFT_LEAGUE),
//UHC
WIZARDS_WINS("Supreme Wizard", 600,
new String[]{"Wizards.Wins"},

View File

@ -6,6 +6,7 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTime;
import mineplex.core.game.GameCategory;
import mineplex.core.game.GameDisplay;
import mineplex.core.stats.PlayerStats;
import mineplex.core.stats.StatsManager;
@ -49,6 +50,10 @@ public enum AchievementCategory
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, "None"),
MINECRAFT_LEAGUE("Minecraft League", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.IRON_CHESTPLATE, 0, GameCategory.SURVIVAL, "None"),
WIZARDS("Wizards", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Witch Doctor Kit"),

View File

@ -114,6 +114,11 @@ public class CombatManager extends MiniPlugin
break;
}
if (UtilEvent.isBowDamage(event))
{
cause = "Bow";
}
if (damagerEnt instanceof Player)
{
if (event.getCause() == DamageCause.ENTITY_ATTACK)

View File

@ -17,6 +17,8 @@ public enum DataLoc
BLUE_ORE("14"),
DIAMOND_ORE("56"),
COAL_ORE("16"),
MOSH_IRON("129"),
GRIND_AREA(" GRIND"),
//Wither
WITHER_WAYPOINT("PURPLE"),

View File

@ -6,7 +6,6 @@ import java.util.concurrent.ConcurrentHashMap;
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.UtilInv;
import mineplex.core.common.util.UtilItem;
@ -24,9 +23,9 @@ import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.ArcadeManager;
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.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.minecraftleague.commands.MinecraftLeagueCommand;
import nautilus.game.arcade.game.games.minecraftleague.commands.freeze.FreezeManager;
@ -39,9 +38,10 @@ import nautilus.game.arcade.game.games.minecraftleague.data.TeamTowerBase;
import nautilus.game.arcade.game.games.minecraftleague.data.TowerAlert;
import nautilus.game.arcade.game.games.minecraftleague.data.TowerManager;
import nautilus.game.arcade.game.games.minecraftleague.data.map.ItemMapManager;
import nautilus.game.arcade.game.games.minecraftleague.data.objectives.GearObjective;
import nautilus.game.arcade.game.games.minecraftleague.kit.KitPlayer;
import nautilus.game.arcade.game.games.minecraftleague.objective.ObjectiveManager;
import nautilus.game.arcade.game.games.minecraftleague.tracker.AltarBuilderTracker;
import nautilus.game.arcade.game.games.minecraftleague.tracker.FirstStrikeTracker;
import nautilus.game.arcade.game.games.minecraftleague.tracker.HeadHunterTracker;
import nautilus.game.arcade.game.games.minecraftleague.variation.ExtraScoreboardData;
import nautilus.game.arcade.game.games.minecraftleague.variation.GameVariation;
import nautilus.game.arcade.game.games.minecraftleague.variation.VariationManager;
@ -54,12 +54,13 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.block.BlockFace;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
@ -67,6 +68,8 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
@ -80,6 +83,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
@ -87,9 +91,10 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.material.Dispenser;
import org.bukkit.material.MaterialData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import com.google.common.base.Objects;
@ -99,6 +104,7 @@ public class MinecraftLeague extends TeamGame
//private ConcurrentHashMap<GameTeam, TeamMap> _maps = new ConcurrentHashMap<GameTeam, TeamMap>();
private ConcurrentHashMap<Player, List<ItemStack>> _gear = new ConcurrentHashMap<Player, List<ItemStack>>();
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>();
@ -116,12 +122,12 @@ public class MinecraftLeague extends TeamGame
public boolean OverTime = false;
private VariationManager _vman;
public ObjectiveManager Objective;
//public ObjectiveManager Objective;
private FreezeManager _freeze;
private TowerManager _tower;
public TowerAlert Alert;
private final EntityType[] _passive = new EntityType[] {EntityType.CHICKEN, EntityType.COW, EntityType.PIG, EntityType.RABBIT, EntityType.SHEEP};
//private final EntityType[] _passive = new EntityType[] {EntityType.CHICKEN, EntityType.COW, EntityType.PIG, EntityType.RABBIT, EntityType.SHEEP};
public MinecraftLeague(ArcadeManager manager)
{
@ -141,12 +147,12 @@ public class MinecraftLeague extends TeamGame
C.cWhite + "Last team standing wins",
});
this.DeathOut = false;
this.DeathOut = true;
this.DamageSelf = false;
this.DeathSpectateSecs = 5;
this.DeathSpectateSecs = 10;
this.WorldBoundaryKill = true;
this.DeathDropItems = true;
this.CreatureAllow = true;
this.CreatureAllow = false;
this.HungerSet = 20;
this.BlockBreak = true;
@ -181,11 +187,13 @@ public class MinecraftLeague extends TeamGame
registerStatTrackers(
new AltarBuilderTracker(this),
new FirstStrikeTracker(this),
new HeadHunterTracker(this)
);
_vman = new VariationManager(this);
Objective = new ObjectiveManager(this);
//Objective = new ObjectiveManager(this);
_freeze = new FreezeManager();
_tower = new TowerManager(this);
Alert = new TowerAlert();
@ -617,12 +625,12 @@ public class MinecraftLeague extends TeamGame
_lastOreReset = System.currentTimeMillis();
Manager.GetExplosion().setEnabled(false);
Manager.GetDamage().SetEnabled(false);
Manager.GetCreature().SetForce(true);
Manager.GetCreature().SetForce(false);
Manager.GetCreature().SetDisableCustomDrops(true);
_cmd = new MinecraftLeagueCommand(Manager, this);
Manager.addCommand(_cmd);
Manager.getGameChatManager().TeamSpy = false;
Objective.setMainObjective(new GearObjective());
//Objective.setMainObjective(new GearObjective());
}
if (event.GetState() == GameState.End)
@ -734,20 +742,26 @@ public class MinecraftLeague extends TeamGame
//Alert.update();
/*for (GameTeam dmg : TeamPoison.keySet())
{
if (UtilTime.elapsed(TeamPoison.get(dmg), UtilTime.convert(1, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
{
TeamPoison.put(dmg, System.currentTimeMillis());
for (Player player : dmg.GetPlayers(true))
{
this.storeGear(player);
player.damage(1);
}
}
}*/
if (UtilTime.elapsed(_lastOreReset, UtilTime.convert(5, TimeUnit.MINUTES, TimeUnit.MILLISECONDS)))
{
_lastOreReset = System.currentTimeMillis();
for (Location loc : WorldData.GetCustomLocs(DataLoc.DIAMOND_ORE.getKey()))
{
loc.getBlock().setType(Material.DIAMOND_ORE);
}
for (Location loc : WorldData.GetCustomLocs(DataLoc.COAL_ORE.getKey()))
{
loc.getBlock().setType(Material.COAL_ORE);
}
_tower.ironOreGen(GetTeam(ChatColor.RED));
_tower.ironOreGen(GetTeam(ChatColor.AQUA));
UtilTextMiddle.display("", C.cGold + "All Ores have been refreshed!");
}
if (!OverTime)
@ -762,7 +776,34 @@ public class MinecraftLeague extends TeamGame
if (UtilTime.elapsed(_lastIncrease, UtilTime.convert(5, TimeUnit.MINUTES, TimeUnit.MILLISECONDS)))
{
_lastIncrease = System.currentTimeMillis();
this.DeathSpectateSecs = Math.max(0, this.DeathSpectateSecs + 2.5);
this.DeathSpectateSecs = Math.min(20, this.DeathSpectateSecs + 2.5);
}
for (Location grind : WorldData.GetCustomLocs(DataLoc.GRIND_AREA.getKey()))
{
int spider = 0;
int chicken = 0;
for (LivingEntity le : UtilEnt.getInRadius(grind, 15).keySet())
{
if (le.getType() == EntityType.SPIDER)
spider++;
if (le.getType() == EntityType.CHICKEN)
chicken++;
}
while (spider < 5)
{
spider++;
CreatureAllowOverride = true;
Manager.GetCreature().SpawnEntity(grind, EntityType.SPIDER);
CreatureAllowOverride = false;
}
while (chicken < 10)
{
chicken++;
CreatureAllowOverride = true;
Manager.GetCreature().SpawnEntity(grind, EntityType.CHICKEN);
CreatureAllowOverride = false;
}
}
/*for (Player player : _spawnAllow.keySet())
@ -852,10 +893,10 @@ public class MinecraftLeague extends TeamGame
if (!tower.canDamage(player))
return;
if (!tower.Vulnerable)
//if (!tower.Vulnerable)
{
UtilPlayer.message(player, F.main("Game", "That Tower is protected by the power of another!"));
return;
//UtilPlayer.message(player, F.main("Game", "That Tower is protected by the power of another!"));
//return;
}
if (!tower.damage(event.getDamage() / 2, player))
@ -873,10 +914,10 @@ public class MinecraftLeague extends TeamGame
if (!tower.canDamage(player))
return;
if (!tower.Vulnerable)
//if (!tower.Vulnerable)
{
UtilPlayer.message(player, F.main("Game", "That Tower is protected by the power of another!"));
return;
//UtilPlayer.message(player, F.main("Game", "That Tower is protected by the power of another!"));
//return;
}
if (player.getItemInHand() == null || player.getItemInHand().getType() == Material.AIR)
@ -936,6 +977,27 @@ public class MinecraftLeague extends TeamGame
_customRespawns.put(player, new PlayerRespawnPoint(player, event.getClickedBlock().getLocation()));
}*/
private boolean isLocked(Block block)
{
for (BlockProtection prot : _blockLock.values())
{
if (prot.hasBlock(block))
return true;
}
return false;
}
private Player getOwner(Block block)
{
for (Player player : _blockLock.keySet())
{
if (_blockLock.get(player).hasBlock(block))
return player;
}
return null;
}
private boolean isLockedTo(Block block, Player to, boolean ignoreTeam)
{
for (BlockProtection prot : _blockLock.values())
@ -963,7 +1025,7 @@ public class MinecraftLeague extends TeamGame
return;
Block block = event.getBlock();
if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST || block.getType() == Material.FURNACE)
if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST || block.getType() == Material.FURNACE || block.getType() == Material.BURNING_FURNACE)
_blockLock.get(event.getPlayer()).lockBlock(block);
}
@ -973,11 +1035,17 @@ public class MinecraftLeague extends TeamGame
if (!IsLive())
return;
if (isLockedTo(event.getBlock(), event.getPlayer(), true))
_blockLock.get(event.getPlayer()).unlockBlock(event.getBlock());
if (!isLocked(event.getBlock()))
return;
if (!isLockedTo(event.getBlock(), event.getPlayer(), false))
_blockLock.get(getOwner(event.getBlock())).unlockBlock(event.getBlock());
else
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "That container is locked by " + getOwner(event.getBlock()).getName() + "!"));
event.setCancelled(true);
}
}
@EventHandler
public void tryOpen(PlayerInteractEvent event)
@ -999,11 +1067,21 @@ public class MinecraftLeague extends TeamGame
Block block = event.getClickedBlock();
if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST || block.getType() == Material.FURNACE)
if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST || block.getType() == Material.FURNACE || block.getType() == Material.BURNING_FURNACE)
{
if (!isLocked(block))
{
if (event.getPlayer().isSneaking())
{
_blockLock.get(event.getPlayer()).lockBlock(block);
return;
}
}
if (isLockedTo(event.getClickedBlock(), event.getPlayer(), false))
{
event.setCancelled(true);
UtilPlayer.message(event.getPlayer(), F.main("Game", "That container is locked by " + getOwner(event.getClickedBlock()).getName() + "!"));
return;
}
if (isOwner(event.getClickedBlock(), event.getPlayer()))
@ -1014,13 +1092,6 @@ public class MinecraftLeague extends TeamGame
return;
}
}
if (!isOwner(event.getClickedBlock(), event.getPlayer()))
{
if (!isLockedTo(event.getClickedBlock(), event.getPlayer(), true))
{
_blockLock.get(event.getPlayer()).lockBlock(event.getClickedBlock());
}
}
}
}
@ -1154,6 +1225,7 @@ public class MinecraftLeague extends TeamGame
if (!IsLive())
return;
event.getEntity().setHealth(event.getEntity().getMaxHealth());
List<ItemStack> newDrops = new ArrayList<ItemStack>();
Integer arrows = 0;
@ -1221,7 +1293,7 @@ public class MinecraftLeague extends TeamGame
}
if (event.getInventory().getResult().getType() == Material.ARROW)
{
event.getInventory().setResult(new ItemStack(Material.ARROW, (event.getInventory().getResult().getAmount() * 2)));
event.getInventory().setResult(new ItemStack(Material.ARROW, (event.getInventory().getResult().getAmount() * 4)));
}
if (event.getInventory().getResult().getType() == Material.FLINT_AND_STEEL)
{
@ -1241,7 +1313,7 @@ public class MinecraftLeague extends TeamGame
event.setCancelled(true);
}
@EventHandler
/*@EventHandler
public void controlMobRate(CreatureSpawnEvent event)
{
if (!IsLive())
@ -1274,7 +1346,7 @@ public class MinecraftLeague extends TeamGame
for (int i = 1; i <= 3; i++)
Manager.GetCreature().SpawnEntity(event.getLocation(), EntityType.SPIDER);
}
}
}*/
@EventHandler
public void editHealth(GameStateChangeEvent event)
@ -1357,15 +1429,8 @@ public class MinecraftLeague extends TeamGame
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void storeGear(EntityDamageEvent event)
public void storeGear(Player player)
{
if (!IsLive())
return;
if (!(event.getEntity() instanceof Player))
return;
Player player = (Player)event.getEntity();
List<ItemStack> gear = new ArrayList<ItemStack>();
if (!UtilItem.isDiamondProduct(player.getInventory().getHelmet()))
@ -1398,7 +1463,7 @@ public class MinecraftLeague extends TeamGame
else
gear.add(new ItemStack(Material.AIR));
if (UtilInv.contains(player, Material.BOW, (byte) 0, 1))
if (UtilInv.getAmount(player, Material.BOW) >= 1)
{
for (ItemStack poss : UtilInv.getItems(player))
{
@ -1410,6 +1475,18 @@ public class MinecraftLeague extends TeamGame
}
}
if (UtilInv.getAmount(player, Material.FISHING_ROD) >= 1)
{
for (ItemStack poss : UtilInv.getItems(player))
{
if (poss.getType() == Material.FISHING_ROD)
{
gear.add(poss);
break;
}
}
}
int arrowsToAdd = UtilInv.getAmount(player, Material.ARROW) / 2;
while (arrowsToAdd >= 1)
{
@ -1421,6 +1498,18 @@ public class MinecraftLeague extends TeamGame
_gear.put(player, gear);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void storeGear(EntityDamageEvent event)
{
if (!IsLive())
return;
if (!(event.getEntity() instanceof Player))
return;
Player player = (Player)event.getEntity();
storeGear(player);
}
@EventHandler
public void blockDeadPvt(PrivateMessageEvent event)
{
@ -1491,6 +1580,29 @@ public class MinecraftLeague extends TeamGame
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void handleDeath(PlayerDeathOutEvent event)
{
if (!IsLive())
return;
if (_tower.getAmountAlive(GetTeam(event.GetPlayer())) >= 1)
{
if (OverTime)
{
_tower.getVulnerable(GetTeam(event.GetPlayer())).damage(20, null);
if (_tower.getAmountAlive(GetTeam(event.GetPlayer())) >= 1)
{
event.setCancelled(true);
}
}
else
{
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void handleDeath(CombatDeathEvent event)
{
@ -1498,69 +1610,6 @@ public class MinecraftLeague extends TeamGame
return;
event.SetBroadcastType(DeathMessageType.Detailed);
if (event.GetLog().GetPlayer() == null)
return;
if (Bukkit.getPlayer(event.GetLog().GetPlayer().GetName()) == null)
return;
Player player = Bukkit.getPlayer(event.GetLog().GetPlayer().GetName());
if (_tower.getAmountAlive(GetTeam(player)) < 1)
{
SetPlayerState(player, PlayerState.OUT);
Manager.GetCondition().Factory().Blind("PermDead", player, player, 1.5, 0, false, false, false);
Manager.GetCondition().Factory().Cloak("PermDead", player, player, 9999, false, false);
player.setAllowFlight(true);
player.setFlying(true);
((CraftPlayer)player).getHandle().spectating = true;
((CraftPlayer)player).getHandle().k = false;
UtilAction.velocity(player, new Vector(0,1.2,0));
//getMap(GetTeam(player)).update(player);
player.getInventory().clear();
player.getInventory().setArmorContents(new ItemStack[]
{
new ItemStack(Material.AIR),
new ItemStack(Material.AIR),
new ItemStack(Material.AIR),
new ItemStack(Material.AIR)
});
return;
}
if (OverTime)
{
_tower.getVulnerable(GetTeam(player)).damage(20, null);
if (_tower.getAmountAlive(GetTeam(player)) < 1)
{
SetPlayerState(player, PlayerState.OUT);
Manager.GetCondition().Factory().Blind("PermDead", player, player, 1.5, 0, false, false, false);
Manager.GetCondition().Factory().Cloak("PermDead", player, player, 9999, false, false);
player.setAllowFlight(true);
player.setFlying(true);
((CraftPlayer)player).getHandle().spectating = true;
((CraftPlayer)player).getHandle().k = false;
UtilAction.velocity(player, new Vector(0,1.2,0));
//getMap(GetTeam(player)).update(player);
player.getInventory().clear();
player.getInventory().setArmorContents(new ItemStack[]
{
new ItemStack(Material.AIR),
new ItemStack(Material.AIR),
new ItemStack(Material.AIR),
new ItemStack(Material.AIR)
});
return;
}
}
//_spawnAllow.put(player, System.currentTimeMillis() + UtilTime.convert((long) this.DeathSpectateSecs, TimeUnit.SECONDS, TimeUnit.MILLISECONDS));
}
@EventHandler(priority = EventPriority.HIGHEST)
@ -1617,6 +1666,20 @@ public class MinecraftLeague extends TeamGame
return;
}
}
for (TeamTowerBase base : _tower.getTeamTowers(GetTeam(ChatColor.RED)))
{
if (UtilMath.offset(base.getLocation(), event.getBlock().getLocation()) <= 7)
{
event.setCancelled(true);
}
}
for (TeamTowerBase base : _tower.getTeamTowers(GetTeam(ChatColor.AQUA)))
{
if (UtilMath.offset(base.getLocation(), event.getBlock().getLocation()) <= 7)
{
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
@ -1648,6 +1711,21 @@ public class MinecraftLeague extends TeamGame
}
}
for (TeamTowerBase base : _tower.getTeamTowers(GetTeam(ChatColor.RED)))
{
if (UtilMath.offset(base.getLocation(), event.getBlock().getLocation()) <= 7)
{
event.setCancelled(true);
}
}
for (TeamTowerBase base : _tower.getTeamTowers(GetTeam(ChatColor.AQUA)))
{
if (UtilMath.offset(base.getLocation(), event.getBlock().getLocation()) <= 7)
{
event.setCancelled(true);
}
}
if (event.getBlock().getType() == Material.GRAVEL)
{
event.setCancelled(true);
@ -1655,4 +1733,92 @@ public class MinecraftLeague extends TeamGame
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation(), new ItemStack(Material.FLINT));
}
}
@EventHandler
public void noMonsterLava(BlockFromToEvent event)
{
if (!IsLive())
return;
Block block = event.getBlock();
if (block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA || block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER)
{
Block next = event.getToBlock();
for (BlockFace bf : BlockFace.values())
{
if (!next.getRelative(bf).equals(block))
{
if (block.getType().toString().contains("LAVA"))
{
if (next.getRelative(bf).getType().toString().contains("WATER"))
{
event.setCancelled(true);
}
}
if (block.getType().toString().contains("WATER"))
{
if (next.getRelative(bf).getType().toString().contains("LAVA"))
{
event.setCancelled(true);
}
}
}
}
}
}
@EventHandler(ignoreCancelled=true)
public void onPlayerEmptyBucket(PlayerBucketEmptyEvent event)
{
if (!IsLive())
return;
Player player = event.getPlayer();
if (player.getItemInHand().getType() == Material.WATER_BUCKET)
{
player.getItemInHand().setType(Material.BUCKET);
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
if (block.getType().toString().contains("LAVA"))
{
event.setCancelled(true);
return;
}
for (BlockFace bf : BlockFace.values())
{
if (block.getRelative(bf).getType().toString().contains("LAVA"))
{
event.setCancelled(true);
}
}
}
}
@EventHandler(ignoreCancelled=true)
public void onBlockDispense(BlockDispenseEvent event)
{
if (!IsLive())
return;
if (event.getItem().getType() == Material.WATER_BUCKET)
{
Block dispenser = event.getBlock();
MaterialData mat = dispenser.getState().getData();
Dispenser disp_mat = (Dispenser)mat;
BlockFace face = disp_mat.getFacing();
Block block = dispenser.getRelative(face);
if (block.getType().toString().contains("LAVA"))
{
event.setCancelled(true);
return;
}
for (BlockFace bf : BlockFace.values())
{
if (block.getRelative(bf).getType().toString().contains("LAVA"))
{
event.setCancelled(true);
}
}
}
}
}

View File

@ -30,12 +30,17 @@ public class BlockProtection
public boolean hasBlock(Block block)
{
return _blocks.contains(block);
for (Block b : _blocks)
{
if (ProtectionUtil.isSameBlock(block, b))
return true;
}
return false;
}
public boolean isLockedTo(Player opening, Block block, boolean ignoreTeam)
{
if (!_blocks.contains(block))
if (!hasBlock(block))
return false;
if (_host.GetTeam(_player).GetColor() != _host.GetTeam(opening).GetColor())
return ignoreTeam;

View File

@ -55,6 +55,9 @@ public class DefenderAI
private void attack()
{
if (!_tower.Vulnerable)
return;
if (_procTime != -1)
{
if (System.currentTimeMillis() >= _procTime)
@ -67,12 +70,12 @@ public class DefenderAI
}
if (!_manager.Attack)
return;
if (!UtilTime.elapsed(_lastAttack, UtilTime.convert(30, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
if (!UtilTime.elapsed(_lastAttack, UtilTime.convert(5, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
return;
/*if (UtilMath.random.nextDouble() < .75)
return;*/
_lastAttack = System.currentTimeMillis();
_procTime = System.currentTimeMillis() + UtilTime.convert(25, TimeUnit.SECONDS, TimeUnit.MILLISECONDS);
_procTime = System.currentTimeMillis() + UtilTime.convert(4, TimeUnit.SECONDS, TimeUnit.MILLISECONDS);
animate();
}
@ -90,8 +93,9 @@ public class DefenderAI
if (UtilPlayer.isSpectator(player))
continue;
_manager.Host.storeGear(player);
player.getWorld().strikeLightningEffect(player.getLocation());
player.damage(4 * 2);
player.damage(Math.min(6 * 2, player.getHealth()));
}
}
@ -140,7 +144,7 @@ public class DefenderAI
if (!_active)
return;
if (UtilTime.elapsed(_lastStepIncrease, UtilTime.convert(3, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
if (UtilTime.elapsed(_lastStepIncrease, UtilTime.convert(1, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
{
_step++;
_lastStepIncrease = System.currentTimeMillis();
@ -150,7 +154,7 @@ public class DefenderAI
private void drawHelix()
{
double height = Math.min(_step, 15D);
double height = Math.min(_step * 2, 15D);
for (double y = 0; y <= height; y += .5)
{
@ -170,7 +174,7 @@ public class DefenderAI
while (UtilMath.offset(base, target) > UtilMath.offset(base, display))
{
Vector v = UtilAlg.getTrajectory(display, target);
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, display, null, 0, 1, ViewDist.MAX);
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, display, null, 0, 1, ViewDist.MAX);
display.add(v);
}
}

View File

@ -17,6 +17,8 @@ public class OreGenerator
_choices.clear();
for (Location loc : possible)
{
if (loc.getBlock().getType() == Material.WORKBENCH || loc.getBlock().getType() == Material.CHEST || loc.getBlock().getType() == Material.TRAPPED_CHEST || loc.getBlock().getType() == Material.FURNACE || loc.getBlock().getType() == Material.BURNING_FURNACE)
continue;
loc.getBlock().setType(Material.STONE);
_choices.add(loc);
}

View File

@ -0,0 +1,16 @@
package nautilus.game.arcade.game.games.minecraftleague.data;
import org.bukkit.block.Block;
public class ProtectionUtil {
public static boolean isSameBlock(Block a, Block b)
{
if (a.getX() == b.getX())
if (a.getY() == b.getY())
return (a.getZ() == b.getZ());
return false;
}
}

View File

@ -11,8 +11,6 @@ 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.common.util.UtilTime.TimeUnit;
import mineplex.core.hologram.Hologram;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.GameTeam;
@ -49,7 +47,7 @@ public abstract class TeamTowerBase
{
_host = host;
_manager = manager;
_spawn = spawn.clone().add(0.5, 1.2, 0.5);
_spawn = spawn.clone().add(-0.5, 1.2, -0.5);
_team = team;
_maxHealth = 11111D;
_health = 11111D;
@ -79,12 +77,13 @@ public abstract class TeamTowerBase
else
message = _team.GetColor() + _team.getDisplayName() + "'s " + C.cDPurpleB + _type + _team.GetColor() + " has been destroyed!";
Bukkit.broadcastMessage(message);
//Bukkit.broadcastMessage(message);
UtilTextMiddle.display("", message);
if (!_type.equalsIgnoreCase("Tower"))
{
for (Player inform : _team.GetPlayers(true))
UtilTextMiddle.display(C.cGold + "Team Crystal Destroyed", C.cGold + "You will no longer respawn!", inform);
UtilTextMiddle.display(C.cGold + "Team Crystal Destroyed", C.cGold + "You will no longer respawn and will be poisoned in 5 minutes!", inform);
}
Alive = false;
@ -135,6 +134,10 @@ public abstract class TeamTowerBase
{
b.setType(Material.AIR);
}
for (int i = 1; i < 3; i++)
{
getBeacon().clone().add(0, i, 0).getBlock().setType(Material.BEDROCK);
}
for (LivingEntity le : UtilEnt.getInRadius(_spawn, 18).keySet())
{
if (le instanceof Wither)
@ -142,10 +145,18 @@ public abstract class TeamTowerBase
else
{
if (UtilMath.offset(le.getLocation(), _spawn) <= 5)
{
if (UtilPlayer.isSpectator(le))
continue;
if (le instanceof Player)
{
_host.storeGear((Player)le);
}
le.damage(6);
}
}
}
}
public Location getBeacon()
{
@ -223,7 +234,7 @@ public abstract class TeamTowerBase
_health = newHealth;
if (player != null)
Recharge.Instance.use(player, "Damage TeamTower", UtilTime.convert(1/2, TimeUnit.SECONDS, TimeUnit.MILLISECONDS), false, false);
Recharge.Instance.use(player, "Damage TeamTower", 400, false, false);
return false;
}

View File

@ -1,7 +1,11 @@
package nautilus.game.arcade.game.games.minecraftleague.data;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import nautilus.game.arcade.game.GameTeam;
import org.bukkit.Instrument;
@ -11,12 +15,21 @@ import org.bukkit.entity.Player;
public class TowerAlert
{
//private ConcurrentHashMap<GameTeam, Long> _alerts = new ConcurrentHashMap<GameTeam, Long>();
private ConcurrentHashMap<GameTeam, Long> _alerts = new ConcurrentHashMap<GameTeam, Long>();
//private ConcurrentHashMap<GameTeam, String> _alertType = new ConcurrentHashMap<GameTeam, String>();
public void alert(GameTeam team, TeamTowerBase tower)
{
//_alerts.put(team, System.currentTimeMillis());
if (!UtilTime.elapsed(_alerts.getOrDefault(team, (long) 1), UtilTime.convert(7, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
{
for (Player player : team.GetPlayers(true))
playSound(player);
return;
}
_alerts.put(team, System.currentTimeMillis());
String type = "";
if (tower instanceof TeamTower)
{

View File

@ -6,13 +6,15 @@ import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.util.UtilTextMiddle;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.minecraftleague.DataLoc;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.game.games.minecraftleague.data.objectives.KillObjective;
import nautilus.game.arcade.world.WorldData;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
@ -28,7 +30,7 @@ public class TowerManager implements Listener
//private ConcurrentHashMap<TeamTowerBase, MapZone> _mapZone = new ConcurrentHashMap<TeamTowerBase, MapZone>();
private ConcurrentHashMap<GameTeam, TeamBeacon> _beacons = new ConcurrentHashMap<GameTeam, TeamBeacon>();
private OreGenerator _ore;
public boolean Attack = true;
public boolean Attack = false;
public TowerManager(MinecraftLeague host)
{
@ -47,12 +49,29 @@ public class TowerManager implements Listener
_beacons.get(base.getTeam()).setBlock(base.getBeacon().getBlock());
}
public void ironOreGen(GameTeam team)
public void ironOreGen(GameTeam team, boolean start)
{
int amount = 10;
if (start)
amount = 40;
for (Location loc : Host.WorldData.GetCustomLocs(DataLoc.DIAMOND_ORE.getKey()))
{
loc.getBlock().setType(Material.DIAMOND_ORE);
}
if (start)
{
if (team.GetColor() == ChatColor.RED)
_ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.RED_ORE.getKey()), 30);
_ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.RED_ORE.getKey()), amount);
else
_ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.BLUE_ORE.getKey()), 30);
_ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.BLUE_ORE.getKey()), amount);
}
else
{
_ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.MOSH_IRON.getKey()), amount);
UtilTextMiddle.display("", "Valuable Ores have respawned in the middle!");
}
}
private List<TeamTowerBase> getAllTeamTowers(GameTeam team)
@ -158,8 +177,8 @@ public class TowerManager implements Listener
Host.Beacons.put(blue, _beacons.get(blue));
makeVulnerable(getTeamTowers(red).getFirst());
makeVulnerable(getTeamTowers(blue).getFirst());
ironOreGen(red);
ironOreGen(blue);
ironOreGen(red, true);
ironOreGen(blue, true);
}
public void prepareHealth(int players, double multiplier)
@ -202,7 +221,25 @@ public class TowerManager implements Listener
else
enemy = Host.GetTeam(ChatColor.RED);
Host.Objective.setTeamObjective(enemy, new KillObjective());
Host.AnnounceEnd(enemy);
for (GameTeam team : Host.GetTeamList())
{
if (enemy != null && team.equals(enemy))
{
for (Player player : team.GetPlayers(false))
Host.AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
Host.AddGems(player, 10, "Participation", false, false);
}
Host.SetState(GameState.End);
//Host.Objective.setTeamObjective(enemy, new KillObjective());
//Host.TeamPoison.put(towerBase.getTeam(), System.currentTimeMillis() + (UtilTime.convert(5, TimeUnit.MINUTES, TimeUnit.MILLISECONDS) - UtilTime.convert(1, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)));
return;
}
@ -212,7 +249,7 @@ public class TowerManager implements Listener
public void toggleAttack()
{
Attack = !Attack;
//Attack = !Attack;
}
public void update()

View File

@ -5,6 +5,7 @@ import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.game.games.minecraftleague.data.MapZone;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.map.MapCanvas;
@ -111,6 +112,19 @@ public class ItemMapRenderer extends MapRenderer
if (mapX > -64 && mapX < 64 && mapZ > -64 && mapZ < 64)
{
MapCursor.Type cursorDisplay;
MapCursor.Type friend;
MapCursor.Type foe;
if (_host.GetTeam(player).GetColor() == ChatColor.RED)
{
friend = MapCursor.Type.RED_POINTER;
foe = MapCursor.Type.BLUE_POINTER;
}
else
{
friend = MapCursor.Type.BLUE_POINTER;
foe = MapCursor.Type.RED_POINTER;
}
if (player == other)
{
@ -118,12 +132,12 @@ public class ItemMapRenderer extends MapRenderer
}
else if (_host.GetTeam(player) == _host.GetTeam(other))
{
cursorDisplay = MapCursor.Type.BLUE_POINTER;
cursorDisplay = friend;
}
else if (_host.GetTeam(player) != _host.GetTeam(other))
{
if (_host.OverTime)
cursorDisplay = MapCursor.Type.RED_POINTER;
cursorDisplay = foe;
else
continue;
}

View File

@ -82,6 +82,9 @@ public class ObjectiveManager implements Listener
public void setTeamObjective(GameTeam team, GameObjective objective)
{
if (getTeamObjective(team).equalsIgnoreCase("KILL_ENEMY"))
return;
resetTeamToMainObjective(team);
_teamObjectives.put(team, objective);
}
@ -103,7 +106,7 @@ public class ObjectiveManager implements Listener
for (Player player : _host.GetPlayers(true))
{
if (_main != null || _specificObjectives.containsKey(player))
if (_main != null || _specificObjectives.containsKey(player) || _teamObjectives.containsKey(_host.GetTeam(player)))
displayObjective(player);
}
}

View File

@ -0,0 +1,21 @@
package nautilus.game.arcade.game.games.minecraftleague.tracker;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.event.EventHandler;
public class AltarBuilderTracker extends StatTracker<MinecraftLeague>
{
public AltarBuilderTracker(MinecraftLeague game)
{
super(game);
}
@EventHandler
public void build(PlaceSkullEvent e)
{
addStat(e.getPlayer(), "AltarBuilder", 1, false, false);
}
}

View File

@ -0,0 +1,22 @@
package nautilus.game.arcade.game.games.minecraftleague.tracker;
import nautilus.game.arcade.events.FirstBloodEvent;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.event.EventHandler;
public class FirstStrikeTracker extends StatTracker<MinecraftLeague>
{
public FirstStrikeTracker(MinecraftLeague game)
{
super(game);
}
@EventHandler
public void blood(FirstBloodEvent e)
{
addStat(e.getPlayer(), "FirstStrike", 1, false, false);
}
}

View File

@ -0,0 +1,31 @@
package nautilus.game.arcade.game.games.minecraftleague.tracker;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class GrabSkullEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
public GrabSkullEvent(Player player)
{
_player = player;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public Player getPlayer()
{
return _player;
}
}

View File

@ -0,0 +1,21 @@
package nautilus.game.arcade.game.games.minecraftleague.tracker;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.event.EventHandler;
public class HeadHunterTracker extends StatTracker<MinecraftLeague>
{
public HeadHunterTracker(MinecraftLeague game)
{
super(game);
}
@EventHandler
public void build(GrabSkullEvent e)
{
addStat(e.getPlayer(), "HeadHunter", 1, false, false);
}
}

View File

@ -0,0 +1,31 @@
package nautilus.game.arcade.game.games.minecraftleague.tracker;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PlaceSkullEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
public PlaceSkullEvent(Player player)
{
_player = player;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public Player getPlayer()
{
return _player;
}
}

View File

@ -16,12 +16,10 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minecraftleague.DataLoc;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.game.games.minecraftleague.data.TeamTowerBase;
import nautilus.game.arcade.game.games.minecraftleague.data.objectives.GearObjective;
import nautilus.game.arcade.game.games.minecraftleague.variation.GameVariation;
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.TeamAltar;
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.WitherMinionManager;
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.WitherPathfinder;
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.objectives.WitherObjective;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -131,6 +129,27 @@ public class WitherVariation extends GameVariation
player.removePotionEffect(PotionEffectType.WITHER);
player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 20 * 6, 0));
}
if (!Host.IsAlive(player))
continue;
/*GameTeam enemy = null;
if (Host.GetTeam(player).GetColor() == ChatColor.RED)
{
enemy = Host.GetTeam(ChatColor.AQUA);
}
else
{
enemy = Host.GetTeam(ChatColor.RED);
}
if (UtilMath.offset(player, Host.getActiveTower(enemy).getEntity()) <= 7)
{
for (Location loc : UtilShapes.getCircle(player.getEyeLocation(), true, 3))
{
if (new Random().nextInt(5) <= 3)
{
UtilParticle.PlayParticle(ParticleType.DRIP_LAVA, loc, null, 0, 2, ViewDist.SHORT, player);
}
}
}*/
}
if (_pathfinder != null)
if (_pathfinder.update())
@ -139,9 +158,9 @@ public class WitherVariation extends GameVariation
WitherSpawned = false;
_wowner = null;
_skellyMan.onWitherDeath();
UtilTextMiddle.display("", C.cGray + "The Mighty Wither has fallen!");
Host.Objective.resetTeamToMainObjective(Host.GetTeam(ChatColor.RED));
Host.Objective.resetTeamToMainObjective(Host.GetTeam(ChatColor.AQUA));
UtilTextMiddle.display("", C.cWhite + "The Mighty Wither has fallen!");
//Host.Objective.resetTeamToMainObjective(Host.GetTeam(ChatColor.RED));
//Host.Objective.resetTeamToMainObjective(Host.GetTeam(ChatColor.AQUA));
}
}
}
@ -183,16 +202,16 @@ public class WitherVariation extends GameVariation
_wither = (Wither)event.getEntity();
_wither.setCustomName(team.GetColor() + team.getDisplayName() + "'s Wither");
_wither.setCustomNameVisible(true);
UtilTextMiddle.display("", C.cBlack + team.getDisplayName() + " Team has spawned a Wither Boss!", UtilServer.getPlayers());
UtilTextMiddle.display("", C.cWhite + team.getDisplayName() + " Team has spawned a Wither Boss!", UtilServer.getPlayers());
_pathfinder = new WitherPathfinder(this, _wither, getWaypoints(_altars.get(team).getLocation()), team, enemy, Host.getTowerManager());
_skellyMan.onWitherSpawn();
Host.Objective.setMainObjective(new GearObjective());
Host.Objective.setTeamObjective(team, new WitherObjective("Attack Enemy Towers"));
Host.Objective.setTeamObjective(enemy, new WitherObjective("Kill Wither"));
for (Player player : Host.GetPlayers(true))
//Host.Objective.setMainObjective(new GearObjective());
//Host.Objective.setTeamObjective(team, new WitherObjective("Attack Enemy Towers"));
//Host.Objective.setTeamObjective(enemy, new WitherObjective("Kill Wither"));
/*for (Player player : Host.GetPlayers(true))
{
Host.Objective.resetPlayerToMainObjective(player);
}
}*/
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
{
public void run()
@ -243,7 +262,7 @@ public class WitherVariation extends GameVariation
TeamTowerBase blue = Host.getActiveTower(Host.GetTeam(ChatColor.AQUA));
HashMap<Block, Double> inside = UtilBlock.getInRadius(event.getLocation().getBlock(), 4, false);
double dmg = 5 * (Host.GetTeam(ChatColor.RED).GetPlayers(true).size() + Host.GetTeam(ChatColor.RED).GetPlayers(true).size());
double dmg = 20 * (Host.GetTeam(ChatColor.RED).GetPlayers(true).size() + Host.GetTeam(ChatColor.RED).GetPlayers(true).size());
if (inside.containsKey(red.getLocation().getBlock()))
{
red.damage(dmg, null);
@ -397,5 +416,9 @@ public class WitherVariation extends GameVariation
return;
Manager.GetCondition().Clean(event.GetPlayer());
/*if (Host.Objective.getPlayerObjective(event.GetPlayer()).equals("RETURN_SKULL"))
{
Host.Objective.resetPlayerToMainObjective(event.GetPlayer());
}*/
}
}

View File

@ -9,8 +9,10 @@ import mineplex.core.common.util.UtilShapes;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.hologram.Hologram;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minecraftleague.tracker.PlaceSkullEvent;
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.WitherVariation;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@ -42,7 +44,7 @@ public class TeamAltar
_protected = UtilShapes.getSphereBlocks(center, 7, 7, false);
Location labelLoc = center.clone().add(0.5, 5, 0.5);
Location labelLoc = center.clone().add(0/*.5*/, 5, 0.5);
String labelStr = team.GetColor() + team.getDisplayName() + "'s Altar";
Hologram label = new Hologram(host.Host.getArcadeManager().getHologramManager(), labelLoc, labelStr);
label.start();
@ -158,6 +160,8 @@ public class TeamAltar
if (_team.HasPlayer(player) && blockType == Material.SKULL)
{
//_host.Host.Objective.resetPlayerToMainObjective(player);
Bukkit.getPluginManager().callEvent(new PlaceSkullEvent(player));
if (_placed < 2)
{
UtilTextMiddle.display("", _team.GetColor() + _team.getDisplayName() + " has placed a Skull on their Altar!");

View File

@ -6,6 +6,7 @@ import java.util.Random;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilParticle;
@ -17,18 +18,19 @@ import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
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.game.games.minecraftleague.data.MapZone;
import nautilus.game.arcade.game.games.minecraftleague.data.objectives.GearObjective;
import nautilus.game.arcade.game.games.minecraftleague.tracker.GrabSkullEvent;
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.WitherVariation;
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.objectives.GrabSkullObjective;
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.objectives.ReturnSkullObjective;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -133,7 +135,7 @@ public class WitherMinionManager implements Listener
UtilTextMiddle.display("", C.cGray + "A Wither Skeleton has spawned!");
_skellyZone.setCenter(chosen);
_skellyZone.setValid(true);
_host.Host.Objective.setMainObjective(new GrabSkullObjective());
//_host.Host.Objective.setMainObjective(new GrabSkullObjective());
}
_selected = -1;
_spawned = true;
@ -141,7 +143,7 @@ public class WitherMinionManager implements Listener
public void onWitherDeath()
{
_lastDied = System.currentTimeMillis() + UtilTime.convert(2, TimeUnit.MINUTES, TimeUnit.MILLISECONDS);
_lastDied = System.currentTimeMillis();
_witherBlocked = false;
_host.Host.getTowerManager().toggleAttack();
_sbTimer.freezeTime(-1);
@ -175,7 +177,7 @@ public class WitherMinionManager implements Listener
if (event.GetState() != GameState.Live)
return;
_lastDied = System.currentTimeMillis() + UtilTime.convert(4, TimeUnit.MINUTES, TimeUnit.MILLISECONDS);
_lastDied = System.currentTimeMillis() + UtilTime.convert(60, TimeUnit.SECONDS, TimeUnit.MILLISECONDS);
}
@EventHandler
@ -198,12 +200,13 @@ public class WitherMinionManager implements Listener
_entity.teleport(_spawns.get(_lastUsed));
}
try {
if (UtilTime.elapsed(_lastDied, UtilTime.convert(45, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
{
boolean noUse = _host.Host.getTowerManager().getAmountAlive(_host.Host.GetTeam(ChatColor.RED)) < 1;
if (_host.Host.getTowerManager().getAmountAlive(_host.Host.GetTeam(ChatColor.AQUA)) >= 1)
noUse = false;
if (!_host.WitherSpawned || !noUse)
if (!_witherBlocked && !noUse)
{
if (_entity == null)
{
@ -218,19 +221,19 @@ public class WitherMinionManager implements Listener
{
if (secLeft > 0)
{
UtilTextMiddle.display(C.cGold + secLeft + " Seconds", C.cGray + "Until Wither Skeleton Spawn");
UtilTextMiddle.display(C.cGold + secLeft + " Seconds", "Until Wither Skeleton Spawn");
}
}
}
}
}
if (UtilTime.elapsed(_lastDied, UtilTime.convert(1, TimeUnit.MINUTES, TimeUnit.MILLISECONDS)))
if (UtilTime.elapsed(_lastDied, UtilTime.convert(90, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
{
boolean noUse = _host.Host.getTowerManager().getAmountAlive(_host.Host.GetTeam(ChatColor.RED)) < 1;
if (_host.Host.getTowerManager().getAmountAlive(_host.Host.GetTeam(ChatColor.AQUA)) >= 1)
noUse = false;
if (!_host.WitherSpawned || !noUse)
if (!_witherBlocked && !noUse)
{
if (_entity == null)
spawn(false);
@ -249,13 +252,21 @@ public class WitherMinionManager implements Listener
{
UtilParticle.PlayParticleToAll(ParticleType.DRIP_LAVA, loc, null, 0, 1, ViewDist.MAX);
}
if (Recharge.Instance.usable(player, "FIREWORK_ALERT", false))
{
Recharge.Instance.use(player, "FIREWORK_ALERT", UtilTime.convert(5, TimeUnit.SECONDS, TimeUnit.MILLISECONDS), false, false);
UtilFirework.playFirework(player.getEyeLocation().add(0, 3, 0), Type.BALL_LARGE, Color.PURPLE, false, true);
}
}
else
{
/*if (_host.Host.Objective.getPlayerObjective(player) != null)
{
if (_host.Host.Objective.getPlayerObjective(player).equalsIgnoreCase("GRAB_SKULL"))
{
_host.Host.Objective.resetPlayerToMainObjective(player);
}
}*/
}
if (player.getInventory().getHelmet() != null)
@ -267,6 +278,10 @@ public class WitherMinionManager implements Listener
}
}
}
} catch (Exception e)
{
}
}
@EventHandler
@ -297,7 +312,7 @@ public class WitherMinionManager implements Listener
if (_entity == null)
_sbTimer.freezeTime(-1);
_sbTimer.setEnd((_lastDied + UtilTime.convert(1, TimeUnit.MINUTES, TimeUnit.MILLISECONDS)));
_sbTimer.setEnd((_lastDied + UtilTime.convert(90, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)));
}
@EventHandler(priority = EventPriority.HIGHEST)
@ -327,14 +342,16 @@ public class WitherMinionManager implements Listener
_cb = null;
_changed = Material.AIR;
_host.Host.Objective.setMainObjective(new GearObjective());
_host.Host.getTowerManager().ironOreGen(null, false);
//_host.Host.Objective.setMainObjective(new GearObjective());
}
}
}
}
}
@EventHandler
@EventHandler(priority = EventPriority.HIGHEST)
public void onPickup(PlayerPickupItemEvent event)
{
if (!_host.Host.IsLive())
@ -356,15 +373,25 @@ public class WitherMinionManager implements Listener
{
public void run()
{
UtilTextMiddle.display("", C.cGold + "Place the skull on top of your Altar's Soulsand!", event.getPlayer());
UtilTextMiddle.display("", C.cGold + "Place the skull on top of", event.getPlayer());
}
}, 20 * 5);
_host.Host.Objective.setPlayerObjective(event.getPlayer(), new ReturnSkullObjective());
Bukkit.getScheduler().runTaskLater(_host.Manager.getPlugin(), new Runnable()
{
public void run()
{
UtilTextMiddle.display("", C.cGold + "Your Altar's Soul Sand!", event.getPlayer());
}
}, 20 * 8);
//_host.Host.Objective.setPlayerObjective(event.getPlayer(), new ReturnSkullObjective());
if (!event.getItem().hasMetadata("Dropped"))
{
Bukkit.getPluginManager().callEvent(new GrabSkullEvent(event.getPlayer()));
UtilTextMiddle.display("", _host.Host.GetTeam(event.getPlayer()).GetColor() + _host.Host.GetTeam(event.getPlayer()).getDisplayName() + " has picked up a Wither Skull!", 20, 20 * 5, 20);
}
}
}
}
@EventHandler
public void onDrop(PlayerDropItemEvent event)
@ -383,7 +410,7 @@ public class WitherMinionManager implements Listener
if (fin.equalsIgnoreCase(fin1))
{
event.getItemDrop().setMetadata("Dropped", new FixedMetadataValue(_host.Manager.getPlugin(), true));
_host.Host.Objective.resetPlayerToMainObjective(event.getPlayer());
//_host.Host.Objective.resetPlayerToMainObjective(event.getPlayer());
}
}
}
@ -396,7 +423,7 @@ public class WitherMinionManager implements Listener
for (Location loc : _spawns)
{
if (UtilShapes.getSphereBlocks(loc, 5, 5, false).contains(event.getBlock().getLocation()))
if (UtilShapes.getSphereBlocks(loc, 6, 6, false).contains(event.getBlock().getLocation()))
event.setCancelled(true);
}
}
@ -409,7 +436,7 @@ public class WitherMinionManager implements Listener
for (Location loc : _spawns)
{
if (UtilShapes.getSphereBlocks(loc, 5, 5, false).contains(event.getBlock().getLocation()))
if (UtilShapes.getSphereBlocks(loc, 6, 6, false).contains(event.getBlock().getLocation()))
event.setCancelled(true);
}
}

View File

@ -1,5 +1,7 @@
package nautilus.game.arcade.managers;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.antihack.AntiHack;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
@ -12,6 +14,8 @@ import mineplex.core.common.util.UtilMath;
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.common.util.UtilTime.TimeUnit;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.teleport.event.MineplexTeleportEvent;
@ -73,6 +77,7 @@ public class GameFlagManager implements Listener
{
ArcadeManager Manager;
SecondaryDamageManager Secondary;
private ConcurrentHashMap<Player, Long> _respawnTimers = new ConcurrentHashMap<Player, Long>();
public GameFlagManager(ArcadeManager manager)
{
@ -98,12 +103,15 @@ public class GameFlagManager implements Listener
else
{
if (Manager.GetDamage().IsEnabled())
{
if (Secondary != null)
{
HandlerList.unregisterAll(Secondary);
Secondary = null;
}
}
}
}
@EventHandler(priority = EventPriority.LOW)
public void DamageEvent(CustomDamageEvent event)
@ -762,6 +770,8 @@ public class GameFlagManager implements Listener
if (game.GetTeam(player).GetRespawnTime() > time)
time = game.GetTeam(player).GetRespawnTime();
final double timeF = time;
UtilInv.Clear(player);
Manager.GetCondition().Factory().Cloak("Ghost", player, player, time, false, false);
player.setAllowFlight(true);
@ -786,7 +796,14 @@ public class GameFlagManager implements Listener
UtilPlayer.message(player, C.cWhite + C.Bold + "You will respawn in " + time + " seconds...");
UtilTextMiddle.display(null, "Respawning in " + time + " seconds...", 5, 40, 5, player);
}
Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
public void run()
{
Long t = Double.valueOf(timeF).longValue();
_respawnTimers.put(player, System.currentTimeMillis() + UtilTime.convert(t, TimeUnit.SECONDS, TimeUnit.MILLISECONDS));
}
}, 6);
Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
public void run()
@ -1244,4 +1261,37 @@ public class GameFlagManager implements Listener
UtilTextMiddle.display(C.cGold + C.Bold + Manager.GetGame().GetType().GetName(), "Make sure you accept the Resource Pack", 20, 120, 20, event.getPlayer());
}
@EventHandler
public void displayRespawnTimer(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
return;
if (Manager.GetGame() == null)
{
_respawnTimers.clear();
return;
}
if (!Manager.GetGame().IsLive())
{
_respawnTimers.clear();
return;
}
for (Player player : _respawnTimers.keySet())
{
if (!player.isOnline())
{
_respawnTimers.remove(player);
continue;
}
if (System.currentTimeMillis() >= _respawnTimers.get(player))
{
_respawnTimers.remove(player);
continue;
}
long sec = UtilTime.convert(_respawnTimers.get(player) - System.currentTimeMillis(), TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
UtilTextMiddle.display("Respawning In", sec + " Seconds", player);
}
}
}