1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Clean up code

Other:
- Removed unused imports.
- Removed deprecation methods.
- Support for WorldEdit 7.0.0
- Support for MyPet 3.0
This commit is contained in:
montlikadani 2018-08-20 17:07:20 +02:00
parent 7fc27936ab
commit f3c456c046
29 changed files with 13 additions and 58 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

@ -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;

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

@ -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 {
@ -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

@ -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

@ -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,7 +361,6 @@ 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");

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,7 +15,6 @@ 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 {

View File

@ -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);

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 {

View File

@ -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)
@ -239,7 +238,6 @@ public class ShopManager {
ArrayList<String> Lore = new ArrayList<String>();
@SuppressWarnings("deprecation")
CMIMaterial mat = CMIMaterial.get(item.getIconId(), item.getIconData());
if (item.isHideWithoutPerm()) {

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,6 @@ import java.util.HashSet;
import java.util.Set;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.stuff.Debug;
public class ExploreChunk {

View File

@ -33,7 +33,6 @@ 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

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;
@ -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,7 +81,6 @@ 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 {
@ -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

@ -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;
@ -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;
@ -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

@ -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,7 +15,6 @@ 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();

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;

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) {