mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 05:55:27 +01:00
User defined actionbar and boosbar update types
This commit is contained in:
parent
4d94195146
commit
00a50da871
@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.MessageToggleState;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
|
||||
|
||||
@ -33,28 +34,23 @@ public class toggle implements Cmd {
|
||||
UUID playerUUID = player.getUniqueId();
|
||||
|
||||
if (isActionbar) {
|
||||
boolean ex = ToggleBarHandling.getActionBarToggle().getOrDefault(playerUUID, Jobs.getGCManager().ActionBarsMessageByDefault);
|
||||
|
||||
if (ex) {
|
||||
Language.sendMessage(sender, "command.toggle.output.off");
|
||||
} else {
|
||||
Language.sendMessage(sender, "command.toggle.output.on");
|
||||
}
|
||||
ToggleBarHandling.getActionBarToggle().put(playerUUID, !ex);
|
||||
MessageToggleState ex = ToggleBarHandling.getActionBarToggle().getOrDefault(playerUUID, Jobs.getGCManager().ActionBarsMessageDefault).getNext();
|
||||
Language.sendMessage(sender, "command.toggle.output." + ex.toString());
|
||||
ToggleBarHandling.getActionBarToggle().put(playerUUID, ex);
|
||||
}
|
||||
|
||||
if (isBossbar) {
|
||||
boolean ex = ToggleBarHandling.getBossBarToggle().getOrDefault(playerUUID, Jobs.getGCManager().BossBarsMessageByDefault);
|
||||
MessageToggleState ex = ToggleBarHandling.getBossBarToggle().getOrDefault(playerUUID, Jobs.getGCManager().BossBarsMessageDefault).getNext();
|
||||
|
||||
if (ex) {
|
||||
Language.sendMessage(sender, "command.toggle.output.off");
|
||||
Language.sendMessage(sender, "command.toggle.output." + ex.toString());
|
||||
|
||||
if (ex.equals(MessageToggleState.Off)) {
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player.getUniqueId());
|
||||
if (jPlayer != null)
|
||||
jPlayer.hideBossBars();
|
||||
} else {
|
||||
Language.sendMessage(sender, "command.toggle.output.on");
|
||||
}
|
||||
ToggleBarHandling.getBossBarToggle().put(playerUUID, !ex);
|
||||
|
||||
ToggleBarHandling.getBossBarToggle().put(playerUUID, ex);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -10,6 +10,7 @@ import com.gamingmesh.jobs.container.BossBarInfo;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.MessageToggleState;
|
||||
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
|
||||
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
@ -36,10 +37,10 @@ public class BossBarManager {
|
||||
}
|
||||
|
||||
public void ShowJobProgression(final JobsPlayer player, final JobProgression jobProg, double expGain) {
|
||||
if (Version.getCurrent().isLower(Version.v1_9_R1) || !Jobs.getGCManager().BossBarsMessageByDefault)
|
||||
if (Version.getCurrent().isLower(Version.v1_9_R1) || Jobs.getGCManager().BossBarsMessageDefault.equals(MessageToggleState.Off))
|
||||
return;
|
||||
|
||||
if (!ToggleBarHandling.getBossBarToggle().getOrDefault(player.getUniqueId(), true))
|
||||
if (ToggleBarHandling.getBossBarToggle().getOrDefault(player.getUniqueId(), MessageToggleState.Rapid).equals(MessageToggleState.Off))
|
||||
return;
|
||||
|
||||
showJobProgressionInTask(player, jobProg, expGain);
|
||||
|
@ -37,8 +37,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.CurrencyLimit;
|
||||
import com.gamingmesh.jobs.container.CurrencyType;
|
||||
import com.gamingmesh.jobs.container.MessageToggleState;
|
||||
|
||||
import net.Zrips.CMILib.CMILib;
|
||||
import net.Zrips.CMILib.Container.CMIArray;
|
||||
import net.Zrips.CMILib.Container.CMIList;
|
||||
import net.Zrips.CMILib.Container.CMINumber;
|
||||
import net.Zrips.CMILib.Enchants.CMIEnchantment;
|
||||
@ -103,15 +105,17 @@ public class GeneralConfigManager {
|
||||
applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useMinimumOveralExp, useBreederFinder,
|
||||
CancelCowMilking, fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
|
||||
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat,
|
||||
EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
|
||||
EmptyServerAccountActionBar, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
|
||||
JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, ShowActionNames, hideItemAttributes,
|
||||
DisableJoiningJobThroughGui, FireworkLevelupUse, UseRandom, UsePerPermissionForLeaving,
|
||||
EnableConfirmation, jobsInfoOpensBrowse, MonsterDamageUse, MonsterDamageIgnoreBosses, tameablesPayout, useMaxPaymentCurve, blockOwnershipTakeOver,
|
||||
hideJobsInfoWithoutPermission, UseTaxes, TransferToServerAccount, TakeFromPlayersPayment, AutoJobJoinUse, AllowDelevel, RomanNumbers,
|
||||
BossBarEnabled = false, BossBarsMessageByDefault = false, ExploreCompact, ExploreSaveIntoDatabase = false, DBCleaningJobsUse, DBCleaningUsersUse,
|
||||
BossBarEnabled = false, ActionBarEnabled, ExploreCompact, ExploreSaveIntoDatabase = false, DBCleaningJobsUse, DBCleaningUsersUse,
|
||||
DisabledWorldsUse, UseAsWhiteListWorldList, MythicMobsEnabled,
|
||||
LoggingUse, payForCombiningItems, BlastFurnacesReassign = false, SmokerReassign = false, payForStackedEntities, payForAbove = false,
|
||||
payForEachVTradeItem, allowEnchantingBoostedItems, preventShopItemEnchanting;
|
||||
public MessageToggleState BossBarsMessageDefault = MessageToggleState.Rapid;
|
||||
public MessageToggleState ActionBarsMessageDefault = MessageToggleState.Rapid;
|
||||
|
||||
public int ActionBarsMessageKeepFor;
|
||||
|
||||
@ -988,10 +992,13 @@ public class GeneralConfigManager {
|
||||
"Only works when fix-at-max-level is set to false");
|
||||
levelLossPercentageFromMax = c.get("old-job.level-loss-from-max-level", levelLossPercentage);
|
||||
|
||||
c.addComment("ActionBars.Messages.EnabledByDefault", "When this set to true player will see action bar messages by default",
|
||||
"When false, players will see chat messages instead.");
|
||||
ActionBarsMessageByDefault = c.get("ActionBars.Messages.EnabledByDefault", true);
|
||||
c.addComment("ActionBars.Messages.KeepFor", "Time in seconds action bar will remain visible if enabled",
|
||||
c.addComment("ActionBars.Enabled", "Enables ActionBar messages");
|
||||
ActionBarEnabled = c.get("ActionBars.Enabled", true);
|
||||
|
||||
c.addComment("ActionBars.Messages.DefaultState", "States of action bar messages", "Valid options: " + MessageToggleState.toCommaSeparatedString());
|
||||
ActionBarsMessageDefault = MessageToggleState.getByName(c.get("ActionBars.Messages.DefaultState", MessageToggleState.Rapid.toString()));
|
||||
|
||||
c.addComment("ActionBars.Messages.KeepFor", "Time in seconds action bar will remain visible if rapid state is enabled",
|
||||
"This time is used to define for how long we will accumulate payments to be shown in action bar",
|
||||
"If no payments are being issued in defined time then it will reset to 0 and remain hidden");
|
||||
ActionBarsMessageKeepFor = c.get("ActionBars.Messages.KeepFor", 5);
|
||||
@ -1000,8 +1007,8 @@ public class GeneralConfigManager {
|
||||
c.addComment("BossBar.Enabled", "Enables BossBar feature", "Works only from 1.9 mc version");
|
||||
BossBarEnabled = c.get("BossBar.Enabled", true);
|
||||
|
||||
c.addComment("BossBar.Messages.EnabledByDefault", "When this set to true player will see Bossbar messages by default");
|
||||
BossBarsMessageByDefault = c.get("BossBar.Messages.EnabledByDefault", true);
|
||||
c.addComment("BossBar.Messages.DefaultState", "When this set to true player will see Bossbar messages by default");
|
||||
BossBarsMessageDefault = MessageToggleState.getByName(c.get("BossBar.Messages.DefaultState", MessageToggleState.Rapid.toString()));
|
||||
|
||||
c.addComment("BossBar.SegmentCount", "Defines in how many parts bossbar will be split visually", "Valid options: 1, 6, 10, 12, 20");
|
||||
SegmentCount = c.get("BossBar.SegmentCount", 1);
|
||||
|
@ -658,8 +658,9 @@ public class LanguageManager {
|
||||
c.get("command.toggle.output.paid.ACexp", "&7+[exp]XP ");
|
||||
c.get("command.toggle.output.paid.ACpoints", "&6+[points]pts ");
|
||||
|
||||
c.get("command.toggle.output.on", "&aToggled: &aON");
|
||||
c.get("command.toggle.output.off", "&aToggled: &4OFF");
|
||||
c.get("command.toggle.output.Rapid", "&aToggled: &7Rapid");
|
||||
c.get("command.toggle.output.Batched", "&aToggled: &fBatched");
|
||||
c.get("command.toggle.output.Off", "&aToggled: &6Off");
|
||||
|
||||
c.get("command.howmuch.help.info", "Check potential payment by target entity or block");
|
||||
c.get("command.howmuch.help.args", "");
|
||||
|
@ -0,0 +1,38 @@
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
import net.Zrips.CMILib.Container.CMINumber;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
|
||||
public enum MessageToggleState {
|
||||
Off, Rapid, Batched;
|
||||
|
||||
public static MessageToggleState getByName(String name) {
|
||||
for (MessageToggleState state : MessageToggleState.values()) {
|
||||
if (state.name().equalsIgnoreCase(name))
|
||||
return state;
|
||||
}
|
||||
return MessageToggleState.Rapid;
|
||||
}
|
||||
|
||||
public static MessageToggleState getFromID(int id) {
|
||||
return MessageToggleState.values()[CMINumber.clamp(id, 0, MessageToggleState.values().length - 1)];
|
||||
|
||||
}
|
||||
|
||||
public static String toCommaSeparatedString() {
|
||||
StringBuilder str = new StringBuilder();
|
||||
for (MessageToggleState state : MessageToggleState.values()) {
|
||||
if (!str.toString().isEmpty())
|
||||
str.append(LC.info_ListSpliter.getLocale());
|
||||
str.append(state.name());
|
||||
}
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
public MessageToggleState getNext() {
|
||||
int index = this.ordinal();
|
||||
index++;
|
||||
index = index >= MessageToggleState.values().length ? 0 : index;
|
||||
return MessageToggleState.values()[index];
|
||||
}
|
||||
}
|
@ -177,7 +177,7 @@ public class BufferedEconomy {
|
||||
economy.depositPlayer(serverTaxesAccount, taxesAmount);
|
||||
}
|
||||
|
||||
if (Jobs.getGCManager().ActionBarsMessageByDefault && serverTaxesAccount.isOnline()) {
|
||||
if (serverTaxesAccount.isOnline()) {
|
||||
CMIActionBar.send(Bukkit.getPlayer(serverAccountName),
|
||||
Jobs.getLanguage().getMessage("message.taxes", "[amount]", String.format(Jobs.getGCManager().getDecimalPlacesMoney(), totalAmount)));
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.api.JobsInstancePaymentEvent;
|
||||
import com.gamingmesh.jobs.api.JobsPaymentEvent;
|
||||
import com.gamingmesh.jobs.container.CurrencyType;
|
||||
import com.gamingmesh.jobs.container.MessageToggleState;
|
||||
import com.gamingmesh.jobs.economy.BufferedPayment;
|
||||
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
|
||||
|
||||
@ -97,38 +98,60 @@ public class JobsPaymentVisualizationListener implements Listener {
|
||||
public void onJobsPaymentEvent(JobsPaymentEvent event) {
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
showPayment(event);
|
||||
showBatchedActionBarChatMessage(event);
|
||||
}
|
||||
|
||||
private static void showPayment(JobsPaymentEvent event) {
|
||||
private static void showBatchedActionBarChatMessage(JobsPaymentEvent event) {
|
||||
|
||||
if (event.getPlayer() == null || !event.getPlayer().isOnline() || event.getPayment().isEmpty())
|
||||
return;
|
||||
|
||||
MessageToggleState state = ToggleBarHandling.getActionBarState(event.getPlayer().getUniqueId());
|
||||
|
||||
if (state.equals(MessageToggleState.Rapid))
|
||||
return;
|
||||
|
||||
UUID playerUUID = event.getPlayer().getUniqueId();
|
||||
Player abp = Bukkit.getPlayer(playerUUID);
|
||||
if (abp == null)
|
||||
return;
|
||||
|
||||
if (ToggleBarHandling.getActionBarToggle().getOrDefault(playerUUID, Jobs.getGCManager().ActionBarsMessageByDefault))
|
||||
if (!Jobs.getGeneralConfigManager().ActionBarEnabled) {
|
||||
String message = generateDelayedMessage(event.getPayment());
|
||||
if (!message.isEmpty())
|
||||
abp.sendMessage(message);
|
||||
return;
|
||||
}
|
||||
|
||||
String message = Jobs.getLanguage().getMessage("command.toggle.output.paid.main");
|
||||
double money = event.getPayment().get(CurrencyType.MONEY);
|
||||
if (money != 0D)
|
||||
message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.money", "[amount]", String.format(Jobs.getGCManager().getDecimalPlacesMoney(), money));
|
||||
if (state.equals(MessageToggleState.Batched)) {
|
||||
String message = generateDelayedMessage(event.getPayment());
|
||||
if (!message.isEmpty())
|
||||
CMIActionBar.send(abp, message);
|
||||
return;
|
||||
}
|
||||
|
||||
double points = event.getPayment().get(CurrencyType.POINTS);
|
||||
if (points != 0D)
|
||||
message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", "[points]", String.format(Jobs.getGCManager().getDecimalPlacesPoints(), points));
|
||||
|
||||
double exp = event.getPayment().get(CurrencyType.EXP);
|
||||
if (exp != 0D)
|
||||
message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", "[exp]", String.format(Jobs.getGCManager().getDecimalPlacesExp(), exp));
|
||||
String message = generateDelayedMessage(event.getPayment());
|
||||
|
||||
if (!message.isEmpty())
|
||||
abp.sendMessage(message);
|
||||
}
|
||||
|
||||
private static String generateDelayedMessage(Map<CurrencyType, Double> payment) {
|
||||
|
||||
String message = Jobs.getLanguage().getMessage("command.toggle.output.paid.main");
|
||||
double money = payment.get(CurrencyType.MONEY);
|
||||
if (money != 0D)
|
||||
message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.money", "[amount]", String.format(Jobs.getGCManager().getDecimalPlacesMoney(), money));
|
||||
|
||||
double points = payment.get(CurrencyType.POINTS);
|
||||
if (points != 0D)
|
||||
message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", "[points]", String.format(Jobs.getGCManager().getDecimalPlacesPoints(), points));
|
||||
|
||||
double exp = payment.get(CurrencyType.EXP);
|
||||
if (exp != 0D)
|
||||
message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", "[exp]", String.format(Jobs.getGCManager().getDecimalPlacesExp(), exp));
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -140,12 +163,41 @@ public class JobsPaymentVisualizationListener implements Listener {
|
||||
if (!Version.getCurrent().isHigher(Version.v1_8_R3))
|
||||
return;
|
||||
|
||||
// Whether or not to show this on player actionbar or on chat
|
||||
MessageToggleState state = ToggleBarHandling.getBossBarState(event.getPlayer().getUniqueId());
|
||||
|
||||
if (!state.equals(MessageToggleState.Rapid))
|
||||
return;
|
||||
|
||||
Jobs.getBBManager().ShowJobProgression(Jobs.getPlayerManager().getJobsPlayer(event.getPlayer().getUniqueId()));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onJobsPaymentEventBossBar(JobsPaymentEvent event) {
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (event.getPlayer() == null || !event.getPlayer().isOnline())
|
||||
return;
|
||||
|
||||
if (!Version.getCurrent().isHigher(Version.v1_8_R3))
|
||||
return;
|
||||
|
||||
// Whether or not to show this on player actionbar or on chat
|
||||
MessageToggleState state = ToggleBarHandling.getBossBarState(event.getPlayer().getUniqueId());
|
||||
|
||||
if (!state.equals(MessageToggleState.Batched))
|
||||
return;
|
||||
|
||||
Jobs.getBBManager().ShowJobProgression(Jobs.getPlayerManager().getJobsPlayer(event.getPlayer().getUniqueId()));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onJobsInstancePaymentActionBarEvent(JobsInstancePaymentEvent event) {
|
||||
|
||||
if (!Jobs.getGeneralConfigManager().ActionBarEnabled)
|
||||
return;
|
||||
|
||||
if (event.getPlayer() == null || !event.getPlayer().isOnline())
|
||||
return;
|
||||
|
||||
@ -155,9 +207,9 @@ public class JobsPaymentVisualizationListener implements Listener {
|
||||
return;
|
||||
|
||||
// Whether or not to show this on player actionbar or on chat
|
||||
boolean showInActionbar = ToggleBarHandling.getActionBarToggle().getOrDefault(player.getUniqueId(), Jobs.getGCManager().ActionBarsMessageByDefault);
|
||||
MessageToggleState state = ToggleBarHandling.getActionBarState(event.getPlayer().getUniqueId());
|
||||
|
||||
if (!showInActionbar)
|
||||
if (!state.equals(MessageToggleState.Rapid))
|
||||
return;
|
||||
|
||||
paymentCache cached = getPaymentCache(player.getUniqueId(), event.getPayment());
|
||||
|
@ -10,11 +10,14 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.config.YmlMaker;
|
||||
import com.gamingmesh.jobs.container.MessageToggleState;
|
||||
|
||||
import net.Zrips.CMILib.Container.CMINumber;
|
||||
|
||||
public class ToggleBarHandling {
|
||||
|
||||
static Map<UUID, Boolean> actionBarToggle = new HashMap<>();
|
||||
static Map<UUID, Boolean> bossBarToggle = new HashMap<>();
|
||||
static Map<UUID, MessageToggleState> actionBarToggle = new HashMap<>();
|
||||
static Map<UUID, MessageToggleState> bossBarToggle = new HashMap<>();
|
||||
|
||||
public static void load() {
|
||||
YmlMaker f = new YmlMaker(Jobs.getFolder(), "actionBarBossbar.yml");
|
||||
@ -28,28 +31,43 @@ public class ToggleBarHandling {
|
||||
|
||||
if (section != null) {
|
||||
for (String one : section.getKeys(false)) {
|
||||
boolean boo = section.getBoolean(one);
|
||||
if (boo)
|
||||
continue;
|
||||
|
||||
MessageToggleState state = MessageToggleState.Rapid;
|
||||
|
||||
if (section.isBoolean(one)) {
|
||||
if (!section.getBoolean(one))
|
||||
state = MessageToggleState.Off;
|
||||
} else if (section.isInt(one)) {
|
||||
int id = section.getInt(one);
|
||||
state = MessageToggleState.getFromID(id);
|
||||
}
|
||||
|
||||
try {
|
||||
bossBarToggle.put(UUID.fromString(one), boo);
|
||||
bossBarToggle.put(UUID.fromString(one), state);
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Jobs.getGCManager().ActionBarsMessageByDefault) {
|
||||
if (Jobs.getGCManager().ActionBarEnabled) {
|
||||
ConfigurationSection section = config.getConfigurationSection("actionBar");
|
||||
|
||||
if (section != null) {
|
||||
for (String one : section.getKeys(false)) {
|
||||
boolean boo = section.getBoolean(one);
|
||||
if (boo)
|
||||
continue;
|
||||
|
||||
MessageToggleState state = MessageToggleState.Rapid;
|
||||
|
||||
if (section.isBoolean(one)) {
|
||||
if (!section.getBoolean(one))
|
||||
state = MessageToggleState.Off;
|
||||
} else if (section.isInt(one)) {
|
||||
int id = section.getInt(one);
|
||||
state = MessageToggleState.getFromID(id);
|
||||
}
|
||||
|
||||
try {
|
||||
actionBarToggle.put(UUID.fromString(one), boo);
|
||||
actionBarToggle.put(UUID.fromString(one), state);
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
}
|
||||
@ -79,22 +97,20 @@ public class ToggleBarHandling {
|
||||
config.set("bossBar", null);
|
||||
|
||||
if (!bossBarToggle.isEmpty()) {
|
||||
for (Entry<UUID, Boolean> one : bossBarToggle.entrySet()) {
|
||||
if (!one.getValue()) {
|
||||
for (Entry<UUID, MessageToggleState> one : bossBarToggle.entrySet()) {
|
||||
if (!one.getValue().equals(Jobs.getGeneralConfigManager().BossBarsMessageDefault)) {
|
||||
config.set("bossBar." + one.getKey().toString(), one.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Jobs.getGCManager().ActionBarsMessageByDefault) {
|
||||
config.set("actionBar", null);
|
||||
config.set("actionBar", null);
|
||||
|
||||
if (!actionBarToggle.isEmpty()) {
|
||||
for (Entry<UUID, Boolean> one : actionBarToggle.entrySet()) {
|
||||
if (!one.getValue()) {
|
||||
config.set("actionBar." + one.getKey().toString(), one.getValue());
|
||||
}
|
||||
if (!actionBarToggle.isEmpty()) {
|
||||
for (Entry<UUID, MessageToggleState> one : actionBarToggle.entrySet()) {
|
||||
if (!one.getValue().equals(Jobs.getGeneralConfigManager().ActionBarsMessageDefault)) {
|
||||
config.set("actionBar." + one.getKey().toString(), one.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -105,11 +121,23 @@ public class ToggleBarHandling {
|
||||
f.saveConfig();
|
||||
}
|
||||
|
||||
public static Map<UUID, Boolean> getActionBarToggle() {
|
||||
public static Map<UUID, MessageToggleState> getActionBarToggle() {
|
||||
return actionBarToggle;
|
||||
}
|
||||
|
||||
public static Map<UUID, Boolean> getBossBarToggle() {
|
||||
public static Map<UUID, MessageToggleState> getBossBarToggle() {
|
||||
return bossBarToggle;
|
||||
}
|
||||
|
||||
public static MessageToggleState getActionBarState(UUID uuid) {
|
||||
synchronized (actionBarToggle) {
|
||||
return actionBarToggle.getOrDefault(uuid, Jobs.getGCManager().ActionBarsMessageDefault);
|
||||
}
|
||||
}
|
||||
|
||||
public static MessageToggleState getBossBarState(UUID uuid) {
|
||||
synchronized (bossBarToggle) {
|
||||
return bossBarToggle.getOrDefault(uuid, Jobs.getGCManager().BossBarsMessageDefault);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user