mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 02:55:45 +01:00
Use PlaceholderAPI for /npc command
This commit is contained in:
parent
529855bd6d
commit
89874092ed
@ -67,8 +67,9 @@ public class TalkableEntity implements Talkable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void talk(String message) {
|
private void talk(String message) {
|
||||||
if (entity instanceof Player && !CitizensAPI.getNPCRegistry().isNPC(entity))
|
if (entity instanceof Player && !CitizensAPI.getNPCRegistry().isNPC(entity)) {
|
||||||
Messaging.send((Player) entity, message);
|
Messaging.send((Player) entity, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,6 +18,7 @@ import net.citizensnpcs.api.trait.Trait;
|
|||||||
import net.citizensnpcs.api.trait.TraitName;
|
import net.citizensnpcs.api.trait.TraitName;
|
||||||
import net.citizensnpcs.api.util.DataKey;
|
import net.citizensnpcs.api.util.DataKey;
|
||||||
import net.citizensnpcs.api.util.Messaging;
|
import net.citizensnpcs.api.util.Messaging;
|
||||||
|
import net.citizensnpcs.api.util.Placeholders;
|
||||||
import net.citizensnpcs.util.Messages;
|
import net.citizensnpcs.util.Messages;
|
||||||
|
|
||||||
@TraitName("commandtrait")
|
@TraitName("commandtrait")
|
||||||
@ -113,7 +114,7 @@ public class CommandTrait extends Trait {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void run(NPC npc, Player clicker) {
|
public void run(NPC npc, Player clicker) {
|
||||||
String interpolatedCommand = command.replace("<npc>", npc.getName()).replace("<p>", clicker.getName());
|
String interpolatedCommand = Placeholders.replace(command, clicker, npc);
|
||||||
if (player) {
|
if (player) {
|
||||||
boolean wasOp = clicker.isOp();
|
boolean wasOp = clicker.isOp();
|
||||||
if (op) {
|
if (op) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: Citizens
|
name: Citizens
|
||||||
authors: [fullwall]
|
authors: [fullwall]
|
||||||
softdepend: [Vault]
|
softdepend: [Vault, PlaceholderAPI]
|
||||||
version: ${project.version} (build ${BUILD_NUMBER})
|
version: ${project.version} (build ${BUILD_NUMBER})
|
||||||
main: net.citizensnpcs.Citizens
|
main: net.citizensnpcs.Citizens
|
||||||
website: http://www.citizensnpcs.co
|
website: http://www.citizensnpcs.co
|
||||||
|
Loading…
Reference in New Issue
Block a user