mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-01 15:03:36 +01:00
Added option to save the toggled actionbar/bossbar values to a file
- Fixed issue when the /jobs gtop clear not removed the scoreboard - Deprecate some methods - Fixed issue when the nearbyEntities is invalid under 1.8 (armor stand will not work in this version)
This commit is contained in:
parent
a6b3b42da4
commit
dd8a717271
@ -103,11 +103,11 @@ import com.gamingmesh.jobs.listeners.JobsPaymentListener;
|
|||||||
import com.gamingmesh.jobs.listeners.PistonProtectionListener;
|
import com.gamingmesh.jobs.listeners.PistonProtectionListener;
|
||||||
import com.gamingmesh.jobs.selection.SelectionManager;
|
import com.gamingmesh.jobs.selection.SelectionManager;
|
||||||
import com.gamingmesh.jobs.stuff.CMIScoreboardManager;
|
import com.gamingmesh.jobs.stuff.CMIScoreboardManager;
|
||||||
import com.gamingmesh.jobs.stuff.Debug;
|
|
||||||
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
|
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
|
||||||
import com.gamingmesh.jobs.stuff.Loging;
|
import com.gamingmesh.jobs.stuff.Loging;
|
||||||
import com.gamingmesh.jobs.stuff.PageInfo;
|
import com.gamingmesh.jobs.stuff.PageInfo;
|
||||||
import com.gamingmesh.jobs.stuff.TabComplete;
|
import com.gamingmesh.jobs.stuff.TabComplete;
|
||||||
|
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
|
||||||
import com.gamingmesh.jobs.tasks.BufferedPaymentThread;
|
import com.gamingmesh.jobs.tasks.BufferedPaymentThread;
|
||||||
import com.gamingmesh.jobs.tasks.DatabaseSaveThread;
|
import com.gamingmesh.jobs.tasks.DatabaseSaveThread;
|
||||||
|
|
||||||
@ -151,7 +151,17 @@ public class Jobs extends JavaPlugin {
|
|||||||
private static List<Job> jobs = null;
|
private static List<Job> jobs = null;
|
||||||
private static Job noneJob = null;
|
private static Job noneJob = null;
|
||||||
private static WeakHashMap<Job, Integer> usedSlots = new WeakHashMap<>();
|
private static WeakHashMap<Job, Integer> usedSlots = new WeakHashMap<>();
|
||||||
|
/**
|
||||||
|
* Gets the actionbar toggle map
|
||||||
|
* @deprecated Moved to {@link ToggleBarHandling}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static WeakHashMap<String, Boolean> actionbartoggle = new WeakHashMap<>();
|
public static WeakHashMap<String, Boolean> actionbartoggle = new WeakHashMap<>();
|
||||||
|
/**
|
||||||
|
* Gets the bossbar toggle map
|
||||||
|
* @deprecated Moved to {@link ToggleBarHandling}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static WeakHashMap<String, Boolean> BossBartoggle = new WeakHashMap<>();
|
public static WeakHashMap<String, Boolean> BossBartoggle = new WeakHashMap<>();
|
||||||
// public static WeakHashMap<String, Double> GlobalBoost = new WeakHashMap<String, Double>();
|
// public static WeakHashMap<String, Double> GlobalBoost = new WeakHashMap<String, Double>();
|
||||||
private static BufferedEconomy economy = null;
|
private static BufferedEconomy economy = null;
|
||||||
@ -392,10 +402,20 @@ public class Jobs extends JavaPlugin {
|
|||||||
return BBManager;
|
return BBManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the actionbar toggle map
|
||||||
|
* @deprecated Moved to {@link ToggleBarHandling}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static WeakHashMap<String, Boolean> getActionbarToggleList() {
|
public static WeakHashMap<String, Boolean> getActionbarToggleList() {
|
||||||
return actionbartoggle;
|
return actionbartoggle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the bossbar toggle map
|
||||||
|
* @deprecated Moved to {@link ToggleBarHandling}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static WeakHashMap<String, Boolean> getBossBarToggleList() {
|
public static WeakHashMap<String, Boolean> getBossBarToggleList() {
|
||||||
return BossBartoggle;
|
return BossBartoggle;
|
||||||
}
|
}
|
||||||
@ -624,8 +644,8 @@ public class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
dao.getMap().clear();
|
dao.getMap().clear();
|
||||||
if (getPlayerManager().getPlayersCache().size() != 0)
|
if (getPlayerManager().getPlayersCache().size() != 0)
|
||||||
consoleMsg("&e[Jobs] Preloaded " + getPlayerManager().getPlayersCache().size() + " players data in " + ((int) (((System.currentTimeMillis() - time)
|
consoleMsg("&e[Jobs] Preloaded " + getPlayerManager().getPlayersCache().size() + " players data in " +
|
||||||
/ 1000d) * 100) / 100D));
|
((int) (((System.currentTimeMillis() - time) / 1000d) * 100) / 100D));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -633,7 +653,6 @@ public class Jobs extends JavaPlugin {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static void reload() throws IOException {
|
public static void reload() throws IOException {
|
||||||
|
|
||||||
if (saveTask != null) {
|
if (saveTask != null) {
|
||||||
saveTask.shutdown();
|
saveTask.shutdown();
|
||||||
saveTask = null;
|
saveTask = null;
|
||||||
@ -653,6 +672,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
configManager.reload();
|
configManager.reload();
|
||||||
|
|
||||||
FurnaceBrewingHandling.load();
|
FurnaceBrewingHandling.load();
|
||||||
|
ToggleBarHandling.load();
|
||||||
usedSlots.clear();
|
usedSlots.clear();
|
||||||
for (Job job : jobs) {
|
for (Job job : jobs) {
|
||||||
usedSlots.put(job, dao.getSlotsTaken(job));
|
usedSlots.put(job, dao.getSlotsTaken(job));
|
||||||
@ -889,7 +909,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
setWorldGuard();
|
setWorldGuard();
|
||||||
|
|
||||||
setMythicManager();
|
setMythicManager();
|
||||||
if (MythicManager != null && MythicManager.Check() && GconfigManager.MythicMobsEnabled)
|
if (GconfigManager.MythicMobsEnabled && MythicManager != null && MythicManager.Check())
|
||||||
MythicManager.registerListener();
|
MythicManager.registerListener();
|
||||||
|
|
||||||
setPistonProtectionListener();
|
setPistonProtectionListener();
|
||||||
@ -926,6 +946,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
dao.saveExplore();
|
dao.saveExplore();
|
||||||
dao.saveBlockProtection();
|
dao.saveBlockProtection();
|
||||||
FurnaceBrewingHandling.save();
|
FurnaceBrewingHandling.save();
|
||||||
|
ToggleBarHandling.save();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scoreboard.DisplaySlot;
|
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
import com.gamingmesh.jobs.commands.Cmd;
|
import com.gamingmesh.jobs.commands.Cmd;
|
||||||
@ -18,7 +17,6 @@ public class gtop implements Cmd {
|
|||||||
@Override
|
@Override
|
||||||
@JobCommand(600)
|
@JobCommand(600)
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
|
|
||||||
if (args.length != 1 && args.length != 0) {
|
if (args.length != 1 && args.length != 0) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.help.info", "%amount%", Jobs.getGCManager().JobsTopAmount));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.help.info", "%amount%", Jobs.getGCManager().JobsTopAmount));
|
||||||
return true;
|
return true;
|
||||||
@ -26,12 +24,15 @@ public class gtop implements Cmd {
|
|||||||
|
|
||||||
if (!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
|
||||||
|
|
||||||
if (args.length > 0 && args[0].equalsIgnoreCase("clear")) {
|
Player player = (Player) sender;
|
||||||
player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
|
if (args.length == 1) {
|
||||||
|
if (args[0].equalsIgnoreCase("clear")) {
|
||||||
|
//player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
|
||||||
|
plugin.getCMIScoreboardManager().removeScoreBoard(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int page = 1;
|
int page = 1;
|
||||||
if (args.length == 1)
|
if (args.length == 1)
|
||||||
|
@ -8,13 +8,13 @@ import com.gamingmesh.jobs.Jobs;
|
|||||||
import com.gamingmesh.jobs.commands.Cmd;
|
import com.gamingmesh.jobs.commands.Cmd;
|
||||||
import com.gamingmesh.jobs.commands.JobCommand;
|
import com.gamingmesh.jobs.commands.JobCommand;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
|
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
|
||||||
|
|
||||||
public class toggle implements Cmd {
|
public class toggle implements Cmd {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JobCommand(1000)
|
@JobCommand(1000)
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
|
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
||||||
return false;
|
return false;
|
||||||
@ -26,47 +26,46 @@ public class toggle implements Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
String PlayerName = player.getName();
|
String PlayerName = player.getName();
|
||||||
|
|
||||||
if (PlayerName == null || !args[0].equalsIgnoreCase("bossbar") && !args[0].equalsIgnoreCase("actionbar")) {
|
if (PlayerName == null || !args[0].equalsIgnoreCase("bossbar") && !args[0].equalsIgnoreCase("actionbar")) {
|
||||||
Jobs.getCommandManager().sendUsage(sender, "toggle");
|
Jobs.getCommandManager().sendUsage(sender, "toggle");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("actionbar"))
|
if (args[0].equalsIgnoreCase("actionbar")) {
|
||||||
if (Jobs.getActionbarToggleList().containsKey(PlayerName))
|
if (ToggleBarHandling.getActionBarToggle().containsKey(PlayerName)) {
|
||||||
if (Jobs.getActionbarToggleList().get(PlayerName)) {
|
if (ToggleBarHandling.getActionBarToggle().get(PlayerName)) {
|
||||||
Jobs.getActionbarToggleList().put(PlayerName, false);
|
ToggleBarHandling.getActionBarToggle().put(PlayerName, false);
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.off"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.off"));
|
||||||
} else {
|
} else {
|
||||||
Jobs.getActionbarToggleList().put(PlayerName, true);
|
ToggleBarHandling.getActionBarToggle().put(PlayerName, true);
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
Jobs.getActionbarToggleList().put(PlayerName, true);
|
ToggleBarHandling.getActionBarToggle().put(PlayerName, true);
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("bossbar"))
|
if (args[0].equalsIgnoreCase("bossbar")) {
|
||||||
if (Jobs.getBossBarToggleList().containsKey(PlayerName))
|
if (ToggleBarHandling.getBossBarToggle().containsKey(PlayerName)) {
|
||||||
if (Jobs.getBossBarToggleList().get(PlayerName)) {
|
if (ToggleBarHandling.getBossBarToggle().get(PlayerName)) {
|
||||||
Jobs.getBossBarToggleList().put(PlayerName, false);
|
ToggleBarHandling.getBossBarToggle().put(PlayerName, false);
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.off"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.off"));
|
||||||
|
|
||||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player.getUniqueId());
|
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player.getUniqueId());
|
||||||
|
|
||||||
if (jPlayer != null)
|
if (jPlayer != null)
|
||||||
jPlayer.hideBossBars();
|
jPlayer.hideBossBars();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Jobs.getBossBarToggleList().put(PlayerName, true);
|
ToggleBarHandling.getBossBarToggle().put(PlayerName, true);
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
Jobs.getBossBarToggleList().put(PlayerName, true);
|
ToggleBarHandling.getBossBarToggle().put(PlayerName, true);
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import com.gamingmesh.jobs.container.BossBarInfo;
|
|||||||
import com.gamingmesh.jobs.container.Job;
|
import com.gamingmesh.jobs.container.Job;
|
||||||
import com.gamingmesh.jobs.container.JobProgression;
|
import com.gamingmesh.jobs.container.JobProgression;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
|
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
|
||||||
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
||||||
|
|
||||||
public class BossBarManager {
|
public class BossBarManager {
|
||||||
@ -35,7 +36,6 @@ public class BossBarManager {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
List<String> temp = new ArrayList<>();
|
List<String> temp = new ArrayList<>();
|
||||||
|
|
||||||
temp.addAll(player.getUpdateBossBarFor());
|
temp.addAll(player.getUpdateBossBarFor());
|
||||||
|
|
||||||
for (String one : temp) {
|
for (String one : temp) {
|
||||||
@ -50,14 +50,15 @@ public class BossBarManager {
|
|||||||
public synchronized void ShowJobProgression(final JobsPlayer player, final JobProgression jobProg) {
|
public synchronized void ShowJobProgression(final JobsPlayer player, final JobProgression jobProg) {
|
||||||
if (Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1))
|
if (Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1))
|
||||||
return;
|
return;
|
||||||
String playername = player.getUserName();
|
|
||||||
if (!Jobs.getBossBarToggleList().containsKey(playername) && Jobs.getGCManager().BossBarsMessageByDefault)
|
|
||||||
Jobs.getBossBarToggleList().put(playername, true);
|
|
||||||
|
|
||||||
if (!Jobs.getBossBarToggleList().containsKey(playername))
|
String playername = player.getUserName();
|
||||||
|
if (!ToggleBarHandling.getBossBarToggle().containsKey(playername) && Jobs.getGCManager().BossBarsMessageByDefault)
|
||||||
|
ToggleBarHandling.getBossBarToggle().put(playername, true);
|
||||||
|
|
||||||
|
if (!ToggleBarHandling.getBossBarToggle().containsKey(playername))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Boolean show = Jobs.getBossBarToggleList().get(playername);
|
Boolean show = ToggleBarHandling.getBossBarToggle().get(playername);
|
||||||
|
|
||||||
if (!show)
|
if (!show)
|
||||||
return;
|
return;
|
||||||
@ -133,7 +134,6 @@ public class BossBarManager {
|
|||||||
OldOne.setId(Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
OldOne.setId(Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
for (BossBarInfo one : player.getBossBarInfo()) {
|
for (BossBarInfo one : player.getBossBarInfo()) {
|
||||||
if (!one.getPlayerName().equalsIgnoreCase(player.getUserName()))
|
if (!one.getPlayerName().equalsIgnoreCase(player.getUserName()))
|
||||||
continue;
|
continue;
|
||||||
|
@ -100,7 +100,7 @@ public class GeneralConfigManager {
|
|||||||
public boolean useBreederFinder = false;
|
public boolean useBreederFinder = false;
|
||||||
private boolean useTnTFinder = false;
|
private boolean useTnTFinder = false;
|
||||||
public boolean CancelCowMilking;
|
public boolean CancelCowMilking;
|
||||||
public boolean fixAtMaxLevel, ToggleActionBar, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
|
public boolean fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
|
||||||
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat,
|
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat,
|
||||||
EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
|
EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
|
||||||
JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, JobsGUIOpenOnJoin;
|
JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, JobsGUIOpenOnJoin;
|
||||||
@ -285,14 +285,32 @@ public class GeneralConfigManager {
|
|||||||
return modifyChat;
|
return modifyChat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the chat prefix string from file
|
||||||
|
* @deprecated Use {@link #modifyChatPrefix}
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public String getModifyChatPrefix() {
|
public String getModifyChatPrefix() {
|
||||||
return modifyChatPrefix;
|
return modifyChatPrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the chat suffix string from file
|
||||||
|
* @deprecated Use {@link #modifyChatSuffix}
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public String getModifyChatSuffix() {
|
public String getModifyChatSuffix() {
|
||||||
return modifyChatSuffix;
|
return modifyChatSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the chat separator string from file
|
||||||
|
* @deprecated Use {@link #modifyChatSeparator}
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public String getModifyChatSeparator() {
|
public String getModifyChatSeparator() {
|
||||||
return modifyChatSeparator;
|
return modifyChatSeparator;
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ public class JobsPlayer {
|
|||||||
if (method.equals(DisplayMethod.NONE))
|
if (method.equals(DisplayMethod.NONE))
|
||||||
continue;
|
continue;
|
||||||
if (gotTitle) {
|
if (gotTitle) {
|
||||||
builder.append(Jobs.getGCManager().getModifyChatSeparator());
|
builder.append(Jobs.getGCManager().modifyChatSeparator);
|
||||||
gotTitle = false;
|
gotTitle = false;
|
||||||
}
|
}
|
||||||
Title title = Jobs.gettitleManager().getTitle(prog.getLevel(), prog.getJob().getName());
|
Title title = Jobs.gettitleManager().getTitle(prog.getLevel(), prog.getJob().getName());
|
||||||
@ -691,7 +691,7 @@ public class JobsPlayer {
|
|||||||
honorific = builder.toString().trim();
|
honorific = builder.toString().trim();
|
||||||
if (honorific.length() > 0)
|
if (honorific.length() > 0)
|
||||||
honorific = org.bukkit.ChatColor.translateAlternateColorCodes('&',
|
honorific = org.bukkit.ChatColor.translateAlternateColorCodes('&',
|
||||||
Jobs.getGCManager().getModifyChatPrefix() + honorific + Jobs.getGCManager().getModifyChatSuffix());
|
Jobs.getGCManager().modifyChatPrefix + honorific + Jobs.getGCManager().modifyChatSuffix);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
import com.gamingmesh.jobs.api.JobsPaymentEvent;
|
import com.gamingmesh.jobs.api.JobsPaymentEvent;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
|
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
|
||||||
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
||||||
import com.gamingmesh.jobs.tasks.BufferedPaymentTask;
|
import com.gamingmesh.jobs.tasks.BufferedPaymentTask;
|
||||||
|
|
||||||
@ -144,9 +145,9 @@ public class BufferedEconomy {
|
|||||||
economy.depositPlayer(ServerTaxesAccount, TaxesAmount);
|
economy.depositPlayer(ServerTaxesAccount, TaxesAmount);
|
||||||
|
|
||||||
if (ServerTaxesAccount.isOnline()) {
|
if (ServerTaxesAccount.isOnline()) {
|
||||||
if (!Jobs.getActionbarToggleList().containsKey(ServerTaxesAccountname) && Jobs.getGCManager().ActionBarsMessageByDefault)
|
if (!ToggleBarHandling.getActionBarToggle().containsKey(ServerTaxesAccountname) && Jobs.getGCManager().ActionBarsMessageByDefault)
|
||||||
Jobs.getActionbarToggleList().put(ServerTaxesAccountname, true);
|
ToggleBarHandling.getActionBarToggle().put(ServerTaxesAccountname, true);
|
||||||
if (Jobs.getActionbarToggleList().containsKey(ServerTaxesAccountname) && Jobs.getActionbarToggleList().get(ServerTaxesAccountname))
|
if (ToggleBarHandling.getActionBarToggle().containsKey(ServerTaxesAccountname) && ToggleBarHandling.getActionBarToggle().get(ServerTaxesAccountname))
|
||||||
Jobs.getActionBar().send(Bukkit.getPlayer(ServerAccountname), Jobs.getLanguage().getMessage("message.taxes", "[amount]", (int) (TotalAmount * 100)
|
Jobs.getActionBar().send(Bukkit.getPlayer(ServerAccountname), Jobs.getLanguage().getMessage("message.taxes", "[amount]", (int) (TotalAmount * 100)
|
||||||
/ 100.0));
|
/ 100.0));
|
||||||
}
|
}
|
||||||
@ -213,16 +214,16 @@ public class BufferedEconomy {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
String playername = payment.getOfflinePlayer().getName();
|
String playername = payment.getOfflinePlayer().getName();
|
||||||
if ((!Jobs.getActionbarToggleList().containsKey(playername)) && (Jobs.getGCManager().ActionBarsMessageByDefault))
|
if ((!ToggleBarHandling.getActionBarToggle().containsKey(playername)) && (Jobs.getGCManager().ActionBarsMessageByDefault))
|
||||||
Jobs.getActionbarToggleList().put(playername, Boolean.valueOf(true));
|
ToggleBarHandling.getActionBarToggle().put(playername, Boolean.valueOf(true));
|
||||||
|
|
||||||
if (playername == null)
|
if (playername == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Jobs.getActionbarToggleList().containsKey(playername))
|
if (!ToggleBarHandling.getActionBarToggle().containsKey(playername))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Boolean show = Jobs.getActionbarToggleList().get(playername);
|
Boolean show = ToggleBarHandling.getActionBarToggle().get(playername);
|
||||||
Player abp = Bukkit.getPlayer(payment.getOfflinePlayer().getUniqueId());
|
Player abp = Bukkit.getPlayer(payment.getOfflinePlayer().getUniqueId());
|
||||||
if ((abp != null) && (show.booleanValue())) {
|
if ((abp != null) && (show.booleanValue())) {
|
||||||
String Message = Jobs.getLanguage().getMessage("command.toggle.output.paid.main");
|
String Message = Jobs.getLanguage().getMessage("command.toggle.output.paid.main");
|
||||||
|
@ -49,7 +49,6 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockCookEvent;
|
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.enchantment.EnchantItemEvent;
|
import org.bukkit.event.enchantment.EnchantItemEvent;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
@ -103,7 +102,6 @@ import com.gamingmesh.jobs.container.ExploreRespond;
|
|||||||
import com.gamingmesh.jobs.container.FastPayment;
|
import com.gamingmesh.jobs.container.FastPayment;
|
||||||
import com.gamingmesh.jobs.container.JobProgression;
|
import com.gamingmesh.jobs.container.JobProgression;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
import com.gamingmesh.jobs.stuff.Debug;
|
|
||||||
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
|
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
|
||||||
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling.ownershipFeedback;
|
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling.ownershipFeedback;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
@ -570,7 +568,6 @@ public class JobsPaymentListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onInventoryCraft(CraftItemEvent event) {
|
public void onInventoryCraft(CraftItemEvent event) {
|
||||||
|
|
||||||
// make sure plugin is enabled
|
// make sure plugin is enabled
|
||||||
if (!plugin.isEnabled())
|
if (!plugin.isEnabled())
|
||||||
return;
|
return;
|
||||||
@ -1311,9 +1308,11 @@ public class JobsPaymentListener implements Listener {
|
|||||||
if (!ent.getType().toString().equalsIgnoreCase("ARMOR_STAND"))
|
if (!ent.getType().toString().equalsIgnoreCase("ARMOR_STAND"))
|
||||||
return;
|
return;
|
||||||
Location loc = event.getLocation();
|
Location loc = event.getLocation();
|
||||||
Collection<Entity> ents = loc.getWorld().getNearbyEntities(loc, 4, 4, 4);
|
Collection<Entity> ents = Version.isCurrentEqualOrLower(Version.v1_8_R1)
|
||||||
|
? null : loc.getWorld().getNearbyEntities(loc, 4, 4, 4);
|
||||||
double dis = Double.MAX_VALUE;
|
double dis = Double.MAX_VALUE;
|
||||||
Player player = null;
|
Player player = null;
|
||||||
|
if (ents != null) {
|
||||||
for (Entity one : ents) {
|
for (Entity one : ents) {
|
||||||
if (!(one instanceof Player))
|
if (!(one instanceof Player))
|
||||||
continue;
|
continue;
|
||||||
@ -1326,6 +1325,7 @@ public class JobsPaymentListener implements Listener {
|
|||||||
player = p;
|
player = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (player == null || !player.isOnline())
|
if (player == null || !player.isOnline())
|
||||||
return;
|
return;
|
||||||
|
@ -0,0 +1,83 @@
|
|||||||
|
package com.gamingmesh.jobs.stuff;
|
||||||
|
|
||||||
|
import java.util.WeakHashMap;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
|
import com.gamingmesh.jobs.Jobs;
|
||||||
|
import com.gamingmesh.jobs.config.YmlMaker;
|
||||||
|
|
||||||
|
public class ToggleBarHandling {
|
||||||
|
|
||||||
|
static WeakHashMap<String, Boolean> actionBarToggle = new WeakHashMap<>();
|
||||||
|
static WeakHashMap<String, Boolean> bossBarToggle = new WeakHashMap<>();
|
||||||
|
|
||||||
|
public static void load() {
|
||||||
|
YmlMaker f = new YmlMaker(Jobs.getInstance(), "actionBarBossbar.yml");
|
||||||
|
if (!f.exists())
|
||||||
|
return;
|
||||||
|
|
||||||
|
FileConfiguration config = f.getConfig();
|
||||||
|
|
||||||
|
if (Jobs.getGCManager().BossBarEnabled) {
|
||||||
|
ConfigurationSection section = config.getConfigurationSection("bossBar");
|
||||||
|
|
||||||
|
if (section != null) {
|
||||||
|
for (String one : section.getKeys(false)) {
|
||||||
|
bossBarToggle.put(one, section.getBoolean(one));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Jobs.getGCManager().ActionBarsMessageByDefault) {
|
||||||
|
ConfigurationSection section = config.getConfigurationSection("actionBar");
|
||||||
|
|
||||||
|
if (section != null) {
|
||||||
|
for (String one : section.getKeys(false)) {
|
||||||
|
actionBarToggle.put(one, section.getBoolean(one));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void save() {
|
||||||
|
YmlMaker f = new YmlMaker(Jobs.getInstance(), "actionBarBossbar.yml");
|
||||||
|
if (!f.exists())
|
||||||
|
f.createNewFile();
|
||||||
|
|
||||||
|
f.saveDefaultConfig();
|
||||||
|
|
||||||
|
FileConfiguration config = f.getConfig();
|
||||||
|
|
||||||
|
if (Jobs.getGCManager().BossBarEnabled) {
|
||||||
|
config.set("bossBar", null);
|
||||||
|
|
||||||
|
for (Entry<String, Boolean> one : bossBarToggle.entrySet()) {
|
||||||
|
config.set("bossBar." + one.getKey(), one.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Jobs.getGCManager().ActionBarsMessageByDefault) {
|
||||||
|
config.set("actionBar", null);
|
||||||
|
|
||||||
|
for (Entry<String, Boolean> one : actionBarToggle.entrySet()) {
|
||||||
|
config.set("actionBar." + one.getKey(), one.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bossBarToggle.clear();
|
||||||
|
actionBarToggle.clear();
|
||||||
|
|
||||||
|
f.saveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WeakHashMap<String, Boolean> getActionBarToggle() {
|
||||||
|
return actionBarToggle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WeakHashMap<String, Boolean> getBossBarToggle() {
|
||||||
|
return bossBarToggle;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user