Merge pull request #97 in MIN/mineplex from william-gladiators to master

* commit 'd91e4ab4f756746b31c7ebdd3e7d33c139ea7d30':
  Another door bug, and a title fix.
  Health looks nicer.
  Bug fixes. Title shortened.
This commit is contained in:
Shaun Bennett 2015-12-14 03:45:55 -06:00
commit 6ec8ec4c01
4 changed files with 53 additions and 50 deletions

View File

@ -42,7 +42,7 @@ public class Arena
private ArenaState _state;
private long _stateTime;
private boolean _alertedAlready;
private ArrayList<Player> _alreadyAlertedPleaseWait;
private boolean _alertedAlready2;
private HashMap<Player, ArrayList<ParticleData>> _particles;
@ -62,7 +62,7 @@ public class Arena
_stateTime = System.currentTimeMillis();
_particles = new HashMap<>();
_doBye = false;
_alertedAlready = false;
_alreadyAlertedPleaseWait = new ArrayList<>();
_alertedAlready2 = false;
setupSpawns();
@ -174,16 +174,6 @@ public class Arena
return null;
}
public boolean isAlertedAlready()
{
return _alertedAlready;
}
public void setAlertedAlready(boolean alertedAlready)
{
_alertedAlready = alertedAlready;
}
private void setupSpawns()
{
ArrayList<Location> possible = (ArrayList<Location>) _host.WorldData.GetDataLocs("BLACK").clone();
@ -309,15 +299,15 @@ public class Arena
if (_host.getRoundState() != RoundState.FIGHTING)
return;
if (_alertedAlready)
return;
for (Player p : getPastPlayers())
{
UtilTextMiddle.display(C.cAqua + "Please Wait", "The next round will start shortly", 0, 20 * 100, 0, p);
}
if (_alreadyAlertedPleaseWait.contains(p))
continue;
_alertedAlready = true;
UtilTextMiddle.display(C.cAqua + "Please Wait", "The next round will start shortly", 0, 20 * 120, 0, p); // 2 min
_alreadyAlertedPleaseWait.add(p);
}
}
else if (_state.equals(ArenaState.FIGHTING))
{
@ -346,7 +336,7 @@ public class Arena
if (_alertedAlready2)
continue;
UtilTextMiddle.display(C.cGreen + "Next Battle", "Follow the particles", 0, 20 * 100, 0, p);
UtilTextMiddle.display(C.cGreen + "Next Battle", "Follow the particles", 0, 20 * 120, 0, p); // 2 min
}
_alertedAlready2 = true;

View File

