From 9a3b472e966dc07976f2868b757f5d0af70cbaeb Mon Sep 17 00:00:00 2001 From: ulumulu1510 Date: Fri, 26 Feb 2016 16:57:09 +0100 Subject: [PATCH] 0.2h - Resolve PSS NullPointerException through MassiveExceptions. --- .../massivecraft/factions/cmd/CmdFactionsSetCircle.java | 2 -- .../massivecraft/factions/cmd/CmdFactionsSetSquare.java | 3 +-- .../massivecraft/factions/cmd/CmdFactionsSetXRadius.java | 7 ++----- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSetCircle.java b/src/com/massivecraft/factions/cmd/CmdFactionsSetCircle.java index e88bd268..b33d1d9f 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsSetCircle.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsSetCircle.java @@ -48,8 +48,6 @@ public class CmdFactionsSetCircle extends CmdFactionsSetXRadius chunks.add(chunk); // The center should come first for pretty messages Integer radiusZero = this.getRadiusZero(); - if (radiusZero == null) return null; - double radiusSquared = radiusZero * radiusZero; for (int dx = -radiusZero; dx <= radiusZero; dx++) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSetSquare.java b/src/com/massivecraft/factions/cmd/CmdFactionsSetSquare.java index 43f575ea..c70a377a 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsSetSquare.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsSetSquare.java @@ -48,8 +48,7 @@ public class CmdFactionsSetSquare extends CmdFactionsSetXRadius chunks.add(chunk); // The center should come first for pretty messages Integer radiusZero = this.getRadiusZero(); - if (radiusZero == null) return null; - + for (int dx = -radiusZero; dx <= radiusZero; dx++) { for (int dz = -radiusZero; dz <= radiusZero; dz++) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSetXRadius.java b/src/com/massivecraft/factions/cmd/CmdFactionsSetXRadius.java index db21756a..92be3bc2 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsSetXRadius.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsSetXRadius.java @@ -37,15 +37,13 @@ public abstract class CmdFactionsSetXRadius extends CmdFactionsSetX // Radius Claim Min if (radius < 1) { - msg("If you specify a radius, it must be at least 1."); - return null; + throw new MassiveException().setMsg("If you specify a radius, it must be at least 1."); } // Radius Claim Max if (radius > MConf.get().setRadiusMax && ! msender.isOverriding()) { - msg("The maximum radius allowed is %s.", MConf.get().setRadiusMax); - return null; + throw new MassiveException().setMsg("The maximum radius allowed is %s.", MConf.get().setRadiusMax); } return radius; @@ -54,7 +52,6 @@ public abstract class CmdFactionsSetXRadius extends CmdFactionsSetX public Integer getRadiusZero() throws MassiveException { Integer ret = this.getRadius(); - if (ret == null) return ret; return ret - 1; }