Fix issues that appeared on live

This commit is contained in:
Sam 2018-09-15 19:06:06 +01:00 committed by Alexander Meech
parent 6edc1d7560
commit 1acf9485c8
4 changed files with 31 additions and 25 deletions

View File

@ -8,6 +8,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.event.vehicle.VehicleEnterEvent;
@ -15,6 +16,8 @@ import org.bukkit.event.vehicle.VehicleEnterEvent;
import mineplex.core.ReflectivelyCreateMiniPlugin; import mineplex.core.ReflectivelyCreateMiniPlugin;
import mineplex.core.account.permissions.Permission; import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup; import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.arcadeevents.CoreGameStartEvent;
import mineplex.core.arcadeevents.CoreGameStopEvent;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.GadgetEnableEvent;
@ -22,6 +25,7 @@ import mineplex.core.gadget.persistence.UserGadgetPersistence;
import mineplex.core.pet.event.PetSpawnEvent; import mineplex.core.pet.event.PetSpawnEvent;
import mineplex.core.teleport.event.MineplexTeleportEvent; import mineplex.core.teleport.event.MineplexTeleportEvent;
import mineplex.game.nano.GameManager; import mineplex.game.nano.GameManager;
import mineplex.game.nano.NanoManager;
import mineplex.game.nano.game.Game.GameState; import mineplex.game.nano.game.Game.GameState;
import mineplex.game.nano.game.components.ComponentHook; import mineplex.game.nano.game.components.ComponentHook;
import mineplex.game.nano.game.event.GameStateChangeEvent; import mineplex.game.nano.game.event.GameStateChangeEvent;
@ -73,9 +77,11 @@ public class GamePlayerManager extends GameManager implements ComponentHook<Game
{ {
case Prepare: case Prepare:
_manager.getAntiHack().enableAnticheat(); _manager.getAntiHack().enableAnticheat();
UtilServer.CallEvent(new CoreGameStartEvent(NanoManager.getGameDisplay()));
break; break;
case End: case End:
_manager.getAntiHack().disableAnticheat(); _manager.getAntiHack().disableAnticheat();
UtilServer.CallEvent(new CoreGameStopEvent(NanoManager.getGameDisplay()));
break; break;
case Dead: case Dead:
setHook(null); setHook(null);
@ -177,6 +183,18 @@ public class GamePlayerManager extends GameManager implements ComponentHook<Game
} }
} }
// Big hack to prevent people opening it in-game, remove this at some point
@EventHandler
public void cosmeticChest(InventoryOpenEvent event)
{
if (_hook == null || UtilPlayer.isSpectator(event.getPlayer()) || !event.getInventory().getName().equals("Cosmetics"))
{
return;
}
event.setCancelled(true);
}
@EventHandler @EventHandler
public void gadgetEnable(GadgetEnableEvent event) public void gadgetEnable(GadgetEnableEvent event)
{ {

View File

@ -19,13 +19,10 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
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.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -101,6 +98,14 @@ public class CopyCat extends RoomedSoloGame<SealBreakerRoom>
_rooms.forEach((player, room) -> _rooms.forEach((player, room) ->
{ {
if (!player.isFlying())
{
UtilTextMiddle.display(null, C.cYellow + "Double Tap Space To Fly", 0, 40, 0, player);
}
player.setAllowFlight(true);
player.setFlying(true);
if (room.next()) if (room.next())
{ {
UtilTextMiddle.display(C.cYellowB + "Level " + room.Level, C.cRed + room.Blocks + " Blocks", 0, 40, 0, player); UtilTextMiddle.display(C.cYellowB + "Level " + room.Level, C.cRed + room.Blocks + " Blocks", 0, 40, 0, player);
@ -118,26 +123,6 @@ public class CopyCat extends RoomedSoloGame<SealBreakerRoom>
}); });
} }
@EventHandler
public void updateFlight(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (Player player : getAllPlayers())
{
player.setAllowFlight(true);
player.setFlying(true);
if (UtilEnt.isGrounded(player))
{
UtilAction.velocity(player, new Vector(0, 0.3, 0));
}
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void blockPlace(BlockPlaceEvent event) public void blockPlace(BlockPlaceEvent event)
{ {

View File

@ -1,5 +1,7 @@
package mineplex.game.nano.game.games.quick.challenges; package mineplex.game.nano.game.games.quick.challenges;
import java.util.concurrent.TimeUnit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Cow; import org.bukkit.entity.Cow;
@ -21,7 +23,7 @@ public class ChallengeMilkCow extends Challenge
{ {
super(game, ChallengeType.MILK_A_COW); super(game, ChallengeType.MILK_A_COW);
_timeout = 2500; _timeout = TimeUnit.SECONDS.toMillis(5);
} }
@Override @Override

View File

@ -4,6 +4,7 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -52,7 +53,7 @@ public class ChallengePlayMusic extends Challenge
_song = song; _song = song;
_songTick = new HashMap<>(); _songTick = new HashMap<>();
_timeout = 2500; _timeout = TimeUnit.SECONDS.toMillis(5);
} }
@Override @Override