From 890442178da61acd15f70984d1d58221eccbaf3d Mon Sep 17 00:00:00 2001 From: asofold Date: Fri, 6 Feb 2015 02:27:23 +0100 Subject: [PATCH] Random fixes for CreativeFly. --- .../neatmonster/nocheatplus/checks/moving/CreativeFly.java | 7 +++++-- .../nocheatplus/checks/moving/MovingConfig.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/CreativeFly.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/CreativeFly.java index 6b8ac376..601aa980 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/CreativeFly.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/CreativeFly.java @@ -2,6 +2,7 @@ package fr.neatmonster.nocheatplus.checks.moving; import java.util.Locale; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -10,6 +11,7 @@ import fr.neatmonster.nocheatplus.actions.ParameterName; import fr.neatmonster.nocheatplus.checks.Check; import fr.neatmonster.nocheatplus.checks.CheckType; import fr.neatmonster.nocheatplus.checks.ViolationData; +import fr.neatmonster.nocheatplus.compat.BridgeMisc; import fr.neatmonster.nocheatplus.logging.Streams; import fr.neatmonster.nocheatplus.utilities.PlayerLocation; import fr.neatmonster.nocheatplus.utilities.TrigUtil; @@ -44,7 +46,8 @@ public class CreativeFly extends Check { data.setSetBack(from); } - final ModelFlying model = cc.flyingModels.get(player.getGameMode()); + final GameMode gameMode = player.getGameMode(); + final ModelFlying model = cc.flyingModels.get(gameMode); // Before doing anything, do a basic height check to determine if players are flying too high. final double maximumHeight = model.maxHeight + player.getWorld().getMaxHeight(); @@ -77,7 +80,7 @@ public class CreativeFly extends Check { fSpeed = 1D + 0.2D * (speedModifier + 1D); } - final boolean flying = player.isFlying(); + final boolean flying = gameMode == BridgeMisc.GAME_MODE_SPECTATOR || player.isFlying(); if (flying) { // TODO: Consider mechanichs for flying backwards. fSpeed *= data.flySpeed / 0.1; diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java index 9c4dd6ef..fe4ad3d0 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java @@ -182,7 +182,7 @@ public class MovingConfig extends ACheckConfig { creativeFlyCheck = config.getBoolean(ConfPaths.MOVING_CREATIVEFLY_CHECK); final ModelFlying defaultModel = new ModelFlying(config, ConfPaths.MOVING_CREATIVEFLY_MODEL + "creative.", new ModelFlying()); for (final GameMode gameMode : GameMode.values()) { - flyingModels.put(gameMode, new ModelFlying(config, ConfPaths.MOVING_CREATIVEFLY_MODEL + gameMode.toString().toLowerCase() + ".", defaultModel)); + flyingModels.put(gameMode, new ModelFlying(config, ConfPaths.MOVING_CREATIVEFLY_MODEL + (gameMode.name().toLowerCase()) + ".", defaultModel)); } creativeFlyActions = config.getOptimizedActionList(ConfPaths.MOVING_CREATIVEFLY_ACTIONS, Permissions.MOVING_CREATIVEFLY);