mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-10-06 03:17:27 +02:00
Add new zombiemodifier for professions
This commit is contained in:
parent
212157d509
commit
495e8ad286
@ -1969,7 +1969,7 @@ public class NPCCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = { "npc" },
|
aliases = { "npc" },
|
||||||
usage = "zombiemod (-b(aby), -v(illager))",
|
usage = "zombiemod (-b(aby), -v(illager) --p(rofession) [profession])",
|
||||||
desc = "Sets a zombie NPC to be a baby or villager",
|
desc = "Sets a zombie NPC to be a baby or villager",
|
||||||
modifiers = { "zombie", "zombiemod" },
|
modifiers = { "zombie", "zombiemod" },
|
||||||
flags = "bv",
|
flags = "bv",
|
||||||
@ -1988,5 +1988,14 @@ public class NPCCommands {
|
|||||||
Messaging.sendTr(sender, isVillager ? Messages.ZOMBIE_VILLAGER_SET : Messages.ZOMBIE_VILLAGER_UNSET,
|
Messaging.sendTr(sender, isVillager ? Messages.ZOMBIE_VILLAGER_SET : Messages.ZOMBIE_VILLAGER_UNSET,
|
||||||
npc.getName());
|
npc.getName());
|
||||||
}
|
}
|
||||||
|
if (args.hasValueFlag("profession") || args.hasValueFlag("p")) {
|
||||||
|
Profession profession = Util.matchEnum(Profession.values(), args.getFlag("profession", args.getFlag("p")));
|
||||||
|
if (profession == null) {
|
||||||
|
throw new CommandException();
|
||||||
|
}
|
||||||
|
trait.setProfession(profession);
|
||||||
|
Messaging.sendTr(sender, Messages.ZOMBIE_VILLAGER_PROFESSION_SET, npc.getName(),
|
||||||
|
Util.prettyEnum(profession));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.citizensnpcs.trait;
|
package net.citizensnpcs.trait;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Villager.Profession;
|
||||||
import org.bukkit.entity.Zombie;
|
import org.bukkit.entity.Zombie;
|
||||||
|
|
||||||
import net.citizensnpcs.api.persistence.Persist;
|
import net.citizensnpcs.api.persistence.Persist;
|
||||||
@ -11,6 +12,8 @@ public class ZombieModifier extends Trait {
|
|||||||
@Persist
|
@Persist
|
||||||
private boolean baby;
|
private boolean baby;
|
||||||
@Persist
|
@Persist
|
||||||
|
private Profession profession;
|
||||||
|
@Persist
|
||||||
private boolean villager;
|
private boolean villager;
|
||||||
private boolean zombie;
|
private boolean zombie;
|
||||||
|
|
||||||
@ -23,22 +26,33 @@ public class ZombieModifier extends Trait {
|
|||||||
if (npc.getEntity() instanceof Zombie) {
|
if (npc.getEntity() instanceof Zombie) {
|
||||||
((Zombie) npc.getEntity()).setVillager(villager);
|
((Zombie) npc.getEntity()).setVillager(villager);
|
||||||
((Zombie) npc.getEntity()).setBaby(baby);
|
((Zombie) npc.getEntity()).setBaby(baby);
|
||||||
|
((Zombie) npc.getEntity()).setVillagerProfession(profession);
|
||||||
zombie = true;
|
zombie = true;
|
||||||
} else
|
} else {
|
||||||
zombie = false;
|
zombie = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProfession(Profession profession) {
|
||||||
|
this.profession = profession;
|
||||||
|
if (zombie) {
|
||||||
|
((Zombie) npc.getEntity()).setVillagerProfession(profession);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean toggleBaby() {
|
public boolean toggleBaby() {
|
||||||
baby = !baby;
|
baby = !baby;
|
||||||
if (zombie)
|
if (zombie) {
|
||||||
((Zombie) npc.getEntity()).setBaby(baby);
|
((Zombie) npc.getEntity()).setBaby(baby);
|
||||||
|
}
|
||||||
return baby;
|
return baby;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean toggleVillager() {
|
public boolean toggleVillager() {
|
||||||
villager = !villager;
|
villager = !villager;
|
||||||
if (zombie)
|
if (zombie) {
|
||||||
((Zombie) npc.getEntity()).setVillager(villager);
|
((Zombie) npc.getEntity()).setVillager(villager);
|
||||||
|
}
|
||||||
return villager;
|
return villager;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -281,6 +281,7 @@ public class Messages {
|
|||||||
public static final String WRITING_DEFAULT_SETTING = "citizens.settings.writing-default";
|
public static final String WRITING_DEFAULT_SETTING = "citizens.settings.writing-default";
|
||||||
public static final String ZOMBIE_BABY_SET = "citizens.commands.npc.zombiemod.baby-set";
|
public static final String ZOMBIE_BABY_SET = "citizens.commands.npc.zombiemod.baby-set";
|
||||||
public static final String ZOMBIE_BABY_UNSET = "citizens.commands.npc.zombiemod.baby-unset";
|
public static final String ZOMBIE_BABY_UNSET = "citizens.commands.npc.zombiemod.baby-unset";
|
||||||
|
public static final String ZOMBIE_VILLAGER_PROFESSION_SET = "citizens.commands.npc.zombiemod.villager-profession-set";
|
||||||
public static final String ZOMBIE_VILLAGER_SET = "citizens.commands.npc.zombiemod.villager-set";
|
public static final String ZOMBIE_VILLAGER_SET = "citizens.commands.npc.zombiemod.villager-set";
|
||||||
public static final String ZOMBIE_VILLAGER_UNSET = "citizens.commands.npc.zombiemod.villager-unset";
|
public static final String ZOMBIE_VILLAGER_UNSET = "citizens.commands.npc.zombiemod.villager-unset";
|
||||||
}
|
}
|
||||||
|
@ -142,6 +142,7 @@ citizens.commands.npc.zombiemod.villager-set=[[{0}]] is now a villager.
|
|||||||
citizens.commands.npc.zombiemod.villager-unset=[[{0}]] is no longer a villager.
|
citizens.commands.npc.zombiemod.villager-unset=[[{0}]] is no longer a villager.
|
||||||
citizens.commands.npc.zombiemod.baby-set=[[{0}]] is now a baby.
|
citizens.commands.npc.zombiemod.baby-set=[[{0}]] is now a baby.
|
||||||
citizens.commands.npc.zombiemod.baby-unset=[[{0}]] is no longer a baby.
|
citizens.commands.npc.zombiemod.baby-unset=[[{0}]] is no longer a baby.
|
||||||
|
citizens.commands.npc.zombiemod.villager-profession-set=[[{0}]]''s profession set to [[{1}]].
|
||||||
citizens.commands.page-missing=The page [[{0}]] does not exist.
|
citizens.commands.page-missing=The page [[{0}]] does not exist.
|
||||||
citizens.commands.requirements.disallowed-mobtype=The NPC cannot be the mob type [[{0}]] for that command.
|
citizens.commands.requirements.disallowed-mobtype=The NPC cannot be the mob type [[{0}]] for that command.
|
||||||
citizens.commands.requirements.living-entity=The NPC must be a living entity.
|
citizens.commands.requirements.living-entity=The NPC must be a living entity.
|
||||||
|
Loading…
Reference in New Issue
Block a user