@ -4,7 +4,6 @@ import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
@ -109,13 +108,13 @@ public class Gladiators extends SoloGame
EnableTutorials = false;
BlockBreakAllow.add(Material.SUGAR_CANE_BLOCK.getId());
BlockBreakAllow.add(Material.GRASS.getId());
BlockBreakAllow.add(Material.DEAD_BUSH.getId());
BlockBreakAllow.add(Material.LONG_GRASS.getId());
registerStatTrackers(
new BrawlerTracker(this),
//new UntouchableTracker(this),
//new FlawlessTracker(this),
new UntouchableTracker(this),
new FlawlessTracker(this),
new PrecisionTracker(this),
new SwiftKillTracker(this)
);
@ -529,8 +528,6 @@ public class Gladiators extends SoloGame
a.setState(ArenaState.WAITING);
}
UtilTextMiddle.display(C.cGreen + "Gladiators!", C.cGreen + "Defeat your opponent to advance", 20, 60, 20);
return;
}
@ -541,6 +538,12 @@ public class Gladiators extends SoloGame
//closeUnusedArenas();
}
@EventHandler
public void helpMessage(PlayerPrepareTeleportEvent e)
{
UtilTextMiddle.display(C.cGreen + "Gladiators!", C.cGreen + "Defeat your opponent to advance", 20, 20 * 7, 20);
}
/**
*-------------------
* MAIN UPDATE METHOD
@ -559,9 +562,6 @@ public class Gladiators extends SoloGame
{
_roundState = RoundState.STARTING_5;
if (_firstRound)
return;
UtilTextMiddle.display("", C.cGreen + C.Bold + getRoundNotation(), 0, 80 , 0);
_furthestOutCurrent = getFurthestOut(); // Find furthest out for fight.
@ -676,6 +676,7 @@ public class Gladiators extends SoloGame
{
//p.sendMessage("bounce. closest = " + closest.toString() + " player arena = " + _playerArenas.get(p).toString());
UtilAction.velocity(p, UtilAlg.getTrajectory2d(e.getTo(), p.getLocation()), 1.7, true, 0.2, 0, 3, true);
sendPlayerArenaBounceCheck(p);
}
return;
@ -693,6 +694,25 @@ public class Gladiators extends SoloGame
}
}
private void sendPlayerArenaBounceCheck(final Player p)
{
Manager.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
@Override
public void run()
{
if (!GetPlayers(true).contains(p))
return;
Arena closest = getArenaByMid(UtilAlg.findClosest(p.getLocation(), getAllArenaMids()));
if (closest != _playerArenas.get(p))
{
p.teleport(UtilAlg.findClosest(p.getLocation(), _playerArenas.get(p).getSpawns()));
}
}
}, 20L);
}
@EventHandler
public void arenaChange(PlayerChangeArenaEvent e)
{
@ -819,9 +839,6 @@ public class Gladiators extends SoloGame
{
_roundState = RoundState.STARTING_2;
if (_firstRound)
return;
UtilTextMiddle.display(C.cGreen + "3", C.cGreen + C.Bold + getRoundNotation(), 0, 80, 0);
for (Player p : UtilServer.getPlayers())
@ -832,9 +849,6 @@ public class Gladiators extends SoloGame
{
_roundState = RoundState.STARTING_1;
if (_firstRound)
return;
UtilTextMiddle.display(C.cYellow + "2", C.cGreen + C.Bold + getRoundNotation(), 0, 80, 0);
for (Player p : UtilServer.getPlayers())
@ -845,9 +859,6 @@ public class Gladiators extends SoloGame
{
_roundState = RoundState.STARTED;
if (_firstRound)
return;
UtilTextMiddle.display(C.cGold + "1", C.cGreen + C.Bold + getRoundNotation(), 0, 80, 0);
for (Player p : UtilServer.getPlayers())
@ -858,11 +869,11 @@ public class Gladiators extends SoloGame
{
_roundState = RoundState.FIGHTING;
if (_firstRound)
{
_firstRound = false;
return;
}
// if (_firstRound)
// {
// _firstRound = false;
// return;
// }
UtilTextMiddle.display(C.cRed + "FIGHT", C.cGreen + C.Bold + getRoundNotation(), 0, 40, 0);
@ -1048,7 +1059,7 @@ public class Gladiators extends SoloGame
if (e.GetLog().GetKiller().IsPlayer())
{
Player killer = UtilPlayer.searchExact(e.GetLog().GetKiller().GetName());
((Player)e.GetEvent().getEntity()).sendMessage(F.main("Game", "Your killer had " + C.cRed + new DecimalFormat("#").format(killer.getHealth()) + "" + C.cGray + " left."));
((Player)e.GetEvent().getEntity()).sendMessage(F.main("Game", "Your killer had " + C.cRed + (new DecimalFormat("#.#").format((killer.getHealth() / 2))) + "" + C.cGray + " left."));
}
}

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.gladiators.Gladiators;
@ -29,16 +30,16 @@ public class FlawlessTracker extends StatTracker<Gladiators>
}
@EventHandler
public void onDmg(EntityDamageEvent e)
public void onDmg(CustomDamageEvent e)
{
if (e.isCancelled())
return;
System.out.println(e.getEventName() + " took damage by " + e.getCause().toString());
//System.out.println(e.getEventName() + " took damage by " + e.GetCause().toString());
if (e.getEntity() instanceof Player)
if (e.GetDamageeEntity() instanceof Player)
{
_noWin.add(((Player)e.getEntity()).getName());
_noWin.add(((Player)e.GetDamageeEntity()).getName());
}
}

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.gladiators.Gladiators;
import nautilus.game.arcade.game.games.gladiators.events.RoundStartEvent;
import nautilus.game.arcade.stats.StatTracker;
@ -27,14 +28,14 @@ public class UntouchableTracker extends StatTracker<Gladiators>
}
@EventHandler
public void onDmg(EntityDamageEvent e)
public void onDmg(CustomDamageEvent e)
{
if (e.isCancelled())
return;
if (e.getEntity() instanceof Player)
if (e.GetDamageeEntity() instanceof Player)
{
_noWin.add(((Player)e.getEntity()).getName());
_noWin.add(((Player)e.GetDamageeEntity()).getName());
}
}