1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +01:00
This commit is contained in:
Zrips 2018-08-21 13:05:06 +03:00
commit 7b585cf803
80 changed files with 246 additions and 297 deletions

Binary file not shown.

BIN
libs/MyPet-3.0-SNAPSHOT.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -292,7 +292,7 @@ public class CMIEffectManager {
}
public static List<CMIParticle> getParticleList() {
List<CMIParticle> ls = new ArrayList<CMIParticle>();
List<CMIParticle> ls = new ArrayList<>();
for (CMIParticle one : CMIParticle.values()) {
if (!one.isParticle())
continue;

View File

@ -107,7 +107,7 @@ public class CMIItemStack {
ItemMeta meta = this.getItemStack().getItemMeta();
List<String> lore = meta.getLore();
if (lore == null)
lore = new ArrayList<String>();
lore = new ArrayList<>();
lore.add(ChatColor.translateAlternateColorCodes('&', string));
meta.setLore(lore);
this.getItemStack().setItemMeta(meta);
@ -116,7 +116,7 @@ public class CMIItemStack {
public CMIItemStack clearLore() {
ItemMeta meta = this.getItemStack().getItemMeta();
List<String> t = new ArrayList<String>();
List<String> t = new ArrayList<>();
meta.setLore(t);
this.getItemStack().setItemMeta(meta);
return this;
@ -126,7 +126,7 @@ public class CMIItemStack {
if (lore == null || lore.isEmpty())
return this;
ItemMeta meta = this.getItemStack().getItemMeta();
List<String> t = new ArrayList<String>();
List<String> t = new ArrayList<>();
for (String one : lore) {
t.add(ChatColor.translateAlternateColorCodes('&', one));
}
@ -165,7 +165,7 @@ public class CMIItemStack {
if (meta != null) {
List<String> lore = meta.getLore();
if (lore == null) {
lore = new ArrayList<String>();
lore = new ArrayList<>();
meta.setLore(lore);
}

View File

@ -23,10 +23,10 @@ import com.gamingmesh.jobs.stuff.VersionChecker.Version;
public class ItemManager {
static HashMap<Integer, CMIItemStack> byId = new HashMap<Integer, CMIItemStack>();
static HashMap<String, CMIItemStack> byBukkitName = new HashMap<String, CMIItemStack>();
static HashMap<String, CMIItemStack> byMojangName = new HashMap<String, CMIItemStack>();
static HashMap<CMIMaterial, CMIItemStack> byMaterial = new HashMap<CMIMaterial, CMIItemStack>();
static HashMap<Integer, CMIItemStack> byId = new HashMap<>();
static HashMap<String, CMIItemStack> byBukkitName = new HashMap<>();
static HashMap<String, CMIItemStack> byMojangName = new HashMap<>();
static HashMap<CMIMaterial, CMIItemStack> byMaterial = new HashMap<>();
static final Version version = Jobs.getVersionCheckManager().getVersion();
public static void load() {
@ -122,7 +122,7 @@ public class ItemManager {
return cm;
}
static HashMap<String, ItemStack> headCache = new HashMap<String, ItemStack>();
static HashMap<String, ItemStack> headCache = new HashMap<>();
public static CMIItemStack getItem(String name) {
if (byBukkitName.isEmpty())
@ -279,7 +279,7 @@ public class ItemManager {
}
static public List<Recipe> getAllRecipes() {
List<Recipe> results = new ArrayList<Recipe>();
List<Recipe> results = new ArrayList<>();
Iterator<Recipe> iter = Bukkit.recipeIterator();
while (iter.hasNext()) {
Recipe recipe = iter.next();
@ -290,7 +290,7 @@ public class ItemManager {
static public List<Recipe> getRecipesFor(ItemStack result) {
List<Recipe> results = new ArrayList<Recipe>();
List<Recipe> results = new ArrayList<>();
Iterator<Recipe> iter = Bukkit.recipeIterator();
while (iter.hasNext()) {
Recipe recipe = iter.next();
@ -1584,7 +1584,7 @@ public class ItemManager {
public static CMIMaterial getRandom(CMIMaterial mat) {
List<CMIMaterial> ls = new ArrayList<CMIMaterial>();
List<CMIMaterial> ls = new ArrayList<>();
for (CMIMaterial one : CMIMaterial.values()) {
if (one.getLegacyId() == -1)

View File

@ -8,7 +8,7 @@ import com.gamingmesh.jobs.container.Job;
public class GuiInfoList {
String name;
List<Job> jobList = new ArrayList<Job>();
List<Job> jobList = new ArrayList<>();
Boolean jobInfo = false;
int backButton = 27;

View File

@ -25,7 +25,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
public class GuiManager {
public HashMap<UUID, GuiInfoList> GuiList = new HashMap<UUID, GuiInfoList>();
public HashMap<UUID, GuiInfoList> GuiList = new HashMap<>();
public void CloseInventories() {
for (Entry<UUID, GuiInfoList> one : GuiList.entrySet()) {
@ -68,7 +68,7 @@ public class GuiManager {
public Inventory CreateJobsGUI(Player player) {
ArrayList<Job> JobsList = new ArrayList<Job>();
ArrayList<Job> JobsList = new ArrayList<>();
for (Job job : Jobs.getJobs()) {
if (Jobs.getGCManager().getHideJobsWithoutPermission())
if (!Jobs.getCommandManager().hasJobPermission(player, job))
@ -117,7 +117,7 @@ public class GuiManager {
break main;
Job job = JobsList.get(i);
ArrayList<String> Lore = new ArrayList<String>();
ArrayList<String> Lore = new ArrayList<>();
for (JobProgression onePJob : pJobs) {
if (onePJob.getJob().getName().equalsIgnoreCase(job.getName()))
@ -198,7 +198,7 @@ public class GuiManager {
int numjobs = JPlayer.getJobProgression().size();
List<ItemStack> items = new ArrayList<ItemStack>();
List<ItemStack> items = new ArrayList<>();
int i = 0;
for (ActionType actionType : ActionType.values()) {
List<JobInfo> info = job.getJobInfo(actionType);
@ -206,7 +206,7 @@ public class GuiManager {
if (info == null || info.isEmpty())
continue;
ArrayList<String> Lore = new ArrayList<String>();
ArrayList<String> Lore = new ArrayList<>();
Lore.add(ChatColor.translateAlternateColorCodes('&', "&e" + Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase()
+ ".info")));
int y = 1;

View File

@ -96,7 +96,6 @@ import com.gamingmesh.jobs.listeners.PistonProtectionListener;
import com.gamingmesh.jobs.selection.SelectionManager;
import com.gamingmesh.jobs.stuff.ActionBar;
import com.gamingmesh.jobs.stuff.CMIScoreboardManager;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
import com.gamingmesh.jobs.stuff.Loging;
import com.gamingmesh.jobs.stuff.RawMessage;
@ -106,7 +105,6 @@ import com.gamingmesh.jobs.tasks.BufferedPaymentThread;
import com.gamingmesh.jobs.tasks.DatabaseSaveThread;
public class Jobs extends JavaPlugin {
// public static Jobs plugin = new Jobs();
private static String version = "";
private static PlayerManager pManager = null;
private static JobsCommands cManager = null;
@ -146,9 +144,9 @@ public class Jobs extends JavaPlugin {
private static JobsDAO dao = null;
private static List<Job> jobs = null;
private static Job noneJob = null;
private static WeakHashMap<Job, Integer> usedSlots = new WeakHashMap<Job, Integer>();
public static WeakHashMap<String, Boolean> actionbartoggle = new WeakHashMap<String, Boolean>();
public static WeakHashMap<String, Boolean> BossBartoggle = new WeakHashMap<String, Boolean>();
private static WeakHashMap<Job, Integer> usedSlots = new WeakHashMap<>();
public static WeakHashMap<String, Boolean> actionbartoggle = new WeakHashMap<>();
public static WeakHashMap<String, Boolean> BossBartoggle = new WeakHashMap<>();
// public static WeakHashMap<String, Double> GlobalBoost = new WeakHashMap<String, Double>();
private static BufferedEconomy economy;
private static PermissionHandler permissionHandler;
@ -159,7 +157,7 @@ public class Jobs extends JavaPlugin {
public static BufferedPaymentThread paymentThread = null;
private static DatabaseSaveThread saveTask = null;
public static HashMap<String, FastPayment> FastPayment = new HashMap<String, FastPayment>();
public static HashMap<String, FastPayment> FastPayment = new HashMap<>();
private static NMS nms;
@ -552,7 +550,7 @@ public class Jobs extends JavaPlugin {
public static void loadAllPlayersData() {
long time = System.currentTimeMillis();
// Cloning to avoid issues
HashMap<UUID, PlayerInfo> temp = new HashMap<UUID, PlayerInfo>(Jobs.getPlayerManager().getPlayersInfoUUIDMap());
HashMap<UUID, PlayerInfo> temp = new HashMap<>(Jobs.getPlayerManager().getPlayersInfoUUIDMap());
HashMap<Integer, List<JobsDAOData>> playersJobs = Jobs.getJobsDAO().getAllJobs();
HashMap<Integer, PlayerPoints> playersPoints = Jobs.getJobsDAO().getAllPoints();
HashMap<Integer, HashMap<String, Log>> playersLogs = Jobs.getJobsDAO().getAllLogs();
@ -846,8 +844,7 @@ public class Jobs extends JavaPlugin {
FurnaceBrewingHandling.load();
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Plugin has been enabled succesfully.");
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
console.sendMessage(message);
Bukkit.getServer().getConsoleSender().sendMessage(message);
lManager.reload();
cManager.fillCommands();
@ -870,8 +867,7 @@ public class Jobs extends JavaPlugin {
Jobs.shutdown();
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] &2Plugin has been disabled succesfully.");
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
console.sendMessage(message);
Bukkit.getServer().getConsoleSender().sendMessage(message);
this.setEnabled(false);
}
@ -995,7 +991,7 @@ public class Jobs extends JavaPlugin {
Jobs.getEconomy().pay(jPlayer, income, pointAmount, 0.0);
if (GconfigManager.LoggingUse) {
HashMap<CurrencyType, Double> amounts = new HashMap<CurrencyType, Double>();
HashMap<CurrencyType, Double> amounts = new HashMap<>();
amounts.put(CurrencyType.MONEY, income);
loging.recordToLog(jPlayer, info, amounts);
}
@ -1133,7 +1129,7 @@ public class Jobs extends JavaPlugin {
int oldLevel = prog.getLevel();
if (GconfigManager.LoggingUse) {
HashMap<CurrencyType, Double> amounts = new HashMap<CurrencyType, Double>();
HashMap<CurrencyType, Double> amounts = new HashMap<>();
amounts.put(CurrencyType.MONEY, income);
amounts.put(CurrencyType.EXP, expAmount);
amounts.put(CurrencyType.POINTS, pointAmount);
@ -1290,7 +1286,7 @@ public class Jobs extends JavaPlugin {
int oldLevel = prog.getLevel();
if (GconfigManager.LoggingUse) {
HashMap<CurrencyType, Double> amounts = new HashMap<CurrencyType, Double>();
HashMap<CurrencyType, Double> amounts = new HashMap<>();
amounts.put(CurrencyType.MONEY, payment.getAmount());
amounts.put(CurrencyType.EXP, payment.getExp());
amounts.put(CurrencyType.POINTS, payment.getPoints());

View File

@ -6,7 +6,6 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.plugin.Plugin;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.stuff.Debug;
import io.lumine.xikage.mythicmobs.MythicMobs;
import io.lumine.xikage.mythicmobs.api.bukkit.BukkitAPIHelper;

View File

@ -66,7 +66,7 @@ public class PermissionHandler {
if (hasWorldPermission(player)) {
List<JobProgression> progression = jPlayer.getJobProgression();
// calculate new permissions
HashMap<String, Boolean> permissions = new HashMap<String, Boolean>();
HashMap<String, Boolean> permissions = new HashMap<>();
if (progression.size() == 0) {
Job job = Jobs.getNoneJob();

View File

@ -32,7 +32,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
public class PermissionManager {
HashMap<String, Integer> permDelay = new HashMap<String, Integer>();
HashMap<String, Integer> permDelay = new HashMap<>();
private enum prm {
// jobs_join_JOBNAME(remade("jobs.join.%JOBNAME%"), 60 * 1000),
@ -70,7 +70,7 @@ public class PermissionManager {
}
private static List<String> remade(String perm) {
List<String> perms = new ArrayList<String>();
List<String> perms = new ArrayList<>();
for (Job oneJ : Jobs.getJobs()) {
String t = perm;
if (t.contains("%JOBNAME%"))
@ -107,7 +107,7 @@ public class PermissionManager {
}
private static HashMap<String, Boolean> getAll(Player player) {
HashMap<String, Boolean> mine = new HashMap<String, Boolean>();
HashMap<String, Boolean> mine = new HashMap<>();
for (PermissionAttachmentInfo permission : player.getEffectivePermissions()) {
if (permission.getPermission().startsWith("jobs."))
mine.put(permission.getPermission(), permission.getValue());

View File

@ -63,17 +63,17 @@ import com.gamingmesh.jobs.stuff.PerformCommands;
public class PlayerManager {
// private Map<String, JobsPlayer> players = Collections.synchronizedMap(new HashMap<String, JobsPlayer>());
private ConcurrentHashMap<String, JobsPlayer> playersCache = new ConcurrentHashMap<String, JobsPlayer>();
private ConcurrentHashMap<UUID, JobsPlayer> playersUUIDCache = new ConcurrentHashMap<UUID, JobsPlayer>();
private ConcurrentHashMap<String, JobsPlayer> players = new ConcurrentHashMap<String, JobsPlayer>();
private ConcurrentHashMap<UUID, JobsPlayer> playersUUID = new ConcurrentHashMap<UUID, JobsPlayer>();
private ConcurrentHashMap<String, JobsPlayer> playersCache = new ConcurrentHashMap<>();
private ConcurrentHashMap<UUID, JobsPlayer> playersUUIDCache = new ConcurrentHashMap<>();
private ConcurrentHashMap<String, JobsPlayer> players = new ConcurrentHashMap<>();
private ConcurrentHashMap<UUID, JobsPlayer> playersUUID = new ConcurrentHashMap<>();
private PointsData PointsDatabase = new PointsData();
private final String mobSpawnerMetadata = "jobsMobSpawner";
private HashMap<UUID, PlayerInfo> PlayerUUIDMap = new HashMap<UUID, PlayerInfo>();
private HashMap<Integer, PlayerInfo> PlayerIDMap = new HashMap<Integer, PlayerInfo>();
private HashMap<String, PlayerInfo> PlayerNameMap = new HashMap<String, PlayerInfo>();
private HashMap<UUID, PlayerInfo> PlayerUUIDMap = new HashMap<>();
private HashMap<Integer, PlayerInfo> PlayerIDMap = new HashMap<>();
private HashMap<String, PlayerInfo> PlayerNameMap = new HashMap<>();
Jobs plugin;
public PlayerManager(Jobs plugin) {
@ -214,7 +214,7 @@ public class PlayerManager {
* 2) Perform save on all players on copied list.
* 3) Garbage collect the real list to remove any offline players with saved data
*/
ArrayList<JobsPlayer> list = new ArrayList<JobsPlayer>(this.players.values());
ArrayList<JobsPlayer> list = new ArrayList<>(this.players.values());
for (JobsPlayer jPlayer : list) {
jPlayer.save();
@ -414,7 +414,7 @@ public class PlayerManager {
* @param jPlayer
*/
public void leaveAllJobs(JobsPlayer jPlayer) {
List<JobProgression> jobs = new ArrayList<JobProgression>();
List<JobProgression> jobs = new ArrayList<>();
jobs.addAll(jPlayer.getJobProgression());
for (JobProgression job : jobs) {
leaveJob(jPlayer, job.getJob());
@ -729,7 +729,7 @@ public class PlayerManager {
}
}
HashMap<UUID, HashMap<Job, ItemBonusCache>> cache = new HashMap<UUID, HashMap<Job, ItemBonusCache>>();
HashMap<UUID, HashMap<Job, ItemBonusCache>> cache = new HashMap<>();
public void resetiItemBonusCache(UUID uuid) {
cache.remove(uuid);

View File

@ -5,7 +5,7 @@ import java.util.List;
public class SignInfo {
List<Sign> AllSigns = new ArrayList<Sign>();
List<Sign> AllSigns = new ArrayList<>();
public SignInfo() {
}

View File

@ -16,7 +16,6 @@ import org.bukkit.configuration.file.YamlConfiguration;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.config.CommentedYamlConfiguration;
import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.stuff.Debug;
public class SignUtil {
@ -41,7 +40,7 @@ public class SignUtil {
return;
ConfigurationSection ConfCategory = f.getConfigurationSection("Signs");
ArrayList<String> categoriesList = new ArrayList<String>(ConfCategory.getKeys(false));
ArrayList<String> categoriesList = new ArrayList<>(ConfCategory.getKeys(false));
if (categoriesList.size() == 0)
return;
for (String category : categoriesList) {
@ -108,7 +107,7 @@ public class SignUtil {
double SignsZ = one.GetZ();
int number = one.GetNumber() - 1;
List<TopList> PlayerList = new ArrayList<TopList>();
List<TopList> PlayerList = new ArrayList<>();
if (!JobName.equalsIgnoreCase("gtoplist")) {
PlayerList = Jobs.getJobsDAO().toplist(SignJobName, number);
} else {
@ -202,7 +201,6 @@ public class SignUtil {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
@SuppressWarnings("deprecation")
public void run() {
org.bukkit.material.Sign signMat = (org.bukkit.material.Sign) sign.getData();

View File

@ -42,8 +42,8 @@ import com.gamingmesh.jobs.stuff.RawMessage;
public class JobsCommands implements CommandExecutor {
private static final String label = "jobs";
private static final String packagePath = "com.gamingmesh.jobs.commands.list";
private static final List<String> hidenCommands = new ArrayList<String>();
Map<String, Integer> CommandList = new HashMap<String, Integer>();
private static final List<String> hidenCommands = new ArrayList<>();
Map<String, Integer> CommandList = new HashMap<>();
protected Jobs plugin;
@ -109,10 +109,6 @@ public class JobsCommands implements CommandExecutor {
}
}
// if (cmdClass == null) {
// return help(sender, 1);
// }
boolean back = cmdClass.perform(plugin, sender, myArgs);
if (back)
return true;
@ -184,7 +180,7 @@ public class JobsCommands implements CommandExecutor {
}
private static List<String> getClassesFromPackage(String pckgname) throws ClassNotFoundException {
List<String> result = new ArrayList<String>();
List<String> result = new ArrayList<>();
try {
for (URL jarURL : ((URLClassLoader) Jobs.class.getClassLoader()).getURLs()) {
try {
@ -201,7 +197,7 @@ public class JobsCommands implements CommandExecutor {
private static List<String> getClassesInSamePackageFromJar(String packageName, String jarPath) {
JarFile jarFile = null;
List<String> listOfCommands = new ArrayList<String>();
List<String> listOfCommands = new ArrayList<>();
try {
jarFile = new JarFile(jarPath);
Enumeration<JarEntry> en = jarFile.entries();
@ -228,7 +224,7 @@ public class JobsCommands implements CommandExecutor {
}
public Map<String, Integer> GetCommands(CommandSender sender) {
Map<String, Integer> temp = new HashMap<String, Integer>();
Map<String, Integer> temp = new HashMap<>();
for (Entry<String, Integer> cmd : CommandList.entrySet()) {
if (!hasCommandPermission(sender, cmd.getKey()))
continue;
@ -238,8 +234,8 @@ public class JobsCommands implements CommandExecutor {
}
public void fillCommands() {
List<String> lm = new ArrayList<String>();
HashMap<String, Class<?>> classes = new HashMap<String, Class<?>>();
List<String> lm = new ArrayList<>();
HashMap<String, Class<?>> classes = new HashMap<>();
try {
lm = getClassesFromPackage(packagePath);
} catch (ClassNotFoundException e) {
@ -289,14 +285,14 @@ public class JobsCommands implements CommandExecutor {
}
private static Map<String, Integer> sort(Map<String, Integer> unsortMap) {
List<Map.Entry<String, Integer>> list = new LinkedList<Map.Entry<String, Integer>>(unsortMap.entrySet());
List<Map.Entry<String, Integer>> list = new LinkedList<>(unsortMap.entrySet());
Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
@Override
public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
return (o1.getValue()).compareTo(o2.getValue());
}
});
Map<String, Integer> sortedMap = new LinkedHashMap<String, Integer>();
Map<String, Integer> sortedMap = new LinkedHashMap<>();
for (Iterator<Map.Entry<String, Integer>> it = list.iterator(); it.hasNext();) {
Map.Entry<String, Integer> entry = it.next();
sortedMap.put(entry.getKey(), entry.getValue());
@ -351,7 +347,7 @@ public class JobsCommands implements CommandExecutor {
type = type.toLowerCase();
}
List<String> message = new ArrayList<String>();
List<String> message = new ArrayList<>();
int showAllTypes = 1;
for (ActionType actionType : ActionType.values()) {

View File

@ -17,7 +17,6 @@ import com.gamingmesh.jobs.container.RestrictedArea;
public class area implements Cmd {
@SuppressWarnings("deprecation")
@Override
@JobCommand(300)
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -11,7 +11,6 @@ import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.BoostMultiplier;
import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobItemBonus;
import com.gamingmesh.jobs.container.JobItems;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.ChatColor;

View File

@ -3,7 +3,6 @@ package com.gamingmesh.jobs.commands.list;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;

View File

@ -3,14 +3,9 @@ package com.gamingmesh.jobs.commands.list;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Score;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.ScoreboardManager;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;

View File

@ -1,7 +1,6 @@
package com.gamingmesh.jobs.commands.list;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

View File

@ -3,14 +3,9 @@ package com.gamingmesh.jobs.commands.list;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Score;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.ScoreboardManager;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;

View File

@ -14,8 +14,7 @@ import com.gamingmesh.jobs.container.DBAction;
public class BlockProtectionManager {
private HashMap<World, HashMap<String, HashMap<String, HashMap<String, BlockProtection>>>> map =
new HashMap<World, HashMap<String, HashMap<String, HashMap<String, BlockProtection>>>>();
private HashMap<World, HashMap<String, HashMap<String, HashMap<String, BlockProtection>>>> map = new HashMap<>();
public Long timer = 0L;
@ -60,15 +59,15 @@ public class BlockProtectionManager {
String v = loc.getBlockX() + ":" + loc.getBlockY() + ":" + loc.getBlockZ();
HashMap<String, HashMap<String, HashMap<String, BlockProtection>>> regions = map.get(loc.getWorld());
if (regions == null)
regions = new HashMap<String, HashMap<String, HashMap<String, BlockProtection>>>();
regions = new HashMap<>();
String region = locToRegion(loc);
HashMap<String, HashMap<String, BlockProtection>> chunks = regions.get(region);
if (chunks == null)
chunks = new HashMap<String, HashMap<String, BlockProtection>>();
chunks = new HashMap<>();
String chunk = locToChunk(loc);
HashMap<String, BlockProtection> Bpm = chunks.get(chunk);
if (Bpm == null)
Bpm = new HashMap<String, BlockProtection>();
Bpm = new HashMap<>();
BlockProtection Bp = Bpm.get(v);

View File

@ -35,7 +35,7 @@ public class BossBarManager {
if (player == null)
return;
List<String> temp = new ArrayList<String>();
List<String> temp = new ArrayList<>();
temp.addAll(player.getUpdateBossBarFor());

View File

@ -37,7 +37,7 @@ public class CommentedYamlConfiguration extends YamlConfiguration {
public CommentedYamlConfiguration() {
super();
comments = new HashMap<String, String>();
comments = new HashMap<>();
}
@Override

View File

@ -32,7 +32,6 @@ import java.util.UUID;
import org.apache.commons.lang.StringEscapeUtils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
@ -58,7 +57,6 @@ import com.gamingmesh.jobs.container.JobPermission;
import com.gamingmesh.jobs.container.Quest;
import com.gamingmesh.jobs.resources.jfep.Parser;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.VersionChecker.Version;
public class ConfigManager {
@ -363,12 +361,11 @@ public class ConfigManager {
* loads from Jobs/jobConfig.yml
* @throws IOException
*/
@SuppressWarnings("deprecation")
private void loadJobSettings() throws IOException {
File f = new File(plugin.getDataFolder(), "jobConfig.yml");
InputStreamReader s = new InputStreamReader(new FileInputStream(f), "UTF-8");
ArrayList<Job> jobs = new ArrayList<Job>();
ArrayList<Job> jobs = new ArrayList<>();
Jobs.setJobs(jobs);
Jobs.setNoneJob(null);
if (!f.exists()) {
@ -446,7 +443,7 @@ public class ConfigManager {
String description = org.bukkit.ChatColor.translateAlternateColorCodes('&', jobSection.getString("description", ""));
List<String> fDescription = new ArrayList<String>();
List<String> fDescription = new ArrayList<>();
if (jobSection.contains("FullDescription")) {
if (jobSection.isString("FullDescription"))
fDescription.add(jobSection.getString("FullDescription"));
@ -564,7 +561,7 @@ public class ConfigManager {
}
// Permissions
ArrayList<JobPermission> jobPermissions = new ArrayList<JobPermission>();
ArrayList<JobPermission> jobPermissions = new ArrayList<>();
ConfigurationSection permissionsSection = jobSection.getConfigurationSection("permissions");
if (permissionsSection != null) {
for (String permissionKey : permissionsSection.getKeys(false)) {
@ -582,7 +579,7 @@ public class ConfigManager {
}
// Conditions
ArrayList<JobConditions> jobConditions = new ArrayList<JobConditions>();
ArrayList<JobConditions> jobConditions = new ArrayList<>();
ConfigurationSection conditionsSection = jobSection.getConfigurationSection("conditions");
if (conditionsSection != null) {
for (String ConditionKey : conditionsSection.getKeys(false)) {
@ -605,19 +602,19 @@ public class ConfigManager {
}
// Command on leave
List<String> JobsCommandOnLeave = new ArrayList<String>();
List<String> JobsCommandOnLeave = new ArrayList<>();
if (jobSection.isList("cmd-on-leave")) {
JobsCommandOnLeave = jobSection.getStringList("cmd-on-leave");
}
// Command on join
List<String> JobsCommandOnJoin = new ArrayList<String>();
List<String> JobsCommandOnJoin = new ArrayList<>();
if (jobSection.isList("cmd-on-join")) {
JobsCommandOnJoin = jobSection.getStringList("cmd-on-join");
}
// Commands
ArrayList<JobCommands> jobCommand = new ArrayList<JobCommands>();
ArrayList<JobCommands> jobCommand = new ArrayList<>();
ConfigurationSection commandsSection = jobSection.getConfigurationSection("commands");
if (commandsSection != null) {
for (String commandKey : commandsSection.getKeys(false)) {
@ -628,7 +625,7 @@ public class ConfigManager {
Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid command key" + commandKey + "!");
continue;
}
List<String> commands = new ArrayList<String>();
List<String> commands = new ArrayList<>();
if (commandSection.isString("command"))
commands.add(commandSection.getString("command"));
else if (commandSection.isList("command"))
@ -640,7 +637,7 @@ public class ConfigManager {
}
// Items
HashMap<String, JobItems> jobItems = new HashMap<String, JobItems>();
HashMap<String, JobItems> jobItems = new HashMap<>();
ConfigurationSection itemsSection = jobSection.getConfigurationSection("items");
if (itemsSection != null) {
for (String itemKey : itemsSection.getKeys(false)) {
@ -657,13 +654,13 @@ public class ConfigManager {
if (itemSection.isString("name"))
name = itemSection.getString("name");
List<String> lore = new ArrayList<String>();
List<String> lore = new ArrayList<>();
if (itemSection.getStringList("lore") != null)
for (String eachLine : itemSection.getStringList("lore")) {
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
}
HashMap<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
HashMap<Enchantment, Integer> enchants = new HashMap<>();
if (itemSection.getStringList("enchants") != null)
for (String eachLine : itemSection.getStringList("enchants")) {
@ -695,7 +692,7 @@ public class ConfigManager {
}
// Limited Items
ArrayList<JobLimitedItems> jobLimitedItems = new ArrayList<JobLimitedItems>();
ArrayList<JobLimitedItems> jobLimitedItems = new ArrayList<>();
ConfigurationSection LimitedItemsSection = jobSection.getConfigurationSection("limitedItems");
if (LimitedItemsSection != null) {
for (String itemKey : LimitedItemsSection.getKeys(false)) {
@ -712,13 +709,13 @@ public class ConfigManager {
if (itemSection.isString("name"))
name = itemSection.getString("name");
List<String> lore = new ArrayList<String>();
List<String> lore = new ArrayList<>();
if (itemSection.getStringList("lore") != null)
for (String eachLine : itemSection.getStringList("lore")) {
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
}
HashMap<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
HashMap<Enchantment, Integer> enchants = new HashMap<>();
if (itemSection.getStringList("enchants") != null)
for (String eachLine : itemSection.getStringList("enchants")) {
@ -753,7 +750,7 @@ public class ConfigManager {
if (jobSection.contains("Quests")) {
List<Quest> quests = new ArrayList<Quest>();
List<Quest> quests = new ArrayList<>();
ConfigurationSection qsection = jobSection.getConfigurationSection("Quests");
for (String one : qsection.getKeys(false)) {
@ -816,7 +813,7 @@ public class ConfigManager {
for (ActionType actionType : ActionType.values()) {
ConfigurationSection typeSection = jobSection.getConfigurationSection(actionType.getName());
ArrayList<JobInfo> jobInfo = new ArrayList<JobInfo>();
ArrayList<JobInfo> jobInfo = new ArrayList<>();
if (typeSection != null) {
for (String key : typeSection.getKeys(false)) {
ConfigurationSection section = typeSection.getConfigurationSection(key);

View File

@ -2,11 +2,8 @@ package com.gamingmesh.jobs.config;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -18,11 +15,10 @@ import com.gamingmesh.jobs.container.ExploreChunk;
import com.gamingmesh.jobs.container.ExploreRegion;
import com.gamingmesh.jobs.container.ExploreRespond;
import com.gamingmesh.jobs.dao.JobsDAO.ExploreDataTableFields;
import com.gamingmesh.jobs.stuff.Debug;
public class ExploreManager {
private HashMap<String, ExploreRegion> worlds = new HashMap<String, ExploreRegion>();
private HashMap<String, ExploreRegion> worlds = new HashMap<>();
private boolean exploreEnabled = false;
private int playerAmount = 1;

View File

@ -45,7 +45,7 @@ import com.gamingmesh.jobs.stuff.VersionChecker.Version;
public class GeneralConfigManager {
private Jobs plugin;
public List<Integer> BroadcastingLevelUpLevels = new ArrayList<Integer>();
public List<Integer> BroadcastingLevelUpLevels = new ArrayList<>();
protected Locale locale;
protected int savePeriod;
protected boolean economyAsync;
@ -70,14 +70,14 @@ public class GeneralConfigManager {
public boolean PaymentMethodsMoney;
public boolean PaymentMethodsPoints;
public boolean PaymentMethodsExp;
private HashMap<CurrencyType, Double> generalMulti = new HashMap<CurrencyType, Double>();
private HashMap<CurrencyType, Double> generalMulti = new HashMap<>();
public int getSelectionTooldID;
private int ResetTimeHour;
private int ResetTimeMinute;
// Limits
public HashMap<CurrencyType, CurrencyLimit> currencyLimitUse = new HashMap<CurrencyType, CurrencyLimit>();
public HashMap<CurrencyType, CurrencyLimit> currencyLimitUse = new HashMap<>();
public boolean PayForRenaming, PayForEachCraft, SignsEnabled,
SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useCoreProtect, BlockPlaceUse,
@ -147,11 +147,11 @@ public class GeneralConfigManager {
public Parser DynamicPaymentEquation;
public boolean DisabledWorldsUse;
public List<String> DisabledWorldsList = new ArrayList<String>();
public List<String> DisabledWorldsList = new ArrayList<>();
public List<Schedule> BoostSchedule = new ArrayList<Schedule>();
public List<Schedule> BoostSchedule = new ArrayList<>();
public HashMap<String, List<String>> commandArgs = new HashMap<String, List<String>>();
public HashMap<String, List<String>> commandArgs = new HashMap<>();
public boolean DBCleaningJobsUse;
public int DBCleaningJobsLvl;
@ -371,7 +371,6 @@ public class GeneralConfigManager {
*
* loads from Jobs/generalConfig.yml
*/
@SuppressWarnings("deprecation")
private synchronized void loadGeneralSettings() {
File f = new File(plugin.getDataFolder(), "generalConfig.yml");
YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);
@ -640,7 +639,7 @@ public class GeneralConfigManager {
c.getW().addComment("Economy.Limit.Money", "Money gain limit", "With this enabled, players will be limited how much they can make in defined time",
"Time in seconds: 60 = 1min, 3600 = 1 hour, 86400 = 24 hours");
limit.setEnabled(c.get("Economy.Limit.Money.Use", false));
List<CurrencyType> list = new ArrayList<CurrencyType>();
List<CurrencyType> list = new ArrayList<>();
c.getW().addComment("Economy.Limit.Money.StopWithExp", "Do you want to stop money gain when exp limit reached?");
if (c.get("Economy.Limit.Money.StopWithExp", false))
list.add(CurrencyType.EXP);
@ -672,7 +671,7 @@ public class GeneralConfigManager {
// Point limit
limit = new CurrencyLimit();
list = new ArrayList<CurrencyType>();
list = new ArrayList<>();
c.getW().addComment("Economy.Limit.Point", "Point gain limit", "With this enabled, players will be limited how much they can make in defined time");
limit.setEnabled(c.get("Economy.Limit.Point.Use", false));
c.getW().addComment("Economy.Limit.Point.StopWithExp", "Do you want to stop Point gain when exp limit reached?");
@ -706,7 +705,7 @@ public class GeneralConfigManager {
// Exp limit
limit = new CurrencyLimit();
list = new ArrayList<CurrencyType>();
list = new ArrayList<>();
c.getW().addComment("Economy.Limit.Exp", "Exp gain limit", "With this enabled, players will be limited how much they can get in defined time",
"Time in seconds: 60 = 1min, 3600 = 1 hour, 86400 = 24 hours");
limit.setEnabled(c.get("Economy.Limit.Exp.Use", false));

View File

@ -23,7 +23,7 @@ public class LanguageManager {
this.plugin = plugin;
}
List<String> languages = new ArrayList<String>();
List<String> languages = new ArrayList<>();
public List<String> getLanguages() {
return languages;
@ -46,7 +46,7 @@ public class LanguageManager {
private static List<String> getClassesInSamePackageFromJar(String packageName, String jarPath, String cleaner) {
JarFile jarFile = null;
List<String> listOfCommands = new ArrayList<String>();
List<String> listOfCommands = new ArrayList<>();
try {
jarFile = new JarFile(jarPath);
Enumeration<JarEntry> en = jarFile.entries();
@ -80,7 +80,7 @@ public class LanguageManager {
* loads from Jobs/locale/messages_en.yml
*/
synchronized void load() {
languages = new ArrayList<String>();
languages = new ArrayList<>();
try {
languages.addAll(getClassesFromPackage("locale", "messages_"));

View File

@ -20,10 +20,10 @@ public class NameTranslatorManager {
private Jobs plugin;
public ArrayList<NameList> ListOfNames = new ArrayList<NameList>();
public ArrayList<NameList> ListOfEntities = new ArrayList<NameList>();
public ArrayList<NameList> ListOfEnchants = new ArrayList<NameList>();
public ArrayList<NameList> ListOfColors = new ArrayList<NameList>();
public ArrayList<NameList> ListOfNames = new ArrayList<>();
public ArrayList<NameList> ListOfEntities = new ArrayList<>();
public ArrayList<NameList> ListOfEnchants = new ArrayList<>();
public ArrayList<NameList> ListOfColors = new ArrayList<>();
public NameTranslatorManager(Jobs plugin) {
this.plugin = plugin;

View File

@ -21,7 +21,7 @@ import com.gamingmesh.jobs.stuff.ChatColor;
public class RestrictedAreaManager {
protected HashMap<String, RestrictedArea> restrictedAreas = new HashMap<String, RestrictedArea>();
protected HashMap<String, RestrictedArea> restrictedAreas = new HashMap<>();
private Jobs plugin;
@ -114,7 +114,7 @@ public class RestrictedAreaManager {
}
public synchronized List<RestrictedArea> getRestrictedAreasByLoc(Location loc) {
List<RestrictedArea> areas = new ArrayList<RestrictedArea>();
List<RestrictedArea> areas = new ArrayList<>();
for (Entry<String, RestrictedArea> area : restrictedAreas.entrySet()) {
if (area.getValue().inRestrictedArea(loc))
areas.add(area.getValue());
@ -128,7 +128,7 @@ public class RestrictedAreaManager {
}
public synchronized List<RestrictedArea> getRestrictedAreasByName(String name) {
List<RestrictedArea> areas = new ArrayList<RestrictedArea>();
List<RestrictedArea> areas = new ArrayList<>();
for (Entry<String, RestrictedArea> area : restrictedAreas.entrySet()) {
if (area.getKey().equalsIgnoreCase(name))
areas.add(area.getValue());

View File

@ -16,7 +16,7 @@ import com.gamingmesh.jobs.stuff.ChatColor;
public class RestrictedBlockManager {
public HashMap<Integer, Integer> restrictedBlocksTimer = new HashMap<Integer, Integer>();
public HashMap<Integer, Integer> restrictedBlocksTimer = new HashMap<>();
private Jobs plugin;

View File

@ -20,7 +20,6 @@ import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.Schedule;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.TimeManage;
public class ScheduleManager {
@ -180,7 +179,7 @@ public class ScheduleManager {
if (!conf.contains("Boost"))
return;
ArrayList<String> sections = new ArrayList<String>(conf.getConfigurationSection("Boost").getKeys(false));
ArrayList<String> sections = new ArrayList<>(conf.getConfigurationSection("Boost").getKeys(false));
for (String OneSection : sections) {
ConfigurationSection path = conf.getConfigurationSection("Boost." + OneSection);

View File

@ -32,8 +32,8 @@ import com.gamingmesh.jobs.stuff.Perm;
public class ShopManager {
private Jobs plugin;
public List<ShopItem> list = new ArrayList<ShopItem>();
public HashMap<String, Integer> GuiList = new HashMap<String, Integer>();
public List<ShopItem> list = new ArrayList<>();
public HashMap<String, Integer> GuiList = new HashMap<>();
public ShopManager(Jobs plugin) {
this.plugin = plugin;
@ -123,7 +123,6 @@ public class ShopManager {
}
for (JobItems one : item.getitems()) {
@SuppressWarnings("deprecation")
CMIMaterial mat = CMIMaterial.get(one.getId(), one.getData());
if (mat == null)
@ -167,7 +166,7 @@ public class ShopManager {
}
private List<ShopItem> getItemsByPage(Integer page) {
List<ShopItem> ls = new ArrayList<ShopItem>();
List<ShopItem> ls = new ArrayList<>();
for (ShopItem one : list) {
if (one.getPage() == page)
ls.add(one);
@ -237,9 +236,8 @@ public class ShopManager {
ShopItem item = ls.get(i);
ArrayList<String> Lore = new ArrayList<String>();
ArrayList<String> Lore = new ArrayList<>();
@SuppressWarnings("deprecation")
CMIMaterial mat = CMIMaterial.get(item.getIconId(), item.getIconData());
if (item.isHideWithoutPerm()) {
@ -330,7 +328,7 @@ public class ShopManager {
return;
ConfigurationSection ConfCategory = f.getConfigurationSection("Items");
ArrayList<String> categoriesList = new ArrayList<String>(ConfCategory.getKeys(false));
ArrayList<String> categoriesList = new ArrayList<>(ConfCategory.getKeys(false));
if (categoriesList.size() == 0)
return;
int i = 0;
@ -363,7 +361,7 @@ public class ShopManager {
Sitem.setIconName(ChatColor.translateAlternateColorCodes('&', NameSection.getString("Icon.Name")));
if (NameSection.isList("Icon.Lore")) {
List<String> lore = new ArrayList<String>();
List<String> lore = new ArrayList<>();
if (NameSection.getStringList("Icon.Lore") != null)
for (String eachLine : NameSection.getStringList("Icon.Lore")) {
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
@ -382,7 +380,7 @@ public class ShopManager {
Sitem.setRequiredTotalLevels(NameSection.getInt("RequiredTotalLevels"));
if (NameSection.isList("RequiredJobLevels")) {
HashMap<String, Integer> RequiredJobs = new HashMap<String, Integer>();
HashMap<String, Integer> RequiredJobs = new HashMap<>();
for (String one : NameSection.getStringList("RequiredJobLevels")) {
if (!one.contains("-"))
continue;
@ -400,7 +398,7 @@ public class ShopManager {
}
if (NameSection.isList("PerformCommands")) {
List<String> cmd = new ArrayList<String>();
List<String> cmd = new ArrayList<>();
if (NameSection.getStringList("PerformCommands") != null)
for (String eachLine : NameSection.getStringList("PerformCommands")) {
cmd.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
@ -412,7 +410,7 @@ public class ShopManager {
ConfigurationSection itemsSection = NameSection.getConfigurationSection("GiveItems");
Set<String> itemKeys = itemsSection.getKeys(false);
List<JobItems> items = new ArrayList<JobItems>();
List<JobItems> items = new ArrayList<>();
for (String oneItemName : itemKeys) {
@ -434,13 +432,13 @@ public class ShopManager {
if (itemSection.isString("Name"))
name = org.bukkit.ChatColor.translateAlternateColorCodes('&', itemSection.getString("Name"));
List<String> lore = new ArrayList<String>();
List<String> lore = new ArrayList<>();
if (itemSection.getStringList("Lore") != null)
for (String eachLine : itemSection.getStringList("Lore")) {
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
}
HashMap<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
HashMap<Enchantment, Integer> enchants = new HashMap<>();
if (itemSection.getStringList("Enchants") != null)
for (String eachLine : itemSection.getStringList("Enchants")) {

View File

@ -16,7 +16,7 @@ import com.gamingmesh.jobs.stuff.ChatColor;
public class TitleManager {
protected List<Title> titles = new ArrayList<Title>();
protected List<Title> titles = new ArrayList<>();
private Jobs plugin;

View File

@ -4,7 +4,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.logging.Level;

View File

@ -5,7 +5,7 @@ import java.util.Set;
public class ArchivedJobs {
private Set<JobProgression> jobs = new HashSet<JobProgression>();
private Set<JobProgression> jobs = new HashSet<>();
public Set<JobProgression> getArchivedJobs() {
return jobs;

View File

@ -6,7 +6,7 @@ import com.gamingmesh.jobs.PlayerManager.BoostOf;
public class Boost {
HashMap<BoostOf, BoostMultiplier> map = new HashMap<BoostOf, BoostMultiplier>();
HashMap<BoostOf, BoostMultiplier> map = new HashMap<>();
public Boost() {
for (BoostOf one : BoostOf.values()) {

View File

@ -4,7 +4,7 @@ import java.util.HashMap;
public class BoostMultiplier {
HashMap<CurrencyType, Double> map = new HashMap<CurrencyType, Double>();
HashMap<CurrencyType, Double> map = new HashMap<>();
@Override
public BoostMultiplier clone() {

View File

@ -5,13 +5,12 @@ import java.util.HashSet;
import java.util.Set;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.stuff.Debug;
public class ExploreChunk {
int x;
int z;
Set<String> playerNames = new HashSet<String>();
Set<String> playerNames = new HashSet<>();
private Integer dbId = null;
private boolean updated = false;

View File

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

View File

@ -33,11 +33,10 @@ import org.bukkit.inventory.ItemStack;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.resources.jfep.Parser;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
public class Job {
// job info
private EnumMap<ActionType, List<JobInfo>> jobInfo = new EnumMap<ActionType, List<JobInfo>>(ActionType.class);
private EnumMap<ActionType, List<JobInfo>> jobInfo = new EnumMap<>(ActionType.class);
// permissions
private List<JobPermission> jobPermissions;
// commands
@ -67,9 +66,9 @@ public class Job {
// max number of people allowed with this job on the server.
private Integer maxSlots;
// Commands to be performed on player job join
private List<String> CmdOnJoin = new ArrayList<String>();
private List<String> CmdOnJoin = new ArrayList<>();
// Commands to be performed on player job leave
private List<String> CmdOnLeave = new ArrayList<String>();
private List<String> CmdOnLeave = new ArrayList<>();
// Item for GUI
private ItemStack GUIitem;
// Item for GUI
@ -83,9 +82,9 @@ public class Job {
private Parser moneyEquation, xpEquation, pointsEquation;
private List<String> fDescription = new ArrayList<String>();
private List<String> fDescription = new ArrayList<>();
private List<Quest> quests = new ArrayList<Quest>();
private List<Quest> quests = new ArrayList<>();
private int maxDailyQuests = 1;
/**
@ -454,7 +453,7 @@ public class Job {
// }
public Quest getNextQuest(List<String> excludeQuests, Integer level) {
List<Quest> ls = new ArrayList<Quest>(this.quests);
List<Quest> ls = new ArrayList<>(this.quests);
Collections.shuffle(ls);
int i = 0;

View File

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

View File

@ -24,9 +24,9 @@ import java.util.List;
public class JobConditions {
private String node;
private List<String> requiresPerm = new ArrayList<String>();
private HashMap<String, Integer> requiresJobs = new HashMap<String, Integer>();
private HashMap<String, Boolean> performPerm = new HashMap<String, Boolean>();
private List<String> requiresPerm = new ArrayList<>();
private HashMap<String, Integer> requiresJobs = new HashMap<>();
private HashMap<String, Boolean> performPerm = new HashMap<>();
public JobConditions(String node, List<String> requires, List<String> perform) {
this.node = node;

View File

@ -70,7 +70,7 @@ public class JobItems {
if (this.name != null)
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
if (lore != null) {
List<String> TranslatedLore = new ArrayList<String>();
List<String> TranslatedLore = new ArrayList<>();
for (String oneLore : lore) {
TranslatedLore.add(ChatColor.translateAlternateColorCodes('&', oneLore.replace("[player]", player.getName())));
}

View File

@ -148,14 +148,14 @@ public class JobProgression {
* Reloads max experience
*/
public void reloadMaxExperience() {
HashMap<String, Double> param = new HashMap<String, Double>();
HashMap<String, Double> param = new HashMap<>();
param.put("joblevel", (double) level);
param.put("numjobs", (double) jPlayer.getJobProgression().size());
this.maxExperience = (int) job.getMaxExp(param);
}
public int getMaxExperience(int level) {
HashMap<String, Double> param = new HashMap<String, Double>();
HashMap<String, Double> param = new HashMap<>();
param.put("joblevel", (double) level);
param.put("numjobs", (double) jPlayer.getJobProgression().size());
return (int) job.getMaxExp(param);

View File

@ -42,12 +42,12 @@ public class JobsPlayer {
private String userName;
// progression of the player in each job
public UUID playerUUID;
public ArrayList<JobProgression> progression = new ArrayList<JobProgression>();
public ArrayList<JobProgression> progression = new ArrayList<>();
private ArchivedJobs archivedJobs = new ArchivedJobs();
private PaymentData paymentLimits = null;
private HashMap<String, ArrayList<BoostCounter>> boostCounter = new HashMap<String, ArrayList<BoostCounter>>();
private HashMap<String, ArrayList<BoostCounter>> boostCounter = new HashMap<>();
// display honorific
private String honorific;
@ -59,24 +59,24 @@ public class JobsPlayer {
private OfflinePlayer OffPlayer = null;
private Player player = null;
private HashMap<CurrencyType, Integer> limits = new HashMap<CurrencyType, Integer>();
private HashMap<CurrencyType, Integer> limits = new HashMap<>();
private int userid = -1;
List<BossBarInfo> barMap = new ArrayList<BossBarInfo>();
List<String> updateBossBarFor = new ArrayList<String>();
List<BossBarInfo> barMap = new ArrayList<>();
List<String> updateBossBarFor = new ArrayList<>();
// save lock
// public final Object saveLock = new Object();
// log
private HashMap<String, Log> logList = new HashMap<String, Log>();
private HashMap<String, Log> logList = new HashMap<>();
private Long seen = System.currentTimeMillis();
private HashMap<String, Boolean> permissionsCache = null;
private Long lastPermissionUpdate = -1L;
private HashMap<String, List<QuestProgression>> qProgression = new HashMap<String, List<QuestProgression>>();
private HashMap<String, List<QuestProgression>> qProgression = new HashMap<>();
private int doneQuests = 0;
public JobsPlayer(String userName, OfflinePlayer player) {
@ -239,7 +239,7 @@ public class JobsPlayer {
Boost = getPlayerBoostNew(JobName, type);
ArrayList<BoostCounter> counterList = new ArrayList<BoostCounter>();
ArrayList<BoostCounter> counterList = new ArrayList<>();
counterList.add(new BoostCounter(type, Boost, time));
boostCounter.put(JobName, counterList);
@ -840,7 +840,7 @@ public class JobsPlayer {
}
private List<String> getQuestNameList(Job job, ActionType type) {
List<String> ls = new ArrayList<String>();
List<String> ls = new ArrayList<>();
if (!this.isInJob(job))
return ls;
@ -868,7 +868,7 @@ public class JobsPlayer {
}
public List<QuestProgression> getQuestProgressions() {
List<QuestProgression> g = new ArrayList<QuestProgression>();
List<QuestProgression> g = new ArrayList<>();
for (JobProgression one : this.getJobProgression()) {
g.addAll(this.getQuestProgressions(one.getJob()));
}
@ -882,12 +882,12 @@ public class JobsPlayer {
public List<QuestProgression> getQuestProgressions(Job job, ActionType type) {
if (!this.isInJob(job))
return null;
List<QuestProgression> g = new ArrayList<QuestProgression>();
List<QuestProgression> g = new ArrayList<>();
if (this.qProgression.get(job.getName()) != null)
g = new ArrayList<QuestProgression>(this.qProgression.get(job.getName()));
g = new ArrayList<>(this.qProgression.get(job.getName()));
List<QuestProgression> tmp = new ArrayList<QuestProgression>();
List<QuestProgression> tmp = new ArrayList<>();
if (!g.isEmpty()) {
if (g.get(0).isEnded()) {

View File

@ -7,7 +7,7 @@ import com.gamingmesh.jobs.stuff.TimeManage;
public final class Log {
private String action;
private int day;
private HashMap<String, LogAmounts> amountMap = new HashMap<String, LogAmounts>();
private HashMap<String, LogAmounts> amountMap = new HashMap<>();
public Log(String action) {
this.action = action;

View File

@ -11,7 +11,7 @@ public final class LogAmounts {
private String item;
private int count = 0;
private HashMap<CurrencyType, Double> amounts = new HashMap<CurrencyType, Double>();
private HashMap<CurrencyType, Double> amounts = new HashMap<>();
private boolean newEntry = true;

View File

@ -24,8 +24,8 @@ public class Quest {
private int amount = Integer.MAX_VALUE;
private List<String> rewardCmds = new ArrayList<String>();
private List<String> rewards = new ArrayList<String>();
private List<String> rewardCmds = new ArrayList<>();
private List<String> rewards = new ArrayList<>();
public Quest(String questName, Job job, ActionType action) {
this.questName = questName;

View File

@ -22,13 +22,13 @@ public class Schedule {
String Name = null;
List<String> Days = new ArrayList<String>(Arrays.asList("all"));
List<Job> JobsList = new ArrayList<Job>();
List<String> Days = new ArrayList<>(Arrays.asList("all"));
List<Job> JobsList = new ArrayList<>();
List<String> MessageOnStart = new ArrayList<String>();
List<String> MessageOnStop = new ArrayList<String>();
List<String> MessageOnStart = new ArrayList<>();
List<String> MessageOnStop = new ArrayList<>();
List<String> MessageToBroadcast = new ArrayList<String>();
List<String> MessageToBroadcast = new ArrayList<>();
boolean started = false;
boolean stoped = true;
@ -173,7 +173,7 @@ public class Schedule {
}
public void setMessageOnStart(List<String> msg, String From, String Until) {
List<String> temp = new ArrayList<String>();
List<String> temp = new ArrayList<>();
for (String one : msg) {
temp.add(ChatColor.translateAlternateColorCodes('&', one.replace("[until]", Until).replace("[from]", From)));
}
@ -185,7 +185,7 @@ public class Schedule {
}
public void setMessageOnStop(List<String> msg, String From, String Until) {
List<String> temp = new ArrayList<String>();
List<String> temp = new ArrayList<>();
for (String one : msg) {
temp.add(ChatColor.translateAlternateColorCodes('&', one.replace("[until]", Until).replace("[from]", From)));
}
@ -197,7 +197,7 @@ public class Schedule {
}
public void setMessageToBroadcast(List<String> msg, String From, String Until) {
List<String> temp = new ArrayList<String>();
List<String> temp = new ArrayList<>();
for (String one : msg) {
temp.add(ChatColor.translateAlternateColorCodes('&', one.replace("[until]", Until).replace("[from]", From)));
}

View File

@ -17,17 +17,17 @@ public class ShopItem {
private int IconData = 0;
private int IconAmount = 1;
private String IconName = null;
private List<String> IconLore = new ArrayList<String>();
private List<String> IconLore = new ArrayList<>();
private boolean HideWithoutPerm = false;
private int RequiredTotalLevels = -1;
private List<String> RequiredPerm = new ArrayList<String>();
private HashMap<String, Integer> RequiredJobs = new HashMap<String, Integer>();
private List<String> RequiredPerm = new ArrayList<>();
private HashMap<String, Integer> RequiredJobs = new HashMap<>();
private List<String> Commands = new ArrayList<String>();
private List<String> Commands = new ArrayList<>();
private List<JobItems> items = new ArrayList<JobItems>();
private List<JobItems> items = new ArrayList<>();
public ShopItem(String NodeName, double price, int IconId) {
this.NodeName = NodeName;

View File

@ -500,7 +500,7 @@ public abstract class JobsDAO {
else
userData = Jobs.getPlayerManager().getPlayerInfo(uuid);
ArrayList<JobsDAOData> jobs = new ArrayList<JobsDAOData>();
ArrayList<JobsDAOData> jobs = new ArrayList<>();
if (userData == null) {
recordNewPlayer(playerName, uuid);
@ -531,7 +531,7 @@ public abstract class JobsDAO {
}
public HashMap<Integer, List<JobsDAOData>> getAllJobs() {
HashMap<Integer, List<JobsDAOData>> map = new HashMap<Integer, List<JobsDAOData>>();
HashMap<Integer, List<JobsDAOData>> map = new HashMap<>();
JobsConnection conn = getConnection();
if (conn == null)
return map;
@ -544,7 +544,7 @@ public abstract class JobsDAO {
int id = res.getInt("userid");
List<JobsDAOData> ls = map.get(id);
if (ls == null)
ls = new ArrayList<JobsDAOData>();
ls = new ArrayList<>();
ls.add(new JobsDAOData(res.getString("job"), res.getInt("level"), res.getInt("experience")));
map.put(id, ls);
}
@ -558,7 +558,7 @@ public abstract class JobsDAO {
}
public HashMap<Integer, PlayerPoints> getAllPoints() {
HashMap<Integer, PlayerPoints> map = new HashMap<Integer, PlayerPoints>();
HashMap<Integer, PlayerPoints> map = new HashMap<>();
JobsConnection conn = getConnection();
if (conn == null)
return map;
@ -580,7 +580,7 @@ public abstract class JobsDAO {
}
public HashMap<Integer, ArchivedJobs> getAllArchivedJobs() {
HashMap<Integer, ArchivedJobs> map = new HashMap<Integer, ArchivedJobs>();
HashMap<Integer, ArchivedJobs> map = new HashMap<>();
JobsConnection conn = getConnection();
if (conn == null)
return map;
@ -621,7 +621,7 @@ public abstract class JobsDAO {
}
public HashMap<Integer, HashMap<String, Log>> getAllLogs() {
HashMap<Integer, HashMap<String, Log>> map = new HashMap<Integer, HashMap<String, Log>>();
HashMap<Integer, HashMap<String, Log>> map = new HashMap<>();
JobsConnection conn = getConnection();
if (conn == null)
return map;
@ -638,14 +638,14 @@ public abstract class JobsDAO {
HashMap<String, Log> m = map.get(id);
if (m == null)
m = new HashMap<String, Log>();
m = new HashMap<>();
String action = res.getString("action");
Log log = m.get(action);
if (log == null)
log = new Log(action);
HashMap<CurrencyType, Double> amounts = new HashMap<CurrencyType, Double>();
HashMap<CurrencyType, Double> amounts = new HashMap<>();
amounts.put(CurrencyType.MONEY, res.getDouble("money"));
amounts.put(CurrencyType.EXP, res.getDouble("exp"));
amounts.put(CurrencyType.POINTS, res.getDouble("points"));
@ -667,7 +667,7 @@ public abstract class JobsDAO {
return map;
}
private HashMap<Integer, ArrayList<JobsDAOData>> map = new HashMap<Integer, ArrayList<JobsDAOData>>();
private HashMap<Integer, ArrayList<JobsDAOData>> map = new HashMap<>();
public List<JobsDAOData> getAllJobs(PlayerInfo pInfo) {
List<JobsDAOData> list = map.get(pInfo.getID());
@ -796,7 +796,7 @@ public abstract class JobsDAO {
*/
public synchronized List<JobsDAOData> getAllJobsOffline(String userName) {
ArrayList<JobsDAOData> jobs = new ArrayList<JobsDAOData>();
ArrayList<JobsDAOData> jobs = new ArrayList<>();
PlayerInfo info = Jobs.getPlayerManager().getPlayerInfo(userName);
if (info == null)
@ -900,7 +900,7 @@ public abstract class JobsDAO {
}
public synchronized HashMap<Integer, PaymentData> loadPlayerLimits() {
HashMap<Integer, PaymentData> map = new HashMap<Integer, PaymentData>();
HashMap<Integer, PaymentData> map = new HashMap<>();
JobsConnection conn = getConnection();
if (conn == null)
return map;
@ -993,7 +993,7 @@ public abstract class JobsDAO {
if (conn == null)
return null;
List<Convert> list = new ArrayList<Convert>();
List<Convert> list = new ArrayList<>();
PreparedStatement prest = null;
ResultSet res = null;
try {
@ -1139,7 +1139,7 @@ public abstract class JobsDAO {
public List<TopList> getGlobalTopList(int start) {
JobsConnection conn = getConnection();
List<TopList> names = new ArrayList<TopList>();
List<TopList> names = new ArrayList<>();
if (conn == null)
return names;
@ -1558,7 +1558,7 @@ public abstract class JobsDAO {
res = prest.executeQuery();
while (res.next()) {
HashMap<CurrencyType, Double> amounts = new HashMap<CurrencyType, Double>();
HashMap<CurrencyType, Double> amounts = new HashMap<>();
amounts.put(CurrencyType.MONEY, res.getDouble("money"));
amounts.put(CurrencyType.EXP, res.getDouble("exp"));
amounts.put(CurrencyType.POINTS, res.getDouble("points"));
@ -1789,7 +1789,7 @@ public abstract class JobsDAO {
conn.setAutoCommit(false);
int i = 0;
HashMap<String, ExploreRegion> temp = new HashMap<String, ExploreRegion>(Jobs.getExplore().getWorlds());
HashMap<String, ExploreRegion> temp = new HashMap<>(Jobs.getExplore().getWorlds());
for (Entry<String, ExploreRegion> worlds : temp.entrySet()) {
for (Entry<String, ExploreChunk> oneChunk : worlds.getValue().getChunks().entrySet()) {
@ -1838,7 +1838,7 @@ public abstract class JobsDAO {
int i = 0;
HashMap<String, ExploreRegion> temp = new HashMap<String, ExploreRegion>(Jobs.getExplore().getWorlds());
HashMap<String, ExploreRegion> temp = new HashMap<>(Jobs.getExplore().getWorlds());
for (Entry<String, ExploreRegion> worlds : temp.entrySet()) {
for (Entry<String, ExploreChunk> oneChunk : worlds.getValue().getChunks().entrySet()) {
@ -1935,7 +1935,7 @@ public abstract class JobsDAO {
*/
public List<Integer> getLognameList(int fromtime, int untiltime) {
JobsConnection conn = getConnection();
List<Integer> nameList = new ArrayList<Integer>();
List<Integer> nameList = new ArrayList<>();
if (conn == null)
return nameList;
PreparedStatement prest = null;
@ -1964,7 +1964,7 @@ public abstract class JobsDAO {
* @return
*/
public ArrayList<TopList> toplist(String jobsname, int limit) {
ArrayList<TopList> jobs = new ArrayList<TopList>();
ArrayList<TopList> jobs = new ArrayList<>();
JobsConnection conn = getConnection();
if (conn == null)
return jobs;

View File

@ -36,8 +36,8 @@ import com.gamingmesh.jobs.tasks.BufferedPaymentTask;
public class BufferedEconomy {
private Jobs plugin;
private Economy economy;
private LinkedBlockingQueue<BufferedPayment> payments = new LinkedBlockingQueue<BufferedPayment>();
private final Map<UUID, BufferedPayment> paymentCache = Collections.synchronizedMap(new HashMap<UUID, BufferedPayment>());
private LinkedBlockingQueue<BufferedPayment> payments = new LinkedBlockingQueue<>();
private final Map<UUID, BufferedPayment> paymentCache = Collections.synchronizedMap(new HashMap<>());
private OfflinePlayer ServerAccount = null;
private OfflinePlayer ServerTaxesAccount = null;

View File

@ -8,8 +8,8 @@ import com.gamingmesh.jobs.container.CurrencyType;
public class PaymentData {
Long lastAnnouced = 0L;
HashMap<CurrencyType, Double> payments = new HashMap<CurrencyType, Double>();
HashMap<CurrencyType, Long> paymentsTimes = new HashMap<CurrencyType, Long>();
HashMap<CurrencyType, Double> payments = new HashMap<>();
HashMap<CurrencyType, Long> paymentsTimes = new HashMap<>();
private boolean Informed = false;
private boolean Reseted = false;

View File

@ -7,7 +7,7 @@ import com.gamingmesh.jobs.container.PlayerPoints;
public class PointsData {
HashMap<UUID, PlayerPoints> Pointbase = new HashMap<UUID, PlayerPoints>();
HashMap<UUID, PlayerPoints> Pointbase = new HashMap<>();
public PointsData() {
}

View File

@ -65,11 +65,11 @@ public class Language {
String msg = "";
try {
if (customlocale == null || !customlocale.contains(key))
msg = enlocale.contains(key) == true ? ChatColor.translateAlternateColorCodes('&', enlocale.getString(key)) : missing;
msg = enlocale.contains(key) == true ? Colors(enlocale.getString(key)) : missing;
else
msg = customlocale.contains(key) == true ? ChatColor.translateAlternateColorCodes('&', customlocale.getString(key)) : missing;
msg = customlocale.contains(key) == true ? Colors(customlocale.getString(key)) : missing;
} catch (Exception e) {
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] &2Cant read language file. Plugin will be disabled.");
String message = Colors("&e[Jobs] &2Cant read language file. Plugin will be disabled.");
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
console.sendMessage(message);
throw e;
@ -105,7 +105,7 @@ public class Language {
msg = msg.replace(String.valueOf(variables[y]), String.valueOf(variables[y + 1]));
}
msg = filterNewLine(msg);
ls.set(i, ChatColor.translateAlternateColorCodes('&', msg));
ls.set(i, Colors(msg));
}
return ls;
@ -121,7 +121,7 @@ public class Language {
}
public List<String> ColorsArray(List<String> text, Boolean colorize) {
List<String> temp = new ArrayList<String>();
List<String> temp = new ArrayList<>();
for (String part : text) {
if (colorize)
part = Colors(part);
@ -141,7 +141,7 @@ public class Language {
* @return the message
*/
public String getDefaultMessage(String key) {
return enlocale.contains(key) == true ? ChatColor.translateAlternateColorCodes('&', enlocale.getString(key)) : "Cant find locale";
return enlocale.contains(key) == true ? Colors(enlocale.getString(key)) : "Cant find locale";
}
/**

View File

@ -81,14 +81,13 @@ import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsArmorChangeEvent;
import com.gamingmesh.jobs.container.JobsArmorChangeEvent.EquipMethod;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.Util;
public class JobsListener implements Listener {
// hook to the main plugin
private Jobs plugin;
private HashMap<UUID, Long> interactDelay = new HashMap<UUID, Long>();
private HashMap<UUID, Long> interactDelay = new HashMap<>();
public JobsListener(Jobs plugin) {
this.plugin = plugin;
@ -662,7 +661,7 @@ public class JobsListener implements Listener {
String name = null;
List<String> lore = new ArrayList<String>();
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
Map<Enchantment, Integer> enchants = new HashMap<>();
try {
enchants = iih.getEnchantments();
} catch (Exception e) {
@ -834,8 +833,6 @@ public class JobsListener implements Listener {
@EventHandler
public void playerInteractEvent(PlayerInteractEvent event) {
// if (event.isCancelled())
// return;
Action action = event.getAction();
if (action == Action.PHYSICAL)

View File

@ -564,7 +564,7 @@ public class JobsPaymentListener implements Listener {
// Checking if item is been repaired, not crafted. Combining 2 items
ItemStack[] sourceItems = event.getInventory().getContents();
// For dye check
List<ItemStack> DyeStack = new ArrayList<ItemStack>();
List<ItemStack> DyeStack = new ArrayList<>();
int y = -1;
int first = 0;
int second = 0;

View File

@ -26,7 +26,7 @@ public class McMMOlistener implements Listener {
private Jobs plugin;
public boolean mcMMOPresent = false;
HashMap<String, HashMap<AbilityType, Long>> map = new HashMap<String, HashMap<AbilityType, Long>>();
HashMap<String, HashMap<AbilityType, Long>> map = new HashMap<>();
public McMMOlistener(Jobs plugin) {
this.plugin = plugin;
@ -61,7 +61,7 @@ public class McMMOlistener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void OnAbilityOn(McMMOPlayerAbilityActivateEvent event) {
HashMap<AbilityType, Long> InfoMap = new HashMap<AbilityType, Long>();
HashMap<AbilityType, Long> InfoMap = new HashMap<>();
if (map.containsKey(event.getPlayer().getName()))
InfoMap = map.get(event.getPlayer().getName());
InfoMap.put(event.getAbility(), System.currentTimeMillis() + (event.getAbility().getMaxLength() * 1000));

View File

@ -23,7 +23,7 @@ import com.gamingmesh.jobs.NMS;
public class v1_10 implements NMS {
@Override
public List<Block> getPistonRetractBlocks(BlockPistonRetractEvent event) {
List<Block> blocks = new ArrayList<Block>();
List<Block> blocks = new ArrayList<>();
blocks.addAll(event.getBlocks());
return blocks;
}

View File

@ -16,7 +16,7 @@ import com.gamingmesh.jobs.NMS;
public class v1_11 implements NMS {
@Override
public List<Block> getPistonRetractBlocks(BlockPistonRetractEvent event) {
List<Block> blocks = new ArrayList<Block>();
List<Block> blocks = new ArrayList<>();
blocks.addAll(event.getBlocks());
return blocks;
}

View File

@ -16,7 +16,7 @@ import com.gamingmesh.jobs.NMS;
public class v1_12 implements NMS {
@Override
public List<Block> getPistonRetractBlocks(BlockPistonRetractEvent event) {
List<Block> blocks = new ArrayList<Block>();
List<Block> blocks = new ArrayList<>();
blocks.addAll(event.getBlocks());
return blocks;
}

View File

@ -13,7 +13,7 @@ import com.gamingmesh.jobs.NMS;
public class v1_13 implements NMS {
@Override
public List<Block> getPistonRetractBlocks(BlockPistonRetractEvent event) {
List<Block> blocks = new ArrayList<Block>();
List<Block> blocks = new ArrayList<>();
blocks.addAll(event.getBlocks());
return blocks;
}

View File

@ -1,7 +1,6 @@
package com.gamingmesh.jobs.nmsUtil;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import org.bukkit.block.Block;
@ -20,7 +19,7 @@ import com.gamingmesh.jobs.NMS;
public class v1_7 implements NMS {
@Override
public List<Block> getPistonRetractBlocks(BlockPistonRetractEvent event) {
List<Block> blocks = new ArrayList<Block>();
List<Block> blocks = new ArrayList<>();
blocks.add(event.getBlock());
return blocks;
}
@ -52,7 +51,6 @@ public class v1_7 implements NMS {
return name;
}
@SuppressWarnings("deprecation")
@Override
public ItemStack getItemInMainHand(Player player) {
return player.getInventory().getItemInHand();

View File

@ -2,9 +2,7 @@ package com.gamingmesh.jobs.nmsUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Guardian;
@ -22,7 +20,7 @@ import com.gamingmesh.jobs.NMS;
public class v1_8 implements NMS {
@Override
public List<Block> getPistonRetractBlocks(BlockPistonRetractEvent event) {
List<Block> blocks = new ArrayList<Block>();
List<Block> blocks = new ArrayList<>();
blocks.addAll(event.getBlocks());
return blocks;
}
@ -59,7 +57,6 @@ public class v1_8 implements NMS {
return name;
}
@SuppressWarnings("deprecation")
@Override
public ItemStack getItemInMainHand(Player player) {
return player.getInventory().getItemInHand();

View File

@ -22,7 +22,7 @@ import com.gamingmesh.jobs.NMS;
public class v1_9 implements NMS {
@Override
public List<Block> getPistonRetractBlocks(BlockPistonRetractEvent event) {
List<Block> blocks = new ArrayList<Block>();
List<Block> blocks = new ArrayList<>();
blocks.addAll(event.getBlocks());
return blocks;
}

View File

@ -76,8 +76,8 @@ public class Parser {
root = null;
inp_cur = 0;
this.error = error;
functions = new HashSet<String>();
variables = new HashSet<String>();
functions = new HashSet<>();
variables = new HashSet<>();
}
/**

View File

@ -14,8 +14,8 @@ public class SelectionManager {
public static final int MIN_HEIGHT = 0;
public SelectionManager() {
playerLoc1 = Collections.synchronizedMap(new HashMap<String, Location>());
playerLoc2 = Collections.synchronizedMap(new HashMap<String, Location>());
playerLoc1 = Collections.synchronizedMap(new HashMap<>());
playerLoc2 = Collections.synchronizedMap(new HashMap<>());
}
public void updateLocations(Player player, Location loc1, Location loc2) {

View File

@ -23,7 +23,7 @@ import com.gamingmesh.jobs.stuff.VersionChecker.Version;
public class CMIScoreboardManager {
private ConcurrentHashMap<UUID, ScoreboardInfo> timerMap = new ConcurrentHashMap<UUID, ScoreboardInfo>();
private ConcurrentHashMap<UUID, ScoreboardInfo> timerMap = new ConcurrentHashMap<>();
private Jobs plugin;
public CMIScoreboardManager(Jobs plugin) {

View File

@ -43,9 +43,9 @@ public enum ChatColor {
private final char code;
private final int intCode;
private final String toString;
private final static Map<Integer, ChatColor> intMap = new HashMap<Integer, ChatColor>();
private final static Map<Character, ChatColor> charMap = new HashMap<Character, ChatColor>();
private final static Map<String, ChatColor> stringMap = new HashMap<String, ChatColor>();
private final static Map<Integer, ChatColor> intMap = new HashMap<>();
private final static Map<Character, ChatColor> charMap = new HashMap<>();
private final static Map<String, ChatColor> stringMap = new HashMap<>();
private ChatColor(char code, int intCode) {
this.code = code;

View File

@ -26,8 +26,8 @@ public class FurnaceBrewingHandling {
public FurnaceBrewingHandling() {
}
static HashMap<UUID, List<blockLoc>> furnaceMap = new HashMap<UUID, List<blockLoc>>();
static HashMap<UUID, List<blockLoc>> brewingMap = new HashMap<UUID, List<blockLoc>>();
static HashMap<UUID, List<blockLoc>> furnaceMap = new HashMap<>();
static HashMap<UUID, List<blockLoc>> brewingMap = new HashMap<>();
public static void load() {
YmlMaker f = new YmlMaker(Jobs.getInstance(), "furnaceBrewingStands.yml");
@ -39,14 +39,14 @@ public class FurnaceBrewingHandling {
int totalf = 0;
int totalb = 0;
if (Jobs.getGCManager().isFurnacesReassign())
if (Jobs.getGCManager().isFurnacesReassign()) {
if (config.contains("Furnace")) {
ConfigurationSection section = config.getConfigurationSection("Furnace");
try {
for (String one : section.getKeys(false)) {
String value = section.getString(one);
List<String> ls = new ArrayList<String>();
List<String> ls = new ArrayList<>();
if (value.contains(";"))
ls.addAll(Arrays.asList(value.split(";")));
else
@ -55,7 +55,7 @@ public class FurnaceBrewingHandling {
if (uuid == null)
continue;
List<blockLoc> blist = new ArrayList<blockLoc>();
List<blockLoc> blist = new ArrayList<>();
for (String oneL : ls) {
blockLoc bl = new blockLoc(oneL);
Block block = bl.getBlock();
@ -76,6 +76,7 @@ public class FurnaceBrewingHandling {
e.printStackTrace();
}
}
}
if (Jobs.getGCManager().isBrewingStandsReassign())
if (config.contains("Brewing")) {
@ -84,7 +85,7 @@ public class FurnaceBrewingHandling {
try {
for (String one : section.getKeys(false)) {
String value = section.getString(one);
List<String> ls = new ArrayList<String>();
List<String> ls = new ArrayList<>();
if (value.contains(";"))
ls.addAll(Arrays.asList(value.split(";")));
else
@ -94,7 +95,7 @@ public class FurnaceBrewingHandling {
if (uuid == null)
continue;
List<blockLoc> blist = new ArrayList<blockLoc>();
List<blockLoc> blist = new ArrayList<>();
for (String oneL : ls) {
blockLoc bl = new blockLoc(oneL);
Block block = bl.getBlock();
@ -284,7 +285,7 @@ public class FurnaceBrewingHandling {
List<blockLoc> ls = furnaceMap.get(player.getUniqueId());
if (ls == null)
ls = new ArrayList<blockLoc>();
ls = new ArrayList<>();
ls.add(new blockLoc(block.getLocation()));
furnaceMap.put(player.getUniqueId(), ls);
@ -329,7 +330,7 @@ public class FurnaceBrewingHandling {
List<blockLoc> ls = brewingMap.get(player.getUniqueId());
if (ls == null)
ls = new ArrayList<blockLoc>();
ls = new ArrayList<>();
ls.add(new blockLoc(block.getLocation()));
brewingMap.put(player.getUniqueId(), ls);

View File

@ -6,7 +6,6 @@ import java.util.List;
import java.util.Map.Entry;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -16,13 +15,12 @@ import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial;
public class GiveItem {
public static boolean GiveItemForPlayer(Player player, int id, int meta, int qty, String name, List<String> lore, HashMap<Enchantment, Integer> hashMap) {
@SuppressWarnings("deprecation")
ItemStack itemStack = CMIMaterial.get(id, meta).newItemStack();
itemStack.setAmount(qty);
ItemMeta ItemMeta = itemStack.getItemMeta();
if (lore != null) {
List<String> TranslatedLore = new ArrayList<String>();
List<String> TranslatedLore = new ArrayList<>();
for (String oneLore : lore) {
TranslatedLore.add(ChatColor.translateAlternateColorCodes('&', oneLore.replace("[player]", player.getName())));
}

View File

@ -9,14 +9,14 @@ import org.bukkit.entity.Player;
public class RawMessage {
List<String> parts = new ArrayList<String>();
List<String> cleanParts = new ArrayList<String>();
List<String> parts = new ArrayList<>();
List<String> cleanParts = new ArrayList<>();
String combined = "";
String combinedClean = "";
public void clear() {
parts = new ArrayList<String>();
cleanParts = new ArrayList<String>();
parts = new ArrayList<>();
cleanParts = new ArrayList<>();
combined = "";
combinedClean = "";
}

View File

@ -14,7 +14,7 @@ public class Sorting {
public static Map<String, Integer> sortDESC(Map<String, Integer> unsortMap) {
// Convert Map to List
List<Map.Entry<String, Integer>> list = new LinkedList<Map.Entry<String, Integer>>(unsortMap.entrySet());
List<Map.Entry<String, Integer>> list = new LinkedList<>(unsortMap.entrySet());
// Sort list with comparator, to compare the Map values
Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
@ -25,7 +25,7 @@ public class Sorting {
});
// Convert sorted map back to a Map
Map<String, Integer> sortedMap = new LinkedHashMap<String, Integer>();
Map<String, Integer> sortedMap = new LinkedHashMap<>();
for (Iterator<Map.Entry<String, Integer>> it = list.iterator(); it.hasNext();) {
Map.Entry<String, Integer> entry = it.next();
sortedMap.put(entry.getKey(), entry.getValue());
@ -36,7 +36,7 @@ public class Sorting {
public static Map<String, Double> sortDoubleDESC(Map<String, Double> unsortMap) {
// Convert Map to List
List<Map.Entry<String, Double>> list = new LinkedList<Map.Entry<String, Double>>(unsortMap.entrySet());
List<Map.Entry<String, Double>> list = new LinkedList<>(unsortMap.entrySet());
// Sort list with comparator, to compare the Map values
Collections.sort(list, new Comparator<Map.Entry<String, Double>>() {
@ -47,7 +47,7 @@ public class Sorting {
});
// Convert sorted map back to a Map
Map<String, Double> sortedMap = new LinkedHashMap<String, Double>();
Map<String, Double> sortedMap = new LinkedHashMap<>();
for (Iterator<Map.Entry<String, Double>> it = list.iterator(); it.hasNext();) {
Map.Entry<String, Double> entry = it.next();
sortedMap.put(entry.getKey(), entry.getValue());
@ -58,7 +58,7 @@ public class Sorting {
public static Map<LogAmounts, Double> sortDoubleDESCByLog(Map<LogAmounts, Double> unsortMap) {
// Convert Map to List
List<Map.Entry<LogAmounts, Double>> list = new LinkedList<Map.Entry<LogAmounts, Double>>(unsortMap.entrySet());
List<Map.Entry<LogAmounts, Double>> list = new LinkedList<>(unsortMap.entrySet());
// Sort list with comparator, to compare the Map values
Collections.sort(list, new Comparator<Map.Entry<LogAmounts, Double>>() {
@ -69,7 +69,7 @@ public class Sorting {
});
// Convert sorted map back to a Map
Map<LogAmounts, Double> sortedMap = new LinkedHashMap<LogAmounts, Double>();
Map<LogAmounts, Double> sortedMap = new LinkedHashMap<>();
for (Iterator<Map.Entry<LogAmounts, Double>> it = list.iterator(); it.hasNext();) {
Map.Entry<LogAmounts, Double> entry = it.next();
sortedMap.put(entry.getKey(), entry.getValue());
@ -80,7 +80,7 @@ public class Sorting {
public static Map<String, Integer> sortASC(Map<String, Integer> unsortMap) {
// Convert Map to List
List<Map.Entry<String, Integer>> list = new LinkedList<Map.Entry<String, Integer>>(unsortMap.entrySet());
List<Map.Entry<String, Integer>> list = new LinkedList<>(unsortMap.entrySet());
// Sort list with comparator, to compare the Map values
Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
@ -91,7 +91,7 @@ public class Sorting {
});
// Convert sorted map back to a Map
Map<String, Integer> sortedMap = new LinkedHashMap<String, Integer>();
Map<String, Integer> sortedMap = new LinkedHashMap<>();
for (Iterator<Map.Entry<String, Integer>> it = list.iterator(); it.hasNext();) {
Map.Entry<String, Integer> entry = it.next();
sortedMap.put(entry.getKey(), entry.getValue());

View File

@ -15,7 +15,6 @@ import org.bukkit.util.StringUtil;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobItemBonus;
import com.gamingmesh.jobs.container.JobItems;
import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
@ -28,7 +27,7 @@ public class TabComplete implements TabCompleter {
if (args.length == 1) {
String PartOfCommand = args[0];
List<String> temp = new ArrayList<String>();
List<String> temp = new ArrayList<>();
for (Entry<String, Integer> BCmd : Jobs.getCommandManager().GetCommands(sender).entrySet()) {
temp.add(BCmd.getKey());
@ -50,7 +49,7 @@ public class TabComplete implements TabCompleter {
continue;
String arg = ArgsList.get(i - 1);
List<String> temp = new ArrayList<String>();
List<String> temp = new ArrayList<>();
if (arg.contains("%%"))
for (String one : arg.split("%%")) {

View File

@ -24,7 +24,7 @@ public class Util {
public Util() {
}
private static HashMap<UUID, String> jobsEditorMap = new HashMap<UUID, String>();
private static HashMap<UUID, String> jobsEditorMap = new HashMap<>();
@SuppressWarnings("deprecation")
public static ItemStack setEntityType(ItemStack is, EntityType type) throws IllegalArgumentException {
@ -86,7 +86,7 @@ public class Util {
distance = 15 * 16;
if (distance < 1)
distance = 1;
ArrayList<Block> blocks = new ArrayList<Block>();
ArrayList<Block> blocks = new ArrayList<>();
Iterator<Block> itr = new BlockIterator(player, distance);
while (itr.hasNext()) {
Block block = itr.next();

View File

@ -108,20 +108,20 @@ public class VersionChecker {
return null;
}
public boolean isLower(Version version) {
return this.version.getValue() < version.getValue();
public boolean isLower(Version v) {
return version.getValue() < v.getValue();
}
public boolean isLowerEquals(Version version) {
return this.version.getValue() <= version.getValue();
public boolean isLowerEquals(Version v) {
return version.getValue() <= v.getValue();
}
public boolean isHigher(Version version) {
return this.version.getValue() > version.getValue();
public boolean isHigher(Version v) {
return version.getValue() > v.getValue();
}
public boolean isHigherEquals(Version version) {
return this.version.getValue() >= version.getValue();
public boolean isHigherEquals(Version v) {
return version.getValue() >= v.getValue();
}
public void VersionCheck(final Player player) {