@SuppressWarnings("deprecation") public void setGameMode(Player player, String param) { param = param.toLowerCase(); for (GameMode gm : GameMode.values()) { if (gm.toString().toLowerCase().startsWith(param) || param.equalsIgnoreCase(gm.getValue() + "")) { setGameMode(player, gm); return; } } sendMessage("No such gamemode: &c" + param); }
/** * Instantiates a new moving configuration. * * @param config the data */ public MovingConfig(final ConfigFile config) { super(config, ConfPaths.MOVING); ignoreCreative = config.getBoolean(ConfPaths.MOVING_CREATIVEFLY_IGNORECREATIVE); ignoreAllowFlight = config.getBoolean(ConfPaths.MOVING_CREATIVEFLY_IGNOREALLOWFLIGHT); 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.name().toLowerCase()) + ".", defaultModel)); } creativeFlyActions = config.getOptimizedActionList( ConfPaths.MOVING_CREATIVEFLY_ACTIONS, Permissions.MOVING_CREATIVEFLY); morePacketsCheck = config.getBoolean(ConfPaths.MOVING_MOREPACKETS_CHECK); morePacketsEPSIdeal = config.getInt(ConfPaths.MOVING_MOREPACKETS_EPSIDEAL); morePacketsEPSMax = Math.max(morePacketsEPSIdeal, config.getInt(ConfPaths.MOVING_MOREPACKETS_EPSMAX)); morePacketsEPSBuckets = 2 * Math.max(1, Math.min(60, config.getInt(ConfPaths.MOVING_MOREPACKETS_SECONDS))); morePacketsBurstPackets = config.getInt(ConfPaths.MOVING_MOREPACKETS_BURST_EPM); morePacketsBurstDirect = config.getInt(ConfPaths.MOVING_MOREPACKETS_BURST_DIRECT); morePacketsBurstEPM = config.getInt(ConfPaths.MOVING_MOREPACKETS_BURST_EPM); morePacketsActions = config.getOptimizedActionList( ConfPaths.MOVING_MOREPACKETS_ACTIONS, Permissions.MOVING_MOREPACKETS); morePacketsVehicleCheck = config.getBoolean(ConfPaths.MOVING_MOREPACKETSVEHICLE_CHECK); morePacketsVehicleActions = config.getOptimizedActionList( ConfPaths.MOVING_MOREPACKETSVEHICLE_ACTIONS, Permissions.MOVING_MOREPACKETS); noFallCheck = config.getBoolean(ConfPaths.MOVING_NOFALL_CHECK); noFallDealDamage = config.getBoolean(ConfPaths.MOVING_NOFALL_DEALDAMAGE); noFallViolationReset = config.getBoolean(ConfPaths.MOVING_NOFALL_RESETONVL); noFallTpReset = config.getBoolean(ConfPaths.MOVING_NOFALL_RESETONTP); noFallVehicleReset = config.getBoolean(ConfPaths.MOVING_NOFALL_RESETONVEHICLE); noFallAntiCriticals = config.getBoolean(ConfPaths.MOVING_NOFALL_ANTICRITICALS); noFallActions = config.getOptimizedActionList(ConfPaths.MOVING_NOFALL_ACTIONS, Permissions.MOVING_NOFALL); passableCheck = config.getBoolean(ConfPaths.MOVING_PASSABLE_CHECK); passableRayTracingCheck = config.getBoolean(ConfPaths.MOVING_PASSABLE_RAYTRACING_CHECK); passableRayTracingBlockChangeOnly = config.getBoolean(ConfPaths.MOVING_PASSABLE_RAYTRACING_BLOCKCHANGEONLY); passableActions = config.getOptimizedActionList( ConfPaths.MOVING_PASSABLE_ACTIONS, Permissions.MOVING_PASSABLE); passableUntrackedTeleportCheck = config.getBoolean(ConfPaths.MOVING_PASSABLE_UNTRACKED_TELEPORT_ACTIVE); passableUntrackedCommandCheck = config.getBoolean(ConfPaths.MOVING_PASSABLE_UNTRACKED_CMD_ACTIVE); passableUntrackedCommandTryTeleport = config.getBoolean(ConfPaths.MOVING_PASSABLE_UNTRACKED_CMD_TRYTELEPORT); CommandUtil.feedCommands( passableUntrackedCommandPrefixes, config, ConfPaths.MOVING_PASSABLE_UNTRACKED_CMD_PREFIXES, true); survivalFlyCheck = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_CHECK); // Default values are specified here because this settings aren't showed by default into the // configuration file. survivalFlyBlockingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_BLOCKINGSPEED, 100); survivalFlySneakingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_SNEAKINGSPEED, 100); survivalFlySpeedingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_SPEEDINGSPEED, 200); survivalFlySprintingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_SPRINTINGSPEED, 100); survivalFlySwimmingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_SWIMMINGSPEED, 100); survivalFlyWalkingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_WALKINGSPEED, 100); survivalFlyCobwebHack = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_COBWEBHACK, true); sfGroundHop = config.getBoolean( ConfPaths.MOVING_SURVIVALFLY_GROUNDHOP, ServerVersion.compareMinecraftVersion("1.7") == -1); survivalFlyAccountingH = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_EXTENDED_HACC, false); survivalFlyAccountingV = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_EXTENDED_VACC); sfSetBackPolicyFallDamage = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_SETBACKPOLICY_FALLDAMAGE); sfSetBackPolicyVoid = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_SETBACKPOLICY_VOIDTOVOID); final double sfStepHeight = config.getDouble(ConfPaths.MOVING_SURVIVALFLY_STEPHEIGHT, Double.MAX_VALUE); if (sfStepHeight == Double.MAX_VALUE) { final String ref; if (Bukkit.getVersion().toLowerCase().indexOf("spigot") != -1) { // Assume 1.8 clients being supported. ref = "1.7.10"; } else { ref = "1.8"; } this.sfStepHeight = ServerVersion.select(ref, 0.5, 0.6, 0.6, 0.5).doubleValue(); } else { this.sfStepHeight = sfStepHeight; } survivalFlyVLFreeze = config.getLong(ConfPaths.MOVING_SURVIVALFLY_VLFREEZE, 2000L); survivalFlyActions = config.getOptimizedActionList( ConfPaths.MOVING_SURVIVALFLY_ACTIONS, Permissions.MOVING_SURVIVALFLY); sfHoverCheck = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_HOVER_CHECK); sfHoverTicks = config.getInt(ConfPaths.MOVING_SURVIVALFLY_HOVER_TICKS); sfHoverLoginTicks = Math.max(0, config.getInt(ConfPaths.MOVING_SURVIVALFLY_HOVER_LOGINTICKS)); sfHoverFallDamage = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_HOVER_FALLDAMAGE); sfHoverViolation = config.getDouble(ConfPaths.MOVING_SURVIVALFLY_HOVER_SFVIOLATION); velocityActivationCounter = config.getInt(ConfPaths.MOVING_VELOCITY_ACTIVATIONCOUNTER); velocityActivationTicks = config.getInt(ConfPaths.MOVING_VELOCITY_ACTIVATIONTICKS); velocityStrictInvalidation = config.getBoolean(ConfPaths.MOVING_VELOCITY_STRICTINVALIDATION); yOnGround = config.getDouble( ConfPaths.MOVING_YONGROUND, Y_ON_GROUND_MIN, Y_ON_GROUND_MAX, Y_ON_GROUND_DEFAULT); // sqrt(1/256), see: NetServerHandler. noFallyOnGround = config.getDouble( ConfPaths.MOVING_NOFALL_YONGROUND, Y_ON_GROUND_MIN, Y_ON_GROUND_MAX, yOnGround); // TODO: Ignore the stance, once it is known that the server catches such. ignoreStance = config.getAlmostBoolean(ConfPaths.MOVING_IGNORESTANCE, AlmostBoolean.NO).decide(); tempKickIllegal = config.getBoolean(ConfPaths.MOVING_TEMPKICKILLEGAL); loadChunksOnJoin = config.getBoolean(ConfPaths.MOVING_LOADCHUNKS_JOIN); sprintingGrace = Math.max( 0L, (long) (config.getDouble(ConfPaths.MOVING_SPRINTINGGRACE) * 1000.0)); // Config: seconds. assumeSprint = config.getBoolean(ConfPaths.MOVING_ASSUMESPRINT); speedGrace = Math.max( 0, (int) Math.round( config.getDouble(ConfPaths.MOVING_SPEEDGRACE) * 20.0)); // Config: seconds AlmostBoolean ref = config.getAlmostBoolean(ConfPaths.MOVING_ENFORCELOCATION, AlmostBoolean.MAYBE); if (ref == AlmostBoolean.MAYBE) { enforceLocation = Bugs.shouldEnforceLocation(); } else { enforceLocation = ref.decide(); } ref = config.getAlmostBoolean(ConfPaths.MOVING_VEHICLES_ENFORCELOCATION, AlmostBoolean.MAYBE); vehicleEnforceLocation = ref.decideOptimistically(); // Currently rather enabled. vehiclePreventDestroyOwn = config.getBoolean(ConfPaths.MOVING_VEHICLES_PREVENTDESTROYOWN); traceSize = config.getInt(ConfPaths.MOVING_TRACE_SIZE); traceMergeDist = config.getDouble(ConfPaths.MOVING_TRACE_MERGEDIST); }