Dragon Escape
This commit is contained in:
parent
790d13d1d7
commit
b28fb9a99d
@ -5,6 +5,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@ -39,9 +40,9 @@ import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.block.BlockData;
|
||||
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.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
@ -83,7 +84,7 @@ public class DragonEscape extends SoloGame
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public PlayerFinishEvent(Player who)
|
||||
PlayerFinishEvent(Player who)
|
||||
{
|
||||
super(who);
|
||||
}
|
||||
@ -95,46 +96,43 @@ public class DragonEscape extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<DragonScore> _ranks = new ArrayList<DragonScore>();
|
||||
private static final String[] DESCRIPTION =
|
||||
{
|
||||
C.cYellowB + "Douglas the Dragon" + C.Reset + " is after you!",
|
||||
C.cRedB + "RUN!!!!!!!!!!",
|
||||
C.cYellow + "Last Player" + C.Reset + " alive wins!"
|
||||
};
|
||||
|
||||
private NautHashMap<Player, Long> _warpTime = new NautHashMap<Player, Long>();
|
||||
private final List<DragonScore> _ranks = new ArrayList<>();
|
||||
private final Map<Player, Long> _warpTime = new HashMap<>();
|
||||
|
||||
private Location _dragon;
|
||||
private ArrayList<Location> _waypoints;
|
||||
private List<Location> _waypoints;
|
||||
|
||||
private DragonEscapeData _dragonData;
|
||||
|
||||
private Player _winner = null;
|
||||
|
||||
private double _speedMult = 1;
|
||||
|
||||
private HashMap<BlockData, Player> _tunneled = new HashMap<BlockData, Player>();
|
||||
private final Map<BlockData, Player> _tunneled = new HashMap<>();
|
||||
private final Map<Player, Location> _safeLocation = new HashMap<>();
|
||||
|
||||
private long _started;
|
||||
private long _ended;
|
||||
|
||||
public DragonEscape(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.DragonEscape,
|
||||
super(manager, GameType.DragonEscape, new Kit[]
|
||||
{
|
||||
new KitLeaper(manager),
|
||||
new KitDisruptor(manager),
|
||||
new KitWarper(manager),
|
||||
new KitDigger(manager),
|
||||
}, DESCRIPTION);
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitLeaper(manager),
|
||||
new KitDisruptor(manager),
|
||||
new KitWarper(manager),
|
||||
new KitDigger(manager),
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Douglas the Dragon is after you!",
|
||||
"RUN!!!!!!!!!!",
|
||||
"Last player alive wins!"
|
||||
});
|
||||
|
||||
this.DamagePvP = false;
|
||||
this.HungerSet = 20;
|
||||
this.BlockPlace = true;
|
||||
StrictAntiHack = true;
|
||||
DamagePvP = false;
|
||||
HungerSet = 20;
|
||||
BlockPlace = true;
|
||||
AllowParticles = false;
|
||||
|
||||
registerStatTrackers(
|
||||
new ParalympicsStatTracker(this),
|
||||
@ -155,15 +153,13 @@ public class DragonEscape extends SoloGame
|
||||
.setGiveCompassToSpecs(true)
|
||||
.setGiveCompassToAlive(false)
|
||||
.register(this);
|
||||
|
||||
StrictAntiHack = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
_dragon = WorldData.GetDataLocs("RED").get(0);
|
||||
_waypoints = new ArrayList<Location>();
|
||||
_waypoints = new ArrayList<>();
|
||||
|
||||
//Order Waypoints
|
||||
Location last = _dragon;
|
||||
@ -195,19 +191,19 @@ public class DragonEscape extends SoloGame
|
||||
|
||||
_waypoints.add(best);
|
||||
WorldData.GetDataLocs("BLACK").remove(best);
|
||||
best.subtract(new Vector(0,1,0));
|
||||
best.subtract(new Vector(0, 1, 0));
|
||||
|
||||
last = best;
|
||||
}
|
||||
|
||||
if (!WorldData.GetDataLocs("GREEN").isEmpty())
|
||||
_speedMult = WorldData.GetDataLocs("GREEN").get(0).getX()/100d;
|
||||
_speedMult = WorldData.GetDataLocs("GREEN").get(0).getX() / 100d;
|
||||
|
||||
if (WorldData.MapName.contains("Hell"))
|
||||
this.WorldTimeSet = 16000;
|
||||
WorldTimeSet = 16000;
|
||||
|
||||
if (WorldData.MapName.contains("Pirate"))
|
||||
this.WorldWaterDamage = 2;
|
||||
WorldWaterDamage = 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -216,9 +212,13 @@ public class DragonEscape extends SoloGame
|
||||
if (GetState().ordinal() >= GameState.End.ordinal())
|
||||
{
|
||||
if (_winner == null)
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections.singletonList(_winner);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -231,9 +231,9 @@ public class DragonEscape extends SoloGame
|
||||
for (Team team : GetScoreboard().getScoreboard().getTeams())
|
||||
team.setCanSeeFriendlyInvisibles(true);
|
||||
|
||||
this.CreatureAllowOverride = true;
|
||||
CreatureAllowOverride = true;
|
||||
EnderDragon dragon = _dragon.getWorld().spawn(_dragon, EnderDragon.class);
|
||||
this.CreatureAllowOverride = false;
|
||||
CreatureAllowOverride = false;
|
||||
|
||||
dragon.setCustomName(ChatColor.YELLOW + C.Bold + "Douglas the Dragon");
|
||||
|
||||
@ -241,9 +241,9 @@ public class DragonEscape extends SoloGame
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Invisibility(PlayerKitGiveEvent event)
|
||||
public void invisibility(PlayerKitGiveEvent event)
|
||||
{
|
||||
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false));
|
||||
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0, false, false));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -255,7 +255,7 @@ public class DragonEscape extends SoloGame
|
||||
if (_dragonData == null)
|
||||
return;
|
||||
|
||||
_dragonData.Target = _waypoints.get(Math.min(_waypoints.size()-1, (GetWaypointIndex(_dragonData.Location) + 1)));
|
||||
_dragonData.Target = _waypoints.get(Math.min(_waypoints.size() - 1, (GetWaypointIndex(_dragonData.Location) + 1)));
|
||||
|
||||
_dragonData.Move();
|
||||
|
||||
@ -308,11 +308,6 @@ public class DragonEscape extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<DragonScore> GetScores()
|
||||
{
|
||||
return _ranks;
|
||||
}
|
||||
|
||||
public boolean SetScore(Player player, double playerScore)
|
||||
{
|
||||
//Rank
|
||||
@ -321,8 +316,8 @@ public class DragonEscape extends SoloGame
|
||||
if (score.Player.equals(player))
|
||||
{
|
||||
//debug
|
||||
int preNode = (int)(score.Score/10000);
|
||||
int postNode = (int)(playerScore/10000);
|
||||
int preNode = (int) (score.Score / 10000);
|
||||
int postNode = (int) (playerScore / 10000);
|
||||
|
||||
//Backwards
|
||||
if (preNode - postNode >= 3)
|
||||
@ -345,10 +340,10 @@ public class DragonEscape extends SoloGame
|
||||
if (GetWaypointIndex(player.getLocation()) == _waypoints.size() - 1)
|
||||
{
|
||||
//Only if NEAR end.
|
||||
if (UtilMath.offset(player.getLocation(), _waypoints.get(_waypoints.size()-1)) < 3)
|
||||
if (UtilMath.offset(player.getLocation(), _waypoints.get(_waypoints.size() - 1)) < 3)
|
||||
{
|
||||
_winner = player;
|
||||
this.SetCustomWinLine(player.getName() + " reached the end of the course!");
|
||||
SetCustomWinLine(player.getName() + " reached the end of the course!");
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new PlayerFinishEvent(player));
|
||||
|
||||
@ -370,9 +365,9 @@ public class DragonEscape extends SoloGame
|
||||
{
|
||||
int index = GetWaypointIndex(ent.getLocation());
|
||||
|
||||
double score = 10000 * index;
|
||||
double score = 10000 * index;
|
||||
|
||||
score -= UtilMath.offset(ent.getLocation(), _waypoints.get(Math.min(_waypoints.size()-1, index+1)));
|
||||
score -= UtilMath.offset(ent.getLocation(), _waypoints.get(Math.min(_waypoints.size() - 1, index + 1)));
|
||||
|
||||
return score;
|
||||
}
|
||||
@ -382,7 +377,7 @@ public class DragonEscape extends SoloGame
|
||||
int best = -1;
|
||||
double bestDist = 0;
|
||||
|
||||
for (int i=0 ; i<_waypoints.size() ; i++)
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
{
|
||||
Location waypoint = _waypoints.get(i);
|
||||
|
||||
@ -400,34 +395,31 @@ public class DragonEscape extends SoloGame
|
||||
|
||||
private void SortScores()
|
||||
{
|
||||
for (int i=0 ; i<_ranks.size() ; i++)
|
||||
for (int i = 0; i < _ranks.size(); i++)
|
||||
{
|
||||
for (int j=_ranks.size()-1 ; j>0 ; j--)
|
||||
for (int j = _ranks.size() - 1; j > 0; j--)
|
||||
{
|
||||
if (_ranks.get(j).Score > _ranks.get(j-1).Score)
|
||||
if (_ranks.get(j).Score > _ranks.get(j - 1).Score)
|
||||
{
|
||||
DragonScore temp = _ranks.get(j);
|
||||
_ranks.set(j, _ranks.get(j-1));
|
||||
_ranks.set(j-1, temp);
|
||||
_ranks.set(j, _ranks.get(j - 1));
|
||||
_ranks.set(j - 1, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SortScores();
|
||||
|
||||
//Wipe Last
|
||||
Scoreboard.reset();
|
||||
|
||||
Scoreboard.writeNewLine();
|
||||
|
||||
AtomicInteger index = new AtomicInteger(0);
|
||||
@ -448,10 +440,10 @@ public class DragonEscape extends SoloGame
|
||||
{
|
||||
if (SpectatorSpawn == null)
|
||||
{
|
||||
SpectatorSpawn = new Location(this.WorldData.World, 0,0,0);
|
||||
SpectatorSpawn = new Location(WorldData.World, 0, 0, 0);
|
||||
}
|
||||
|
||||
Vector vec = new Vector(0,0,0);
|
||||
Vector vec = new Vector(0, 0, 0);
|
||||
double count = 0;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
@ -461,13 +453,15 @@ public class DragonEscape extends SoloGame
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
||||
vec.multiply(1d/count);
|
||||
vec.multiply(1d / count);
|
||||
|
||||
SpectatorSpawn.setX(vec.getX());
|
||||
SpectatorSpawn.setX(vec.getX() + 0.5);
|
||||
SpectatorSpawn.setY(vec.getY() + 10);
|
||||
SpectatorSpawn.setZ(vec.getZ());
|
||||
SpectatorSpawn.setZ(vec.getZ() + 0.5);
|
||||
|
||||
return SpectatorSpawn;
|
||||
}
|
||||
@ -476,22 +470,29 @@ public class DragonEscape extends SoloGame
|
||||
public void EndCheck()
|
||||
{
|
||||
if (!IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetPlayers(true).size() <= 0 || _winner != null)
|
||||
if (GetPlayers(true).isEmpty() || _winner != null)
|
||||
{
|
||||
SortScores();
|
||||
|
||||
ArrayList<Player> places = new ArrayList<Player>();
|
||||
List<Player> places = new ArrayList<>();
|
||||
|
||||
for (DragonScore score : _ranks)
|
||||
{
|
||||
places.add(score.Player);
|
||||
}
|
||||
|
||||
//Announce
|
||||
AnnounceEnd(places);
|
||||
|
||||
//Gems
|
||||
if (_winner != null)
|
||||
{
|
||||
AddGems(_winner, 10, "Course Complete", false, false);
|
||||
}
|
||||
|
||||
if (places.size() >= 1)
|
||||
{
|
||||
@ -500,18 +501,25 @@ public class DragonEscape extends SoloGame
|
||||
}
|
||||
|
||||
if (places.size() >= 2)
|
||||
{
|
||||
AddGems(places.get(1), 15, "2nd Place", false, false);
|
||||
}
|
||||
|
||||
if (places.size() >= 3)
|
||||
{
|
||||
AddGems(places.get(2), 10, "3rd Place", false, false);
|
||||
}
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
if (player.isOnline())
|
||||
{
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
}
|
||||
|
||||
//End
|
||||
_safeLocation.clear();
|
||||
SetState(GameState.End);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -523,17 +531,17 @@ public class DragonEscape extends SoloGame
|
||||
@EventHandler
|
||||
public void Warp(PlayerInteractEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK &&
|
||||
event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR)
|
||||
if (event.getAction() != Action.PHYSICAL || IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilInv.IsItem(player.getItemInHand(), Material.ENDER_PEARL, (byte)0))
|
||||
if (!UtilInv.IsItem(player.getItemInHand(), Material.ENDER_PEARL, (byte) 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
@ -542,7 +550,7 @@ public class DragonEscape extends SoloGame
|
||||
Player target = null;
|
||||
boolean self = false;
|
||||
|
||||
for (int i=_ranks.size()-1 ; i>=0 ; i--)
|
||||
for (int i = _ranks.size() - 1; i >= 0; i--)
|
||||
{
|
||||
DragonScore score = _ranks.get(i);
|
||||
|
||||
@ -562,7 +570,7 @@ public class DragonEscape extends SoloGame
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
UtilInv.remove(player, Material.ENDER_PEARL, (byte)0, 1);
|
||||
UtilInv.remove(player, Material.ENDER_PEARL, (byte) 0, 1);
|
||||
UtilInv.Update(player);
|
||||
|
||||
//Firework
|
||||
@ -570,7 +578,7 @@ public class DragonEscape extends SoloGame
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
|
||||
|
||||
//Teleport
|
||||
player.teleport(target.getLocation().add(0, 0.5, 0));
|
||||
player.teleport(_safeLocation.getOrDefault(target, target.getLocation()).add(0, 0.5, 0));
|
||||
UtilAction.zeroVelocity(player);
|
||||
|
||||
//Record
|
||||
@ -582,7 +590,6 @@ public class DragonEscape extends SoloGame
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 1f, 1f);
|
||||
|
||||
|
||||
//Firework
|
||||
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
|
||||
@ -613,10 +620,11 @@ public class DragonEscape extends SoloGame
|
||||
for (Player other : GetPlayers(true))
|
||||
{
|
||||
if (player.equals(other))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UtilMath.offset(event.getBlock().getLocation().add(0.5, 0.5, 0.5), other.getLocation()) < 1.5 ||
|
||||
UtilMath.offset(event.getBlock().getLocation().add(0.5, 1, 0.5), other.getLocation()) < 1.5)
|
||||
if (UtilMath.offset(event.getBlock().getLocation().add(0.5, 0.5, 0.5), other.getLocation()) < 1.5 || UtilMath.offset(event.getBlock().getLocation().add(0.5, 1, 0.5), other.getLocation()) < 1.5)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "You cannot dig near other players."));
|
||||
return;
|
||||
@ -634,7 +642,7 @@ public class DragonEscape extends SoloGame
|
||||
|
||||
Manager.GetBlockRestore().add(event.getBlock(), 0, (byte) 0, 2400);
|
||||
|
||||
UtilInv.remove(player, Material.DIAMOND_PICKAXE, (byte)0, 1);
|
||||
UtilInv.remove(player, Material.DIAMOND_PICKAXE, (byte) 0, 1);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@ -652,7 +660,9 @@ public class DragonEscape extends SoloGame
|
||||
public void TunnelerUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<BlockData> tunnelIterator = _tunneled.keySet().iterator();
|
||||
|
||||
@ -661,12 +671,19 @@ public class DragonEscape extends SoloGame
|
||||
BlockData data = tunnelIterator.next();
|
||||
|
||||
if (data.Block.getType() != Material.AIR || UtilTime.elapsed(data.Time, 2400))
|
||||
{
|
||||
tunnelIterator.remove();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (!other.equals(_tunneled.get(data)))
|
||||
{
|
||||
other.sendBlockChange(data.Block.getLocation(), data.Material, data.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -674,16 +691,16 @@ public class DragonEscape extends SoloGame
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getClickedBlock() == null)
|
||||
return;
|
||||
Block block = event.getClickedBlock();
|
||||
|
||||
if(event.getClickedBlock().getType() != Material.TRAP_DOOR)
|
||||
return;
|
||||
|
||||
// Stops players using trap doors in game.
|
||||
event.setCancelled(true);
|
||||
if (UtilBlock.usable(block))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -703,7 +720,9 @@ public class DragonEscape extends SoloGame
|
||||
public void updateTimer(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetState() == GameState.Prepare)
|
||||
{
|
||||
@ -712,19 +731,37 @@ public class DragonEscape extends SoloGame
|
||||
else if (GetState() == GameState.Live)
|
||||
{
|
||||
if (_started == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilTextTop.display(F.game("Game time: ") + F.time(UtilTime.convertString(System.currentTimeMillis() - _started, 6, TimeUnit.SECONDS)), UtilServer.getPlayers());
|
||||
}
|
||||
else if (GetState() == GameState.End)
|
||||
{
|
||||
if (_started == 0)
|
||||
return;
|
||||
|
||||
if (_ended == 0)
|
||||
if (_started == 0 || _ended == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilTextBottom.display(F.game("Game time: ") + F.time(UtilTime.convertString(_ended - _started, 6, TimeUnit.SECONDS)), UtilServer.getPlayers());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateSafe(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTER || !InProgress())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (UtilEnt.isGrounded(player))
|
||||
{
|
||||
_safeLocation.put(player, player.getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,571 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.dragonescape;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
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.UtilBlock;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.*;
|
||||
import nautilus.game.arcade.game.modules.TeamArmorModule;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||
|
||||
public class DragonEscapeTeams extends TeamGame
|
||||
{
|
||||
private ArrayList<DragonScore> _ranks = new ArrayList<DragonScore>();
|
||||
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
|
||||
|
||||
private NautHashMap<Player, Long> _warpTime = new NautHashMap<Player, Long>();
|
||||
|
||||
private Location _dragon;
|
||||
private ArrayList<Location> _waypoints;
|
||||
|
||||
private HashMap<Location, Double> _waypointScore = new HashMap<Location, Double>();
|
||||
|
||||
private DragonEscapeTeamsData _dragonData;
|
||||
|
||||
private double _speedMult = 1;
|
||||
|
||||
public DragonEscapeTeams(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.DragonEscapeTeams,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitLeaper(manager),
|
||||
new KitWarper(manager),
|
||||
new KitDigger(manager),
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Douglas the Dragon is after you!",
|
||||
"RUN!!!!!!!!!!",
|
||||
"Last player alive wins!"
|
||||
});
|
||||
|
||||
this.DamagePvP = false;
|
||||
this.HungerSet = 20;
|
||||
|
||||
registerChatStats(
|
||||
Deaths,
|
||||
DamageTaken,
|
||||
BlankLine,
|
||||
new ChatStatData("kit", "Kit", true)
|
||||
);
|
||||
new TeamArmorModule()
|
||||
.giveHotbarItem()
|
||||
.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
_dragon = WorldData.GetDataLocs("RED").get(0);
|
||||
_waypoints = new ArrayList<Location>();
|
||||
|
||||
//Order Waypoints
|
||||
Location last = _dragon;
|
||||
|
||||
while (!WorldData.GetDataLocs("BLACK").isEmpty())
|
||||
{
|
||||
Location best = null;
|
||||
double bestDist = 0;
|
||||
|
||||
//Get Best
|
||||
for (Location loc : WorldData.GetDataLocs("BLACK"))
|
||||
{
|
||||
double dist = UtilMath.offset(loc, last);
|
||||
|
||||
if (best == null || dist < bestDist)
|
||||
{
|
||||
best = loc;
|
||||
bestDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
//Ignore Close
|
||||
if (bestDist < 3 && WorldData.GetDataLocs("BLACK").size() > 1)
|
||||
{
|
||||
System.out.println("Ignoring Node");
|
||||
WorldData.GetDataLocs("BLACK").remove(best);
|
||||
continue;
|
||||
}
|
||||
|
||||
_waypoints.add(best);
|
||||
WorldData.GetDataLocs("BLACK").remove(best);
|
||||
best.subtract(new Vector(0,1,0));
|
||||
|
||||
last = best;
|
||||
}
|
||||
|
||||
//Score Waypoints
|
||||
double dist = 0;
|
||||
Location lastLoc = null;
|
||||
for (int i=0 ; i<_waypoints.size() ; i++)
|
||||
{
|
||||
Location newLoc = _waypoints.get(i);
|
||||
|
||||
//First
|
||||
if (lastLoc == null)
|
||||
{
|
||||
_waypointScore.put(newLoc, 0d);
|
||||
lastLoc = newLoc;
|
||||
continue;
|
||||
}
|
||||
|
||||
dist += UtilMath.offset(lastLoc, newLoc);
|
||||
_waypointScore.put(newLoc, dist);
|
||||
lastLoc = newLoc;
|
||||
}
|
||||
|
||||
if (!WorldData.GetDataLocs("GREEN").isEmpty())
|
||||
_speedMult = WorldData.GetDataLocs("GREEN").get(0).getX()/100d;
|
||||
|
||||
if (WorldData.MapName.contains("Hell"))
|
||||
this.WorldTimeSet = 16000;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerTeleport(PlayerPrepareTeleportEvent event)
|
||||
{
|
||||
Manager.GetCondition().Factory().Invisible(GetName(), event.GetPlayer(), event.GetPlayer(), 16, 1, false, false, false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void SpawnDragon(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
this.CreatureAllowOverride = true;
|
||||
EnderDragon dragon = _dragon.getWorld().spawn(_dragon, EnderDragon.class);
|
||||
this.CreatureAllowOverride = false;
|
||||
|
||||
dragon.setCustomName(ChatColor.YELLOW + C.Bold + "Douglas the Dragon");
|
||||
|
||||
_dragonData = new DragonEscapeTeamsData(this, dragon, _waypoints.get(0));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void MoveDragon(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (_dragonData == null)
|
||||
return;
|
||||
|
||||
_dragonData.Target = _waypoints.get(Math.min(_waypoints.size()-1, (GetWaypointIndex(_dragonData.Location) + 1)));
|
||||
|
||||
_dragonData.Move();
|
||||
|
||||
Set<Block> blocks = UtilBlock.getInRadius(_dragonData.Location, 10d).keySet();
|
||||
|
||||
Iterator<Block> blockIterator = blocks.iterator();
|
||||
while (blockIterator.hasNext())
|
||||
{
|
||||
Block block = blockIterator.next();
|
||||
|
||||
if (block.isLiquid())
|
||||
blockIterator.remove();
|
||||
|
||||
else if (block.getRelative(BlockFace.UP).isLiquid())
|
||||
blockIterator.remove();
|
||||
|
||||
else if (WorldData.MapName.contains("Hell") && block.getY() < 30)
|
||||
blockIterator.remove();
|
||||
|
||||
else if (WorldData.MapName.contains("Pirate") && (block.getY() < 6))
|
||||
blockIterator.remove();
|
||||
}
|
||||
|
||||
Manager.GetExplosion().BlockExplosion(blocks, _dragonData.Location, false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void UpdateScores(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (_dragonData == null)
|
||||
return;
|
||||
|
||||
double dragonScore = GetScore(_dragonData.Dragon);
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
double playerScore = GetScore(player);
|
||||
|
||||
SetScore(player, playerScore);
|
||||
|
||||
if (dragonScore > playerScore)
|
||||
player.damage(50);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<DragonScore> GetScores()
|
||||
{
|
||||
return _ranks;
|
||||
}
|
||||
|
||||
public double GetPlayerScore(Player player)
|
||||
{
|
||||
for (DragonScore score : _ranks)
|
||||
{
|
||||
if (score.Player.equals(player))
|
||||
return Math.max(0, score.Score);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void SetScore(Player player, double playerScore)
|
||||
{
|
||||
//Rank
|
||||
for (DragonScore score : _ranks)
|
||||
{
|
||||
if (score.Player.equals(player))
|
||||
{
|
||||
//debug
|
||||
int preNode = (int)(score.Score/10000);
|
||||
int postNode = (int)(playerScore/10000);
|
||||
|
||||
//Backwards
|
||||
if (preNode - postNode >= 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Shortcut
|
||||
if (postNode - preNode >= 3)
|
||||
{
|
||||
if (!_warpTime.containsKey(score.Player) || UtilTime.elapsed(_warpTime.get(score.Player), 1000))
|
||||
{
|
||||
score.Player.damage(500);
|
||||
UtilPlayer.message(player, F.main("Game", "You were killed for trying to cheat!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (playerScore > score.Score)
|
||||
score.Score = playerScore;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_ranks.add(new DragonScore(player, playerScore));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public double GetScore(Entity ent)
|
||||
{
|
||||
int index = GetWaypointIndex(ent.getLocation());
|
||||
|
||||
//Not at last waypoint
|
||||
if (index < _waypoints.size() - 1)
|
||||
{
|
||||
double score = _waypointScore.get(_waypoints.get(index + 1));
|
||||
score -= UtilMath.offset(ent.getLocation(), _waypoints.get(index+1));
|
||||
return score;
|
||||
}
|
||||
|
||||
//Finished, max score
|
||||
return _waypointScore.get(_waypoints.get(index));
|
||||
|
||||
}
|
||||
|
||||
public int GetWaypointIndex(Location loc)
|
||||
{
|
||||
int best = -1;
|
||||
double bestDist = 0;
|
||||
|
||||
for (int i=0 ; i<_waypoints.size() ; i++)
|
||||
{
|
||||
Location waypoint = _waypoints.get(i);
|
||||
|
||||
double dist = UtilMath.offset(waypoint, loc);
|
||||
|
||||
if (best == -1 || dist < bestDist)
|
||||
{
|
||||
best = i;
|
||||
bestDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
public Location GetWaypoint(Location loc)
|
||||
{
|
||||
Location best = null;
|
||||
double bestDist = 0;
|
||||
|
||||
for (int i=0 ; i<_waypoints.size() ; i++)
|
||||
{
|
||||
Location waypoint = _waypoints.get(i);
|
||||
|
||||
double dist = UtilMath.offset(waypoint, loc);
|
||||
|
||||
if (best == null || dist < bestDist)
|
||||
{
|
||||
best = waypoint;
|
||||
bestDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
public HashMap<GameTeam, Double> GetTeamScores()
|
||||
{
|
||||
HashMap<GameTeam, Double> scores = new HashMap<GameTeam, Double>();
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
double score = 0;
|
||||
for (Player player : team.GetPlayers(false))
|
||||
score += GetPlayerScore(player);
|
||||
|
||||
scores.put(team, score);
|
||||
}
|
||||
|
||||
return scores;
|
||||
}
|
||||
|
||||
private void SortScores()
|
||||
{
|
||||
for (int i=0 ; i<_ranks.size() ; i++)
|
||||
{
|
||||
for (int j=_ranks.size()-1 ; j>0 ; j--)
|
||||
{
|
||||
if (_ranks.get(j).Score > _ranks.get(j-1).Score)
|
||||
{
|
||||
DragonScore temp = _ranks.get(j);
|
||||
_ranks.set(j, _ranks.get(j-1));
|
||||
_ranks.set(j-1, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
Scoreboard.reset();
|
||||
|
||||
HashMap<GameTeam, Double> scores = GetTeamScores();
|
||||
for (GameTeam team : scores.keySet())
|
||||
{
|
||||
//Time
|
||||
int score = scores.get(team).intValue();
|
||||
|
||||
Scoreboard.writeNewLine();
|
||||
Scoreboard.write(team.GetColor() + team.GetName());
|
||||
Scoreboard.write(score + "" + team.GetColor() + " Score");
|
||||
}
|
||||
|
||||
Scoreboard.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location GetSpectatorLocation()
|
||||
{
|
||||
if (SpectatorSpawn == null)
|
||||
{
|
||||
SpectatorSpawn = new Location(this.WorldData.World, 0,0,0);
|
||||
}
|
||||
|
||||
Vector vec = new Vector(0,0,0);
|
||||
double count = 0;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
count++;
|
||||
vec.add(player.getLocation().toVector());
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
count++;
|
||||
|
||||
vec.multiply(1d/count);
|
||||
|
||||
SpectatorSpawn.setX(vec.getX());
|
||||
SpectatorSpawn.setY(vec.getY() + 10);
|
||||
SpectatorSpawn.setZ(vec.getZ());
|
||||
|
||||
return SpectatorSpawn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>();
|
||||
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
if (team.GetPlayers(true).size() > 0)
|
||||
teamsAlive.add(team);
|
||||
|
||||
if (teamsAlive.size() <= 0)
|
||||
{
|
||||
//Get Winner
|
||||
GameTeam winner = null;
|
||||
double bestScore = 0;
|
||||
|
||||
HashMap<GameTeam, Double> scores = GetTeamScores();
|
||||
for (GameTeam team : scores.keySet())
|
||||
{
|
||||
if (winner == null || scores.get(team) > bestScore)
|
||||
{
|
||||
winner = team;
|
||||
bestScore = scores.get(team);
|
||||
}
|
||||
}
|
||||
|
||||
//Announce
|
||||
if (winner != null)
|
||||
{
|
||||
AnnounceEnd(winner);
|
||||
}
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (WinnerTeam != null && team.equals(WinnerTeam))
|
||||
{
|
||||
for (Player player : team.GetPlayers(false))
|
||||
AddGems(player, 10, "Winning Team", false, false);
|
||||
}
|
||||
|
||||
for (Player player : team.GetPlayers(false))
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
//End
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
|
||||
public double GetSpeedMult()
|
||||
{
|
||||
return _speedMult;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Warp(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK &&
|
||||
event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilInv.IsItem(player.getItemInHand(), Material.ENDER_PEARL, (byte)0))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
SortScores();
|
||||
|
||||
Player target = null;
|
||||
boolean self = false;
|
||||
|
||||
for (int i=_ranks.size()-1 ; i>=0 ; i--)
|
||||
{
|
||||
DragonScore score = _ranks.get(i);
|
||||
|
||||
if (score.Player.equals(player))
|
||||
{
|
||||
self = true;
|
||||
}
|
||||
else if (self)
|
||||
{
|
||||
if (IsAlive(score.Player))
|
||||
{
|
||||
target = score.Player;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
UtilInv.remove(player, Material.ENDER_PEARL, (byte)0, 1);
|
||||
UtilInv.Update(player);
|
||||
|
||||
//Firework
|
||||
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
|
||||
|
||||
//Teleport
|
||||
player.teleport(target.getLocation().add(0, 0.5, 0));
|
||||
UtilAction.zeroVelocity(player);
|
||||
|
||||
//Record
|
||||
_warpTime.put(player, System.currentTimeMillis());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You warped to " + F.name(target.getName()) + "!"));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 1f, 1f);
|
||||
|
||||
|
||||
//Firework
|
||||
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "There is no one infront of you!"));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.dragonescape;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class DragonEscapeTeamsData
|
||||
{
|
||||
public DragonEscapeTeams Host;
|
||||
|
||||
public EnderDragon Dragon;
|
||||
|
||||
public Location Target = null;
|
||||
public Location Location = null;
|
||||
|
||||
public float Pitch = 0;
|
||||
public Vector Velocity = new Vector(0,0,0);
|
||||
|
||||
public DragonEscapeTeamsData(DragonEscapeTeams host, EnderDragon dragon, Location target)
|
||||
{
|
||||
Host = host;
|
||||
|
||||
Dragon = dragon;
|
||||
UtilEnt.ghost(Dragon, true, false);
|
||||
|
||||
Location temp = dragon.getLocation();
|
||||
temp.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(dragon.getLocation(), target)));
|
||||
dragon.teleport(temp);
|
||||
|
||||
Velocity = dragon.getLocation().getDirection().setY(0).normalize();
|
||||
Pitch = UtilAlg.GetPitch(dragon.getLocation().getDirection());
|
||||
|
||||
Location = dragon.getLocation();
|
||||
}
|
||||
|
||||
public void Move()
|
||||
{
|
||||
Turn();
|
||||
|
||||
//Speed
|
||||
double speed = 0.20;
|
||||
|
||||
//speed += (System.currentTimeMillis() - Host.GetStateTime())/1000d * 0.001;
|
||||
|
||||
//Speed Distance Boost
|
||||
/*
|
||||
if (!Host.GetScores().isEmpty())
|
||||
{
|
||||
double score = Host.GetScore(Dragon);
|
||||
double best = Host.GetScores().get(0).Score;
|
||||
|
||||
double lead = (best-score)/10000d;
|
||||
|
||||
speed += lead * 0.0025;
|
||||
}
|
||||
*/
|
||||
|
||||
speed = speed * Host.GetSpeedMult();
|
||||
|
||||
Location.add(Velocity.clone().multiply(speed));
|
||||
Location.add(0, -Pitch, 0);
|
||||
|
||||
Location.setPitch(-1 * Pitch);
|
||||
Location.setYaw(180 + UtilAlg.GetYaw(Velocity));
|
||||
|
||||
Dragon.teleport(Location);
|
||||
}
|
||||
|
||||
private void Turn()
|
||||
{
|
||||
//Pitch
|
||||
float desiredPitch = UtilAlg.GetPitch(UtilAlg.getTrajectory(Location, Target));
|
||||
if (desiredPitch < Pitch) Pitch = (float)(Pitch - 0.05);
|
||||
if (desiredPitch > Pitch) Pitch = (float)(Pitch + 0.05);
|
||||
if (Pitch > 0.5) Pitch = 0.5f;
|
||||
if (Pitch < -0.5) Pitch = -0.5f;
|
||||
|
||||
//Flat
|
||||
Vector desired = UtilAlg.getTrajectory2d(Location, Target);
|
||||
desired.subtract(UtilAlg.Normalize(new Vector(Velocity.getX(), 0, Velocity.getZ())));
|
||||
desired.multiply(0.2);
|
||||
|
||||
Velocity.add(desired);
|
||||
|
||||
//Speed
|
||||
UtilAlg.Normalize(Velocity);
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ public class KitArmorer extends Kit
|
||||
|
||||
private static final Perk[] PERKS =
|
||||
{
|
||||
new PerkDoubleJump("Double Jump", 1.2, 1.2, false),
|
||||
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
|
||||
new PerkDummy("Armorer", Collections.singletonList(C.cGray + "Receive " + C.cYellow + "Full Gold Armor").toArray(new String[1])),
|
||||
new PerkCraftman(),
|
||||
};
|
||||
|
@ -27,7 +27,7 @@ public class KitPitcher extends Kit
|
||||
|
||||
private static final Perk[] PERKS =
|
||||
{
|
||||
new PerkDoubleJump("Double Jump", 1.2, 1.2, false),
|
||||
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
|
||||
new PerkCraftman()
|
||||
};
|
||||
|
||||
|
@ -11,10 +11,12 @@ import org.bukkit.event.EventPriority;
|
||||
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.kit.perks.event.PerkLeapEvent;
|
||||
|
||||
public class ParalympicsStatTracker extends StatTracker<Game>
|
||||
{
|
||||
|
||||
private final Set<UUID> _hasLeaped = new HashSet<>();
|
||||
|
||||
public ParalympicsStatTracker(Game game)
|
||||
@ -22,29 +24,37 @@ public class ParalympicsStatTracker extends StatTracker<Game>
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPerkLeap(PerkLeapEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
if (!getGame().IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_hasLeaped.add(event.GetPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onGameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() == Game.GameState.End)
|
||||
if (event.GetState() == GameState.End)
|
||||
{
|
||||
List<Player> winners = getGame().getWinners();
|
||||
return;
|
||||
}
|
||||
|
||||
if (winners != null)
|
||||
List<Player> winners = getGame().getWinners();
|
||||
|
||||
if (winners == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player winner : winners)
|
||||
{
|
||||
if (!_hasLeaped.contains(winner.getUniqueId()))
|
||||
{
|
||||
for (Player winner : winners)
|
||||
{
|
||||
if (!_hasLeaped.contains(winner.getUniqueId()))
|
||||
addStat(winner, "Paralympics", 1, true, false);
|
||||
}
|
||||
addStat(winner, "Paralympics", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user