diff --git a/src/ca/gibstick/discosheep/DiscoParty.java b/src/ca/gibstick/discosheep/DiscoParty.java index 252e87d..fdb8f04 100644 --- a/src/ca/gibstick/discosheep/DiscoParty.java +++ b/src/ca/gibstick/discosheep/DiscoParty.java @@ -42,6 +42,7 @@ public class DiscoParty { private static HashMap maxGuestNumbers = new HashMap(); private boolean doFireworks = false; private boolean doJump = true; + private boolean doLightning = false; private int duration, period, radius, sheep; private int state = 0; // basically our own tick system private DiscoUpdater updater; @@ -185,6 +186,11 @@ public class DiscoParty { this.doFireworks = doFireworks; return this; } + + public DiscoParty setDoLightning(boolean doLightning) { + this.doLightning = doLightning; + return this; + } public DiscoParty setGuestNumber(String key, int n) throws IllegalArgumentException { if (getMaxGuestNumbers().containsKey(key.toUpperCase())) { @@ -260,11 +266,17 @@ public class DiscoParty { newSheep.setBreed(false); // this prevents breeding - no event listener required newSheep.teleport(loc); // teleport is needed to set orientation getSheepList().add(newSheep); + if (doLightning) { + world.strikeLightningEffect(loc); + } } void spawnGuest(World world, Location loc, EntityType type) { Entity newGuest = world.spawnEntity(loc, type); getGuestList().add(newGuest); + if (doLightning) { + world.strikeLightningEffect(loc); + } } // Mark all guests for removal, then clear the array diff --git a/src/ca/gibstick/discosheep/DiscoSheep.java b/src/ca/gibstick/discosheep/DiscoSheep.java index ff14a22..ed39c39 100644 --- a/src/ca/gibstick/discosheep/DiscoSheep.java +++ b/src/ca/gibstick/discosheep/DiscoSheep.java @@ -24,6 +24,7 @@ public final class DiscoSheep extends JavaPlugin { static final String PERMISSION_ONJOIN = "discosheep.party.onjoin"; static final String PERMISSION_SPAWNGUESTS = "discosheep.party.spawnguests"; static final String PERMISSION_TOGGLEPARTYONJOIN = "discosheep.admin.toggleonjoin"; + static final String PERMISSION_LIGHTNING = "discosheep.party.lightning"; static boolean partyOnJoin = true; Map parties = new HashMap(); diff --git a/src/ca/gibstick/discosheep/DiscoSheepCommandExecutor.java b/src/ca/gibstick/discosheep/DiscoSheepCommandExecutor.java index 88c4ed3..188559c 100644 --- a/src/ca/gibstick/discosheep/DiscoSheepCommandExecutor.java +++ b/src/ca/gibstick/discosheep/DiscoSheepCommandExecutor.java @@ -167,6 +167,11 @@ public class DiscoSheepCommandExecutor implements CommandExecutor { } j += 2; // skip over two arguments, since they come in pairs of entity-number } + } else if (args[i].equalsIgnoreCase("-l")) { + if (!sender.hasPermission(DiscoSheep.PERMISSION_LIGHTNING)) { + return parent.noPermsMessage(sender, DiscoSheep.PERMISSION_LIGHTNING); + } + mainParty.setDoLightning(true); } } diff --git a/src/plugin.yml b/src/plugin.yml index ff58069..d39ee6e 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -27,6 +27,7 @@ permissions: discosheep.party.other: true discosheep.party.changeperiod: true discosheep.party.spawnguests: true + discosheep.party.lightning: true discosheep.admin: description: Suggested permissions for administrators default: op @@ -72,4 +73,7 @@ permissions: default: op discosheep.admin.toggleonjoin: description: Allow a player to toggle party-on-join functionality (force disable) + default: op + discosheep.party.lightning: + description: Allow a player to use lightning for parties default: op \ No newline at end of file