Dragon Escape
This commit is contained in:
parent
790d13d1d7
commit
b28fb9a99d
@ -340,7 +340,7 @@ public class DeathTag extends SoloGame
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_runners.GetPlayers(true).size() <= 1)
|
if (_runners.GetPlayers(true).size() <= 1)
|
||||||
{
|
{
|
||||||
List<Player> places = _runners.GetPlacements(true);
|
List<Player> places = _runners.GetPlacements(true);
|
||||||
|
@ -5,6 +5,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
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.block.BlockData;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.NautHashMap;
|
|
||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilFirework;
|
import mineplex.core.common.util.UtilFirework;
|
||||||
import mineplex.core.common.util.UtilInv;
|
import mineplex.core.common.util.UtilInv;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
@ -82,8 +83,8 @@ public class DragonEscape extends SoloGame
|
|||||||
{
|
{
|
||||||
return HANDLER_LIST;
|
return HANDLER_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerFinishEvent(Player who)
|
PlayerFinishEvent(Player who)
|
||||||
{
|
{
|
||||||
super(who);
|
super(who);
|
||||||
}
|
}
|
||||||
@ -95,46 +96,43 @@ public class DragonEscape extends SoloGame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<DragonScore> _ranks = new ArrayList<DragonScore>();
|
private static final String[] DESCRIPTION =
|
||||||
|
{
|
||||||
private NautHashMap<Player, Long> _warpTime = new NautHashMap<Player, Long>();
|
C.cYellowB + "Douglas the Dragon" + C.Reset + " is after you!",
|
||||||
|
C.cRedB + "RUN!!!!!!!!!!",
|
||||||
|
C.cYellow + "Last Player" + C.Reset + " alive wins!"
|
||||||
|
};
|
||||||
|
|
||||||
|
private final List<DragonScore> _ranks = new ArrayList<>();
|
||||||
|
private final Map<Player, Long> _warpTime = new HashMap<>();
|
||||||
|
|
||||||
private Location _dragon;
|
private Location _dragon;
|
||||||
private ArrayList<Location> _waypoints;
|
private List<Location> _waypoints;
|
||||||
|
|
||||||
private DragonEscapeData _dragonData;
|
private DragonEscapeData _dragonData;
|
||||||
|
|
||||||
private Player _winner = null;
|
private Player _winner = null;
|
||||||
|
|
||||||
private double _speedMult = 1;
|
private double _speedMult = 1;
|
||||||
|
private final Map<BlockData, Player> _tunneled = new HashMap<>();
|
||||||
private HashMap<BlockData, Player> _tunneled = new HashMap<BlockData, Player>();
|
private final Map<Player, Location> _safeLocation = new HashMap<>();
|
||||||
|
|
||||||
private long _started;
|
private long _started;
|
||||||
private long _ended;
|
private long _ended;
|
||||||
|
|
||||||
public DragonEscape(ArcadeManager manager)
|
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[]
|
StrictAntiHack = true;
|
||||||
{
|
DamagePvP = false;
|
||||||
new KitLeaper(manager),
|
HungerSet = 20;
|
||||||
new KitDisruptor(manager),
|
BlockPlace = true;
|
||||||
new KitWarper(manager),
|
AllowParticles = false;
|
||||||
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;
|
|
||||||
|
|
||||||
registerStatTrackers(
|
registerStatTrackers(
|
||||||
new ParalympicsStatTracker(this),
|
new ParalympicsStatTracker(this),
|
||||||
@ -147,7 +145,7 @@ public class DragonEscape extends SoloGame
|
|||||||
BlankLine,
|
BlankLine,
|
||||||
new ChatStatData("kit", "Kit", true)
|
new ChatStatData("kit", "Kit", true)
|
||||||
);
|
);
|
||||||
|
|
||||||
registerQuestTrackers(new DragonEscapeWinQuestTracker(this));
|
registerQuestTrackers(new DragonEscapeWinQuestTracker(this));
|
||||||
|
|
||||||
new CompassModule()
|
new CompassModule()
|
||||||
@ -155,21 +153,19 @@ public class DragonEscape extends SoloGame
|
|||||||
.setGiveCompassToSpecs(true)
|
.setGiveCompassToSpecs(true)
|
||||||
.setGiveCompassToAlive(false)
|
.setGiveCompassToAlive(false)
|
||||||
.register(this);
|
.register(this);
|
||||||
|
|
||||||
StrictAntiHack = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ParseData()
|
public void ParseData()
|
||||||
{
|
{
|
||||||
_dragon = WorldData.GetDataLocs("RED").get(0);
|
_dragon = WorldData.GetDataLocs("RED").get(0);
|
||||||
_waypoints = new ArrayList<Location>();
|
_waypoints = new ArrayList<>();
|
||||||
|
|
||||||
//Order Waypoints
|
//Order Waypoints
|
||||||
Location last = _dragon;
|
Location last = _dragon;
|
||||||
|
|
||||||
while (!WorldData.GetDataLocs("BLACK").isEmpty())
|
while (!WorldData.GetDataLocs("BLACK").isEmpty())
|
||||||
{
|
{
|
||||||
Location best = null;
|
Location best = null;
|
||||||
double bestDist = 0;
|
double bestDist = 0;
|
||||||
|
|
||||||
@ -184,7 +180,7 @@ public class DragonEscape extends SoloGame
|
|||||||
bestDist = dist;
|
bestDist = dist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Ignore Close
|
//Ignore Close
|
||||||
if (bestDist < 3 && WorldData.GetDataLocs("BLACK").size() > 1)
|
if (bestDist < 3 && WorldData.GetDataLocs("BLACK").size() > 1)
|
||||||
{
|
{
|
||||||
@ -195,19 +191,19 @@ public class DragonEscape extends SoloGame
|
|||||||
|
|
||||||
_waypoints.add(best);
|
_waypoints.add(best);
|
||||||
WorldData.GetDataLocs("BLACK").remove(best);
|
WorldData.GetDataLocs("BLACK").remove(best);
|
||||||
best.subtract(new Vector(0,1,0));
|
best.subtract(new Vector(0, 1, 0));
|
||||||
|
|
||||||
last = best;
|
last = best;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!WorldData.GetDataLocs("GREEN").isEmpty())
|
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"))
|
if (WorldData.MapName.contains("Hell"))
|
||||||
this.WorldTimeSet = 16000;
|
WorldTimeSet = 16000;
|
||||||
|
|
||||||
if (WorldData.MapName.contains("Pirate"))
|
if (WorldData.MapName.contains("Pirate"))
|
||||||
this.WorldWaterDamage = 2;
|
WorldWaterDamage = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -216,9 +212,13 @@ public class DragonEscape extends SoloGame
|
|||||||
if (GetState().ordinal() >= GameState.End.ordinal())
|
if (GetState().ordinal() >= GameState.End.ordinal())
|
||||||
{
|
{
|
||||||
if (_winner == null)
|
if (_winner == null)
|
||||||
|
{
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
return Collections.singletonList(_winner);
|
return Collections.singletonList(_winner);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,54 +227,54 @@ public class DragonEscape extends SoloGame
|
|||||||
{
|
{
|
||||||
if (event.GetState() != GameState.Prepare)
|
if (event.GetState() != GameState.Prepare)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Team team : GetScoreboard().getScoreboard().getTeams())
|
for (Team team : GetScoreboard().getScoreboard().getTeams())
|
||||||
team.setCanSeeFriendlyInvisibles(true);
|
team.setCanSeeFriendlyInvisibles(true);
|
||||||
|
|
||||||
this.CreatureAllowOverride = true;
|
CreatureAllowOverride = true;
|
||||||
EnderDragon dragon = _dragon.getWorld().spawn(_dragon, EnderDragon.class);
|
EnderDragon dragon = _dragon.getWorld().spawn(_dragon, EnderDragon.class);
|
||||||
this.CreatureAllowOverride = false;
|
CreatureAllowOverride = false;
|
||||||
|
|
||||||
dragon.setCustomName(ChatColor.YELLOW + C.Bold + "Douglas the Dragon");
|
dragon.setCustomName(ChatColor.YELLOW + C.Bold + "Douglas the Dragon");
|
||||||
|
|
||||||
_dragonData = new DragonEscapeData(this, dragon, _waypoints.get(0));
|
_dragonData = new DragonEscapeData(this, dragon, _waypoints.get(0));
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void Invisibility(PlayerKitGiveEvent event)
|
|
||||||
{
|
|
||||||
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
public void invisibility(PlayerKitGiveEvent event)
|
||||||
|
{
|
||||||
|
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0, false, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
public void MoveDragon(UpdateEvent event)
|
public void MoveDragon(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_dragonData == null)
|
if (_dragonData == null)
|
||||||
return;
|
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();
|
_dragonData.Move();
|
||||||
|
|
||||||
Set<Block> blocks = UtilBlock.getInRadius(_dragonData.Location, 10d).keySet();
|
Set<Block> blocks = UtilBlock.getInRadius(_dragonData.Location, 10d).keySet();
|
||||||
|
|
||||||
Iterator<Block> blockIterator = blocks.iterator();
|
Iterator<Block> blockIterator = blocks.iterator();
|
||||||
while (blockIterator.hasNext())
|
while (blockIterator.hasNext())
|
||||||
{
|
{
|
||||||
Block block = blockIterator.next();
|
Block block = blockIterator.next();
|
||||||
|
|
||||||
if (block.isLiquid())
|
if (block.isLiquid())
|
||||||
blockIterator.remove();
|
blockIterator.remove();
|
||||||
|
|
||||||
else if (block.getRelative(BlockFace.UP).isLiquid())
|
else if (block.getRelative(BlockFace.UP).isLiquid())
|
||||||
blockIterator.remove();
|
blockIterator.remove();
|
||||||
|
|
||||||
else if (WorldData.MapName.contains("Hell") && block.getY() < 30)
|
else if (WorldData.MapName.contains("Hell") && block.getY() < 30)
|
||||||
blockIterator.remove();
|
blockIterator.remove();
|
||||||
|
|
||||||
else if (WorldData.MapName.contains("Pirate") && (block.getY() < 6))
|
else if (WorldData.MapName.contains("Pirate") && (block.getY() < 6))
|
||||||
blockIterator.remove();
|
blockIterator.remove();
|
||||||
}
|
}
|
||||||
@ -287,11 +287,11 @@ public class DragonEscape extends SoloGame
|
|||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.FAST)
|
if (event.getType() != UpdateType.FAST)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_dragonData == null)
|
if (_dragonData == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double dragonScore = GetScore(_dragonData.Dragon);
|
double dragonScore = GetScore(_dragonData.Dragon);
|
||||||
@ -307,11 +307,6 @@ public class DragonEscape extends SoloGame
|
|||||||
player.damage(50);
|
player.damage(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<DragonScore> GetScores()
|
|
||||||
{
|
|
||||||
return _ranks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean SetScore(Player player, double playerScore)
|
public boolean SetScore(Player player, double playerScore)
|
||||||
{
|
{
|
||||||
@ -321,15 +316,15 @@ public class DragonEscape extends SoloGame
|
|||||||
if (score.Player.equals(player))
|
if (score.Player.equals(player))
|
||||||
{
|
{
|
||||||
//debug
|
//debug
|
||||||
int preNode = (int)(score.Score/10000);
|
int preNode = (int) (score.Score / 10000);
|
||||||
int postNode = (int)(playerScore/10000);
|
int postNode = (int) (playerScore / 10000);
|
||||||
|
|
||||||
//Backwards
|
//Backwards
|
||||||
if (preNode - postNode >= 3)
|
if (preNode - postNode >= 3)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Shortcut
|
//Shortcut
|
||||||
if (postNode - preNode >= 3)
|
if (postNode - preNode >= 3)
|
||||||
{
|
{
|
||||||
@ -338,17 +333,17 @@ public class DragonEscape extends SoloGame
|
|||||||
score.Player.damage(500);
|
score.Player.damage(500);
|
||||||
UtilPlayer.message(player, F.main("Game", "You were killed for trying to cheat!"));
|
UtilPlayer.message(player, F.main("Game", "You were killed for trying to cheat!"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Finish
|
//Finish
|
||||||
if (GetWaypointIndex(player.getLocation()) == _waypoints.size() - 1)
|
if (GetWaypointIndex(player.getLocation()) == _waypoints.size() - 1)
|
||||||
{
|
{
|
||||||
//Only if NEAR end.
|
//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;
|
_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));
|
Bukkit.getPluginManager().callEvent(new PlayerFinishEvent(player));
|
||||||
|
|
||||||
@ -370,9 +365,9 @@ public class DragonEscape extends SoloGame
|
|||||||
{
|
{
|
||||||
int index = GetWaypointIndex(ent.getLocation());
|
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;
|
return score;
|
||||||
}
|
}
|
||||||
@ -382,7 +377,7 @@ public class DragonEscape extends SoloGame
|
|||||||
int best = -1;
|
int best = -1;
|
||||||
double bestDist = 0;
|
double bestDist = 0;
|
||||||
|
|
||||||
for (int i=0 ; i<_waypoints.size() ; i++)
|
for (int i = 0; i < _waypoints.size(); i++)
|
||||||
{
|
{
|
||||||
Location waypoint = _waypoints.get(i);
|
Location waypoint = _waypoints.get(i);
|
||||||
|
|
||||||
@ -398,36 +393,33 @@ public class DragonEscape extends SoloGame
|
|||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SortScores()
|
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);
|
DragonScore temp = _ranks.get(j);
|
||||||
_ranks.set(j, _ranks.get(j-1));
|
_ranks.set(j, _ranks.get(j - 1));
|
||||||
_ranks.set(j-1, temp);
|
_ranks.set(j - 1, temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void ScoreboardUpdate(UpdateEvent event)
|
public void ScoreboardUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.FAST)
|
if (event.getType() != UpdateType.FAST)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SortScores();
|
SortScores();
|
||||||
|
|
||||||
//Wipe Last
|
|
||||||
Scoreboard.reset();
|
|
||||||
|
|
||||||
Scoreboard.writeNewLine();
|
Scoreboard.writeNewLine();
|
||||||
|
|
||||||
AtomicInteger index = new AtomicInteger(0);
|
AtomicInteger index = new AtomicInteger(0);
|
||||||
@ -448,26 +440,28 @@ public class DragonEscape extends SoloGame
|
|||||||
{
|
{
|
||||||
if (SpectatorSpawn == null)
|
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;
|
double count = 0;
|
||||||
|
|
||||||
for (Player player : GetPlayers(true))
|
for (Player player : GetPlayers(true))
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
vec.add(player.getLocation().toVector());
|
vec.add(player.getLocation().toVector());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
|
{
|
||||||
count++;
|
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.setY(vec.getY() + 10);
|
||||||
SpectatorSpawn.setZ(vec.getZ());
|
SpectatorSpawn.setZ(vec.getZ() + 0.5);
|
||||||
|
|
||||||
return SpectatorSpawn;
|
return SpectatorSpawn;
|
||||||
}
|
}
|
||||||
@ -476,22 +470,29 @@ public class DragonEscape extends SoloGame
|
|||||||
public void EndCheck()
|
public void EndCheck()
|
||||||
{
|
{
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetPlayers(true).size() <= 0 || _winner != null)
|
if (GetPlayers(true).isEmpty() || _winner != null)
|
||||||
{
|
{
|
||||||
SortScores();
|
SortScores();
|
||||||
|
|
||||||
ArrayList<Player> places = new ArrayList<Player>();
|
List<Player> places = new ArrayList<>();
|
||||||
|
|
||||||
for (DragonScore score : _ranks)
|
for (DragonScore score : _ranks)
|
||||||
|
{
|
||||||
places.add(score.Player);
|
places.add(score.Player);
|
||||||
|
}
|
||||||
|
|
||||||
//Announce
|
//Announce
|
||||||
AnnounceEnd(places);
|
AnnounceEnd(places);
|
||||||
|
|
||||||
//Gems
|
//Gems
|
||||||
if (_winner != null)
|
if (_winner != null)
|
||||||
|
{
|
||||||
AddGems(_winner, 10, "Course Complete", false, false);
|
AddGems(_winner, 10, "Course Complete", false, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (places.size() >= 1)
|
if (places.size() >= 1)
|
||||||
{
|
{
|
||||||
@ -500,52 +501,59 @@ public class DragonEscape extends SoloGame
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (places.size() >= 2)
|
if (places.size() >= 2)
|
||||||
|
{
|
||||||
AddGems(places.get(1), 15, "2nd Place", false, false);
|
AddGems(places.get(1), 15, "2nd Place", false, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (places.size() >= 3)
|
if (places.size() >= 3)
|
||||||
|
{
|
||||||
AddGems(places.get(2), 10, "3rd Place", false, false);
|
AddGems(places.get(2), 10, "3rd Place", false, false);
|
||||||
|
}
|
||||||
|
|
||||||
for (Player player : GetPlayers(false))
|
for (Player player : GetPlayers(false))
|
||||||
|
{
|
||||||
if (player.isOnline())
|
if (player.isOnline())
|
||||||
|
{
|
||||||
AddGems(player, 10, "Participation", false, false);
|
AddGems(player, 10, "Participation", false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//End
|
_safeLocation.clear();
|
||||||
SetState(GameState.End);
|
SetState(GameState.End);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double GetSpeedMult()
|
public double GetSpeedMult()
|
||||||
{
|
{
|
||||||
return _speedMult;
|
return _speedMult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void Warp(PlayerInteractEvent event)
|
public void Warp(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (!IsLive())
|
if (event.getAction() != Action.PHYSICAL || IsLive())
|
||||||
|
{
|
||||||
return;
|
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)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
SortScores();
|
SortScores();
|
||||||
|
|
||||||
Player target = null;
|
Player target = null;
|
||||||
boolean self = false;
|
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);
|
DragonScore score = _ranks.get(i);
|
||||||
|
|
||||||
if (score.Player.equals(player))
|
if (score.Player.equals(player))
|
||||||
{
|
{
|
||||||
self = true;
|
self = true;
|
||||||
@ -559,29 +567,28 @@ public class DragonEscape extends SoloGame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target != null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
UtilInv.remove(player, Material.ENDER_PEARL, (byte)0, 1);
|
UtilInv.remove(player, Material.ENDER_PEARL, (byte) 0, 1);
|
||||||
UtilInv.Update(player);
|
UtilInv.Update(player);
|
||||||
|
|
||||||
//Firework
|
//Firework
|
||||||
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
|
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
|
||||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
|
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
|
||||||
|
|
||||||
//Teleport
|
//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);
|
UtilAction.zeroVelocity(player);
|
||||||
|
|
||||||
//Record
|
//Record
|
||||||
_warpTime.put(player, System.currentTimeMillis());
|
_warpTime.put(player, System.currentTimeMillis());
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(player, F.main("Game", "You warped to " + F.name(target.getName()) + "!"));
|
UtilPlayer.message(player, F.main("Game", "You warped to " + F.name(target.getName()) + "!"));
|
||||||
|
|
||||||
//Effect
|
//Effect
|
||||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 1f, 1f);
|
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 1f, 1f);
|
||||||
|
|
||||||
|
|
||||||
//Firework
|
//Firework
|
||||||
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
|
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
|
||||||
@ -592,18 +599,18 @@ public class DragonEscape extends SoloGame
|
|||||||
UtilPlayer.message(player, F.main("Game", "There is no one infront of you!"));
|
UtilPlayer.message(player, F.main("Game", "There is no one infront of you!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void Tunneler(BlockDamageEvent event)
|
public void Tunneler(BlockDamageEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!IsAlive(player))
|
if (!IsAlive(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!player.getInventory().contains(Material.DIAMOND_PICKAXE))
|
if (!player.getInventory().contains(Material.DIAMOND_PICKAXE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!UtilTime.elapsed(GetStateTime(), 10000))
|
if (!UtilTime.elapsed(GetStateTime(), 10000))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main("Game", "You cannot dig for " + F.elem(UtilTime.MakeStr(10000 - (System.currentTimeMillis() - GetStateTime())) + ".")));
|
UtilPlayer.message(player, F.main("Game", "You cannot dig for " + F.elem(UtilTime.MakeStr(10000 - (System.currentTimeMillis() - GetStateTime())) + ".")));
|
||||||
@ -613,79 +620,89 @@ public class DragonEscape extends SoloGame
|
|||||||
for (Player other : GetPlayers(true))
|
for (Player other : GetPlayers(true))
|
||||||
{
|
{
|
||||||
if (player.equals(other))
|
if (player.equals(other))
|
||||||
|
{
|
||||||
continue;
|
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."));
|
UtilPlayer.message(player, F.main("Game", "You cannot dig near other players."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Recharge.Instance.use(player, "Tunneler", 100, false, false))
|
if (!Recharge.Instance.use(player, "Tunneler", 100, false, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, event.getBlock().getType());
|
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, event.getBlock().getType());
|
||||||
|
|
||||||
player.getInventory().addItem(new ItemStack(event.getBlock().getType()));
|
player.getInventory().addItem(new ItemStack(event.getBlock().getType()));
|
||||||
|
|
||||||
_tunneled.put(new BlockData(event.getBlock()), player);
|
_tunneled.put(new BlockData(event.getBlock()), player);
|
||||||
|
|
||||||
Manager.GetBlockRestore().add(event.getBlock(), 0, (byte) 0, 2400);
|
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)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void Tunneler(BlockPlaceEvent event)
|
public void Tunneler(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Manager.GetBlockRestore().add(event.getBlock(),
|
Manager.GetBlockRestore().add(event.getBlock(),
|
||||||
event.getPlayer().getItemInHand().getType().getId(), event.getPlayer().getItemInHand().getData().getData(),
|
event.getPlayer().getItemInHand().getType().getId(), event.getPlayer().getItemInHand().getData().getData(),
|
||||||
event.getBlockReplacedState().getTypeId(), event.getBlockReplacedState().getRawData(), 2400);
|
event.getBlockReplacedState().getTypeId(), event.getBlockReplacedState().getRawData(), 2400);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void TunnelerUpdate(UpdateEvent event)
|
public void TunnelerUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Iterator<BlockData> tunnelIterator = _tunneled.keySet().iterator();
|
Iterator<BlockData> tunnelIterator = _tunneled.keySet().iterator();
|
||||||
|
|
||||||
while (tunnelIterator.hasNext())
|
while (tunnelIterator.hasNext())
|
||||||
{
|
{
|
||||||
BlockData data = tunnelIterator.next();
|
BlockData data = tunnelIterator.next();
|
||||||
|
|
||||||
if (data.Block.getType() != Material.AIR || UtilTime.elapsed(data.Time, 2400))
|
if (data.Block.getType() != Material.AIR || UtilTime.elapsed(data.Time, 2400))
|
||||||
|
{
|
||||||
tunnelIterator.remove();
|
tunnelIterator.remove();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
for (Player other : UtilServer.getPlayers())
|
for (Player other : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
if (!other.equals(_tunneled.get(data)))
|
if (!other.equals(_tunneled.get(data)))
|
||||||
|
{
|
||||||
other.sendBlockChange(data.Block.getLocation(), data.Material, data.Data);
|
other.sendBlockChange(data.Block.getLocation(), data.Material, data.Data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent event)
|
public void onPlayerInteract(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.getClickedBlock() == null)
|
Block block = event.getClickedBlock();
|
||||||
return;
|
|
||||||
|
|
||||||
if(event.getClickedBlock().getType() != Material.TRAP_DOOR)
|
if (UtilBlock.usable(block))
|
||||||
return;
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
// Stops players using trap doors in game.
|
}
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void setTimes(GameStateChangeEvent event)
|
public void setTimes(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
@ -698,13 +715,15 @@ public class DragonEscape extends SoloGame
|
|||||||
_ended = System.currentTimeMillis();
|
_ended = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void updateTimer(UpdateEvent event)
|
public void updateTimer(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.FASTEST)
|
if (event.getType() != UpdateType.FASTEST)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetState() == GameState.Prepare)
|
if (GetState() == GameState.Prepare)
|
||||||
{
|
{
|
||||||
UtilTextTop.display(F.game("Game time: ") + F.time("0.0 Seconds"), UtilServer.getPlayers());
|
UtilTextTop.display(F.game("Game time: ") + F.time("0.0 Seconds"), UtilServer.getPlayers());
|
||||||
@ -712,19 +731,37 @@ public class DragonEscape extends SoloGame
|
|||||||
else if (GetState() == GameState.Live)
|
else if (GetState() == GameState.Live)
|
||||||
{
|
{
|
||||||
if (_started == 0)
|
if (_started == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UtilTextTop.display(F.game("Game time: ") + F.time(UtilTime.convertString(System.currentTimeMillis() - _started, 6, TimeUnit.SECONDS)), UtilServer.getPlayers());
|
UtilTextTop.display(F.game("Game time: ") + F.time(UtilTime.convertString(System.currentTimeMillis() - _started, 6, TimeUnit.SECONDS)), UtilServer.getPlayers());
|
||||||
}
|
}
|
||||||
else if (GetState() == GameState.End)
|
else if (GetState() == GameState.End)
|
||||||
{
|
{
|
||||||
if (_started == 0)
|
if (_started == 0 || _ended == 0)
|
||||||
return;
|
{
|
||||||
|
|
||||||
if (_ended == 0)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UtilTextBottom.display(F.game("Game time: ") + F.time(UtilTime.convertString(_ended - _started, 6, TimeUnit.SECONDS)), UtilServer.getPlayers());
|
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 =
|
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 PerkDummy("Armorer", Collections.singletonList(C.cGray + "Receive " + C.cYellow + "Full Gold Armor").toArray(new String[1])),
|
||||||
new PerkCraftman(),
|
new PerkCraftman(),
|
||||||
};
|
};
|
||||||
|
@ -27,7 +27,7 @@ public class KitPitcher extends Kit
|
|||||||
|
|
||||||
private static final Perk[] PERKS =
|
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()
|
new PerkCraftman()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,10 +11,12 @@ import org.bukkit.event.EventPriority;
|
|||||||
|
|
||||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
import nautilus.game.arcade.kit.perks.event.PerkLeapEvent;
|
import nautilus.game.arcade.kit.perks.event.PerkLeapEvent;
|
||||||
|
|
||||||
public class ParalympicsStatTracker extends StatTracker<Game>
|
public class ParalympicsStatTracker extends StatTracker<Game>
|
||||||
{
|
{
|
||||||
|
|
||||||
private final Set<UUID> _hasLeaped = new HashSet<>();
|
private final Set<UUID> _hasLeaped = new HashSet<>();
|
||||||
|
|
||||||
public ParalympicsStatTracker(Game game)
|
public ParalympicsStatTracker(Game game)
|
||||||
@ -22,29 +24,37 @@ public class ParalympicsStatTracker extends StatTracker<Game>
|
|||||||
super(game);
|
super(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPerkLeap(PerkLeapEvent event)
|
public void onPerkLeap(PerkLeapEvent event)
|
||||||
{
|
{
|
||||||
if (getGame().GetState() != Game.GameState.Live)
|
if (!getGame().IsLive())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_hasLeaped.add(event.GetPlayer().getUniqueId());
|
_hasLeaped.add(event.GetPlayer().getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onGameStateChange(GameStateChangeEvent event)
|
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)
|
addStat(winner, "Paralympics", 1, true, false);
|
||||||
{
|
|
||||||
if (!_hasLeaped.contains(winner.getUniqueId()))
|
|
||||||
addStat(winner, "Paralympics", 1, true, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user