mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-24 03:25:13 +01:00
Stuff
This commit is contained in:
parent
798c713394
commit
bb36e8ea27
@ -185,8 +185,7 @@ public class EventListen implements Listener {
|
||||
EntityPlayer handle = ((CraftPlayer) event.getPlayer()).getHandle();
|
||||
if (!(handle instanceof EntityHumanNPC))
|
||||
return;
|
||||
if (Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean())
|
||||
((CraftServer) Bukkit.getServer()).getHandle().players.remove(handle);
|
||||
((CraftServer) Bukkit.getServer()).getHandle().players.remove(handle);
|
||||
// on teleport, player NPCs are added to the server player list. this is
|
||||
// undesirable as player NPCs are not real players and confuse plugins.
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ public class NPCCommands {
|
||||
permission = "npc.playerlist")
|
||||
@Requirements(types = EntityType.PLAYER)
|
||||
public void playerlist(CommandContext args, CommandSender sender, NPC npc) {
|
||||
boolean remove = !npc.data().getPersistent("removefromplayerlist",
|
||||
boolean remove = !npc.data().get("removefromplayerlist",
|
||||
Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
|
||||
if (args.hasFlag('a'))
|
||||
remove = false;
|
||||
@ -984,10 +984,9 @@ public class NPCCommands {
|
||||
if (args.hasFlag('t')) {
|
||||
npc.data().set(NPC.DEFAULT_PROTECTED_METADATA, vulnerable);
|
||||
} else {
|
||||
vulnerable = !npc.data().getPersistent(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
npc.data().setPersistent(NPC.DEFAULT_PROTECTED_METADATA, vulnerable);
|
||||
}
|
||||
String key = vulnerable ? Messages.VULNERABLE_SET : Messages.VULNERABLE_STOPPED;
|
||||
String key = vulnerable ? Messages.VULNERABLE_STOPPED : Messages.VULNERABLE_SET;
|
||||
Messaging.sendTr(sender, key, npc.getName());
|
||||
}
|
||||
}
|
@ -140,6 +140,10 @@ public abstract class CitizensNPC extends AbstractNPC {
|
||||
PersistenceLoader.save(trait, traitKey);
|
||||
removedTraits.remove(trait.getName());
|
||||
}
|
||||
removeTraitData(root);
|
||||
}
|
||||
|
||||
private void removeTraitData(DataKey root) {
|
||||
for (String name : removedTraits) {
|
||||
root.removeKey("traits." + name);
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ public class CitizensHumanNPC extends CitizensNPC implements Equipable {
|
||||
// set the head yaw in another tick - if done immediately,
|
||||
// minecraft will not update it.
|
||||
boolean removeFromPlayerList = Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean();
|
||||
NMS.addOrRemoveFromPlayerList(getBukkitEntity(), removeFromPlayerList
|
||||
|| data().getPersistent("removefromplayerlist", removeFromPlayerList));
|
||||
NMS.addOrRemoveFromPlayerList(getBukkitEntity(),
|
||||
removeFromPlayerList || data().get("removefromplayerlist", removeFromPlayerList));
|
||||
}
|
||||
}, 5);
|
||||
handle.getBukkitEntity().setSleepingIgnored(true);
|
||||
|
Loading…
Reference in New Issue
Block a user