From 4e3d54f3a407ffeeea3b7f87aa914fbb02484f90 Mon Sep 17 00:00:00 2001 From: Gibstick Date: Thu, 18 Jul 2013 21:43:14 -0400 Subject: [PATCH] minor refactorization of DiscoSheep.startParty() and DiscoParty.startDisco() --- dist/DiscoSheep.jar | Bin 30198 -> 30614 bytes .../bukkit/discosheep/DiscoParty.java | 6 ++++++ .../bukkit/discosheep/DiscoSheep.java | 8 +++++++- .../discosheep/DiscoSheepCommandExecutor.java | 5 +++-- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dist/DiscoSheep.jar b/dist/DiscoSheep.jar index 6dc814fe41b608f4fdf63d0ace5967358500dc84..b3c29217e8249464651ed3edd11eb149e9b1bbfc 100644 GIT binary patch delta 3316 zcmaJ^X?T>?6@KrR<(uV8NJ7X00VeE*B~JhYA%rCfkPxtJVM|$tOag%<12Yp6sT#0U zT(No;S!yX;aUpD>0aR2h)S@k-h$2g|MT=EhD^_XMR^KxjlE9B9&zyVixo5lQy!XzX zuRl}kK3CSHqOfoWU;{ceJZ9ZybZpo+#8O7520cdgl%Z1flVPJ8!lCiBx@eE;)Nm~~ zuC_x~bswO*@rW}kNhLL2?_M9>H4^8c&UHck1KzSU( z0hI$wjX;bViQZ}yenYv{Y=tHq1hjwP%;Y?Tt9;ni80w8hqAEa&D#SoFzVV}hi7Hx> zIeKaIwl0Z4mqh)tvzJaE9ADqVf$@0A#KR64c*u@IJYr(40}*&sCO@}frGw*RCLVXd zfkz$CctRvkIb$-_ba$BH@$2)^ee|1I?y#wt zrqhQdL>6I!LWWkE8SN}g#RUsL!Xyh9@h6=+b4b03OBO!FpDp|amrZFWyU^1=P*J*s7GH@)OjSj7^FoXKYmrBJ%F5j} zm4O=xTo+;V4dIQT{|>siA#Dx(AC&8c?BvXEB!M4enuTxior(Wi_#eKvcpRo#N-4v_ zJj}OLm?-!$%~au*icpbyWkOO`1s0piw3JQRSw-cra3@w+_zCW^lv4~UQDrL2Qc)_} z#Cc1#Q!$o`RdG6|q`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src/gibstick/bukkit/discosheep/DiscoParty.java b/src/gibstick/bukkit/discosheep/DiscoParty.java index 470c2e6..1281657 100644 --- a/src/gibstick/bukkit/discosheep/DiscoParty.java +++ b/src/gibstick/bukkit/discosheep/DiscoParty.java @@ -312,6 +312,12 @@ public class DiscoParty { this.scheduleUpdate(); ds.getPartyMap().put(this.player.getName(), this); } + + void startDisco() { + this.spawnSheep(sheep, radius); + this.scheduleUpdate(); + ds.getPartyMap().put(this.player.getName(), this); + } void stopDisco() { removeAllSheep(); diff --git a/src/gibstick/bukkit/discosheep/DiscoSheep.java b/src/gibstick/bukkit/discosheep/DiscoSheep.java index 7ea8381..151e081 100644 --- a/src/gibstick/bukkit/discosheep/DiscoSheep.java +++ b/src/gibstick/bukkit/discosheep/DiscoSheep.java @@ -110,7 +110,13 @@ public final class DiscoSheep extends JavaPlugin { public void startParty(Player player, int duration, int sheepAmount, int radius, int period, boolean fireworksEnabled) { if (!hasParty(player.getName())) { - new DiscoParty(this, player).startDisco(duration, sheepAmount, radius, period, fireworksEnabled); + DiscoParty ds = new DiscoParty(this, player); + ds.setDuration(duration); + ds.setSheep(sheepAmount); + ds.setRadius(radius); + ds.setPeriod(period); + ds.setDoFireworks(fireworksEnabled); + ds.startDisco(); } } } diff --git a/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java b/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java index 61894dc..a233612 100644 --- a/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java +++ b/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java @@ -15,6 +15,7 @@ public class DiscoSheepCommandExecutor implements CommandExecutor { public DiscoSheepCommandExecutor(DiscoSheep parent) { this.parent = parent; } + private static final String PERMISSION_PARTY = "discosheep.party"; private static final String PERMISSION_ALL = "discosheep.partyall"; private static final String PERMISSION_FIREWORKS = "discosheep.fireworks"; @@ -205,7 +206,7 @@ public class DiscoSheepCommandExecutor implements CommandExecutor { if (args.length > 0) { if (args[0].equalsIgnoreCase("all")) { - return partyAllCommand(player, duration, sheepNumber, radius, period, fireworks); + return partyAllCommand(sender, duration, sheepNumber, radius, period, fireworks); } else if (args[0].equalsIgnoreCase("stopall")) { return stopAllCommand(sender); } else if (args[0].equalsIgnoreCase("stop") && isPlayer) { @@ -219,7 +220,7 @@ public class DiscoSheepCommandExecutor implements CommandExecutor { } else if (args[0].equalsIgnoreCase("reload")) { return reloadCommand(sender); } else { - sender.sendMessage(ChatColor.RED + "Invalid argument."); + sender.sendMessage(ChatColor.RED + "Invalid argument (certain commands do not work from console)."); return false; }