customizable chat prefix

This commit is contained in:
aPunch 2012-02-12 12:29:33 -06:00
parent b35d5f05cd
commit f77e1e71ec
2 changed files with 10 additions and 2 deletions

View File

@ -30,11 +30,12 @@ public class Settings {
} }
public enum Setting { public enum Setting {
CHAT_PREFIX("npc.chat.prefix", "[<npc>]: "),
DEBUG_MODE("general.debug-mode", false), DEBUG_MODE("general.debug-mode", false),
USE_DATABASE("use-database", false), QUICK_SELECT("npc.selection.quick-select", false),
SELECTION_ITEM("npc.selection.item", 280), SELECTION_ITEM("npc.selection.item", 280),
SELECTION_MESSAGE("npc.selection.message", "<b>You selected <a><npc><b>!"), SELECTION_MESSAGE("npc.selection.message", "<b>You selected <a><npc><b>!"),
QUICK_SELECT("npc.selection.quick-select", false); USE_DATABASE("use-database", false);
private String path; private String path;
private Object value; private Object value;

View File

@ -1,5 +1,6 @@
package net.citizensnpcs.npc; package net.citizensnpcs.npc;
import net.citizensnpcs.Settings.Setting;
import net.citizensnpcs.api.event.NPCDespawnEvent; import net.citizensnpcs.api.event.NPCDespawnEvent;
import net.citizensnpcs.api.event.NPCSpawnEvent; import net.citizensnpcs.api.event.NPCSpawnEvent;
import net.citizensnpcs.api.npc.AbstractNPC; import net.citizensnpcs.api.npc.AbstractNPC;
@ -28,6 +29,12 @@ public abstract class CitizensNPC extends AbstractNPC {
inventory = new NPCInventory(this); inventory = new NPCInventory(this);
} }
@Override
public void chat(String message) {
for (Player player : Bukkit.getOnlinePlayers())
Messaging.sendWithNPC(player, Setting.CHAT_PREFIX.asString() + message, this);
}
protected abstract EntityLiving createHandle(Location loc); protected abstract EntityLiving createHandle(Location loc);
@Override @Override