From 8066eb939acb2e7f35074f9ad8bc1bfa654c42be Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 6 Jun 2016 18:14:06 +0100 Subject: [PATCH] PC-500 Fixes an issue where players were able to open beacon inventories can give themselves the buffs from it. --- .../game/games/survivalgames/SurvivalGames.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index b39c25164..72c4af1cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -37,14 +37,14 @@ import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.hanging.HangingBreakEvent; +import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; -import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.vehicle.VehicleCreateEvent; +import org.bukkit.inventory.BeaconInventory; import org.bukkit.inventory.FurnaceInventory; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; @@ -94,8 +94,6 @@ import nautilus.game.arcade.stats.SimultaneousSkeletonStatTracker; import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker; import net.minecraft.server.v1_8_R3.EntityLargeFireball; import net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam; -import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder; -import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder.EnumWorldBorderAction; import net.minecraft.server.v1_8_R3.ScoreboardTeam; import net.minecraft.server.v1_8_R3.WorldServer; @@ -2018,6 +2016,15 @@ public abstract class SurvivalGames extends Game } } } + + @EventHandler + public void onInventoryOpen(InventoryOpenEvent event) + { + if(event.getInventory() instanceof BeaconInventory) + { + event.setCancelled(true); + } + } public int getSecondsSinceStart() {