added lightning effect on sheep spawn
This commit is contained in:
parent
ae93d9a5e4
commit
bf1e1feaa0
@ -42,6 +42,7 @@ public class DiscoParty {
|
||||
private static HashMap<String, Integer> maxGuestNumbers = new HashMap<String, Integer>();
|
||||
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;
|
||||
@ -186,6 +187,11 @@ public class DiscoParty {
|
||||
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())) {
|
||||
if (n <= getMaxGuestNumbers().get(key.toUpperCase()) && n >= 0) { // so that /ds defaults can take 0 as arg
|
||||
@ -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
|
||||
|
@ -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<String, DiscoParty> parties = new HashMap<String, DiscoParty>();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
@ -73,3 +74,6 @@ permissions:
|
||||
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
|
Loading…
Reference in New Issue
Block a user