mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
Some code clean up
- Fix 1 color not work (lime) - We using the default data folder from main class - We don't need to copy and create a lot of message file
This commit is contained in:
parent
717b0edebe
commit
ed0eadad69
@ -30,7 +30,7 @@ public class ConfigReader extends YamlConfiguration {
|
||||
private File file = null;
|
||||
|
||||
public ConfigReader(String fileName) throws Exception {
|
||||
this(new File(Jobs.getInstance().getDataFolder(), fileName));
|
||||
this(new File(Jobs.getFolder(), fileName));
|
||||
}
|
||||
|
||||
public ConfigReader(File file) throws Exception {
|
||||
@ -227,7 +227,7 @@ public class ConfigReader extends YamlConfiguration {
|
||||
}
|
||||
|
||||
public void saveToBackup() {
|
||||
File cc = new File(Jobs.getInstance().getDataFolder(), "FileBackups");
|
||||
File cc = new File(Jobs.getFolder(), "FileBackups");
|
||||
if (!cc.isDirectory())
|
||||
cc.mkdir();
|
||||
|
||||
@ -235,10 +235,10 @@ public class ConfigReader extends YamlConfiguration {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss ");
|
||||
String newFileName = dateFormat.format(date) + file.getName();
|
||||
|
||||
Jobs.consoleMsg("&cFailed to load " + file.getName() + "! Backup have been saved into " + Jobs.getInstance().getDataFolder().getPath() + File.separator + "FileBackups"
|
||||
Jobs.consoleMsg("&cFailed to load " + file.getName() + "! Backup have been saved into " + Jobs.getFolder().getPath() + File.separator + "FileBackups"
|
||||
+ File.separator + newFileName);
|
||||
|
||||
File f = new File(Jobs.getInstance().getDataFolder(), "FileBackups" + File.separator + newFileName);
|
||||
File f = new File(Jobs.getFolder(), "FileBackups" + File.separator + newFileName);
|
||||
// file.renameTo(f);
|
||||
try {
|
||||
Files.copy(file, f);
|
||||
|
@ -324,7 +324,7 @@ public class ItemManager {
|
||||
Magenta(2, "Magenta"),
|
||||
LIGHT_BLUE(3, "Light Blue"), // TODO: Not work, github issue: #267
|
||||
Yellow(4, "Yellow"),
|
||||
LIME_GREEN(5, "Lime Green"), // TODO: Not work, github issue: #267
|
||||
Lime(5, "Lime Green"),
|
||||
Pink(6, "Pink"),
|
||||
Gray(7, "Gray"),
|
||||
LIGHT_GRAY(8, "Light Gray"), // TODO: Not work, github issue: #267
|
||||
@ -1706,7 +1706,7 @@ public class ItemManager {
|
||||
public static CMIMaterial get(String id) {
|
||||
Integer ids = null;
|
||||
Integer data = null;
|
||||
|
||||
|
||||
id = id.replace("_", "").replace(" ", "").toLowerCase();
|
||||
try {
|
||||
ids = Integer.parseInt(id);
|
||||
@ -1786,13 +1786,13 @@ public class ItemManager {
|
||||
return one;
|
||||
if (one.getName().replace("_", "").replace(" ", "").equalsIgnoreCase(id))
|
||||
return one;
|
||||
|
||||
|
||||
}
|
||||
for (CMIMaterial one : CMIMaterial.values()) {
|
||||
if (one.name().replace("_", "").toLowerCase().endsWith(id))
|
||||
return one;
|
||||
return one;
|
||||
}
|
||||
|
||||
|
||||
return CMIMaterial.NONE;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,6 @@ public class Jobs extends JavaPlugin {
|
||||
private static Reflections reflections = null;
|
||||
|
||||
private static Logger pLogger = null;
|
||||
private static File dataFolder = null;
|
||||
private static JobsClassLoader classLoader = null;
|
||||
private static JobsDAO dao = null;
|
||||
private static List<Job> jobs = null;
|
||||
@ -248,8 +247,8 @@ public class Jobs extends JavaPlugin {
|
||||
return DBManager;
|
||||
}
|
||||
|
||||
public static void setShopManager(Jobs plugin) {
|
||||
shopManager = new ShopManager(plugin);
|
||||
public static void setShopManager() {
|
||||
shopManager = new ShopManager();
|
||||
}
|
||||
|
||||
public static ShopManager getShopManager() {
|
||||
@ -257,7 +256,7 @@ public class Jobs extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void setConfigManager() {
|
||||
configManager = new ConfigManager(this);
|
||||
configManager = new ConfigManager();
|
||||
}
|
||||
|
||||
public static ConfigManager getConfigManager() {
|
||||
@ -308,16 +307,16 @@ public class Jobs extends JavaPlugin {
|
||||
return RBManager;
|
||||
}
|
||||
|
||||
public static void setRestrictedAreaManager(Jobs plugin) {
|
||||
RAManager = new RestrictedAreaManager(plugin);
|
||||
public static void setRestrictedAreaManager() {
|
||||
RAManager = new RestrictedAreaManager();
|
||||
}
|
||||
|
||||
public static RestrictedAreaManager getRestrictedAreaManager() {
|
||||
return RAManager;
|
||||
}
|
||||
|
||||
public static void setTitleManager(Jobs plugin) {
|
||||
titleManager = new TitleManager(plugin);
|
||||
public static void setTitleManager() {
|
||||
titleManager = new TitleManager();
|
||||
}
|
||||
|
||||
public static TitleManager gettitleManager() {
|
||||
@ -356,8 +355,8 @@ public class Jobs extends JavaPlugin {
|
||||
return NameTranslatorManager;
|
||||
}
|
||||
|
||||
public static void setNameTranslatorManager(Jobs plugin) {
|
||||
NameTranslatorManager = new NameTranslatorManager(plugin);
|
||||
public static void setNameTranslatorManager() {
|
||||
NameTranslatorManager = new NameTranslatorManager();
|
||||
}
|
||||
|
||||
public static GuiManager getGUIManager() {
|
||||
@ -428,8 +427,8 @@ public class Jobs extends JavaPlugin {
|
||||
return lmManager;
|
||||
}
|
||||
|
||||
public static void setLanguageManager(Jobs plugin) {
|
||||
lmManager = new LanguageManager(plugin);
|
||||
public static void setLanguageManager() {
|
||||
lmManager = new LanguageManager();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -447,20 +446,11 @@ public class Jobs extends JavaPlugin {
|
||||
return pLogger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the data folder
|
||||
* @param dir - the data folder
|
||||
*/
|
||||
public void setDataFolder(File dataFolder) {
|
||||
Jobs.dataFolder = dataFolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the data folder
|
||||
* @return data folder
|
||||
*/
|
||||
public static File getFolder() {
|
||||
return dataFolder;
|
||||
File folder = Jobs.getInstance().getDataFolder();
|
||||
if (!folder.exists())
|
||||
folder.mkdirs();
|
||||
return folder;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -795,7 +785,6 @@ public class Jobs extends JavaPlugin {
|
||||
setExplore();
|
||||
setBBManager();
|
||||
setPluginLogger(getLogger());
|
||||
setDataFolder(getDataFolder());
|
||||
setLoging();
|
||||
setGCManager();
|
||||
setConfigManager();
|
||||
|
@ -62,10 +62,8 @@ import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
||||
|
||||
public class ConfigManager {
|
||||
private Jobs plugin;
|
||||
|
||||
public ConfigManager(Jobs plugin) {
|
||||
this.plugin = plugin;
|
||||
public ConfigManager() {
|
||||
}
|
||||
|
||||
public void reload() throws IOException {
|
||||
@ -74,7 +72,7 @@ public class ConfigManager {
|
||||
}
|
||||
|
||||
public void changeJobsSettings(String path, Object value) {
|
||||
File f = new File(plugin.getDataFolder(), "jobConfig.yml");
|
||||
File f = new File(Jobs.getFolder(), "jobConfig.yml");
|
||||
InputStreamReader s = null;
|
||||
try {
|
||||
s = new InputStreamReader(new FileInputStream(f), "UTF-8");
|
||||
@ -402,7 +400,7 @@ public class ConfigManager {
|
||||
* @throws IOException
|
||||
*/
|
||||
private void loadJobSettings() throws IOException {
|
||||
File f = new File(plugin.getDataFolder(), "jobConfig.yml");
|
||||
File f = new File(Jobs.getFolder(), "jobConfig.yml");
|
||||
InputStreamReader s = new InputStreamReader(new FileInputStream(f), "UTF-8");
|
||||
|
||||
ArrayList<Job> jobs = new ArrayList<>();
|
||||
|
@ -342,19 +342,19 @@ public class GeneralConfigManager {
|
||||
Jobs.getJobsDAO().cleanJobs();
|
||||
Jobs.getJobsDAO().cleanUsers();
|
||||
// Load locale
|
||||
Jobs.setLanguageManager(this.plugin);
|
||||
Jobs.setLanguageManager();
|
||||
Jobs.getLanguageManager().load();
|
||||
// title settings
|
||||
Jobs.setTitleManager(this.plugin);
|
||||
Jobs.setTitleManager();
|
||||
Jobs.gettitleManager().load();
|
||||
// restricted areas
|
||||
Jobs.setRestrictedAreaManager(this.plugin);
|
||||
Jobs.setRestrictedAreaManager();
|
||||
Jobs.getRestrictedAreaManager().load();
|
||||
// restricted blocks
|
||||
Jobs.setRestrictedBlockManager();
|
||||
Jobs.getRestrictedBlockManager().load();
|
||||
// Item/Block/mobs name list
|
||||
Jobs.setNameTranslatorManager(this.plugin);
|
||||
Jobs.setNameTranslatorManager();
|
||||
Jobs.getNameTranslatorManager().load();
|
||||
// signs information
|
||||
Jobs.setSignUtil(this.plugin);
|
||||
@ -362,7 +362,7 @@ public class GeneralConfigManager {
|
||||
// Schedule
|
||||
Jobs.setScheduleManager(this.plugin);
|
||||
// Shop
|
||||
Jobs.setShopManager(this.plugin);
|
||||
Jobs.setShopManager();
|
||||
Jobs.getShopManager().load();
|
||||
}
|
||||
|
||||
@ -372,7 +372,7 @@ public class GeneralConfigManager {
|
||||
* loads from Jobs/generalConfig.yml
|
||||
*/
|
||||
private synchronized void loadGeneralSettings() {
|
||||
File f = new File(plugin.getDataFolder(), "generalConfig.yml");
|
||||
File f = new File(Jobs.getFolder(), "generalConfig.yml");
|
||||
YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);
|
||||
CommentedYamlConfiguration write = new CommentedYamlConfiguration();
|
||||
LocaleReader c = new LocaleReader(conf, write);
|
||||
|
@ -2,25 +2,17 @@ package com.gamingmesh.jobs.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.LocaleReader;
|
||||
|
||||
public class LanguageManager {
|
||||
private Jobs plugin;
|
||||
|
||||
public LanguageManager(Jobs plugin) {
|
||||
this.plugin = plugin;
|
||||
public LanguageManager() {
|
||||
}
|
||||
|
||||
private List<String> languages = new ArrayList<>();
|
||||
@ -29,7 +21,7 @@ public class LanguageManager {
|
||||
return languages;
|
||||
}
|
||||
|
||||
public static List<String> getClassesFromPackage(String pckgname, String cleaner) throws ClassNotFoundException {
|
||||
/** public static List<String> getClassesFromPackage(String pckgname, String cleaner) throws ClassNotFoundException {
|
||||
List<String> result = new ArrayList<>();
|
||||
try {
|
||||
for (URL jarURL : ((URLClassLoader) Jobs.class.getClassLoader()).getURLs()) {
|
||||
@ -72,7 +64,7 @@ public class LanguageManager {
|
||||
}
|
||||
}
|
||||
return listOfCommands;
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Method to load the language file configuration
|
||||
@ -81,29 +73,31 @@ public class LanguageManager {
|
||||
*/
|
||||
synchronized void load() {
|
||||
languages = new ArrayList<>();
|
||||
|
||||
try {
|
||||
languages.addAll(getClassesFromPackage("locale", "messages_"));
|
||||
} catch (ClassNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
/** try {
|
||||
languages.addAll(getClassesFromPackage("locale", "messages_"));
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
|
||||
String ls = Jobs.getGCManager().localeString;
|
||||
|
||||
if (ls == null || ls.equals(""))
|
||||
return;
|
||||
|
||||
languages.clear();
|
||||
languages.add("en");
|
||||
|
||||
File customLocaleFile = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + ls + ".yml");
|
||||
File customLocaleFile = new File(Jobs.getFolder(), "locale" + File.separator + "messages_" + ls + ".yml");
|
||||
if (!customLocaleFile.exists() && !ls.equalsIgnoreCase("en"))
|
||||
languages.add(ls);
|
||||
|
||||
for (String lang : languages) {
|
||||
File f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml");
|
||||
File f = new File(Jobs.getFolder(), "locale" + File.separator + "messages_" + lang + ".yml");
|
||||
|
||||
// Fail safe if file get corrupted and being created with corrupted data, we need to recreate it
|
||||
if ((f.length() / 1024) > 1024) {
|
||||
f.delete();
|
||||
f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml");
|
||||
f = new File(Jobs.getFolder(), "locale" + File.separator + "messages_" + lang + ".yml");
|
||||
}
|
||||
|
||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(f);
|
||||
@ -196,8 +190,8 @@ public class LanguageManager {
|
||||
c.get("command.itembonus.output.list", "&e[jobname]: %money% %points% %exp%");
|
||||
|
||||
c.get("command.edititembonus.help.info", "Edit item boost bonus");
|
||||
c.get("command.edititembonus.help.args", "[list/add/remove] [jobname] [itemBoostName]");
|
||||
Jobs.getGCManager().commandArgs.put("edititembonus", Arrays.asList("[list%%add%%remove]", "[jobname]", "[jobitemname]"));
|
||||
c.get("command.edititembonus.help.args", "list/add/remove [jobname] [itemBoostName]");
|
||||
Jobs.getGCManager().commandArgs.put("edititembonus", Arrays.asList("list%%add%%remove", "[jobname]", "[jobitemname]"));
|
||||
|
||||
c.get("command.bonus.help.info", "Show job bonuses");
|
||||
c.get("command.bonus.help.args", "[jobname]");
|
||||
@ -252,8 +246,8 @@ public class LanguageManager {
|
||||
c.get("command.points.totalpoints", " &eTotal amount of collected points until now: &6%totalpoints%");
|
||||
|
||||
c.get("command.editpoints.help.info", "Edit players points.");
|
||||
c.get("command.editpoints.help.args", "[set/add/take] [playername] [amount]");
|
||||
Jobs.getGCManager().commandArgs.put("editpoints", Arrays.asList("[set%%add%%take]", "[playername]"));
|
||||
c.get("command.editpoints.help.args", "set/add/take [playername] [amount]");
|
||||
Jobs.getGCManager().commandArgs.put("editpoints", Arrays.asList("set%%add%%take", "[playername]"));
|
||||
c.get("command.editpoints.output.set", "&ePlayers (&6%playername%&e) points was set to &6%amount%");
|
||||
c.get("command.editpoints.output.add", "&ePlayer (&6%playername%&e) got aditinal &6%amount% &epoints. Now he has &6%total%");
|
||||
c.get("command.editpoints.output.take", "&ePlayer (&6%playername%&e) lost &6%amount% &epoints. Now he has &6%total%");
|
||||
@ -507,8 +501,8 @@ public class LanguageManager {
|
||||
c.get("command.gtop.output.show", "&2Show from &e[from] &2until &e[until] &2global top list");
|
||||
|
||||
c.get("command.area.help.info", "Modify restricted areas.");
|
||||
c.get("command.area.help.args", "[add/remove/info/list]");
|
||||
Jobs.getGCManager().commandArgs.put("area", Arrays.asList("[add%%remove%%info%%list]"));
|
||||
c.get("command.area.help.args", "add/remove/info/list");
|
||||
Jobs.getGCManager().commandArgs.put("area", Arrays.asList("add%%remove%%info%%list"));
|
||||
c.get("command.area.help.addUsage", "&eUsage: &6/Jobs area add [areaName/wg:worldGuardAreaName] [bonus]");
|
||||
c.get("command.area.help.removeUsage", "&eUsage: &6/Jobs area remove [areaName]");
|
||||
c.get("command.area.output.addedNew", "&eAdded new restricted area with &6%bonus% &ebonus");
|
||||
@ -559,8 +553,8 @@ public class LanguageManager {
|
||||
c.get("command.promote.output.target", "You have been promoted %levelsgained% levels in %jobname%.");
|
||||
|
||||
c.get("command.exp.help.info", "Change the player exp for job.");
|
||||
c.get("command.exp.help.args", "[playername] [jobname] [set/add/take] [amount]");
|
||||
Jobs.getGCManager().commandArgs.put("exp", Arrays.asList("[playername]", "[jobname]", "[set%%add%%take]"));
|
||||
c.get("command.exp.help.args", "[playername] [jobname] set/add/take [amount]");
|
||||
Jobs.getGCManager().commandArgs.put("exp", Arrays.asList("[playername]", "[jobname]", "set%%add%%take"));
|
||||
c.get("command.exp.output.target", "&eYour exp was changed for %jobname% &eand now you at &6%level%lvl &eand with &6%exp%exp.");
|
||||
|
||||
c.get("command.demote.help.info", "Demote the player X levels in a job.");
|
||||
@ -590,8 +584,8 @@ public class LanguageManager {
|
||||
c.get("command.reload.help.info", "Reload configurations.");
|
||||
|
||||
c.get("command.toggle.help.info", "Toggles payment output on action bar or bossbar.");
|
||||
c.get("command.toggle.help.args", "[actionbar/bossbar]");
|
||||
Jobs.getGCManager().commandArgs.put("toggle", Arrays.asList("[actionbar%%bossbar]"));
|
||||
c.get("command.toggle.help.args", "actionbar/bossbar");
|
||||
Jobs.getGCManager().commandArgs.put("toggle", Arrays.asList("actionbar%%bossbar"));
|
||||
c.get("command.toggle.output.turnedoff", "&4This feature are turned off!");
|
||||
c.get("command.toggle.output.paid.main", "&aYou got:");
|
||||
c.get("command.toggle.output.paid.money", "&e[amount] money");
|
||||
|
@ -18,16 +18,13 @@ import com.gamingmesh.jobs.container.NameList;
|
||||
|
||||
public class NameTranslatorManager {
|
||||
|
||||
private Jobs plugin;
|
||||
|
||||
public ArrayList<NameList> ListOfNames = new ArrayList<>();
|
||||
public ArrayList<NameList> ListOfPotionNames = 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;
|
||||
public NameTranslatorManager() {
|
||||
}
|
||||
|
||||
public String Translate(String materialName, JobInfo info) {
|
||||
@ -134,7 +131,7 @@ public class NameTranslatorManager {
|
||||
}
|
||||
|
||||
public void readFile() {
|
||||
YmlMaker ItemFile = new YmlMaker(plugin, "TranslatableWords" + File.separator + "Words_" + Jobs.getGCManager().localeString + ".yml");
|
||||
YmlMaker ItemFile = new YmlMaker(Jobs.getInstance(), "TranslatableWords" + File.separator + "Words_" + Jobs.getGCManager().localeString + ".yml");
|
||||
ItemFile.saveDefaultConfig();
|
||||
|
||||
if (ItemFile.getConfig().isConfigurationSection("ItemList")) {
|
||||
@ -228,35 +225,35 @@ public class NameTranslatorManager {
|
||||
if (ls == null || ls.equals(""))
|
||||
return;
|
||||
|
||||
File file = new File(plugin.getDataFolder(), "TranslatableWords.yml");
|
||||
File file2 = new File(plugin.getDataFolder(), "TranslatableWords" + File.separator + "Words_" + ls + ".yml");
|
||||
File file = new File(Jobs.getFolder(), "TranslatableWords.yml");
|
||||
File file2 = new File(Jobs.getFolder(), "TranslatableWords" + File.separator + "Words_" + ls + ".yml");
|
||||
if (file.exists())
|
||||
file.renameTo(file2);
|
||||
|
||||
// Just copying default language files, except en, that one will be generated
|
||||
List<String> languages = new ArrayList<>();
|
||||
|
||||
try {
|
||||
/** try {
|
||||
languages.addAll(LanguageManager.getClassesFromPackage("TranslatableWords", "Words_"));
|
||||
} catch (ClassNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
|
||||
languages.clear();
|
||||
languages.add("en");
|
||||
|
||||
File customLocaleFile = new File(plugin.getDataFolder(), "TranslatableWords" + File.separator + "Words_" + ls + ".yml");
|
||||
File customLocaleFile = new File(Jobs.getFolder(), "TranslatableWords" + File.separator + "Words_" + ls + ".yml");
|
||||
if (!customLocaleFile.exists() && !ls.equalsIgnoreCase("en"))
|
||||
languages.add(ls);
|
||||
|
||||
for (String lang : languages) {
|
||||
|
||||
File f = new File(plugin.getDataFolder(), "TranslatableWords" + File.separator + "Words_" + lang + ".yml");
|
||||
File f = new File(Jobs.getFolder(), "TranslatableWords" + File.separator + "Words_" + lang + ".yml");
|
||||
|
||||
// Fail safe if file get corrupted and being created with corrupted data, we need to recreate it
|
||||
if ((f.length() / 1024) > 1024) {
|
||||
f.delete();
|
||||
f = new File(plugin.getDataFolder(), "TranslatableWords" + File.separator + "Words_" + lang + ".yml");
|
||||
f = new File(Jobs.getFolder(), "TranslatableWords" + File.separator + "Words_" + lang + ".yml");
|
||||
}
|
||||
|
||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(f);
|
||||
@ -429,7 +426,7 @@ public class NameTranslatorManager {
|
||||
c.get("ColorList.2-magenta", "&dMagenta");
|
||||
c.get("ColorList.3-LIGHT_BLUE", "&9Light blue");
|
||||
c.get("ColorList.4-yellow", "&eYellow");
|
||||
c.get("ColorList.5-LIME_GREEN", "&aLime");
|
||||
c.get("ColorList.5-lime", "&aLime");
|
||||
c.get("ColorList.6-pink", "&dPink");
|
||||
c.get("ColorList.7-gray", "&8Gray");
|
||||
c.get("ColorList.8-LIGHT_GRAY", "&7Light gray");
|
||||
|
@ -170,7 +170,7 @@ public class ScheduleManager {
|
||||
* loads from Jobs/schedule.yml
|
||||
*/
|
||||
public void load() {
|
||||
File f = new File(plugin.getDataFolder(), "schedule.yml");
|
||||
File f = new File(Jobs.getFolder(), "schedule.yml");
|
||||
YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);
|
||||
|
||||
conf.options().copyDefaults(true);
|
||||
|
@ -33,12 +33,10 @@ import com.gamingmesh.jobs.container.ShopItem;
|
||||
import com.gamingmesh.jobs.stuff.Perm;
|
||||
|
||||
public class ShopManager {
|
||||
private Jobs plugin;
|
||||
public List<ShopItem> list = new ArrayList<>();
|
||||
public HashMap<String, Integer> GuiList = new HashMap<>();
|
||||
|
||||
public ShopManager(Jobs plugin) {
|
||||
this.plugin = plugin;
|
||||
public ShopManager() {
|
||||
}
|
||||
|
||||
public List<ShopItem> getShopItemList() {
|
||||
@ -303,29 +301,29 @@ public class ShopManager {
|
||||
meta.setLore(Lore);
|
||||
|
||||
if (item.getCustomHead() != null) {
|
||||
GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack();
|
||||
GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack();
|
||||
|
||||
SkullMeta skullMeta = (SkullMeta) GUIitem.getItemMeta();
|
||||
// Fix skull meta
|
||||
skullMeta.setDisplayName(item.getIconName());
|
||||
skullMeta.setLore(Lore);
|
||||
SkullMeta skullMeta = (SkullMeta) GUIitem.getItemMeta();
|
||||
// Fix skull meta
|
||||
skullMeta.setDisplayName(item.getIconName());
|
||||
skullMeta.setLore(Lore);
|
||||
|
||||
if (item.getCustomHeadOwner())
|
||||
skullMeta.setOwner(Jobs.getPlayerManager().getJobsPlayer(player).getUserName());
|
||||
if (item.isHeadOwner())
|
||||
skullMeta.setOwner(Jobs.getPlayerManager().getJobsPlayer(player).getUserName());
|
||||
else {
|
||||
try {
|
||||
@SuppressWarnings("deprecation")
|
||||
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(item.getCustomHead());
|
||||
skullMeta.setOwner(offPlayer.getName());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
@SuppressWarnings("deprecation")
|
||||
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(item.getCustomHead());
|
||||
skullMeta.setOwner(offPlayer.getName());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
GUIitem.setItemMeta(skullMeta);
|
||||
} else
|
||||
GUIitem.setItemMeta(meta);
|
||||
} else
|
||||
GUIitem.setItemMeta(meta);
|
||||
|
||||
GuiInv.setItem(i, GUIitem);
|
||||
GuiInv.setItem(i, GUIitem);
|
||||
}
|
||||
|
||||
ItemStack Item = new ItemStack(Material.ARROW);
|
||||
@ -350,7 +348,7 @@ public class ShopManager {
|
||||
|
||||
public void load() {
|
||||
list.clear();
|
||||
File file = new File(plugin.getDataFolder(), "shopItems.yml");
|
||||
File file = new File(Jobs.getFolder(), "shopItems.yml");
|
||||
YamlConfiguration f = YamlConfiguration.loadConfiguration(file);
|
||||
|
||||
if (!f.isConfigurationSection("Items"))
|
||||
|
@ -17,10 +17,7 @@ public class TitleManager {
|
||||
|
||||
protected List<Title> titles = new ArrayList<>();
|
||||
|
||||
private Jobs plugin;
|
||||
|
||||
public TitleManager(Jobs plugin) {
|
||||
this.plugin = plugin;
|
||||
public TitleManager() {
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,7 +49,7 @@ public class TitleManager {
|
||||
synchronized void load() {
|
||||
this.titles.clear();
|
||||
|
||||
File f = new File(plugin.getDataFolder(), "titleConfig.yml");
|
||||
File f = new File(Jobs.getFolder(), "titleConfig.yml");
|
||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(f);
|
||||
CommentedYamlConfiguration writer = new CommentedYamlConfiguration();
|
||||
|
||||
|
@ -154,7 +154,7 @@ public class ShopItem {
|
||||
this.PlayerName = PlayerName;
|
||||
}
|
||||
|
||||
public boolean getCustomHeadOwner() {
|
||||
public boolean isHeadOwner() {
|
||||
return useCurrentPlayer;
|
||||
}
|
||||
|
||||
|
@ -163,13 +163,14 @@ public class JobsListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
|
||||
Block block = event.getClickedBlock();
|
||||
Location loc = null;
|
||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||
Location loc = block.getLocation();
|
||||
loc = block.getLocation();
|
||||
Jobs.getSelectionManager().placeLoc1(player, loc);
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.area.output.selected1", "%x%", loc.getBlockX(), "%y%", loc.getBlockY(), "%z%", loc.getBlockZ()));
|
||||
event.setCancelled(true);
|
||||
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
Location loc = block.getLocation();
|
||||
loc = block.getLocation();
|
||||
Jobs.getSelectionManager().placeLoc2(player, loc);
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.area.output.selected2", "%x%", loc.getBlockX(), "%y%", loc.getBlockY(), "%z%", loc.getBlockZ()));
|
||||
event.setCancelled(true);
|
||||
@ -209,9 +210,8 @@ public class JobsListener implements Listener {
|
||||
public void onShopGuiClose(InventoryCloseEvent event) {
|
||||
if (Jobs.getShopManager().GuiList.isEmpty())
|
||||
return;
|
||||
Player player = (Player) event.getPlayer();
|
||||
if (Jobs.getShopManager().GuiList.containsKey(player.getName())) {
|
||||
Jobs.getShopManager().GuiList.remove(player.getName());
|
||||
if (Jobs.getShopManager().GuiList.containsKey(event.getPlayer().getName())) {
|
||||
Jobs.getShopManager().GuiList.remove(event.getPlayer().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,8 +219,7 @@ public class JobsListener implements Listener {
|
||||
public void onGuiClose(InventoryCloseEvent event) {
|
||||
if (Jobs.getGUIManager().GuiList.isEmpty())
|
||||
return;
|
||||
Player player = (Player) event.getPlayer();
|
||||
Jobs.getGUIManager().GuiList.remove(player.getUniqueId());
|
||||
Jobs.getGUIManager().GuiList.remove(event.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@ -831,7 +830,6 @@ public class JobsListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void playerInteractEvent(PlayerInteractEvent event) {
|
||||
|
||||
Action action = event.getAction();
|
||||
if (action == Action.PHYSICAL)
|
||||
return;
|
||||
|
@ -74,14 +74,14 @@ command:
|
||||
infostats: '&c-----> &aPontszám x%boost% engedélyezve&c <-------'
|
||||
expboost:
|
||||
help:
|
||||
info: 'Növeli az összes játékos nyereségét.'
|
||||
info: 'Növeli az összes játékos xp nyereségét.'
|
||||
args: '[jobname] [arány]'
|
||||
output:
|
||||
allreset: '&aMinden tapasztalat növelés kikapcsolva.'
|
||||
jobsboostreset: '&cTapasztalat lendület a(z) %jobname% munkánál kikapcsolva.'
|
||||
nothingtoreset: '&cSemmi nem állítható vissza.'
|
||||
boostalladded: '&aTapasztalat növelése %boost% minden munkához hozzáadva!'
|
||||
boostadded: '&aTapasztalat növelése &e%boost% &ahozzáadva &e%jobname% &amunkához!'
|
||||
boostadded: '&aTapasztalat növelése &e%boost% &ahozzáadva a(z) &e%jobname% &amunkához!'
|
||||
infostats: '&c-----> &aTapasztalat arány x%boost% engedélyezve&c <-------'
|
||||
bonus:
|
||||
help:
|
||||
@ -151,9 +151,9 @@ command:
|
||||
editpoints:
|
||||
help:
|
||||
info: 'Játékos pontok szerkesztése.'
|
||||
args: '[set/add/take] [playername] [összeg]'
|
||||
args: 'set/add/take [playername] [összeg]'
|
||||
output:
|
||||
set: '&e(&6%playername%&e) játékosnak pont beállítva &6%amount%'
|
||||
set: '&e(&6%playername%&e) játékosnak &6%amount%&e pont beállítva'
|
||||
add: '&e(&6%playername%&e) játékosnak van további &6%amount% &epontja. Most van &6%total%'
|
||||
take: '&e(&6%playername%&e) játékos vesztett &6%amount% &epontot. Most van &6%total%'
|
||||
editjobs:
|
||||
@ -180,7 +180,7 @@ command:
|
||||
lookHover: '&6A bal gombbal kattintva információt kapsz a blokkról, amit keresel.'
|
||||
blockinfo:
|
||||
help:
|
||||
info: 'Megjeleníti a megtekinteni kívánt blokkadatokat.'
|
||||
info: 'Megjeleníti az éppen látótérben lévő blokk adatokat.'
|
||||
args: ''
|
||||
output:
|
||||
name: ' &eBlokk név: &6%blockname%'
|
||||
@ -215,7 +215,7 @@ command:
|
||||
title: '&e------- &8Munkák piac &e-------'
|
||||
currentPoints: '&eNeked van: &6%currentpoints%'
|
||||
price: '&eEgyenleg: &6%price%'
|
||||
reqJobs: '&eKötelező munkák:'
|
||||
reqJobs: '&eSzükséges munkák:'
|
||||
reqJobsList: ' &6%jobsname%&e: &e%level% lvl'
|
||||
reqTotalLevel: '&6Szükséges teljes szint: &e%totalLevel%'
|
||||
cantOpen: '&cNem nyithatod meg ezt az oldalt!'
|
||||
@ -249,7 +249,7 @@ command:
|
||||
args: '[jobname] [action]'
|
||||
actions: '&eÉrvényes akciók: &f%actions%'
|
||||
max: ' - &eMax. szint:&f '
|
||||
newMax: '&eMaximális szint: &f[max]'
|
||||
newMax: ' &eMaximális szint: &f[max]'
|
||||
material: '&7%material%'
|
||||
levelRange: ' &a(&e%levelFrom% &a- &e%levelUntil% &aszintek)'
|
||||
levelFrom: ' &a(&e%levelFrom% &aszint)'
|
||||
@ -306,7 +306,7 @@ command:
|
||||
none: '%jobname%&c nem kap pénzt, ha fest.'
|
||||
enchant:
|
||||
info: '&eVarázs'
|
||||
none: '%jobname%&c nem kap pénzt, ha varázsól.'
|
||||
none: '%jobname%&c nem kap pénzt, ha varázsol.'
|
||||
vtrade:
|
||||
info: '&eFalusi kereskedelem'
|
||||
none: '%jobname%&c nem kap pénzt, ha kereskedik egy falusival.'
|
||||
@ -343,7 +343,7 @@ command:
|
||||
alreadyin: '&cMár csatlakoztál a(z) %jobname%&c munkához!'
|
||||
fullslots: '&cNem tudsz csatlakozni a(z) %jobname%&c munkához, mert nincsenek rendelkezésre álló helyek.'
|
||||
maxjobs: '&cMár túl sok munkát vállaltál.'
|
||||
rejoin: '&cNem csatlakozhatsz ebbe a munkába. Várj [time].'
|
||||
rejoin: '&cNem csatlakozhatsz ebbe a munkába időintervallum miatt. Várj [time].'
|
||||
rejoin: '&aKattints ide, hogy újra csatlakozz ebbe a munkába: '
|
||||
success: '&aSikeresen csatlakoztál a(z) %jobname%&a munkához!'
|
||||
confirm: '&2Kattints ide, hogy a(z) &7[jobname]&2 munkát megerősítse.'
|
||||
@ -362,7 +362,7 @@ command:
|
||||
help:
|
||||
info: 'Ellenőrzi, ki látogatta meg ezt a darabot.'
|
||||
error:
|
||||
noexplore: '&cSenki nem látogatta meg ezt a darabot.'
|
||||
noexplore: '&cSenki sem látogatta meg ezt a darabot.'
|
||||
list: '&a%place%. %playername%'
|
||||
browse:
|
||||
help:
|
||||
@ -459,11 +459,11 @@ command:
|
||||
list: '&e%number%&a. &e%playername% &alvl &e%level%&e %exp% &aexp'
|
||||
prev: '&e<<< Előző oldal &2|'
|
||||
next: '&2|&e Következő oldal >>>'
|
||||
show: '&2Megjelenítés innen &e[from]&2, amíg &e[until] &2a globális top lista.'
|
||||
show: '&2Megjelenítés &e[from]&2-tól/-től, &e[until]&2-ig &2a globális top listán.'
|
||||
area:
|
||||
help:
|
||||
info: 'Korlátozott területek módosítása.'
|
||||
args: '[add/remove/info/list]'
|
||||
args: 'add/remove/info/list'
|
||||
addUsage: '&eHasználat: &6/Jobs area add [arénanév/wg:worldGuardarénanév] [bónusz]'
|
||||
removeUsage: '&eHasználat: &6/Jobs area remove [arénanév]'
|
||||
output:
|
||||
@ -508,7 +508,7 @@ command:
|
||||
info: 'A játékos munkájának áthelyezése régi munkáról egy új munkába.'
|
||||
args: '[playername] [oldjob] [newjob]'
|
||||
output:
|
||||
target: '&cÁtkerültél %oldjobname%&c munkából a(z) %newjobname%&c munkába.'
|
||||
target: '&cÁtkerültél a(z) %oldjobname%&c munkából a(z) %newjobname%&c munkába.'
|
||||
promote:
|
||||
help:
|
||||
info: 'Támogasd a játékos X szintjét egy munkában.'
|
||||
@ -518,7 +518,7 @@ command:
|
||||
exp:
|
||||
help:
|
||||
info: 'Módosítsa a játékos tapasztalat feladatát.'
|
||||
args: '[playername] [jobname] [set/add/take] [amount]'
|
||||
args: '[playername] [jobname] set/add/take [amount]'
|
||||
output:
|
||||
target: '&eA tapasztalat változott %jobname%&e, most van &6%level%lvl &eés &6%exp%&eexp.'
|
||||
demote:
|
||||
@ -556,7 +556,7 @@ command:
|
||||
toggle:
|
||||
help:
|
||||
info: 'A fizetős kimenet a cselekvési sávon (actionbar) vagy a bossbar-on.'
|
||||
args: '[actionbar/bossbar]'
|
||||
args: 'actionbar/bossbar'
|
||||
output:
|
||||
turnedoff: '&4Ez a funkció ki van kapcsolva!'
|
||||
paid:
|
||||
@ -575,7 +575,7 @@ command:
|
||||
edititembonus:
|
||||
help:
|
||||
info: 'Tárgybónusz szerkesztése.'
|
||||
args: '[list/add/remove] [jobname] [itemBoostName]'
|
||||
args: 'list/add/remove [jobname] [itemBoostName]'
|
||||
message:
|
||||
skillup:
|
||||
broadcast: '%playername% játékost előléptették a %titlename% %jobname% munkában.'
|
||||
|
Loading…
Reference in New Issue
Block a user