Skip to content

Commit

Permalink
Fix formats not working correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
spaceemotion committed Mar 7, 2013
1 parent 96e5164 commit a7fb945
Showing 1 changed file with 9 additions and 13 deletions.
@@ -1,31 +1,27 @@
package net.aufdemrand.denizen.scripts.containers.core;

import net.aufdemrand.denizen.npc.dNPC;
import net.aufdemrand.denizen.scripts.ScriptEntry;
import net.aufdemrand.denizen.scripts.containers.ScriptContainer;
import net.aufdemrand.denizen.tags.TagManager;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;

public class FormatScriptContainer extends ScriptContainer {

public FormatScriptContainer(ConfigurationSection configurationSection, String scriptContainerName) {
super(configurationSection, scriptContainerName);
}

public String getFormat(Player player, dNPC npc) {
String format = getContents().getString("FORMAT", "<text>");
format = TagManager.tag(player, npc, format, false);
return format;

public String getFormat() {
return getString("FORMAT", "<text>");
}

public void setFormat(String format) {
getContents().set("FORMAT", format);
set("FORMAT", format);
}

public String getFormattedText(ScriptEntry entry) {
String text = (String) entry.getObject("text");
return getFormat(entry.getPlayer(), entry.getNPC()).replace("<text>", text);
String text = getFormat().replaceAll("<text>", (String) entry.getObject("text"));
return TagManager.tag(entry.getPlayer(), entry.getNPC(), text);
}

}

0 comments on commit a7fb945

Please sign in to comment.