From 54cbc2f8c13197d4416b4caf1fed9f0b86bee634 Mon Sep 17 00:00:00 2001 From: RangerMauve Date: Mon, 29 Jul 2013 21:06:54 -0400 Subject: [PATCH] Changed constructors for DiscoParty and renamed clone method. --- src/ca/gibstick/discosheep/DiscoParty.java | 14 ++++---------- src/ca/gibstick/discosheep/DiscoSheep.java | 4 ++-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/ca/gibstick/discosheep/DiscoParty.java b/src/ca/gibstick/discosheep/DiscoParty.java index fdb8f04..4e1cc5b 100644 --- a/src/ca/gibstick/discosheep/DiscoParty.java +++ b/src/ca/gibstick/discosheep/DiscoParty.java @@ -61,18 +61,12 @@ public class DiscoParty { DyeColor.BLACK, DyeColor.WHITE }; - private Random r; + private Random r=new Random(); private PartyEvents partyEvents; public DiscoParty(DiscoSheep parent, Player player) { - this.parent = parent; + this(parent); this.player = player; - this.duration = DiscoParty.defaultDuration; - this.period = DiscoParty.defaultPeriod; - this.radius = DiscoParty.defaultRadius; - this.sheep = DiscoParty.defaultSheep; - this.guestNumbers = new HashMap(DiscoParty.defaultGuestNumbers); - r = new Random(); } public DiscoParty(DiscoSheep parent) { @@ -87,7 +81,7 @@ public class DiscoParty { // copy but with new player // used for /ds other and /ds all - public DiscoParty DiscoParty(Player player) { + public DiscoParty clone(Player player) { DiscoParty newParty; newParty = new DiscoParty(this.parent, player); newParty.doFireworks = this.doFireworks; @@ -95,8 +89,8 @@ public class DiscoParty { newParty.period = this.period; newParty.radius = this.radius; newParty.sheep = this.sheep; + newParty.doLightning = this.doLightning; newParty.guestNumbers = this.getGuestNumbers(); - newParty.r = new Random(); return newParty; } diff --git a/src/ca/gibstick/discosheep/DiscoSheep.java b/src/ca/gibstick/discosheep/DiscoSheep.java index ed39c39..8f66a72 100644 --- a/src/ca/gibstick/discosheep/DiscoSheep.java +++ b/src/ca/gibstick/discosheep/DiscoSheep.java @@ -226,7 +226,7 @@ public final class DiscoSheep extends JavaPlugin { p = Bukkit.getServer().getPlayer(playerName); if (p != null) { if (!hasParty(p.getName())) { - DiscoParty individualParty = party.DiscoParty(p); + DiscoParty individualParty = party.clone(p); individualParty.startDisco(); } } else { @@ -243,7 +243,7 @@ public final class DiscoSheep extends JavaPlugin { if (sender.hasPermission(PERMISSION_ALL)) { for (Player p : Bukkit.getServer().getOnlinePlayers()) { if (!hasParty(p.getName())) { - DiscoParty individualParty = party.DiscoParty(p); + DiscoParty individualParty = party.clone(p); individualParty.startDisco(); p.sendMessage(ChatColor.RED + "LET'S DISCO!!"); }