Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96e5164
commit a7fb945
Showing
1 changed file
with
9 additions
and
13 deletions.
There are no files selected for viewing
22 changes: 9 additions & 13 deletions
22
src/main/java/net/aufdemrand/denizen/scripts/containers/core/FormatScriptContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
|
||
} |