From dbbe9d5dbaec848d1d282f2e6a44fca75852180f Mon Sep 17 00:00:00 2001 From: Gibstick Date: Fri, 19 Jul 2013 18:34:47 -0400 Subject: [PATCH] I cannot into boolean logic (fixed limit checking and exceptions) --- dist/DiscoSheep.jar | Bin 31665 -> 31770 bytes .../bukkit/discosheep/DiscoParty.java | 8 ++++---- .../discosheep/DiscoSheepCommandExecutor.java | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dist/DiscoSheep.jar b/dist/DiscoSheep.jar index 5fb558801ac1d58811b824b1ffd8e1363e77de3e..5e1b1b7016ec45362182d39ff0aa1f2b8cdb739d 100644 GIT binary patch delta 4035 zcmZ`+3wTt;75>lNBzLlVL&B0x2uUO%K*%Nm3L!k|11t!XM?wgR37}%KBw!$q4Vr+u z1S2RaNH3OREo!yJTC75FV=CgK)(1~TQ4y`w`ar5yYpd3(^qk3Nv#GlK?aY~(fByN; znK^U!?*4*q|B|fYS&k?tpn!s{TdW*o?AG1mEiwwW+S6#5RCSam)$KH%tB#lG&Dgkt zt)E?ZtyTZUKrb+`<1yFp)PyP+`~?Q3?m_ZB=x2X6yg1hZa^nE^Mu9Mpe+ThAqq?|f zX$YUr_(6B0zg?d_U+|tj_(NfQB!8Olf1Le2{D;36pDy_2BZ{L$PsigU%HqV6PEMmi^G2tiUZ!_;EBAO?bhD7jewQOHTHKdtSzIv0hPlRqEHI z=Y&|V3-F{9Z{STQ{(`qmoO0r?cw36U#XSBAyUibkcLegT6Yt@D6PsoFX@w6I&WQPU zg%1@z3MhQ6@DGJg6h2k>r^06n|5Et3!siNKI9b=1PW%U7$(;Wxd@ViSD12+;EcX)> zk&_H^xG0LE6~(wP5+@azGN@Q6#fs%rIhp%uE9mB}(m4 zlq7YsqJdJUm^8@AxKu@HiqgeAN6}yz%8*8;q9G<_DH!drlct(9&7_O$qYe4IztJ6si*_1xs$*5j{X`Gg8Ks+@jF`^RGigRgSLtjr zXR>ds-L}d`Cj{uH7FOX(hFCOj`t8|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m;m%qmm?gY|u<|6qV zTQ^jY2TVN4b*C%ype{9jsTh%xkZ=ZZCWo`oY%uXuo*q1AKAtKPvg|Y>M~=+R2Q_vYt-?n`F2FNJNGM}d8~f;w{L650uim6z~6gOu~qZPNaC*}ZWa7x jYzMkC9UdR^H^dj%Pj 0) { + if (duration <= DiscoParty.maxDuration && duration > 0) { this.duration = duration; return this; } else { @@ -103,7 +103,7 @@ public class DiscoParty { } public DiscoParty setPeriod(int period) throws IllegalArgumentException { - if (period >= DiscoParty.minPeriod || period <= DiscoParty.maxPeriod) { + if (period >= DiscoParty.minPeriod && period <= DiscoParty.maxPeriod) { this.period = period; return this; } else { @@ -112,7 +112,7 @@ public class DiscoParty { } public DiscoParty setRadius(int radius) throws IllegalArgumentException { - if (radius <= DiscoParty.maxRadius || radius > 0) { + if (radius <= DiscoParty.maxRadius && radius > 0) { this.radius = radius; return this; } else { @@ -121,7 +121,7 @@ public class DiscoParty { } public DiscoParty setSheep(int sheep) throws IllegalArgumentException { - if (sheep <= DiscoParty.maxSheep || sheep > 0) { + if (sheep <= DiscoParty.maxSheep && sheep > 0) { this.sheep = sheep; return this; } else { diff --git a/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java b/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java index 510bece..df3cc46 100644 --- a/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java +++ b/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java @@ -187,6 +187,7 @@ public class DiscoSheepCommandExecutor implements CommandExecutor { } else if (args[i].equalsIgnoreCase("-r")) { try { mainParty.setRadius(parseNextIntArg(args, i)); + sender.sendMessage("RADIUS OK"); } catch (IllegalArgumentException e) { sender.sendMessage("Radius must be an integer within the range [1, " + DiscoParty.maxRadius + "]"); @@ -195,6 +196,7 @@ public class DiscoSheepCommandExecutor implements CommandExecutor { } else if (args[i].equalsIgnoreCase("-n")) { try { mainParty.setSheep(parseNextIntArg(args, i)); + sender.sendMessage("SHEEP OK"); } catch (IllegalArgumentException e) { sender.sendMessage("The number of sheep must be an integer within the range [1, " + DiscoParty.maxSheep + "]"); @@ -203,6 +205,7 @@ public class DiscoSheepCommandExecutor implements CommandExecutor { } else if (args[i].equalsIgnoreCase("-t")) { try { mainParty.setDuration(parent.toTicks(parseNextIntArg(args, i))); + sender.sendMessage("DURATION OK"); } catch (IllegalArgumentException e) { sender.sendMessage("The duration in seconds must be an integer within the range [1, " + parent.toSeconds(DiscoParty.maxDuration) + "]"); @@ -211,6 +214,7 @@ public class DiscoSheepCommandExecutor implements CommandExecutor { } else if (args[i].equalsIgnoreCase("-p")) { try { mainParty.setPeriod(parseNextIntArg(args, i)); + sender.sendMessage("PERIOD OK"); } catch (IllegalArgumentException e) { sender.sendMessage( "The period in ticks must be within the range ["