1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

title prefix/suffix/seperator

This commit is contained in:
Zrips 2016-01-11 17:48:56 +02:00
parent 11e374c0f3
commit 7b049fe670
4 changed files with 32 additions and 5 deletions

View File

@ -68,6 +68,9 @@ public class JobsConfiguration {
protected int maxJobs; protected int maxJobs;
protected boolean payNearSpawner; protected boolean payNearSpawner;
protected boolean modifyChat; protected boolean modifyChat;
public String modifyChatPrefix;
public String modifyChatSuffix;
public String modifyChatSeparator;
protected int economyBatchDelay; protected int economyBatchDelay;
protected boolean saveOnDisconnect; protected boolean saveOnDisconnect;
public boolean LocalOfflinePlayersData; public boolean LocalOfflinePlayersData;
@ -267,6 +270,18 @@ public class JobsConfiguration {
return modifyChat; return modifyChat;
} }
public String getModifyChatPrefix() {
return modifyChatPrefix;
}
public String getModifyChatSuffix() {
return modifyChatSuffix;
}
public String getModifyChatSeparator() {
return modifyChatSeparator;
}
public synchronized int getEconomyBatchDelay() { public synchronized int getEconomyBatchDelay() {
return economyBatchDelay; return economyBatchDelay;
} }
@ -453,6 +468,10 @@ public class JobsConfiguration {
"Modifys chat to add chat titles. If you're using a chat manager, you may add the tag {jobs} to your chat format and disable this."); "Modifys chat to add chat titles. If you're using a chat manager, you may add the tag {jobs} to your chat format and disable this.");
modifyChat = getBoolean("modify-chat", true, config, writer); modifyChat = getBoolean("modify-chat", true, config, writer);
modifyChatPrefix = getString("modify-chat-prefix", "&c[", config, writer, true);
modifyChatSuffix = getString("modify-chat-suffix", "&c]", config, writer, true);
modifyChatSeparator = getString("modify-chat-seperator", " ", config, writer, true);
writer.addComment("UseCustomNames", "Do you want to use custom item/block/mob/enchant/color names", writer.addComment("UseCustomNames", "Do you want to use custom item/block/mob/enchant/color names",
"With this set to true names like Stone:1 will be translated to Granite", "Name list is in ItemList.yml file"); "With this set to true names like Stone:1 will be translated to Granite", "Name list is in ItemList.yml file");
UseCustomNames = getBoolean("UseCustomNames", true, config, writer); UseCustomNames = getBoolean("UseCustomNames", true, config, writer);
@ -1124,6 +1143,12 @@ public class JobsConfiguration {
return config.getString(path); return config.getString(path);
} }
private String getString(String path, String boo, YamlConfiguration config, CommentedYamlConfiguration writer, boolean colorize) {
config.addDefault(path, boo);
copySetting(config, writer, path);
return org.bukkit.ChatColor.translateAlternateColorCodes('&', config.getString(path));
}
private Double getDouble(String path, Double boo, YamlConfiguration config, CommentedYamlConfiguration writer) { private Double getDouble(String path, Double boo, YamlConfiguration config, CommentedYamlConfiguration writer) {
config.addDefault(path, boo); config.addDefault(path, boo);
copySetting(config, writer, path); copySetting(config, writer, path);

View File

@ -444,7 +444,7 @@ public class JobsPlayer {
if (method.equals(DisplayMethod.NONE)) if (method.equals(DisplayMethod.NONE))
continue; continue;
if (gotTitle) { if (gotTitle) {
builder.append(" "); builder.append(ConfigManager.getJobsConfiguration().getModifyChatSeparator());
gotTitle = false; gotTitle = false;
} }
Title title = ConfigManager.getJobsConfiguration().getTitleForLevel(prog.getLevel(), prog.getJob().getName()); Title title = ConfigManager.getJobsConfiguration().getTitleForLevel(prog.getLevel(), prog.getJob().getName());
@ -513,6 +513,8 @@ public class JobsPlayer {
} }
honorific = builder.toString().trim(); honorific = builder.toString().trim();
honorific = ConfigManager.getJobsConfiguration().getModifyChatPrefix() + honorific + ConfigManager.getJobsConfiguration().getModifyChatSuffix();
} }
/** /**

View File

@ -406,7 +406,7 @@ public class JobsListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() + " " : ""; String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() : "";
if (honorific.equalsIgnoreCase(" ")) if (honorific.equalsIgnoreCase(" "))
honorific = ""; honorific = "";

View File

@ -1,7 +1,7 @@
name: Jobs name: Jobs
description: Jobs Plugin for the BukkitAPI description: Jobs Plugin for the BukkitAPI
main: com.gamingmesh.jobs.JobsPlugin main: com.gamingmesh.jobs.JobsPlugin
version: 2.59.1 version: 2.60.0
author: phrstbrn author: phrstbrn
softdepend: [Vault, CoreProtect, MythicMobs, McMMO] softdepend: [Vault, CoreProtect, MythicMobs, McMMO]
commands: commands: