Changed constructors for DiscoParty and renamed clone method.
This commit is contained in:
parent
bf1e1feaa0
commit
54cbc2f8c1
@ -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<String, Integer>(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;
|
||||
}
|
||||
|
||||
|
@ -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!!");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user