From 2f77f536484e14fded37dc2fbf50d5c6c02a317f Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 7 May 2018 23:45:05 +0100 Subject: [PATCH] Make some more changes, cause QA got angry --- .../game/core/condition/Condition.java | 6 +++--- .../src/nautilus/game/arcade/game/Game.java | 2 ++ .../game/games/baconbrawl/kits/KitMamaPig.java | 7 +++---- .../baconbrawl/kits/perks/PerkCrispyBacon.java | 2 +- .../arcade/game/games/lobbers/BombLobbers.java | 4 ++-- .../game/games/lobbers/kits/KitPitcher.java | 16 +++++++++++++++- .../game/arcade/game/games/runner/Runner.java | 10 +--------- .../game/games/runner/kits/KitFrosty.java | 14 +++++--------- .../game/arcade/game/games/spleef/Spleef.java | 10 +--------- .../arcade/game/games/turfforts/TurfForts.java | 1 + .../game/arcade/managers/GameFlagManager.java | 18 +++++++++++++++++- 11 files changed, 51 insertions(+), 39 deletions(-) diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java index 4b4edd4dd..7dd31676a 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java @@ -187,11 +187,11 @@ public class Condition _ent.removePotionEffect(type); //Add - PotionEffect effect = new PotionEffect(type, _ticks, _mult, _ambient); + PotionEffect effect = new PotionEffect(type, _ticks, _mult, _ambient, _showIndicator); if (_ticks == -1) - _ent.addPotionEffect(new PotionEffect(type, 72000, _mult, _ambient), true); + _ent.addPotionEffect(new PotionEffect(type, 72000, _mult, _ambient, _showIndicator), true); else - ((CraftLivingEntity) _ent).getHandle().addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), true)); + ((CraftLivingEntity) _ent).getHandle().addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), _showIndicator)); } catch (Exception e) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 7880f4456..cdb3b793f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -402,6 +402,8 @@ public abstract class Game extends ListenerComponent implements Lifetimed // Split Kit XP public boolean SplitKitXP = false; + public boolean NightVision = false; + private IPacketHandler _useEntityPacketHandler; private int _deadBodyCount; private NautHashMap _deadBodies = new NautHashMap(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java index 4069eb746..8ce249b80 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java @@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.baconbrawl.kits; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Pig; @@ -38,7 +37,7 @@ public class KitMamaPig extends Kit } @Override - public void GiveItems(final Player player) + public void GiveItems(Player player) { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); @@ -49,7 +48,7 @@ public class KitMamaPig extends Kit Manager.GetDisguise().disguise(disguise); Manager.GetGame().CreatureAllowOverride = true; - final Pig pig = player.getWorld().spawn(player.getEyeLocation(), Pig.class); + Pig pig = player.getWorld().spawn(player.getEyeLocation(), Pig.class); pig.setBaby(); pig.setAgeLock(true); pig.setCustomName(C.cYellow + player.getName()); @@ -58,7 +57,7 @@ public class KitMamaPig extends Kit player.setPassenger(pig); - Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), () -> UtilPlayer.sendPacket(player, new PacketPlayOutEntityDestroy(new int[]{pig.getEntityId()})), 2); +// Manager.runSyncLater(() -> UtilPlayer.sendPacket(player, new PacketPlayOutEntityDestroy(new int[]{pig.getEntityId()})), 2); } @EventHandler(priority = EventPriority.LOWEST) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/perks/PerkCrispyBacon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/perks/PerkCrispyBacon.java index 76cb2c81c..039e2a1b6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/perks/PerkCrispyBacon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/perks/PerkCrispyBacon.java @@ -60,7 +60,7 @@ public class PerkCrispyBacon extends Perk Item item = player.getWorld().dropItem(location, new ItemBuilder(Material.GRILLED_PORK) .setTitle(String.valueOf(UtilMath.r(1000))) .build()); - item.setVelocity(new Vector((Math.random() - 0.5) * 0.3, 0.4, (Math.random() - 0.5) * 0.3)); + item.setVelocity(new Vector((Math.random() - 0.5) * 0.5, 0.4, (Math.random() - 0.5) * 0.5)); Manager.GetFire().Add(item, player, 10, 1, 2, 2, GetName(), false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index e9c74e3de..dd8876e3b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -71,7 +71,7 @@ public class BombLobbers extends TeamGame implements IThrown "Fight against your enemies using", "the power of " + C.cRed + "Explosives!", C.cGreen + "Left-Click" + C.Reset + " TNT to throw at your enemy.", - C.cYellow + "Last Team" + " alive wins!" + C.cYellow + "Last Team" + C.Reset + " alive wins!" }; private final Map _averageSpawns = new HashMap<>(); @@ -230,7 +230,7 @@ public class BombLobbers extends TeamGame implements IThrown Player player = event.getPlayer(); ItemStack itemStack = player.getItemInHand(); - if (!IsAlive(player) || itemStack == null || itemStack.getType() == Material.TNT) + if (!IsAlive(player) || itemStack == null || itemStack.getType() != Material.TNT) { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java index c502de5c5..823047dd1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java @@ -50,12 +50,26 @@ public class KitPitcher extends Kit } @Override - public void GiveItems(Player player) + public void ApplyKit(Player player) { + UtilInv.Clear(player); + + for (Perk perk : GetPerks()) + { + perk.Apply(player); + } + + GiveItemsCall(player); + player.getInventory().setItem(1, PLAYER_ITEMS[0]); player.getInventory().setArmorContents(PLAYER_ARMOR); } + @Override + public void GiveItems(Player player) + { + } + @EventHandler public void setFuse(TNTThrowEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java index 560c7ed8c..47f2c35ae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java @@ -17,8 +17,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import com.mineplex.anticheat.checks.move.Glide; import com.mineplex.anticheat.checks.move.HeadRoll; @@ -40,7 +38,6 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.runner.kits.KitArcher; import nautilus.game.arcade.game.games.runner.kits.KitFrosty; @@ -78,6 +75,7 @@ public class Runner extends SoloGame implements IThrown HungerSet = 20; WorldWaterDamage = 4; PrepareFreeze = false; + NightVision = true; new CompassModule() .register(this); @@ -99,12 +97,6 @@ public class Runner extends SoloGame implements IThrown antiHack.addIgnoredCheck(HeadRoll.class); } - @EventHandler - public void teleportIn(PlayerPrepareTeleportEvent event) - { - event.GetPlayer().addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, false, false)); - } - @EventHandler public void arrowDamage(ProjectileHitEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitFrosty.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitFrosty.java index 83bd4ceab..71771f9e5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitFrosty.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitFrosty.java @@ -1,6 +1,5 @@ package nautilus.game.arcade.game.games.runner.kits; -import org.bukkit.EntityEffect; import org.bukkit.Material; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -26,7 +25,6 @@ public class KitFrosty extends Kit public KitFrosty(ArcadeManager manager) { super(manager, GameKit.RUNNER_FROSTY, PERKS); - } @Override @@ -38,14 +36,12 @@ public class KitFrosty extends Kit @EventHandler public void SnowballHit(CustomDamageEvent event) { - if (event.GetProjectile() == null) + if (event.GetProjectile() == null || !(event.GetProjectile() instanceof Snowball)) + { return; + } - if (!(event.GetProjectile() instanceof Snowball)) - return; - - event.GetDamageeEntity().playEffect(EntityEffect.HURT); - - Manager.GetCondition().Factory().Slow("Snowball Slow", event.GetDamageeEntity(), (LivingEntity) event.GetProjectile().getShooter(), 2, 1, false, false, true, false); + event.SetKnockback(false); + Manager.GetCondition().Factory().Slow("Snowball Slow", event.GetDamageeEntity(), (LivingEntity) event.GetProjectile().getShooter(), 2, 2, false, false, true, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java index 81f035a98..9a2ad64b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java @@ -12,8 +12,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -31,7 +29,6 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.spleef.kits.KitArcher; import nautilus.game.arcade.game.games.spleef.kits.KitBrawler; @@ -63,6 +60,7 @@ public class Spleef extends SoloGame DamagePvP = false; WorldWaterDamage = 4; PrepareFreeze = false; + NightVision = true; registerStatTrackers( new SpleefBlockDestroyStatTracker(this) @@ -81,12 +79,6 @@ public class Spleef extends SoloGame .register(this); } - @EventHandler - public void teleportIn(PlayerPrepareTeleportEvent event) - { - event.GetPlayer().addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, false, false)); - } - @EventHandler public void snowballHit(ProjectileHitEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 42b81cba5..f4c376995 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -153,6 +153,7 @@ public class TurfForts extends TeamGame DamageFall = false; DeathSpectateSecs = 4; GameTimeout = TimeUnit.MINUTES.toMillis(15); + InventoryClick = true; _breakStatTracker = new BlockBreakStatTracker(this, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index a5499c533..7c0753681 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -45,6 +45,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; import mineplex.core.Managers; @@ -919,8 +920,10 @@ public class GameFlagManager implements Listener } } - if (game == null || !game.IsLive()) + if (game == null || !game.InProgress()) + { return; + } if (game.HungerSet != -1) { @@ -941,6 +944,19 @@ public class GameFlagManager implements Listener player.setHealth(Math.min(game.HealthSet, player.getMaxHealth())); } } + + if (game.NightVision) + { + for (Player player : UtilServer.getPlayersCollection()) + { + if (player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) + { + continue; + } + + Manager.GetCondition().Factory().NightVision("Night Vision", player, player, Integer.MAX_VALUE, 0, false, false, false); + } + } } @EventHandler(priority = EventPriority.LOWEST)