Much fix, many wow.
This commit is contained in:
parent
a83ede3caa
commit
d709071feb
@ -771,7 +771,47 @@ public enum Achievement
|
||||
new int[]{1},
|
||||
AchievementCategory.MONSTER_MAZE),
|
||||
|
||||
GLADIATORS_HARDENED_GLADIATOR("Hardened Gladiator", 1000,
|
||||
new String[]{"Gladiators.Wins"},
|
||||
new String[]{"Win 50 games of Gladiators"},
|
||||
new int[]{50},
|
||||
AchievementCategory.GLADIATORS),
|
||||
|
||||
GLADIATORS_BATTLE_BRED("Battle Bred", 1500,
|
||||
new String[]{"Gladiators.Wins"},
|
||||
new String[]{"Win 100 games of Gladiators"},
|
||||
new int[]{100},
|
||||
AchievementCategory.GLADIATORS),
|
||||
|
||||
GLADIATORS_BRAWLER("Brawler", 1000,
|
||||
new String[]{"Gladiators.Brawler"},
|
||||
new String[]{"Kill 3 Gladiators", "with your bare hands"},
|
||||
new int[]{3},
|
||||
AchievementCategory.GLADIATORS),
|
||||
|
||||
GLADIATORS_UNTOUCHABLE("Untouchable", 1500,
|
||||
new String[]{"Gladiators.Untouchable"},
|
||||
new String[]{"Kill 10 Gladiators", "without taking any damage"},
|
||||
new int[]{10},
|
||||
AchievementCategory.GLADIATORS),
|
||||
|
||||
GLADIATORS_FLAWLESS("Flawless", 1000,
|
||||
new String[]{"Gladiators.Flawless"},
|
||||
new String[]{"Win a game of gladiators", "without taking any damage"},
|
||||
new int[]{1},
|
||||
AchievementCategory.GLADIATORS),
|
||||
|
||||
GLADIATORS_PRECISION("Precision", 800,
|
||||
new String[]{"Gladiators.Precision"},
|
||||
new String[]{"Don't miss a single", "arrow in a game of", "Gladiators (Minimum 3)"},
|
||||
new int[]{1},
|
||||
AchievementCategory.GLADIATORS),
|
||||
|
||||
GLADIATORS_SWIFT_KILL("Swift Kill", 1000,
|
||||
new String[]{"Gladiators.SwiftKill"},
|
||||
new String[]{"Earn 15 first bloods", "in Gladiators"},
|
||||
new int[]{15},
|
||||
AchievementCategory.GLADIATORS)
|
||||
|
||||
;
|
||||
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
@ -264,6 +265,9 @@ public class Arena
|
||||
|
||||
if (_state.equals(ArenaState.WAITING))
|
||||
{
|
||||
if (_host.getRoundState() != RoundState.FIGHTING)
|
||||
return;
|
||||
|
||||
for (Player p : getPastPlayers())
|
||||
{
|
||||
UtilTextMiddle.display(C.cAqua + "Please Wait", "The next round will start shortly", 0, 20, 0, p);
|
||||
@ -272,7 +276,14 @@ public class Arena
|
||||
else if (_state.equals(ArenaState.FIGHTING))
|
||||
{
|
||||
if (!UtilTime.elapsed(_stateTime, 60000))
|
||||
{
|
||||
double elapsed = UtilMath.trim(1, System.currentTimeMillis() - _stateTime);
|
||||
|
||||
for (Player p : getPastPlayers())
|
||||
UtilTextBottom.display(C.cRed + C.Bold + "Poison in " + (UtilTime.MakeStr((long)(60 - elapsed))), p);
|
||||
|
||||
return; // 60 seconds before poison
|
||||
}
|
||||
|
||||
for (Player p : getPastPlayers())
|
||||
{
|
||||
@ -296,7 +307,8 @@ public class Arena
|
||||
{
|
||||
if (_state.equals(ArenaState.RUNNING))
|
||||
{
|
||||
getPastPlayers().stream().forEach(this::showParticles);
|
||||
for (Player p : getPastPlayers())
|
||||
showParticles(p);
|
||||
}
|
||||
}
|
||||
|
||||
@ -337,6 +349,8 @@ public class Arena
|
||||
|
||||
private void handleSlowMovers()
|
||||
{
|
||||
_state = ArenaState.ENDED;
|
||||
|
||||
Arena next = _host.getArenaByMid(UtilAlg.findClosest(_mid, _host.getAllArenaMidsOfType(_host.getNextColour(_colour))));
|
||||
|
||||
for (Player p : getPastPlayers())
|
||||
|
@ -6,6 +6,7 @@ import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -292,11 +293,24 @@ public class Gladiators extends SoloGame
|
||||
Location closest = UtilAlg.findClosest(p.getLocation(), getAllArenaMids());
|
||||
Arena arena = getArenaByMid(closest);
|
||||
arena.getPastPlayers().add(p);
|
||||
arena.setState(ArenaState.WAITING);
|
||||
_playerArenas.put(p, arena);
|
||||
|
||||
giveLoadout(p, _playerArenas.get(p).getColour());
|
||||
}
|
||||
|
||||
for (Arena a : _gameArenaSet)
|
||||
{
|
||||
if (a.getPastPlayers().size() > 1)
|
||||
{
|
||||
a.setState(ArenaState.FIGHTING);
|
||||
a.setStateTime(System.currentTimeMillis());
|
||||
}
|
||||
else if (a.getPastPlayers().size() == 0)
|
||||
a.setState(ArenaState.EMPTY);
|
||||
else if (a.getPastPlayers().size() == 1)
|
||||
a.setState(ArenaState.WAITING);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -304,10 +318,22 @@ public class Gladiators extends SoloGame
|
||||
return;
|
||||
|
||||
findGameArenaSet();
|
||||
closeUnusedArenas();
|
||||
}
|
||||
|
||||
private void closeUnusedArenas()
|
||||
{
|
||||
for (Arena a : _allArenas)
|
||||
if (!_gameArenaSet.contains(a))
|
||||
a.closeDoor();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void arenaMoveCheck(PlayerMoveEvent e){
|
||||
public void arenaMoveCheck(PlayerMoveEvent e)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (!GetPlayers(true).contains(e.getPlayer()))
|
||||
return;
|
||||
|
||||
@ -345,7 +371,7 @@ public class Gladiators extends SoloGame
|
||||
current.getPastPlayers().add(p);
|
||||
current.setState(ArenaState.WAITING);
|
||||
|
||||
p.sendMessage("§7§lDEBUG: §3You left §b" + old.getColour().toString() + " §3and entered §b" + current.getColour().toString() + "§3.");
|
||||
Bukkit.broadcastMessage("§7§lDEBUG: §3" + p.getName() + " left §b" + old.getColour().toString() + " §3and entered §b" + current.getColour().toString() + "§3.");
|
||||
|
||||
giveLoadout(p, current.getColour()); //Kit
|
||||
p.setHealth(p.getMaxHealth()); //Heal
|
||||
@ -372,7 +398,8 @@ public class Gladiators extends SoloGame
|
||||
|
||||
@EventHandler
|
||||
public void debug(PlayerCommandPreprocessEvent e){
|
||||
if (e.getMessage().startsWith("/debuginfo"))
|
||||
|
||||
if (!e.getMessage().startsWith("/debuginfo"))
|
||||
return;
|
||||
|
||||
if (e.getPlayer().getName() != "WilliamTiger")
|
||||
@ -407,6 +434,9 @@ public class Gladiators extends SoloGame
|
||||
@EventHandler
|
||||
public void arenaNeedsMoving(UpdateEvent e)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (e.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
@ -420,7 +450,7 @@ public class Gladiators extends SoloGame
|
||||
|
||||
if (a.getPastPlayers().size() == 1)
|
||||
{
|
||||
if (a.isOpenDoor())
|
||||
if (a.isOpenDoor() || a.getColour().equals(ArenaType.RED))
|
||||
continue;
|
||||
|
||||
a.openDoor();
|
||||
@ -434,7 +464,10 @@ public class Gladiators extends SoloGame
|
||||
@EventHandler
|
||||
public void arenaUpdateTick(UpdateEvent e)
|
||||
{
|
||||
if (e.getType() != UpdateType.SEC)
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (e.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Arena a : _gameArenaSet)
|
||||
@ -444,6 +477,9 @@ public class Gladiators extends SoloGame
|
||||
@EventHandler
|
||||
public void arenaUpdate(UpdateEvent e)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (e.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
@ -454,6 +490,9 @@ public class Gladiators extends SoloGame
|
||||
@EventHandler
|
||||
public void damageCancel(EntityDamageEvent e)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (!(e.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
@ -469,6 +508,9 @@ public class Gladiators extends SoloGame
|
||||
@EventHandler
|
||||
public void startCountdown(UpdateEvent e)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (e.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
@ -522,13 +564,18 @@ public class Gladiators extends SoloGame
|
||||
@EventHandler
|
||||
public void roundUpdate(UpdateEvent e)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (e.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (_roundState.equals(RoundState.FIGHTING))
|
||||
{
|
||||
for (Arena a : _gameArenaSet)
|
||||
if (a.getState() != ArenaState.WAITING)
|
||||
if (!(a.getState() == ArenaState.WAITING ||
|
||||
a.getState() == ArenaState.ENDED ||
|
||||
a.getState() == ArenaState.EMPTY))
|
||||
return;
|
||||
|
||||
//All of the arenas are waiting for the next fight.
|
||||
@ -557,4 +604,20 @@ public class Gladiators extends SoloGame
|
||||
_playerArenas.put(p, a);
|
||||
}
|
||||
|
||||
public RoundState getRoundState()
|
||||
{
|
||||
return _roundState;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void arenaBounce(UpdateEvent e)
|
||||
{
|
||||
if (e.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player p : GetPlayers(true))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.trackers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 08/12/15
|
||||
*/
|
||||
public class FlawlessTracker extends StatTracker<Gladiators>
|
||||
{
|
||||
|
||||
private List<String> _noWin;
|
||||
|
||||
public FlawlessTracker(Gladiators game)
|
||||
{
|
||||
super(game);
|
||||
|
||||
_noWin = new ArrayList<>();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDmg(EntityDamageEvent e)
|
||||
{
|
||||
if (e.isCancelled())
|
||||
return;
|
||||
|
||||
if (e.getEntity() instanceof Player)
|
||||
{
|
||||
_noWin.add(((Player)e.getEntity()).getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void end(GameStateChangeEvent e)
|
||||
{
|
||||
if (e.GetState() != Game.GameState.End)
|
||||
return;
|
||||
|
||||
if (getGame().getWinners() == null)
|
||||
return;
|
||||
|
||||
for (Player p : getGame().getWinners())
|
||||
{
|
||||
if (_noWin.contains(p.getName()))
|
||||
continue;
|
||||
|
||||
addStat(p, "Flawless", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.trackers;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 08/12/15
|
||||
*/
|
||||
public class PrecisionTracker extends StatTracker<Gladiators>
|
||||
{
|
||||
private HashMap<String, Integer> _shot;
|
||||
private HashMap<String, Integer> _hit;
|
||||
|
||||
public PrecisionTracker(Gladiators game)
|
||||
{
|
||||
super(game);
|
||||
|
||||
_shot = new HashMap<>();
|
||||
_hit = new HashMap<>();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void end(GameStateChangeEvent e)
|
||||
{
|
||||
if (e.GetState() != Game.GameState.End)
|
||||
return;
|
||||
|
||||
for (Player p : getGame().getWinners())
|
||||
{
|
||||
if (_shot.containsKey(p.getName()) && _hit.containsKey(p.getName()))
|
||||
{
|
||||
if (_shot.get(p.getName()) == _hit.get(p.getName()))
|
||||
{
|
||||
if (_shot.get(p.getName()) >= 3)
|
||||
addStat(p, "Precision", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void shoot(EntityShootBowEvent e)
|
||||
{
|
||||
if (!(e.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player p = (Player) e.getEntity();
|
||||
|
||||
if (_shot.containsKey(p.getName()))
|
||||
_shot.put(p.getName(), _shot.get(p.getName()) + 1);
|
||||
else
|
||||
_shot.put(p.getName(), 1);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void hit(ProjectileHitEvent e)
|
||||
{
|
||||
if (e.getEntity().getShooter() instanceof Player)
|
||||
{
|
||||
Player p = (Player) e.getEntity().getShooter();
|
||||
|
||||
if (_hit.containsKey(p.getName()))
|
||||
_hit.put(p.getName(), _hit.get(p.getName()) + 1);
|
||||
else
|
||||
_hit.put(p.getName(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user