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

Some things

This commit is contained in:
montlikadani 2020-08-22 20:40:25 +02:00
parent a1840098ba
commit 94f4a46cd3
31 changed files with 161 additions and 188 deletions

View File

@ -16,3 +16,25 @@ A fully configurable plugin that allows you to get paid for breaking, placing, k
Main pages: Main pages:
- Bukkit: https://dev.bukkit.org/projects/jobs-reborn - Bukkit: https://dev.bukkit.org/projects/jobs-reborn
- Spigot: https://www.spigotmc.org/resources/4216/ - Spigot: https://www.spigotmc.org/resources/4216/
# Jobs API
You can manually add the jar file to your build path or you can use jitpack if you use maven (don't know gradle):
```xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.Zrips</groupId>
<artifactId>Jobs</artifactId>
<version>LATEST</version> <!-- Change the LATEST to the current version of jobs -->
<scope>provided</scope>
</dependency>
</dependencies>
```
For API events: https://github.com/Zrips/Jobs/wiki/API

View File

@ -1,14 +1,10 @@
package com.gamingmesh.jobs.CMILib; package com.gamingmesh.jobs.CMILib;
import java.util.HashMap; import java.util.HashMap;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.potion.PotionData; import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType; import org.bukkit.potion.PotionType;

View File

@ -140,7 +140,7 @@ public class ItemBoostManager {
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();
if (cfg.getC().contains(one + ".lore") && !cfg.getC().getStringList(one + ".lore").isEmpty()) { if (cfg.getC().contains(one + ".lore") && !cfg.getC().getStringList(one + ".lore").isEmpty()) {
for (String eachLine : cfg.get(one + ".lore", Arrays.asList(""))) { for (String eachLine : cfg.get(one + ".lore", Arrays.asList(""))) {
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine)); lore.add(CMIChatColor.translate(eachLine));
} }
} }
@ -213,9 +213,9 @@ public class ItemBoostManager {
public static List<JobItems> getItemsByJob(Job job) { public static List<JobItems> getItemsByJob(Job job) {
List<JobItems> ls = new ArrayList<>(); List<JobItems> ls = new ArrayList<>();
for (Entry<String, JobItems> one : items.entrySet()) { for (JobItems one : items.values()) {
if (one.getValue().getJobs().contains(job)) if (one.getJobs().contains(job))
ls.add(one.getValue()); ls.add(one);
} }
return ls; return ls;
} }

View File

@ -60,7 +60,6 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.*; import java.util.*;
import java.util.Map.Entry;
import java.util.logging.Logger; import java.util.logging.Logger;
public class Jobs extends JavaPlugin { public class Jobs extends JavaPlugin {
@ -444,11 +443,11 @@ public class Jobs extends JavaPlugin {
HashMap<Integer, HashMap<String, Log>> playersLogs = dao.getAllLogs(); HashMap<Integer, HashMap<String, Log>> playersLogs = dao.getAllLogs();
HashMap<Integer, ArchivedJobs> playersArchives = dao.getAllArchivedJobs(); HashMap<Integer, ArchivedJobs> playersArchives = dao.getAllArchivedJobs();
HashMap<Integer, PaymentData> playersLimits = dao.loadPlayerLimits(); HashMap<Integer, PaymentData> playersLimits = dao.loadPlayerLimits();
for (Iterator<Entry<UUID, PlayerInfo>> it = temp.entrySet().iterator(); it.hasNext();) { for (Iterator<PlayerInfo> it = temp.values().iterator(); it.hasNext();) {
Entry<UUID, PlayerInfo> one = it.next(); PlayerInfo one = it.next();
int id = one.getValue().getID(); int id = one.getID();
JobsPlayer jPlayer = getPlayerManager().getJobsPlayerOffline( JobsPlayer jPlayer = getPlayerManager().getJobsPlayerOffline(
one.getValue(), one,
playersJobs.get(id), playersJobs.get(id),
playersPoints.get(id), playersPoints.get(id),
playersLogs.get(id), playersLogs.get(id),
@ -1181,12 +1180,13 @@ public class Jobs extends JavaPlugin {
getBpManager().add(block, cd); getBpManager().add(block, cd);
return true; return true;
} }
if (time > System.currentTimeMillis() || bp.isPaid() && bp.getAction() != DBAction.DELETE) { if (time > System.currentTimeMillis() || bp.isPaid() && bp.getAction() != DBAction.DELETE) {
int sec = Math.round((time - System.currentTimeMillis()) / 1000L); int sec = Math.round((time - System.currentTimeMillis()) / 1000L);
if (inform) { if (inform && player.canGetPaid(info)) {
if (player.canGetPaid(info)) ActionBarManager.send(player.getPlayer(), lManager.getMessage("message.blocktimer", "[time]", sec));
ActionBarManager.send(player.getPlayer(), lManager.getMessage("message.blocktimer", "[time]", sec));
} }
getBpManager().add(block, cd); getBpManager().add(block, cd);
return false; return false;
} }

View File

@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map.Entry;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
@ -63,30 +62,29 @@ import com.gamingmesh.jobs.container.PlayerPoints;
import com.gamingmesh.jobs.dao.JobsDAO; import com.gamingmesh.jobs.dao.JobsDAO;
import com.gamingmesh.jobs.dao.JobsDAOData; import com.gamingmesh.jobs.dao.JobsDAOData;
import com.gamingmesh.jobs.economy.PaymentData; import com.gamingmesh.jobs.economy.PaymentData;
import com.gamingmesh.jobs.economy.PointsData;
import com.gamingmesh.jobs.hooks.HookManager; import com.gamingmesh.jobs.hooks.HookManager;
import com.gamingmesh.jobs.stuff.PerformCommands; import com.gamingmesh.jobs.stuff.PerformCommands;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
public class PlayerManager { public class PlayerManager {
private ConcurrentHashMap<String, JobsPlayer> playersCache = new ConcurrentHashMap<>(); private final ConcurrentHashMap<String, JobsPlayer> playersCache = new ConcurrentHashMap<>();
private ConcurrentHashMap<UUID, JobsPlayer> playersUUIDCache = new ConcurrentHashMap<>(); private final ConcurrentHashMap<UUID, JobsPlayer> playersUUIDCache = new ConcurrentHashMap<>();
private ConcurrentHashMap<String, JobsPlayer> players = new ConcurrentHashMap<>(); private final ConcurrentHashMap<String, JobsPlayer> players = new ConcurrentHashMap<>();
private ConcurrentHashMap<UUID, JobsPlayer> playersUUID = new ConcurrentHashMap<>(); private final ConcurrentHashMap<UUID, JobsPlayer> playersUUID = new ConcurrentHashMap<>();
private final String mobSpawnerMetadata = "jobsMobSpawner"; private final String mobSpawnerMetadata = "jobsMobSpawner";
private HashMap<UUID, PlayerInfo> PlayerUUIDMap = new HashMap<>(); private final HashMap<UUID, PlayerInfo> PlayerUUIDMap = new HashMap<>();
private HashMap<Integer, PlayerInfo> PlayerIDMap = new HashMap<>(); private final HashMap<Integer, PlayerInfo> PlayerIDMap = new HashMap<>();
private HashMap<String, PlayerInfo> PlayerNameMap = new HashMap<>(); private final HashMap<String, PlayerInfo> PlayerNameMap = new HashMap<>();
/** /**
* @deprecated Use {@link Jobs#getPointsData} instead * @deprecated Use {@link Jobs#getPointsData} instead
* @return {@link PointsData} * @return {@link com.gamingmesh.jobs.economy.PointsData}
*/ */
@Deprecated @Deprecated
public PointsData getPointsData() { public com.gamingmesh.jobs.economy.PointsData getPointsData() {
return Jobs.getPointsData(); return Jobs.getPointsData();
} }
@ -264,9 +262,7 @@ public class PlayerManager {
int i = 0; int i = 0;
int total = playersUUIDCache.size(); int total = playersUUIDCache.size();
for (Entry<UUID, JobsPlayer> one : playersUUIDCache.entrySet()) { for (JobsPlayer jPlayer : playersUUIDCache.values()) {
JobsPlayer jPlayer = one.getValue();
if (resetID) if (resetID)
jPlayer.setUserId(-1); jPlayer.setUserId(-1);

View File

@ -5,7 +5,6 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map.Entry;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
@ -142,8 +141,7 @@ public class SignUtil {
conf.createSection("Signs"); conf.createSection("Signs");
int i = 0; int i = 0;
for (Entry<String, jobsSign> one : SignsByLocation.entrySet()) { for (jobsSign sign : SignsByLocation.values()) {
jobsSign sign = one.getValue();
++i; ++i;
String path = "Signs." + i; String path = "Signs." + i;
reader.set(path + ".Loc", sign.locToBlockString()); reader.set(path + ".Loc", sign.locToBlockString());
@ -204,8 +202,7 @@ public class SignUtil {
HashMap<String, List<TopList>> temp = new HashMap<>(); HashMap<String, List<TopList>> temp = new HashMap<>();
boolean save = false; boolean save = false;
for (Entry<String, jobsSign> one : (new HashMap<String, jobsSign>(signs)).entrySet()) { for (jobsSign jSign : (new HashMap<String, jobsSign>(signs)).values()) {
jobsSign jSign = one.getValue();
String SignJobName = jSign.getJobName(); String SignJobName = jSign.getJobName();
Location loc = jSign.getLocation(); Location loc = jSign.getLocation();
if (loc == null) if (loc == null)

View File

@ -147,13 +147,13 @@ public class JobsCommands implements CommandExecutor {
} }
sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.title")); sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.title"));
for (Entry<String, Integer> one : commands.entrySet()) { for (String one : commands.keySet()) {
if (!pi.isEntryOk()) if (!pi.isEntryOk())
continue; continue;
if (pi.isBreak()) if (pi.isBreak())
break; break;
String msg = Jobs.getLanguage().getMessage("command.help.output.cmdInfoFormat", "[command]", getUsage(one.getKey()), "[description]", Jobs.getLanguage().getMessage("command." + one.getKey() String msg = Jobs.getLanguage().getMessage("command.help.output.cmdInfoFormat", "[command]", getUsage(one), "[description]", Jobs.getLanguage().getMessage("command." + one
+ ".help.info")); + ".help.info"));
sender.sendMessage(msg); sender.sendMessage(msg);
} }
@ -259,10 +259,7 @@ public class JobsCommands implements CommandExecutor {
return; return;
} }
if (type == null) { type = type == null ? "" : type.toLowerCase();
type = "";
} else
type = type.toLowerCase();
List<String> message = new ArrayList<>(); List<String> message = new ArrayList<>();

View File

@ -58,8 +58,8 @@ public class log implements Cmd {
Map<String, Double> unsortMap = new HashMap<>(); Map<String, Double> unsortMap = new HashMap<>();
for (Entry<String, Log> l : logList.entrySet()) { for (Log l : logList.values()) {
for (Entry<String, LogAmounts> oneMap : l.getValue().getAmountList().entrySet()) { for (Entry<String, LogAmounts> oneMap : l.getAmountList().entrySet()) {
unsortMap.put(oneMap.getKey(), oneMap.getValue().get(CurrencyType.MONEY)); unsortMap.put(oneMap.getKey(), oneMap.getValue().get(CurrencyType.MONEY));
} }
} }
@ -74,15 +74,14 @@ public class log implements Cmd {
int max = 10; int max = 10;
sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.topline", "%playername%", JPlayer.getName())); sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.topline", "%playername%", JPlayer.getName()));
for (Entry<String, Log> l : logList.entrySet()) { for (Log one : logList.values()) {
Log one = l.getValue();
HashMap<String, LogAmounts> AmountList = one.getAmountList(); HashMap<String, LogAmounts> AmountList = one.getAmountList();
double totalMoney = 0, double totalMoney = 0,
totalExp = 0, totalExp = 0,
totalPoints = 0; totalPoints = 0;
for (Entry<String, Double> oneSorted : unsortMap.entrySet()) { for (String oneSorted : unsortMap.keySet()) {
for (Entry<String, LogAmounts> oneMap : AmountList.entrySet()) { for (Entry<String, LogAmounts> oneMap : AmountList.entrySet()) {
if (oneMap.getKey().equalsIgnoreCase(oneSorted.getKey())) { if (oneMap.getKey().equalsIgnoreCase(oneSorted)) {
count++; count++;
LogAmounts amounts = oneMap.getValue(); LogAmounts amounts = oneMap.getValue();

View File

@ -11,7 +11,6 @@ import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs; 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.ActionType;
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.container.QuestObjective; import com.gamingmesh.jobs.container.QuestObjective;
@ -109,8 +108,8 @@ public class quests implements Cmd {
} }
} }
for (Entry<ActionType, HashMap<String, QuestObjective>> oneAction : q.getQuest().getObjectives().entrySet()) { for (HashMap<String, QuestObjective> oneAction : q.getQuest().getObjectives().values()) {
for (Entry<String, QuestObjective> oneObjective : oneAction.getValue().entrySet()) { for (Entry<String, QuestObjective> oneObjective : oneAction.entrySet()) {
hoverList.add(Jobs.getLanguage().getMessage("command.info.output." + oneObjective.getValue().getAction().toString().toLowerCase() + ".info") + " " + hoverList.add(Jobs.getLanguage().getMessage("command.info.output." + oneObjective.getValue().getAction().toString().toLowerCase() + ".info") + " " +
Jobs.getNameTranslatorManager().Translate(oneObjective.getKey(), oneObjective.getValue().getAction(), oneObjective.getValue().getTargetId(), oneObjective.getValue() Jobs.getNameTranslatorManager().Translate(oneObjective.getKey(), oneObjective.getValue().getAction(), oneObjective.getValue().getTargetId(), oneObjective.getValue()
.getTargetMeta(), oneObjective.getValue().getTargetName()) .getTargetMeta(), oneObjective.getValue().getTargetName())

View File

@ -2,7 +2,6 @@ package com.gamingmesh.jobs.commands.list;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map.Entry;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -10,7 +9,6 @@ import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs; 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.ActionType;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.QuestObjective; import com.gamingmesh.jobs.container.QuestObjective;
@ -58,9 +56,9 @@ public class resetquest implements Cmd {
for (QuestProgression one : quests) { for (QuestProgression one : quests) {
one.setValidUntil(System.currentTimeMillis()); one.setValidUntil(System.currentTimeMillis());
for (Entry<ActionType, HashMap<String, QuestObjective>> actions : one.getQuest().getObjectives().entrySet()) { for (HashMap<String, QuestObjective> actions : one.getQuest().getObjectives().values()) {
for (java.util.Map.Entry<String, QuestObjective> obj : actions.getValue().entrySet()) { for (QuestObjective obj : actions.values()) {
one.setAmountDone(obj.getValue(), 0); one.setAmountDone(obj, 0);
} }
} }
} }

View File

@ -18,7 +18,7 @@ import com.gamingmesh.jobs.stuff.Util;
public class ExploreManager { public class ExploreManager {
private HashMap<String, ExploreRegion> worlds = new HashMap<>(); private final HashMap<String, ExploreRegion> worlds = new HashMap<>();
private boolean exploreEnabled = false; private boolean exploreEnabled = false;
private int playerAmount = 1; private int playerAmount = 1;

View File

@ -21,13 +21,13 @@ import com.gamingmesh.jobs.hooks.HookManager;
public class RestrictedAreaManager { public class RestrictedAreaManager {
protected HashMap<String, RestrictedArea> restrictedAreas = new HashMap<>(); protected final HashMap<String, RestrictedArea> restrictedAreas = new HashMap<>();
private boolean worldGuardArea = false; private boolean worldGuardArea = false;
public boolean isExist(String name) { public boolean isExist(String name) {
for (Entry<String, RestrictedArea> area : restrictedAreas.entrySet()) { for (String area : restrictedAreas.keySet()) {
if (area.getKey().equalsIgnoreCase(name)) if (area.equalsIgnoreCase(name))
return true; return true;
} }
return false; return false;
@ -44,9 +44,9 @@ public class RestrictedAreaManager {
} }
public void remove(String name) { public void remove(String name) {
for (Entry<String, RestrictedArea> area : restrictedAreas.entrySet()) { for (String area : restrictedAreas.keySet()) {
if (area.getKey().equalsIgnoreCase(name)) { if (area.equalsIgnoreCase(name)) {
restrictedAreas.remove(area.getKey()); restrictedAreas.remove(area);
break; break;
} }
} }
@ -120,9 +120,9 @@ public class RestrictedAreaManager {
public synchronized List<RestrictedArea> getRestrictedAreasByLoc(Location loc) { public synchronized List<RestrictedArea> getRestrictedAreasByLoc(Location loc) {
List<RestrictedArea> areas = new ArrayList<>(); List<RestrictedArea> areas = new ArrayList<>();
for (Entry<String, RestrictedArea> area : restrictedAreas.entrySet()) { for (RestrictedArea area : restrictedAreas.values()) {
if (area.getValue().inRestrictedArea(loc)) if (area.inRestrictedArea(loc))
areas.add(area.getValue()); areas.add(area);
} }
if (worldGuardArea && HookManager.getWorldGuardManager() != null) if (worldGuardArea && HookManager.getWorldGuardManager() != null)

View File

@ -11,7 +11,7 @@ import com.gamingmesh.jobs.CMILib.ItemManager;
public class RestrictedBlockManager { public class RestrictedBlockManager {
public HashMap<CMIMaterial, Integer> restrictedBlocksTimer = new HashMap<>(); public final HashMap<CMIMaterial, Integer> restrictedBlocksTimer = new HashMap<>();
/** /**
* Method to load the restricted blocks configuration * Method to load the restricted blocks configuration

View File

@ -13,7 +13,7 @@ import com.gamingmesh.jobs.stuff.ChatColor;
public class TitleManager { public class TitleManager {
protected List<Title> titles = new ArrayList<>(); protected final List<Title> titles = new ArrayList<>();
/** /**
* Function to return the title for a given level * Function to return the title for a given level

View File

@ -38,9 +38,7 @@ public class BlockProtection {
} }
private static int convert(long time) { private static int convert(long time) {
if (time == -1L) return time == -1L ? -1 : (int) ((time - pre) / 1000L);
return -1;
return (int) ((time - pre) / 1000L);
} }
private static Long deconvert(Integer time) { private static Long deconvert(Integer time) {
@ -48,10 +46,7 @@ public class BlockProtection {
} }
public void setTime(Long time) { public void setTime(Long time) {
if (time == -1) this.time = time == -1 ? null : convert(time);
this.time = null;
else
this.time = convert(time);
this.recorded = convert(System.currentTimeMillis()); this.recorded = convert(System.currentTimeMillis());
} }
@ -74,10 +69,7 @@ public class BlockProtection {
} }
public void setPaid(Boolean paid) { public void setPaid(Boolean paid) {
if (!paid) this.paid = !paid ? paid : null;
this.paid = paid;
else
this.paid = null;
} }
public void setRecorded(Long recorded) { public void setRecorded(Long recorded) {

View File

@ -50,15 +50,11 @@ public class ExploreChunk {
} }
public boolean isAlreadyVisited(int playerId) { public boolean isAlreadyVisited(int playerId) {
if (isFullyExplored()) return isFullyExplored() ? true : playerIds.contains(playerId);
return true;
return playerIds.contains(playerId);
} }
public int getCount() { public int getCount() {
if (isFullyExplored()) return isFullyExplored() ? Jobs.getExplore().getPlayerAmount() : playerIds.size();
return Jobs.getExplore().getPlayerAmount();
return playerIds.size();
} }
public int getX() { public int getX() {
@ -135,13 +131,10 @@ public class ExploreChunk {
} }
public void setUpdated(boolean updated) { public void setUpdated(boolean updated) {
if (!updated) this.updated = !updated ? null : true;
this.updated = null;
else
this.updated = true;
} }
public boolean isFullyExplored() { public boolean isFullyExplored() {
return full == null ? false : full; return full != null && full;
} }
} }

View File

@ -8,7 +8,8 @@ public class ExploreRegion {
int x; int x;
int z; int z;
private HashMap<String, ExploreChunk> chunks = new HashMap<>();
private final HashMap<String, ExploreChunk> chunks = new HashMap<>();
public ExploreRegion(int x, int z) { public ExploreRegion(int x, int z) {
this.x = x; this.x = x;

View File

@ -23,7 +23,7 @@ import java.util.List;
public class JobCommands { public class JobCommands {
private String node; private String node;
private List<String> commands = new ArrayList<>(); private final List<String> commands = new ArrayList<>();
private int levelFrom; private int levelFrom;
private int levelUntil; private int levelUntil;

View File

@ -23,12 +23,12 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.bukkit.ChatColor;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import com.gamingmesh.jobs.CMILib.CMIChatColor;
import com.gamingmesh.jobs.CMILib.CMIMaterial; import com.gamingmesh.jobs.CMILib.CMIMaterial;
public class JobLimitedItems { public class JobLimitedItems {
@ -66,11 +66,11 @@ public class JobLimitedItems {
item.setAmount(amount); item.setAmount(amount);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
if (this.name != null) if (this.name != null)
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name)); meta.setDisplayName(CMIChatColor.translate(name));
if (lore != null && !lore.isEmpty()) { if (lore != null && !lore.isEmpty()) {
List<String> TranslatedLore = new ArrayList<>(); List<String> TranslatedLore = new ArrayList<>();
for (String oneLore : lore) { for (String oneLore : lore) {
TranslatedLore.add(ChatColor.translateAlternateColorCodes('&', oneLore.replace("[player]", player.getName()))); TranslatedLore.add(CMIChatColor.translate(oneLore.replace("[player]", player.getName())));
} }
meta.setLore(TranslatedLore); meta.setLore(TranslatedLore);
} }

View File

@ -47,12 +47,12 @@ public class JobsPlayer {
private String userName = "Unknown"; private String userName = "Unknown";
// progression of the player in each job // progression of the player in each job
public UUID playerUUID; public UUID playerUUID;
public ArrayList<JobProgression> progression = new ArrayList<>(); public final ArrayList<JobProgression> progression = new ArrayList<>();
private ArchivedJobs archivedJobs = new ArchivedJobs(); private ArchivedJobs archivedJobs = new ArchivedJobs();
private PaymentData paymentLimits; private PaymentData paymentLimits;
private HashMap<String, ArrayList<BoostCounter>> boostCounter = new HashMap<>(); private final HashMap<String, ArrayList<BoostCounter>> boostCounter = new HashMap<>();
// display honorific // display honorific
private String honorific; private String honorific;
@ -61,12 +61,12 @@ public class JobsPlayer {
// player online status // player online status
private volatile boolean isOnline = false; private volatile boolean isOnline = false;
private HashMap<CurrencyType, Integer> limits = new HashMap<>(); private final HashMap<CurrencyType, Integer> limits = new HashMap<>();
private int userid = -1; private int userid = -1;
private List<BossBarInfo> barMap = new ArrayList<>(); private final List<BossBarInfo> barMap = new ArrayList<>();
private List<String> updateBossBarFor = new ArrayList<>(); private final List<String> updateBossBarFor = new ArrayList<>();
// save lock // save lock
// public final Object saveLock = new Object(); // public final Object saveLock = new Object();
@ -78,7 +78,7 @@ public class JobsPlayer {
private HashMap<String, Boolean> permissionsCache; private HashMap<String, Boolean> permissionsCache;
private Long lastPermissionUpdate = -1L; private Long lastPermissionUpdate = -1L;
private HashMap<String, HashMap<String, QuestProgression>> qProgression = new HashMap<>(); private final HashMap<String, HashMap<String, QuestProgression>> qProgression = new HashMap<>();
private int doneQuests = 0; private int doneQuests = 0;
private int skippedQuests = 0; private int skippedQuests = 0;
@ -340,10 +340,8 @@ public class JobsPlayer {
} }
public int getLimit(CurrencyType type) { public int getLimit(CurrencyType type) {
if (type == null) Integer value = type == null ? 0 : limits.get(type);
return 0; return value;
Integer value = limits.get(type);
return value == null ? 0 : value;
} }
public void resetPaymentLimit() { public void resetPaymentLimit() {

View File

@ -31,9 +31,7 @@ public class PlayerInfo {
public String getName() { public String getName() {
if (player == null) if (player == null)
player = Jobs.getPlayerManager().getJobsPlayer(uuid); player = Jobs.getPlayerManager().getJobsPlayer(uuid);
if (player != null) return player != null ? player.getName() : name;
return player.getName();
return name;
} }
public int getID() { public int getID() {

View File

@ -5,7 +5,6 @@ import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
@ -21,14 +20,14 @@ public class Quest {
private Integer minLvl = null; private Integer minLvl = null;
private Integer maxLvl = null; private Integer maxLvl = null;
private List<String> rewardCmds = new ArrayList<>(); private final List<String> rewardCmds = new ArrayList<>();
private List<String> rewards = new ArrayList<>(); private final List<String> rewards = new ArrayList<>();
private List<String> area = new ArrayList<>(); private final List<String> area = new ArrayList<>();
private boolean stopped = false; private boolean stopped = false;
private HashMap<ActionType, HashMap<String, QuestObjective>> objectives = new HashMap<>(); private HashMap<ActionType, HashMap<String, QuestObjective>> objectives = new HashMap<>();
private Set<ActionType> actions = new HashSet<>(); private final Set<ActionType> actions = new HashSet<>();
public Quest(String questName, Job job) { public Quest(String questName, Job job) {
this.questName = questName; this.questName = questName;
@ -167,11 +166,10 @@ public class Quest {
if (old == null) if (old == null)
return false; return false;
for (Entry<String, QuestObjective> one : old.entrySet()) { for (QuestObjective one : old.values()) {
if (one.getValue().getTargetId() == objective.getTargetId() && if (one.getTargetId() == objective.getTargetId() &&
one.getValue().getAction() == objective.getAction() && one.getAction() == objective.getAction() && objective.getAmount() == one.getAmount()
objective.getAmount() == one.getValue().getAmount() && && objective.getTargetName() == one.getTargetName())
objective.getTargetName() == one.getValue().getTargetName())
return true; return true;
} }
return false; return false;
@ -179,9 +177,7 @@ public class Quest {
public void setObjectives(HashMap<ActionType, HashMap<String, QuestObjective>> objectives) { public void setObjectives(HashMap<ActionType, HashMap<String, QuestObjective>> objectives) {
this.objectives = objectives; this.objectives = objectives;
for (Entry<ActionType, HashMap<String, QuestObjective>> one : objectives.entrySet()) { objectives.keySet().forEach(actions::add);
actions.add(one.getKey());
}
} }
public void addObjective(QuestObjective objective) { public void addObjective(QuestObjective objective) {

View File

@ -15,7 +15,7 @@ public class QuestProgression {
private long validUntil; private long validUntil;
private boolean givenReward = false; private boolean givenReward = false;
private HashMap<QuestObjective, Integer> done = new HashMap<>(); private final HashMap<QuestObjective, Integer> done = new HashMap<>();
public QuestProgression(Quest quest) { public QuestProgression(Quest quest) {
this.quest = quest; this.quest = quest;
@ -34,9 +34,9 @@ public class QuestProgression {
public int getTotalAmountNeeded() { public int getTotalAmountNeeded() {
int amountNeeded = 0; int amountNeeded = 0;
for (Entry<ActionType, HashMap<String, QuestObjective>> oneA : quest.getObjectives().entrySet()) { for (HashMap<String, QuestObjective> oneA : quest.getObjectives().values()) {
for (Entry<String, QuestObjective> one : oneA.getValue().entrySet()) { for (QuestObjective one : oneA.values()) {
amountNeeded += one.getValue().getAmount(); amountNeeded += one.getAmount();
} }
} }
return amountNeeded; return amountNeeded;
@ -44,9 +44,10 @@ public class QuestProgression {
public int getTotalAmountDone() { public int getTotalAmountDone() {
int amountDone = 0; int amountDone = 0;
for (Entry<QuestObjective, Integer> one : done.entrySet()) { for (Integer one : done.values()) {
amountDone += one.getValue(); amountDone += one;
} }
return amountDone; return amountDone;
} }
@ -77,10 +78,10 @@ public class QuestProgression {
} }
public boolean isCompleted() { public boolean isCompleted() {
for (Entry<ActionType, HashMap<String, QuestObjective>> oneA : quest.getObjectives().entrySet()) { for (HashMap<String, QuestObjective> oneA : quest.getObjectives().values()) {
for (Entry<String, QuestObjective> one : oneA.getValue().entrySet()) { for (QuestObjective one : oneA.values()) {
Integer amountDone = done.get(one.getValue()); Integer amountDone = done.get(one);
if (amountDone == null || amountDone < one.getValue().getAmount()) if (amountDone == null || amountDone < one.getAmount())
return false; return false;
} }
} }
@ -99,7 +100,7 @@ public class QuestProgression {
.containsKey(action.getName())) .containsKey(action.getName()))
return; return;
if (quest.getRestrictedAreas() != null && !quest.getRestrictedAreas().isEmpty()) { if (!quest.getRestrictedAreas().isEmpty()) {
for (String area : quest.getRestrictedAreas()) { for (String area : quest.getRestrictedAreas()) {
for (Entry<String, RestrictedArea> a : Jobs.getRestrictedAreaManager().getRestrictedAres().entrySet()) { for (Entry<String, RestrictedArea> a : Jobs.getRestrictedAreaManager().getRestrictedAres().entrySet()) {
if (quest.getRestrictedAreas().contains(a.getKey()) && a.getKey().equalsIgnoreCase(area) if (quest.getRestrictedAreas().contains(a.getKey()) && a.getKey().equalsIgnoreCase(area)

View File

@ -17,14 +17,14 @@ public class Schedule {
private boolean nextDay = false; private boolean nextDay = false;
private BoostMultiplier BM = new BoostMultiplier(); private final BoostMultiplier BM = new BoostMultiplier();
private String Name = null; private String Name = null;
private List<String> Days = new ArrayList<>(Arrays.asList("all")); private List<String> Days = new ArrayList<>(Arrays.asList("all"));
private List<Job> JobsList = new ArrayList<>(); private final List<Job> JobsList = new ArrayList<>();
private List<String> MessageOnStart = new ArrayList<>(), private final List<String> MessageOnStart = new ArrayList<>(),
MessageOnStop = new ArrayList<>(), MessageOnStop = new ArrayList<>(),
MessageToBroadcast = new ArrayList<>(); MessageToBroadcast = new ArrayList<>();

View File

@ -969,9 +969,9 @@ public abstract class JobsDAO {
try { try {
exploreStatement = conn.prepareStatement("UPDATE `" + DBTables.ExploreDataTable.getTableName() + "` SET `" + ExploreDataTableFields.worldid.getCollumn() + "` = ? WHERE `" exploreStatement = conn.prepareStatement("UPDATE `" + DBTables.ExploreDataTable.getTableName() + "` SET `" + ExploreDataTableFields.worldid.getCollumn() + "` = ? WHERE `"
+ ExploreDataTableFields.worldname.getCollumn() + "` = ?;"); + ExploreDataTableFields.worldname.getCollumn() + "` = ?;");
for (Entry<String, JobsWorld> jobsWorld : Util.getJobsWorlds().entrySet()) { for (JobsWorld jobsWorld : Util.getJobsWorlds().values()) {
exploreStatement.setInt(1, jobsWorld.getValue().getId()); exploreStatement.setInt(1, jobsWorld.getId());
exploreStatement.setString(2, jobsWorld.getValue().getName()); exploreStatement.setString(2, jobsWorld.getName());
exploreStatement.execute(); exploreStatement.execute();
} }
} catch (SQLException e) { } catch (SQLException e) {
@ -984,9 +984,9 @@ public abstract class JobsDAO {
try { try {
exploreStatementBack = conn.prepareStatement("UPDATE `" + DBTables.ExploreDataTable.getTableName() + "` SET `" + ExploreDataTableFields.worldname.getCollumn() + "` = ? WHERE `" exploreStatementBack = conn.prepareStatement("UPDATE `" + DBTables.ExploreDataTable.getTableName() + "` SET `" + ExploreDataTableFields.worldname.getCollumn() + "` = ? WHERE `"
+ ExploreDataTableFields.worldid.getCollumn() + "` = ?;"); + ExploreDataTableFields.worldid.getCollumn() + "` = ?;");
for (Entry<String, JobsWorld> jobsWorld : Util.getJobsWorlds().entrySet()) { for (JobsWorld jobsWorld : Util.getJobsWorlds().values()) {
exploreStatementBack.setString(1, jobsWorld.getValue().getName()); exploreStatementBack.setString(1, jobsWorld.getName());
exploreStatementBack.setInt(2, jobsWorld.getValue().getId()); exploreStatementBack.setInt(2, jobsWorld.getId());
exploreStatementBack.execute(); exploreStatementBack.execute();
} }
} catch (SQLException e) { } catch (SQLException e) {
@ -999,9 +999,9 @@ public abstract class JobsDAO {
try { try {
bpStatement = conn.prepareStatement("UPDATE `" + DBTables.BlocksTable.getTableName() + "` SET `" + BlockTableFields.worldid.getCollumn() + "` = ? WHERE `" + BlockTableFields.world bpStatement = conn.prepareStatement("UPDATE `" + DBTables.BlocksTable.getTableName() + "` SET `" + BlockTableFields.worldid.getCollumn() + "` = ? WHERE `" + BlockTableFields.world
.getCollumn() + "` = ?;"); .getCollumn() + "` = ?;");
for (Entry<String, JobsWorld> jobsWorld : Util.getJobsWorlds().entrySet()) { for (JobsWorld jobsWorld : Util.getJobsWorlds().values()) {
bpStatement.setInt(1, jobsWorld.getValue().getId()); bpStatement.setInt(1, jobsWorld.getId());
bpStatement.setString(2, jobsWorld.getValue().getName()); bpStatement.setString(2, jobsWorld.getName());
bpStatement.execute(); bpStatement.execute();
} }
} catch (SQLException e) { } catch (SQLException e) {
@ -1014,9 +1014,9 @@ public abstract class JobsDAO {
try { try {
bpStatementback = conn.prepareStatement("UPDATE `" + DBTables.BlocksTable.getTableName() + "` SET `" + BlockTableFields.world.getCollumn() + "` = ? WHERE `" + BlockTableFields.worldid bpStatementback = conn.prepareStatement("UPDATE `" + DBTables.BlocksTable.getTableName() + "` SET `" + BlockTableFields.world.getCollumn() + "` = ? WHERE `" + BlockTableFields.worldid
.getCollumn() + "` = ?;"); .getCollumn() + "` = ?;");
for (Entry<String, JobsWorld> jobsWorld : Util.getJobsWorlds().entrySet()) { for (JobsWorld jobsWorld : Util.getJobsWorlds().values()) {
bpStatementback.setString(1, jobsWorld.getValue().getName()); bpStatementback.setString(1, jobsWorld.getName());
bpStatementback.setInt(2, jobsWorld.getValue().getId()); bpStatementback.setInt(2, jobsWorld.getId());
bpStatementback.execute(); bpStatementback.execute();
} }
} catch (SQLException e) { } catch (SQLException e) {
@ -1997,8 +1997,7 @@ public abstract class JobsDAO {
+ "` = ? AND `" + LogTableFields.action.getCollumn() + "` = ? AND `" + LogTableFields.itemname.getCollumn() + "` = ?;"); + "` = ? AND `" + LogTableFields.action.getCollumn() + "` = ? AND `" + LogTableFields.itemname.getCollumn() + "` = ?;");
boolean added = false; boolean added = false;
for (Entry<String, Log> l : player.getLog().entrySet()) { for (Log log : player.getLog().values()) {
Log log = l.getValue();
for (Entry<String, LogAmounts> one : log.getAmountList().entrySet()) { for (Entry<String, LogAmounts> one : log.getAmountList().entrySet()) {
if (one.getValue().isNewEntry()) if (one.getValue().isNewEntry())
continue; continue;
@ -2025,8 +2024,7 @@ public abstract class JobsDAO {
+ "` (`" + LogTableFields.userid.getCollumn() + "`, `" + LogTableFields.time.getCollumn() + "`, `" + LogTableFields.action.getCollumn() + "` (`" + LogTableFields.userid.getCollumn() + "`, `" + LogTableFields.time.getCollumn() + "`, `" + LogTableFields.action.getCollumn()
+ "`, `" + LogTableFields.itemname.getCollumn() + "`, `" + LogTableFields.count.getCollumn() + "`, `" + LogTableFields.money.getCollumn() + "`, `" + LogTableFields.itemname.getCollumn() + "`, `" + LogTableFields.count.getCollumn() + "`, `" + LogTableFields.money.getCollumn()
+ "`, `" + LogTableFields.exp.getCollumn() + "`, `" + LogTableFields.points.getCollumn() + "`) VALUES (?, ?, ?, ?, ?, ?, ?, ?);"); + "`, `" + LogTableFields.exp.getCollumn() + "`, `" + LogTableFields.points.getCollumn() + "`) VALUES (?, ?, ?, ?, ?, ?, ?, ?);");
for (Entry<String, Log> l : player.getLog().entrySet()) { for (Log log : player.getLog().values()) {
Log log = l.getValue();
for (Entry<String, LogAmounts> one : log.getAmountList().entrySet()) { for (Entry<String, LogAmounts> one : log.getAmountList().entrySet()) {
if (!one.getValue().isNewEntry()) if (!one.getValue().isNewEntry())
continue; continue;
@ -2317,13 +2315,13 @@ public abstract class JobsDAO {
int id = jobsWorld == null ? 0 : jobsWorld.getId(); int id = jobsWorld == null ? 0 : jobsWorld.getId();
if (id != 0) if (id != 0)
for (Entry<String, ExploreChunk> oneChunk : worlds.getValue().getChunks().entrySet()) { for (ExploreChunk oneChunk : worlds.getValue().getChunks().values()) {
if (oneChunk.getValue().getDbId() != null) if (oneChunk.getDbId() != null)
continue; continue;
prest2.setInt(1, id); prest2.setInt(1, id);
prest2.setInt(2, oneChunk.getValue().getX()); prest2.setInt(2, oneChunk.getX());
prest2.setInt(3, oneChunk.getValue().getZ()); prest2.setInt(3, oneChunk.getZ());
prest2.setString(4, oneChunk.getValue().serializeNames()); prest2.setString(4, oneChunk.serializeNames());
prest2.setString(5, jobsWorld != null ? jobsWorld.getName() : ""); prest2.setString(5, jobsWorld != null ? jobsWorld.getName() : "");
prest2.addBatch(); prest2.addBatch();
i++; i++;
@ -2364,14 +2362,14 @@ public abstract class JobsDAO {
HashMap<String, ExploreRegion> temp = new HashMap<>(Jobs.getExplore().getWorlds()); HashMap<String, ExploreRegion> temp = new HashMap<>(Jobs.getExplore().getWorlds());
for (Entry<String, ExploreRegion> worlds : temp.entrySet()) { for (ExploreRegion worlds : temp.values()) {
for (Entry<String, ExploreChunk> oneChunk : worlds.getValue().getChunks().entrySet()) { for (ExploreChunk oneChunk : worlds.getChunks().values()) {
if (oneChunk.getValue().getDbId() == null) if (oneChunk.getDbId() == null)
continue; continue;
if (!oneChunk.getValue().isUpdated()) if (!oneChunk.isUpdated())
continue; continue;
prest.setString(1, oneChunk.getValue().serializeNames()); prest.setString(1, oneChunk.serializeNames());
prest.setInt(2, oneChunk.getValue().getDbId()); prest.setInt(2, oneChunk.getDbId());
prest.addBatch(); prest.addBatch();
i++; i++;
} }

View File

@ -5,19 +5,17 @@ import java.util.UUID;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.container.PlayerPoints; import com.gamingmesh.jobs.container.PlayerPoints;
@Deprecated
public class PointsData { public class PointsData {
@Deprecated
public void addPlayer(UUID uuid) { public void addPlayer(UUID uuid) {
Jobs.getPlayerManager().getJobsPlayer(uuid).getPointsData(); Jobs.getPlayerManager().getJobsPlayer(uuid).getPointsData();
} }
@Deprecated
public void addPlayer(UUID uuid, double points) { public void addPlayer(UUID uuid, double points) {
Jobs.getPlayerManager().getJobsPlayer(uuid).addPoints(points); Jobs.getPlayerManager().getJobsPlayer(uuid).addPoints(points);
} }
@Deprecated
public void addPlayer(UUID uuid, double points, double total) { public void addPlayer(UUID uuid, double points, double total) {
addPlayer(uuid, new PlayerPoints(points, total)); addPlayer(uuid, new PlayerPoints(points, total));
@ -25,7 +23,6 @@ public class PointsData {
Jobs.getPlayerManager().getJobsPlayer(uuid).getPointsData().setTotalPoints(total); Jobs.getPlayerManager().getJobsPlayer(uuid).getPointsData().setTotalPoints(total);
} }
@Deprecated
public void addPlayer(UUID uuid, PlayerPoints points) { public void addPlayer(UUID uuid, PlayerPoints points) {
PlayerPoints pi = Jobs.getPlayerManager().getJobsPlayer(uuid).getPointsData(); PlayerPoints pi = Jobs.getPlayerManager().getJobsPlayer(uuid).getPointsData();
pi.setPoints(points.getCurrentPoints()); pi.setPoints(points.getCurrentPoints());
@ -33,12 +30,10 @@ public class PointsData {
pi.setNewEntry(points.isNewEntry()); pi.setNewEntry(points.isNewEntry());
} }
@Deprecated
public void addPoints(UUID uuid, Double points) { public void addPoints(UUID uuid, Double points) {
Jobs.getPlayerManager().getJobsPlayer(uuid).addPoints(points); Jobs.getPlayerManager().getJobsPlayer(uuid).addPoints(points);
} }
@Deprecated
public PlayerPoints getPlayerPointsInfo(UUID uuid) { public PlayerPoints getPlayerPointsInfo(UUID uuid) {
return Jobs.getPlayerManager().getJobsPlayer(uuid).getPointsData(); return Jobs.getPlayerManager().getJobsPlayer(uuid).getPointsData();
} }

View File

@ -496,10 +496,10 @@ public class JobsListener implements Listener {
List<JobProgression> prog = JPlayer.getJobProgression(); List<JobProgression> prog = JPlayer.getJobProgression();
mein: for (JobProgression one : prog) { mein: for (JobProgression one : prog) {
for (Entry<String, JobLimitedItems> oneItem : one.getJob().getLimitedItems().entrySet()) { for (JobLimitedItems oneItem : one.getJob().getLimitedItems().values()) {
if (one.getLevel() >= oneItem.getValue().getLevel()) if (one.getLevel() >= oneItem.getLevel())
continue; continue;
if (!isThisItem(oneItem.getValue(), CMIMaterial.get(iih), name, lore, enchants)) if (!isThisItem(oneItem, CMIMaterial.get(iih), name, lore, enchants))
continue; continue;
meinOk = one.getJob().getName(); meinOk = one.getJob().getName();
break mein; break mein;

View File

@ -376,8 +376,8 @@ public class JobsPaymentListener implements Listener {
if (item != null && item.getType() != Material.AIR) { if (item != null && item.getType() != Material.AIR) {
// Protection for block break with silktouch // Protection for block break with silktouch
if (Jobs.getGCManager().useSilkTouchProtection) { if (Jobs.getGCManager().useSilkTouchProtection) {
for (Entry<Enchantment, Integer> one : item.getEnchantments().entrySet()) { for (Enchantment one : item.getEnchantments().keySet()) {
if (CMIEnchantment.get(one.getKey()) == CMIEnchantment.SILK_TOUCH) { if (CMIEnchantment.get(one) == CMIEnchantment.SILK_TOUCH) {
if (Jobs.getBpManager().isInBp(block)) if (Jobs.getBpManager().isInBp(block))
return; return;
} }

View File

@ -1,7 +1,6 @@
package com.gamingmesh.jobs.stuff; package com.gamingmesh.jobs.stuff;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map.Entry;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.container.ActionInfo; import com.gamingmesh.jobs.container.ActionInfo;
@ -18,8 +17,8 @@ public class Loging {
public void recordToLog(JobsPlayer jPlayer, String ActionName, String item, HashMap<CurrencyType, Double> amounts) { public void recordToLog(JobsPlayer jPlayer, String ActionName, String item, HashMap<CurrencyType, Double> amounts) {
HashMap<String, Log> logList = jPlayer.getLog(); HashMap<String, Log> logList = jPlayer.getLog();
Log l = null; Log l = null;
for (Entry<String, Log> one : logList.entrySet()) { for (Log one : logList.values()) {
l = one.getValue(); l = one;
break; break;
} }
if (l != null && Jobs.getScheduleManager().getDateByInt() != l.getDate()) { if (l != null && Jobs.getScheduleManager().getDateByInt() != l.getDate()) {

View File

@ -3,7 +3,6 @@ package com.gamingmesh.jobs.stuff;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map.Entry;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -32,8 +31,8 @@ public class TabComplete implements TabCompleter {
String PartOfCommand = args[0]; String PartOfCommand = args[0];
List<String> temp = new ArrayList<>(); List<String> temp = new ArrayList<>();
for (Entry<String, Integer> BCmd : Jobs.getCommandManager().GetCommands(sender).entrySet()) { for (String BCmd : Jobs.getCommandManager().GetCommands(sender).keySet()) {
temp.add(BCmd.getKey()); temp.add(BCmd);
} }
StringUtil.copyPartialMatches(PartOfCommand, temp, completionList); StringUtil.copyPartialMatches(PartOfCommand, temp, completionList);
} }
@ -91,20 +90,20 @@ public class TabComplete implements TabCompleter {
} }
break; break;
case "[jobitemname]": case "[jobitemname]":
for (Entry<String, JobItems> one : ItemBoostManager.getItems().entrySet()) { for (JobItems one : ItemBoostManager.getItems().values()) {
temp.add(one.getValue().getNode()); temp.add(one.getNode());
} }
if (args.length > 3 && args[3].equalsIgnoreCase("limiteditems")) { if (args.length > 3 && args[3].equalsIgnoreCase("limiteditems")) {
Job oneJob = Jobs.getJob(args[i - 1]); Job oneJob = Jobs.getJob(args[i - 1]);
if (oneJob != null) if (oneJob != null)
for (Entry<String, JobLimitedItems> limitedItem : oneJob.getLimitedItems().entrySet()) { for (JobLimitedItems limitedItem : oneJob.getLimitedItems().values()) {
temp.add(limitedItem.getValue().getNode()); temp.add(limitedItem.getNode());
} }
} }
break; break;
case "[boosteditems]": case "[boosteditems]":
for (Entry<String, JobItems> one : ItemBoostManager.getItems().entrySet()) { for (JobItems one : ItemBoostManager.getItems().values()) {
temp.add(one.getValue().getNode()); temp.add(one.getNode());
} }
break; break;
case "[oldjob]": case "[oldjob]":

View File

@ -9,7 +9,6 @@ import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map.Entry;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.UUID; import java.util.UUID;
@ -179,9 +178,9 @@ public class Util {
} }
public static JobsWorld getJobsWorld(int id) { public static JobsWorld getJobsWorld(int id) {
for (Entry<String, JobsWorld> one : jobsWorlds.entrySet()) { for (JobsWorld one : jobsWorlds.values()) {
if (one.getValue().getId() == id) if (one.getId() == id)
return one.getValue(); return one;
} }
return null; return null;
} }