Fix Monster Maze jumping mechanics (Fixes PC-711 and PC-634)

This commit is contained in:
AlexTheCoder 2016-07-01 17:30:07 -04:00 committed by cnr
parent f6d882fcb4
commit 5e994e37da
3 changed files with 39 additions and 4 deletions

View File

@ -48,6 +48,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.scoreboard.Team;
public class MonsterMaze extends SoloGame
@ -60,6 +62,9 @@ public class MonsterMaze extends SoloGame
private Location _center;
private HashMap<Player, Long> _launched = new HashMap<Player, Long>();
private static final int JUMP_POTION_AMPLIFIER = -10;
private int _potionMult = JUMP_POTION_AMPLIFIER;
@SuppressWarnings("unchecked")
public MonsterMaze(ArcadeManager manager)
@ -260,6 +265,36 @@ public class MonsterMaze extends SoloGame
}
}
@EventHandler
public void onDebug(PlayerCommandPreprocessEvent event)
{
if (!event.getPlayer().isOp())
return;
if (event.getMessage().toLowerCase().contains("/setmult "))
{
event.setCancelled(true);
Integer mult = Integer.parseInt(event.getMessage().toLowerCase().replace("/setmult ", ""));
_potionMult = mult;
for (Player pl : GetPlayers(true))
{
Manager.GetCondition().Clean(pl);
}
}
}
@EventHandler
public void onBreakJumper(InventoryClickEvent event)
{
if (!InProgress())
return;
if (!IsAlive(event.getWhoClicked()))
return;
event.setCancelled(true);
}
@EventHandler
public void PotionEffects(UpdateEvent event)
{
@ -276,7 +311,7 @@ public class MonsterMaze extends SoloGame
else
{
if (!Manager.GetCondition().HasCondition(pl, ConditionType.JUMP, null))
Manager.GetCondition().Factory().Jump("No jumping", pl, null, 9999999, 250, true, false, false);
Manager.GetCondition().Factory().Jump("No jumping", pl, null, 9999999, _potionMult, true, false, false);
}
// if (!Manager.GetCondition().HasCondition(pl, ConditionType.INVISIBILITY, null))

View File

@ -42,7 +42,7 @@ public class KitJumper extends ProgressingKit
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(4, PLAYER_ITEMS[4]);
player.getInventory().setItem(8, PLAYER_ITEMS[8]);
player.getInventory().setItem(4, PLAYER_ITEMS[0]);
player.getInventory().setItem(8, PLAYER_ITEMS[1]);
}
}

View File

@ -69,7 +69,7 @@ public class GamePlayerManager implements Listener
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Manager.GetCondition().HasCondition(player, ConditionType.INVISIBILITY))
if (!Manager.GetCondition().HasCondition(player, ConditionType.INVISIBILITY) && Manager.GetGame().IsAlive(player) && !UtilPlayer.isSpectator(player))
{
for (Player viewer : Bukkit.getOnlinePlayers())
{