1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +01:00

Option to broadcast skill message when a player reach level, #171

- Modify-chat set to default false, to ignore user-friendly posts.
- DBManager registering fix at startup, #377
This commit is contained in:
montlikadani 2019-03-06 17:51:35 +01:00
parent 2c0451aa55
commit 417b6f70f9
4 changed files with 11 additions and 4 deletions

View File

@ -364,7 +364,7 @@ public class ItemManager {
public enum CMIPotionType {
Awkward(373, 16, "Awkard Potion"),
Fire_Resistance_1(373, 8195, "Fire Resistance Potion"),
Fire_Resistance_2(373, 8259, "Fire Resistance potion 2"),
Fire_Resistance_2(373, 8259, "Fire Resistance Potion 2"),
Harming_1(373, 8204, "Harming Potion"),
Harming_2(373, 8236, "Harming Potion 2"),
Healing_1(373, 8197, "Healing Potion"),

View File

@ -280,9 +280,11 @@ public class Jobs extends JavaPlugin {
return reflections;
}
public static void setDBManager() {
DBManager = new JobsManager(instance);
}
public static JobsManager getDBManager() {
if (DBManager == null)
DBManager = new JobsManager(instance);
return DBManager;
}
@ -834,6 +836,7 @@ public class Jobs extends JavaPlugin {
setPermissionHandler(new PermissionHandler(this));
setPluginLogger(getLogger());
setJobsClassloader();
setDBManager();
setLanguage();
setGUIManager();
setExplore();

View File

@ -603,6 +603,7 @@ public class PlayerManager {
message = message.replace("%jobname%", job.getChatColor() + job.getName());
for (String line : message.split("\n")) {
if (Jobs.getGCManager().isBroadcastingSkillups())
if (Jobs.getGCManager().BroadcastingSkillUpLevels.contains(oldLevel + 1) || Jobs.getGCManager().BroadcastingSkillUpLevels.contains(0))
Bukkit.getServer().broadcastMessage(line);
else if (player != null) {
if (Jobs.getGCManager().TitleChangeActionBar)

View File

@ -42,6 +42,7 @@ import com.gamingmesh.jobs.resources.jfep.Parser;
public class GeneralConfigManager {
private Jobs plugin;
public List<Integer> BroadcastingLevelUpLevels = new ArrayList<>();
public List<Integer> BroadcastingSkillUpLevels = new ArrayList<>();
protected Locale locale;
protected int savePeriod;
protected boolean economyAsync;
@ -486,6 +487,8 @@ public class GeneralConfigManager {
c.addComment("broadcast.on-skill-up.use", "Do all players get a message when someone goes up a skill level?");
isBroadcastingSkillups = c.get("broadcast.on-skill-up.use", false);
c.addComment("broadcast.on-skill-up.levels", "For what skill levels you want to broadcast message? Keep it at 0 if you want for all of them");
BroadcastingSkillUpLevels = c.getIntList("broadcast.on-skill-up.levels", Arrays.asList(0));
c.addComment("broadcast.on-level-up.use", "Do all players get a message when someone goes up a level?");
isBroadcastingLevelups = c.get("broadcast.on-level-up.use", false);
@ -530,7 +533,7 @@ public class GeneralConfigManager {
payItemDurabilityLoss = c.get("enable-pay-when-item-durability-loss", true);
c.addComment("modify-chat", "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 = c.get("modify-chat.use", true);
modifyChat = c.get("modify-chat.use", false);
modifyChatPrefix = c.get("modify-chat.prefix", "&c[");
modifyChatSuffix = c.get("modify-chat.suffix", "&c]&r ");
modifyChatSeparator = c.get("modify-chat.separator", " ");