mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-23 01:27:33 +01:00
Add /npc bat
This commit is contained in:
parent
cd24ce0e61
commit
310ebb1458
@ -122,6 +122,7 @@ import net.citizensnpcs.trait.Age;
|
||||
import net.citizensnpcs.trait.Anchors;
|
||||
import net.citizensnpcs.trait.ArmorStandTrait;
|
||||
import net.citizensnpcs.trait.AttributeTrait;
|
||||
import net.citizensnpcs.trait.BatTrait;
|
||||
import net.citizensnpcs.trait.BoatTrait;
|
||||
import net.citizensnpcs.trait.BoundingBoxTrait;
|
||||
import net.citizensnpcs.trait.ClickRedirectTrait;
|
||||
@ -431,6 +432,23 @@ public class NPCCommands {
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "bat --awake [awake]",
|
||||
desc = "",
|
||||
modifiers = { "bat" },
|
||||
min = 1,
|
||||
max = 1,
|
||||
permission = "citizens.npc.bat")
|
||||
@Requirements(selected = true, ownership = true, types = EntityType.BAT)
|
||||
public void bat(CommandContext args, CommandSender sender, NPC npc, @Flag("awake") Boolean awake)
|
||||
throws CommandException {
|
||||
if (awake == null)
|
||||
throw new CommandException();
|
||||
npc.getOrAddTrait(BatTrait.class).setAwake(awake);
|
||||
Messaging.sendTr(sender, awake ? Messages.BAT_AWAKE_SET : Messages.BAT_AWAKE_UNSET, npc.getName());
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "boat --type [type]",
|
||||
|
@ -24,6 +24,7 @@ import net.citizensnpcs.trait.Age;
|
||||
import net.citizensnpcs.trait.Anchors;
|
||||
import net.citizensnpcs.trait.ArmorStandTrait;
|
||||
import net.citizensnpcs.trait.AttributeTrait;
|
||||
import net.citizensnpcs.trait.BatTrait;
|
||||
import net.citizensnpcs.trait.BoatTrait;
|
||||
import net.citizensnpcs.trait.BoundingBoxTrait;
|
||||
import net.citizensnpcs.trait.ClickRedirectTrait;
|
||||
@ -80,6 +81,7 @@ public class CitizensTraitFactory implements TraitFactory {
|
||||
registerTrait(TraitInfo.create(ArmorStandTrait.class));
|
||||
registerTrait(TraitInfo.create(AttributeTrait.class));
|
||||
registerTrait(TraitInfo.create(Anchors.class));
|
||||
registerTrait(TraitInfo.create(BatTrait.class));
|
||||
registerTrait(TraitInfo.create(BoatTrait.class));
|
||||
registerTrait(TraitInfo.create(BoundingBoxTrait.class));
|
||||
registerTrait(TraitInfo.create(ClickRedirectTrait.class));
|
||||
|
32
main/src/main/java/net/citizensnpcs/trait/BatTrait.java
Normal file
32
main/src/main/java/net/citizensnpcs/trait/BatTrait.java
Normal file
@ -0,0 +1,32 @@
|
||||
package net.citizensnpcs.trait;
|
||||
|
||||
import org.bukkit.entity.Bat;
|
||||
|
||||
import net.citizensnpcs.api.persistence.Persist;
|
||||
import net.citizensnpcs.api.trait.Trait;
|
||||
import net.citizensnpcs.api.trait.TraitName;
|
||||
|
||||
@TraitName("battrait")
|
||||
public class BatTrait extends Trait {
|
||||
@Persist
|
||||
private boolean awake;
|
||||
|
||||
public BatTrait() {
|
||||
super("battrait");
|
||||
}
|
||||
|
||||
public boolean isAwake() {
|
||||
return awake;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!(npc.getEntity() instanceof Bat))
|
||||
return;
|
||||
((Bat) npc.getEntity()).setAwake(awake);
|
||||
}
|
||||
|
||||
public void setAwake(boolean awake) {
|
||||
this.awake = awake;
|
||||
}
|
||||
}
|
@ -26,6 +26,8 @@ public class Messages {
|
||||
public static final String AXOLOTL_NOT_PLAYING_DEAD = "citizens.commands.npc.axolotl.playing-dead-stopped";
|
||||
public static final String AXOLOTL_PLAYING_DEAD = "citizens.commands.npc.axolotl.playing-dead";
|
||||
public static final String AXOLOTL_VARIANT_SET = "citizens.commands.npc.axolotl.variant-set";
|
||||
public static final String BAT_AWAKE_SET = "citizens.commands.npc.bat.awake-set";
|
||||
public static final String BAT_AWAKE_UNSET = "citizens.commands.npc.bat.awake-unset";
|
||||
public static final String BEE_ANGER_SET = "citizens.commands.npc.bee.anger-set";
|
||||
public static final String BEE_HAS_NECTAR = "citizens.commands.npc.bee.has-nectar";
|
||||
public static final String BEE_NO_NECTAR = "citizens.commands.npc.bee.no-nectar";
|
||||
@ -271,6 +273,7 @@ public class Messages {
|
||||
public static final String MOBTYPE_CANNOT_BE_AGED = "citizens.commands.npc.age.cannot-be-aged";
|
||||
public static final String MONEY_WITHDRAWN = "citizens.economy.money-withdrawn";
|
||||
public static final String MOUNT_NPC_MUST_BE_SPAWNED = "citizens.commands.npc.mount.must-be-spawned";
|
||||
public static final String MOUNT_TRIED_TO_MOUNT_NPC_ON_ITSELF = "citizens.commands.npc.mount.mount-on-itself";
|
||||
public static final String MOVETO_FORMAT = "citizens.commands.npc.moveto.format";
|
||||
public static final String MOVETO_TELEPORTED = "citizens.commands.npc.moveto.teleported";
|
||||
public static final String MUSHROOM_COW_VARIANT_SET = "citizens.commands.npc.mushroomcow.variant-set";
|
||||
@ -426,9 +429,9 @@ public class Messages {
|
||||
public static final String TEXT_EDITOR_RANGE_SET = "citizens.editors.text.range-set";
|
||||
public static final String TEXT_EDITOR_SET_ITEM = "citizens.editors.text.talk-item-set";
|
||||
public static final String TEXT_EDITOR_START_PROMPT = "citizens.editors.text.start-prompt";
|
||||
public static final String TPTO_ENTITY_NOT_FOUND = "citizens.commands.npc.tpto.to-not-found";
|
||||
public static final String TOGGLED_USING_HELD_ITEM = "citizens.commands.npc.useitem.held-item-toggled";
|
||||
public static final String TOGGLED_USING_OFFHAND_ITEM = "citizens.commands.npc.useitem.offhand-item-toggled";
|
||||
public static final String TPTO_ENTITY_NOT_FOUND = "citizens.commands.npc.tpto.to-not-found";
|
||||
public static final String TPTO_SUCCESS = "citizens.commands.npc.tpto.success";
|
||||
public static final String TRACKING_RANGE_SET = "citizens.commands.npc.trackingrange.set";
|
||||
public static final String TRAIT_LOAD_FAILED = "citizens.notifications.trait-load-failed";
|
||||
@ -436,7 +439,6 @@ public class Messages {
|
||||
public static final String TRAITS_ADDED = "citizens.commands.trait.added";
|
||||
public static final String TRAITS_FAILED_TO_ADD = "citizens.commands.trait.failed-to-add";
|
||||
public static final String TRAITS_REMOVED = "citizens.commands.trait.removed";
|
||||
public static final String MOUNT_TRIED_TO_MOUNT_NPC_ON_ITSELF = "citizens.commands.npc.mount.mount-on-itself";
|
||||
public static final String TROPICALFISH_BODY_COLOR_SET = "citizens.commands.npc.tropicalfish.body-color-set";
|
||||
public static final String TROPICALFISH_PATTERN_COLOR_SET = "citizens.commands.npc.tropicalfish.pattern-color-set";
|
||||
public static final String TROPICALFISH_PATTERN_SET = "citizens.commands.npc.tropicalfish.pattern-set";
|
||||
|
@ -24,6 +24,10 @@
|
||||
"citizens.commands.npc.age.help" : "Can only be used on entities that can become babies. Use the [[-l]] flag to lock age over time (note: relogs may be required to see this).",
|
||||
"citizens.commands.npc.age.invalid-age" : "Invalid age. Valid ages are adult, baby, number between -24000 and 0",
|
||||
"citizens.commands.npc.age.locked" : "Age locked.",
|
||||
"citizens.commands.npc.bat.awake-set" : "[[{0}]] is now awake.",
|
||||
"citizens.commands.npc.bat.awake-unset" : "[[{0}]] is no longer awake.",
|
||||
"citizens.commands.npc.bat.description" : "Set bat modifiers",
|
||||
"citizens.commands.npc.bat.help" : "",
|
||||
"citizens.commands.npc.forcefield.describe": "[[{0}]] has a forcefield with height [[{1}]], width [[{2}]], strength [[{3}]].",
|
||||
"citizens.commands.npc.forcefield.description": "Creates a forcefield which pushes players close to the NPC away",
|
||||
"citizens.commands.npc.age.set" : "[[{0}]] is now [[{1}]].",
|
||||
|
Loading…
Reference in New Issue
Block a user