diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index e55855a6d..4c4f9cb9a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -109,8 +109,8 @@ public class AntiHack extends MiniPlugin .build(); public static final Map, CheckThresholds> STRICT_CHECKS = ImmutableMap., CheckThresholds>builder() - .put(Glide.class, new CheckThresholds("Flying", 600, 1200, 1600)) - .put(Speed.class, new CheckThresholds("Speed", 600, 1200, 1600)) + .put(Glide.class, new CheckThresholds("Flying", 600, 1200, 1800)) + .put(Speed.class, new CheckThresholds("Speed", 600, 1200, 1800)) .build(); private static final CheckThresholds NOOP_THRESHOLD = new CheckThresholds("Unknown", Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); @@ -506,7 +506,7 @@ public class AntiHack extends MiniPlugin Integer pastVl = this._cooldown.getIfPresent(key); if (pastVl == null) { - MajorViolationCommand command = new MajorViolationCommand(_thisServer, event.getPlayer().getName(), CheckManager.getCheckSimpleName(event.getCheckClass()), event.getViolations(), event.getMessage()); + MajorViolationCommand command = new MajorViolationCommand(_thisServer, event.getPlayer().getName(), CheckManager.getCheckSimpleName(event.getCheckClass()), event.getViolations(), event.getMessage(), isStrict()); ServerCommandManager.getInstance().publishCommand(command); _cooldown.put(key, event.getViolations()); @@ -561,16 +561,17 @@ public class AntiHack extends MiniPlugin private BaseComponent[] getMinimalMessage(MajorViolationCommand violation) { Class checkType = CheckManager.getCheckBySimpleName(violation.getHackType()); - if (!CHECKS.containsKey(checkType)) + CheckThresholds thresholds = CHECKS.getOrDefault(checkType, NOOP_THRESHOLD); + if (violation.isStrict()) { - System.out.println("Warning: Unknown check type '" + violation.getHackType() + "' " + checkType); + thresholds = STRICT_CHECKS.getOrDefault(checkType, thresholds); } ComponentBuilder componentBuilder = new ComponentBuilder("") .append("A").color(ChatColor.AQUA).obfuscated(true) .append(" GWEN > ", ComponentBuilder.FormatRetention.NONE).color(ChatColor.RED).bold(true) .append(violation.getPlayerName(), ComponentBuilder.FormatRetention.NONE).color(ChatColor.GOLD) .append(" suspected of ", ComponentBuilder.FormatRetention.NONE).color(ChatColor.YELLOW); - CHECKS.getOrDefault(checkType, NOOP_THRESHOLD).format(componentBuilder, violation.getViolations()); + thresholds.format(componentBuilder, violation.getViolations()); if (!violation.getOriginatingServer().equals(this._thisServer)) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/MajorViolationCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/MajorViolationCommand.java index 8ed58a419..85206b559 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/MajorViolationCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/MajorViolationCommand.java @@ -9,14 +9,16 @@ public class MajorViolationCommand extends ServerCommand private final String _hackType; private final int _violations; private final String _message; + private final boolean _strict; - public MajorViolationCommand(String thisServer, String playerName, String hackType, int violations, String message) + public MajorViolationCommand(String thisServer, String playerName, String hackType, int violations, String message, boolean strict) { this._thisServer = thisServer; this._playerName = playerName; this._hackType = hackType; this._violations = violations; this._message = message; + this._strict = strict; } public String getOriginatingServer() @@ -43,4 +45,9 @@ public class MajorViolationCommand extends ServerCommand { return _message; } + + public boolean isStrict() + { + return _strict; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 2311b2b75..346a53b22 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -1112,6 +1112,8 @@ public class GadgetManager extends MiniPlugin public void disableAll() { + _userGadgetPersistence.setEnabled(false); + for (GadgetType gadgetType : _gadgets.keySet()) { for (Gadget gadget : _gadgets.get(gadgetType)) @@ -1140,8 +1142,7 @@ public class GadgetManager extends MiniPlugin if (gadget instanceof KitSelectorGadget) continue; - for (Player player : UtilServer.getPlayers()) - gadget.disable(player); + gadget.disableForAll(); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java index 3f62be744..7439ae81c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java @@ -16,15 +16,27 @@ public class UserGadgetPersistence private final GadgetManager _manager; private final PlayerKeyValueRepository _repository; + private boolean _enabled; public UserGadgetPersistence(GadgetManager manager) { _manager = manager; _repository = new PlayerKeyValueRepository<>("gadgets", String.class); + _enabled = true; + } + + public void setEnabled(boolean enabled) + { + _enabled = enabled; } public void load(Player player) { + if (!_enabled) + { + return; + } + _repository.getAll(player.getUniqueId()).thenCompose(BukkitFuture.accept(values -> { if (player.isOnline()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java index d646f4c91..046f74787 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -123,6 +123,7 @@ public abstract class WinEffectGadget extends Gadget _allPlayers.clear(); _allPlayers = null; // Loads gadgets back when players are teleported to the arcade hub, after the win effect + Manager.getUserGadgetPersistence().setEnabled(true); for (Player player : UtilServer.getPlayers()) { Manager.getUserGadgetPersistence().load(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index bcf32bf6e..1a2baeb6b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -75,6 +75,7 @@ import mineplex.core.events.EnableArcadeSpawnEvent; import mineplex.core.explosion.Explosion; import mineplex.core.explosion.ExplosionEvent; import mineplex.core.facebook.FacebookManager; +import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.ToggleMobsEvent; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; @@ -1689,6 +1690,16 @@ public class ArcadeManager extends MiniPlugin implements IRelation getCosmeticManager().getGadgetManager().setGadgetEnabled(playerCount <= (GetGameHostManager().isEventServer() ? 120 : 40)); } + @EventHandler(priority = EventPriority.HIGH) + public void disableGadgetsInGame(GadgetEnableEvent event) + { + if (_game != null && _game.InProgress() && _game.GadgetsDisabled && event.getGadget().getGadgetType() == GadgetType.COSTUME) + { + event.setShowMessage(false); + event.setCancelled(true); + } + } + /*public void saveBasicStats(final Game game) { if (!IsTournamentServer()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java index e7c0ebbb2..acf9043b2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java @@ -29,7 +29,7 @@ public class KitJumper extends ProgressingKit }; private static final Perk[] PERKS = { - new PerkDoubleJump("Double Jump", 1.2, 1.2, false, 3000, true), + new PerkDoubleJump("Double Jump", 1.2, 1.2, false), new PerkDummy("Feathered Boots", Collections.singletonList(C.cGray + "You take no fall damage.").toArray(new String[1])), new PerkCraftman() }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/common/LeashedEntity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/common/LeashedEntity.java index b0100b73d..4fb7f4bf9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/common/LeashedEntity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/common/LeashedEntity.java @@ -64,6 +64,11 @@ public class LeashedEntity implements Listener { if (event.GetDamageeEntity().equals(_fakeLeash) && event.GetCause() == DamageCause.ENTITY_ATTACK) { + if (event.GetDamagerEntity(true).equals(_host)) + { + event.SetCancelled("Self Leash Damage"); + } + event.setDamagee(_host); event.SetIgnoreRate(false); }