minor refactorization of DiscoSheep.startParty() and DiscoParty.startDisco()
This commit is contained in:
parent
b59ccc776f
commit
4e3d54f3a4
BIN
dist/DiscoSheep.jar
vendored
BIN
dist/DiscoSheep.jar
vendored
Binary file not shown.
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user