Fix early game revive

This commit is contained in:
Sam 2017-03-17 17:03:53 +00:00
parent 15d691370d
commit 8e5a5695d5

View File

@ -1,65 +1,8 @@
package nautilus.game.arcade.game.games.bridge;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockFormEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
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.UtilEvent;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
@ -78,14 +21,7 @@ import nautilus.game.arcade.game.games.bridge.animation.BridgeAnimationType;
import nautilus.game.arcade.game.games.bridge.animation.custom.CustomBridgeAnimation;
import nautilus.game.arcade.game.games.bridge.animation.custom.RadiusCustomBridgeAnimation;
import nautilus.game.arcade.game.games.bridge.animation.custom.RandomCustomBridgeAnimation;
import nautilus.game.arcade.game.games.bridge.kits.KitApple;
import nautilus.game.arcade.game.games.bridge.kits.KitArcher;
import nautilus.game.arcade.game.games.bridge.kits.KitBerserker;
import nautilus.game.arcade.game.games.bridge.kits.KitBomber;
import nautilus.game.arcade.game.games.bridge.kits.KitBrawler;
import nautilus.game.arcade.game.games.bridge.kits.KitDestructor;
import nautilus.game.arcade.game.games.bridge.kits.KitMammoth;
import nautilus.game.arcade.game.games.bridge.kits.KitMiner;
import nautilus.game.arcade.game.games.bridge.kits.*;
import nautilus.game.arcade.game.modules.WorldBorderModule;
import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit;
@ -93,11 +29,38 @@ import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkDestructor;
import nautilus.game.arcade.ore.OreHider;
import nautilus.game.arcade.ore.OreObsfucation;
import nautilus.game.arcade.stats.BridgesSniperStatTracker;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.FoodForTheMassesStatTracker;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.TntMinerStatTracker;
import nautilus.game.arcade.stats.*;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockFormEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class Bridge extends TeamGame implements OreObsfucation
{
@ -144,7 +107,7 @@ public class Bridge extends TeamGame implements OreObsfucation
private int _buildHeight = -1;
//Player Respawn
private HashSet<String> _usedLife = new HashSet<String>();
private Set<String> _usedLife = new HashSet<>();
//Tourney Mode
private boolean _tournament;
@ -204,7 +167,7 @@ public class Bridge extends TeamGame implements OreObsfucation
_ore = new OreHider();
// Flags
GameTimeout = Manager.IsTournamentServer() ? 5400000 : 3600000;
GameTimeout = Manager.IsTournamentServer() ? TimeUnit.MINUTES.toMillis(90) : TimeUnit.MINUTES.toMillis(60);
Manager.GetExplosion().SetLiquidDamage(false);
@ -802,48 +765,12 @@ public class Bridge extends TeamGame implements OreObsfucation
{
if (kit instanceof KitDestructor)
{
((KitDestructor)kit).SetEnabled(true);
((KitDestructor) kit).SetEnabled(true);
}
}
}
}
// @EventHandler
// public void breakLillyPad(BlockBreakEvent event)
// {
// if (event.getBlock().getType() != Material.WATER_LILY)
// return;
//
// _lillyPads.put(event.getBlock().getLocation(), System.currentTimeMillis() + (long)(Math.random() * 12000));
// }
// @EventHandler
// public void breakMushroom(BlockBreakEvent event)
// {
// if (event.isCancelled())
// return;
//
//
// if (event.getBlock().getTypeId() == 100 &&
// WorldData.GetCustomLocs("21").contains(event.getBlock().getLocation().add(0.5, 0, 0.5)))
// {
// event.setCancelled(true);
// event.getBlock().setType(Material.AIR);
//
// _mushroomStem.put(event.getBlock().getLocation(), System.currentTimeMillis() + (long)(Math.random() * 12000));
// }
//
// if (event.getBlock().getTypeId() == 99 &&
// WorldData.GetDataLocs("PURPLE").contains(event.getBlock().getLocation().add(0.5, 0, 0.5)))
// {
// event.setCancelled(true);
// event.getBlock().setType(Material.AIR);
//
// _mushroomTop.put(event.getBlock().getLocation(), System.currentTimeMillis() + (long)(Math.random() * 12000));
// }
// }
@EventHandler
public void BridgeUpdate(UpdateEvent event)
{
@ -1534,7 +1461,7 @@ public class Bridge extends TeamGame implements OreObsfucation
{
_tournamentKillMessageTimer = System.currentTimeMillis();
this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "FIRST TEAM TO HAVE MOST KILLS WINS!");
Announce(C.cRed + C.Bold + "ALERT: " + C.Reset + C.Bold + "FIRST TEAM TO HAVE MOST KILLS WINS!");
}
}
@ -1728,16 +1655,16 @@ public class Bridge extends TeamGame implements OreObsfucation
}
@EventHandler(priority=EventPriority.LOWEST)
public void revivePlayer(EntityDamageEvent event)
public void revivePlayer(CustomDamageEvent event)
{
if (_bridgesDown || !(event.getEntity() instanceof Player))
if (_bridgesDown || !(event.GetDamageeEntity() instanceof Player))
{
return;
}
Player player = (Player) event.getEntity();
Player player = event.GetDamageePlayer();
if (player.getHealth() - event.getDamage() > 0)
if (player.getHealth() - event.GetDamage() > 0)
{
return;
}
@ -1750,7 +1677,7 @@ public class Bridge extends TeamGame implements OreObsfucation
GetTeam(player).SpawnTeleport(player);
player.setHealth(20);
event.setCancelled(true);
event.SetCancelled("Early Game Revive");
}
}