fixed shrinking border warning
This commit is contained in:
parent
34df173940
commit
9544c953a2
@ -82,6 +82,8 @@ public abstract class IntegerSetting extends Setting<Integer> {
|
|||||||
this.state = container.has(this.getNamespacedKey())
|
this.state = container.has(this.getNamespacedKey())
|
||||||
? Integer.valueOf(Objects.requireNonNull(container.get(this.getNamespacedKey(), PersistentDataType.STRING)))
|
? Integer.valueOf(Objects.requireNonNull(container.get(this.getNamespacedKey(), PersistentDataType.STRING)))
|
||||||
: this.defaultValue();
|
: this.defaultValue();
|
||||||
|
|
||||||
|
if(!this.options.contains(this.state)) this.state = this.defaultValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,7 +17,7 @@ import org.bukkit.persistence.PersistentDataContainer;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class Setting<TDataType> {
|
public abstract class Setting<TDataType> {
|
||||||
TDataType state;
|
protected TDataType state;
|
||||||
private final Settings.Key key;
|
private final Settings.Key key;
|
||||||
|
|
||||||
public Setting(Settings.Key key) {
|
public Setting(Settings.Key key) {
|
||||||
|
@ -48,8 +48,8 @@ public class ShrinkingBorderListener extends ApplianceListener<ShrinkingBorder>
|
|||||||
private boolean isSave(Location playerLocation) {
|
private boolean isSave(Location playerLocation) {
|
||||||
WorldBorder worldBorder = playerLocation.getWorld().getWorldBorder();
|
WorldBorder worldBorder = playerLocation.getWorld().getWorldBorder();
|
||||||
Location relativeLocation = playerLocation.clone().subtract(worldBorder.getCenter());
|
Location relativeLocation = playerLocation.clone().subtract(worldBorder.getCenter());
|
||||||
if(relativeLocation.getX() > this.getAppliance().getOption(ShrinkingBorderCommand.Argument.MINIMUM_SIZE)) return false;
|
if(Math.abs(relativeLocation.getX()) > this.getAppliance().getOption(ShrinkingBorderCommand.Argument.MINIMUM_SIZE)) return false;
|
||||||
if(relativeLocation.getZ() > this.getAppliance().getOption(ShrinkingBorderCommand.Argument.MINIMUM_SIZE)) return false;
|
if(Math.abs(relativeLocation.getZ()) > this.getAppliance().getOption(ShrinkingBorderCommand.Argument.MINIMUM_SIZE)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user