Random fixes for CreativeFly.

This commit is contained in:
asofold 2015-02-06 02:27:23 +01:00
parent e0a8ef21d6
commit 890442178d
2 changed files with 6 additions and 3 deletions

View File

@ -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;

View File

@ -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);