Really really really fixed Rune of Holding this time

This commit is contained in:
Sam 2017-11-09 19:59:53 +00:00 committed by Alexander Meech
parent 6229a17373
commit f119e24fcb

View File

@ -55,7 +55,11 @@ public class CakePlayerModule extends CakeModule
.setUnbreakable(true) .setUnbreakable(true)
.build(); .build();
private static final int PLATFORM_DELTA = 1; private static final int PLATFORM_DELTA = 1;
private static final PotionEffect SPAWN_PROTECTION = new PotionEffect(PotionEffectType.REGENERATION, 80, 4); private static final PotionEffect[] SPAWN_PROTECTION =
{
new PotionEffect(PotionEffectType.REGENERATION, 80, 4),
new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 80, 4),
};
private final Set<Block> _placedBlocks; private final Set<Block> _placedBlocks;
// Used to store the inventory of a player when using the rune of holding // Used to store the inventory of a player when using the rune of holding
@ -144,7 +148,7 @@ public class CakePlayerModule extends CakeModule
_game.GetPlayers(true).forEach(player -> _game.GetPlayers(true).forEach(player ->
{ {
if (UtilPlayer.isSpectator(player) || UtilInv.contains(player, RUNE_OF_HOLDING.getType(), RUNE_OF_HOLDING.getData().getData(), 1)) if (UtilPlayer.isSpectator(player) || !UtilInv.contains(player, RUNE_OF_HOLDING.getType(), RUNE_OF_HOLDING.getData().getData(), 1))
{ {
return; return;
} }
@ -175,7 +179,7 @@ public class CakePlayerModule extends CakeModule
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 0.8F); player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 0.8F);
player.sendMessage(F.main("Game", "You consumed one " + F.name(RUNE_OF_HOLDING.getItemMeta().getDisplayName()) + ". You will respawn with your inventory.")); player.sendMessage(F.main("Game", "You consumed one " + F.name(RUNE_OF_HOLDING.getItemMeta().getDisplayName()) + ". You will respawn with your inventory."));
}, 20); }, 5);
} }
else else
{ {
@ -214,7 +218,13 @@ public class CakePlayerModule extends CakeModule
{ {
Player player = event.GetPlayer(); Player player = event.GetPlayer();
_game.getArcadeManager().runSyncLater(() -> player.addPotionEffect(SPAWN_PROTECTION), 5); _game.getArcadeManager().runSyncLater(() ->
{
for (PotionEffect effect : SPAWN_PROTECTION)
{
player.addPotionEffect(effect);
}
}, 5);
} }
@EventHandler @EventHandler