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 static HashMap<String, Integer> maxGuestNumbers = new HashMap<String, Integer>();
|
||||||
private boolean doFireworks = false;
|
private boolean doFireworks = false;
|
||||||
private boolean doJump = true;
|
private boolean doJump = true;
|
||||||
|
private boolean doLightning = false;
|
||||||
private int duration, period, radius, sheep;
|
private int duration, period, radius, sheep;
|
||||||
private int state = 0; // basically our own tick system
|
private int state = 0; // basically our own tick system
|
||||||
private DiscoUpdater updater;
|
private DiscoUpdater updater;
|
||||||
@ -185,6 +186,11 @@ public class DiscoParty {
|
|||||||
this.doFireworks = doFireworks;
|
this.doFireworks = doFireworks;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DiscoParty setDoLightning(boolean doLightning) {
|
||||||
|
this.doLightning = doLightning;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public DiscoParty setGuestNumber(String key, int n) throws IllegalArgumentException {
|
public DiscoParty setGuestNumber(String key, int n) throws IllegalArgumentException {
|
||||||
if (getMaxGuestNumbers().containsKey(key.toUpperCase())) {
|
if (getMaxGuestNumbers().containsKey(key.toUpperCase())) {
|
||||||
@ -260,11 +266,17 @@ public class DiscoParty {
|
|||||||
newSheep.setBreed(false); // this prevents breeding - no event listener required
|
newSheep.setBreed(false); // this prevents breeding - no event listener required
|
||||||
newSheep.teleport(loc); // teleport is needed to set orientation
|
newSheep.teleport(loc); // teleport is needed to set orientation
|
||||||
getSheepList().add(newSheep);
|
getSheepList().add(newSheep);
|
||||||
|
if (doLightning) {
|
||||||
|
world.strikeLightningEffect(loc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void spawnGuest(World world, Location loc, EntityType type) {
|
void spawnGuest(World world, Location loc, EntityType type) {
|
||||||
Entity newGuest = world.spawnEntity(loc, type);
|
Entity newGuest = world.spawnEntity(loc, type);
|
||||||
getGuestList().add(newGuest);
|
getGuestList().add(newGuest);
|
||||||
|
if (doLightning) {
|
||||||
|
world.strikeLightningEffect(loc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark all guests for removal, then clear the array
|
// 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_ONJOIN = "discosheep.party.onjoin";
|
||||||
static final String PERMISSION_SPAWNGUESTS = "discosheep.party.spawnguests";
|
static final String PERMISSION_SPAWNGUESTS = "discosheep.party.spawnguests";
|
||||||
static final String PERMISSION_TOGGLEPARTYONJOIN = "discosheep.admin.toggleonjoin";
|
static final String PERMISSION_TOGGLEPARTYONJOIN = "discosheep.admin.toggleonjoin";
|
||||||
|
static final String PERMISSION_LIGHTNING = "discosheep.party.lightning";
|
||||||
static boolean partyOnJoin = true;
|
static boolean partyOnJoin = true;
|
||||||
Map<String, DiscoParty> parties = new HashMap<String, DiscoParty>();
|
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
|
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.other: true
|
||||||
discosheep.party.changeperiod: true
|
discosheep.party.changeperiod: true
|
||||||
discosheep.party.spawnguests: true
|
discosheep.party.spawnguests: true
|
||||||
|
discosheep.party.lightning: true
|
||||||
discosheep.admin:
|
discosheep.admin:
|
||||||
description: Suggested permissions for administrators
|
description: Suggested permissions for administrators
|
||||||
default: op
|
default: op
|
||||||
@ -72,4 +73,7 @@ permissions:
|
|||||||
default: op
|
default: op
|
||||||
discosheep.admin.toggleonjoin:
|
discosheep.admin.toggleonjoin:
|
||||||
description: Allow a player to toggle party-on-join functionality (force disable)
|
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
|
default: op
|
Loading…
Reference in New Issue
Block a user