Add max-projectile-speed option

Projectils can load chunks pretty intensively if too fast.
This commit is contained in:
md678685 2019-08-05 19:56:25 +01:00
parent 93d36779f0
commit 8bcef6022b
5 changed files with 19 additions and 2 deletions

View file

@ -335,4 +335,6 @@ public interface ISettings extends IConf {
boolean logCommandBlockCommands();
Set<Predicate<String>> getNickBlacklist();
double getMaxProjectileSpeed();
}

View file

@ -557,6 +557,7 @@ public class Settings implements net.ess3.api.ISettings {
isSafeUsermap = _isSafeUsermap();
logCommandBlockCommands = _logCommandBlockCommands();
nickBlacklist = _getNickBlacklist();
maxProjectileSpeed = _getMaxProjectileSpeed();
}
void _lateLoadItemSpawnBlacklist() {
@ -1611,4 +1612,15 @@ public class Settings implements net.ess3.api.ISettings {
public Set<Predicate<String>> getNickBlacklist() {
return nickBlacklist;
}
private double maxProjectileSpeed;
private double _getMaxProjectileSpeed() {
return config.getDouble("max-projectile-speed", 8);
}
@Override
public double getMaxProjectileSpeed() {
return maxProjectileSpeed;
}
}

View file

@ -47,10 +47,11 @@ public class Commandfireball extends EssentialsCommand {
if (args.length > 1) {
try {
speed = FloatUtil.parseDouble(args[1]);
speed = Double.max(0, Double.min(speed, ess.getSettings().getMaxProjectileSpeed()));
} catch (Exception ignored) {}
}
if (args.length > 2 && args[2].equalsIgnoreCase("ride")) {
if (args.length > 2 && args[2].equalsIgnoreCase("ride") && user.isAuthorized("essentials.fireball.ride")) {
ride = true;
}

View file

@ -614,6 +614,9 @@ sethome-multiple:
# change the compass' direction to point towards their first home.
compass-towards-home-perm: false
# Set the maximum speed for projectiles spawned with /fireball.
max-projectile-speed: 8
############################################################
# +------------------------------------------------------+ #
# | EssentialsEco | #

View file

@ -2,5 +2,4 @@ package net.ess3.api;
public interface ISettings extends com.earth2me.essentials.ISettings {
}