1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +01:00

Removed last commit test (error)

- Fix some material recognition
- Fix #268 , in the command not find the player, so it not worked the command
This commit is contained in:
montlikadani 2018-10-17 18:10:34 +02:00
parent e518f7308d
commit 5c18493fc0
10 changed files with 26 additions and 53 deletions

View File

@ -64,7 +64,7 @@ public enum CMIChatColor {
public static String deColorize(String text) {
if (text == null)
return null;
return text.replace("<EFBFBD>", "&");
return text.replace("§", "&");
}
public static String stripColor(String text) {
@ -86,7 +86,7 @@ public enum CMIChatColor {
}
public String getBukkitColorCode() {
return "<EFBFBD>" + c;
return "§" + c;
}
public char getChar() {

View File

@ -694,7 +694,7 @@ public class ItemManager {
BONE_MEAL(351, 15, 32458, "Bone Meal"),
BOOK(340, 0, 23097, "Book"),
BOOKSHELF(47, 0, 10069, "Bookshelf"),
BOW(261, 0, 8745, "Bow", "BOW"),
BOW(261, 0, 8745, "Bow"),
BOWL(281, 0, 32661, "Bowl"),
BRAIN_CORAL(-1, -1, 31316, "Brain Coral"),
BRAIN_CORAL_BLOCK(-1, -1, 30618, "Brain Coral Block"),
@ -875,6 +875,7 @@ public class ItemManager {
DRIED_KELP_BLOCK(-1, -1, 12966, "Dried Kelp Block"),
DROPPER(158, 0, 31273, "Dropper"),
DROWNED_SPAWN_EGG(-1, -1, 19368, "Drowned Spawn Egg"),
DOUBLE_TALL_GRASS(175, 2, 21560, "Double Tall Grass"),
EGG(344, 0, 21603, "Egg"),
ELDER_GUARDIAN_SPAWN_EGG(383, 4, 11418, "Spawn Elder Guardian", "Elder Guardian Spawn Egg"),
ELYTRA(443, 0, 23829, "Elytra"),
@ -1146,7 +1147,7 @@ public class ItemManager {
NETHER_STAR(399, 0, 12469, "Nether Star"),
NETHER_WART(372, 0, 29227, "Nether Wart", "NETHER_STALK"),
NETHER_WART_BLOCK(214, 0, 15486, "Nether Wart Block"),
NOTE_BLOCK(25, 0, 20979, "Note Block", "NOTE_BLOCK"),
NOTE_BLOCK(25, 0, 20979, "Note Block"),
OAK_BOAT(333, 0, 17570, "Boat", "Oak Boat"),
OAK_BUTTON(143, 0, 13510, "Oak Button", "wooden_button"),
OAK_DOOR(324, 0, 20341, "Wooden Door", "Wood Door"),
@ -1444,7 +1445,7 @@ public class ItemManager {
SUGAR(353, 0, 30638, "Sugar"),
SUGAR_CANE(338, 0, 7726, "Sugar Canes", "Sugar Cane"),
SUNFLOWER(175, 0, 7408, "Sunflower"),
TALL_GRASS(31, 0, 21559, "Tall Grass"),
TALL_GRASS(31, 1, 21559, "Tall Grass"),
TALL_SEAGRASS(-1, -1, 27189, "Tall Seagrass"),
TERRACOTTA(172, 0, 16544, "Terracotta", "HARD_CLAY"),
TIPPED_ARROW(440, 0, 25164, "Tipped Arrow"),

View File

@ -300,8 +300,8 @@ public class Jobs extends JavaPlugin {
pManager = new PlayerManager();
}
public static void setRestrictedBlockManager(Jobs plugin) {
RBManager = new RestrictedBlockManager(plugin);
public static void setRestrictedBlockManager() {
RBManager = new RestrictedBlockManager();
}
public static RestrictedBlockManager getRestrictedBlockManager() {

View File

@ -771,13 +771,13 @@ public class ConfigManager {
name = itemSection.getString("name");
List<String> lore = new ArrayList<>();
if (itemSection.getStringList("lore") != null && itemSection.getStringList("lore").size() != 0)
if (itemSection.getStringList("lore") != null && !itemSection.getStringList("lore").isEmpty())
for (String eachLine : itemSection.getStringList("lore")) {
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
}
HashMap<Enchantment, Integer> enchants = new HashMap<>();
if (itemSection.getStringList("enchants") != null && itemSection.getStringList("enchants").size() != 0)
if (itemSection.getStringList("enchants") != null && !itemSection.getStringList("enchants").isEmpty())
for (String eachLine : itemSection.getStringList("enchants")) {
if (!eachLine.contains("="))
@ -826,13 +826,13 @@ public class ConfigManager {
name = itemSection.getString("name");
List<String> lore = new ArrayList<>();
if (itemSection.getStringList("lore") != null && itemSection.getStringList("lore").size() != 0)
if (itemSection.getStringList("lore") != null && !itemSection.getStringList("lore").isEmpty())
for (String eachLine : itemSection.getStringList("lore")) {
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
}
HashMap<Enchantment, Integer> enchants = new HashMap<>();
if (itemSection.getStringList("enchants") != null && itemSection.getStringList("enchants").size() != 0)
if (itemSection.getStringList("enchants") != null && !itemSection.getStringList("enchants").isEmpty())
for (String eachLine : itemSection.getStringList("enchants")) {
if (!eachLine.contains("="))

View File

@ -352,7 +352,7 @@ public class GeneralConfigManager {
Jobs.setRestrictedAreaManager(this.plugin);
Jobs.getRestrictedAreaManager().load();
// restricted blocks
Jobs.setRestrictedBlockManager(this.plugin);
Jobs.setRestrictedBlockManager();
Jobs.getRestrictedBlockManager().load();
// Item/Block/mobs name list
Jobs.setNameTranslatorManager(this.plugin);
@ -552,7 +552,7 @@ public class GeneralConfigManager {
c.getW().addComment("modify-chat", "Modifys chat to add chat titles. If you're using a chat manager, you may add the tag {jobs} to your chat format and disable this.");
modifyChat = c.get("modify-chat.use", true);
modifyChatPrefix = c.get("modify-chat.prefix", "&c[", true);
modifyChatSuffix = c.get("modify-chat.suffix", "&c]&r", true);
modifyChatSuffix = c.get("modify-chat.suffix", "&c]&r ", true);
modifyChatSeparator = c.get("modify-chat.separator", " ", true);
c.getW().addComment("UseCustomNames", "Do you want to use custom item/block/mob/enchant/color names",

View File

@ -151,7 +151,7 @@ public class NameTranslatorManager {
String Name = ItemFile.getConfig().getString("ItemList." + one);
ListOfNames.add(new NameList(id, meta, Name, MCName));
}
if (ListOfNames.size() != 0)
if (ListOfNames.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + ListOfNames.size() + " custom item names!");
} else
Jobs.consoleMsg("&c[Jobs] The ItemList section not found in " + ItemFile.fileName + " file.");
@ -168,7 +168,7 @@ public class NameTranslatorManager {
String Name = ItemFile.getConfig().getString("EntityList." + one);
ListOfEntities.add(new NameList(id, meta, Name, MCName));
}
if (ListOfEntities.size() != 0)
if (ListOfEntities.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + ListOfEntities.size() + " custom entity names!");
} else
Jobs.consoleMsg("&c[Jobs] The EntityList section not found in " + ItemFile.fileName + " file.");
@ -184,7 +184,7 @@ public class NameTranslatorManager {
String Name = section.getString(one + ".Name");
ListOfEnchants.add(new NameList(id, meta, Name, MCName));
}
if (ListOfEnchants.size() != 0)
if (ListOfEnchants.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + ListOfEnchants.size() + " custom enchant names!");
} else
Jobs.consoleMsg("&c[Jobs] The EnchantList section not found in " + ItemFile.fileName + " file.");
@ -200,7 +200,7 @@ public class NameTranslatorManager {
String Name = ItemFile.getConfig().getString("ColorList." + one);
ListOfColors.add(new NameList(id, meta, Name, MCName));
}
if (ListOfColors.size() != 0)
if (ListOfColors.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + ListOfColors.size() + " custom color names!");
} else
Jobs.consoleMsg("&c[Jobs] The ColorList section not found in " + ItemFile.fileName + " file.");
@ -216,7 +216,7 @@ public class NameTranslatorManager {
String Name = ItemFile.getConfig().getString("PotionNamesList." + one);
ListOfColors.add(new NameList(id, meta, Name, MCName));
}
if (ListOfPotionNames.size() != 0)
if (ListOfPotionNames.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + ListOfPotionNames.size() + " custom potion names!");
} else
Jobs.consoleMsg("&c[Jobs] The PotionNamesList section not found in " + ItemFile.fileName + " file.");

View File

@ -13,10 +13,7 @@ public class RestrictedBlockManager {
public HashMap<Integer, Integer> restrictedBlocksTimer = new HashMap<>();
private Jobs plugin;
public RestrictedBlockManager(Jobs plugin) {
this.plugin = plugin;
public RestrictedBlockManager() {
}
/**

View File

@ -64,8 +64,8 @@ public class JobsPlayer {
private int userid = -1;
List<BossBarInfo> barMap = new ArrayList<>();
List<String> updateBossBarFor = new ArrayList<>();
private List<BossBarInfo> barMap = new ArrayList<>();
private List<String> updateBossBarFor = new ArrayList<>();
// save lock
// public final Object saveLock = new Object();
@ -80,9 +80,9 @@ public class JobsPlayer {
private HashMap<String, HashMap<String, QuestProgression>> qProgression = new HashMap<>();
private int doneQuests = 0;
public JobsPlayer(String userName, OfflinePlayer player) {
public JobsPlayer(String userName, OfflinePlayer OffPlayer) {
this.userName = userName;
this.OffPlayer = player;
this.OffPlayer = OffPlayer;
this.player = Bukkit.getPlayer(userName);
}

View File

@ -1,7 +1,5 @@
package com.gamingmesh.jobs.container;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.event.server.ServerCommandEvent;
@ -77,9 +75,8 @@ public class QuestProgression {
jPlayer.addDoneQuest();
List<String> cmds = quest.getRewardCmds();
for (String one : cmds) {
ServerCommandEvent ev = new ServerCommandEvent(Bukkit.getConsoleSender(), one.replace("[playerName]", jPlayer.getUserName()));
for (String one : quest.getRewardCmds()) {
ServerCommandEvent ev = new ServerCommandEvent(Bukkit.getConsoleSender(), one.replace("[playerName]", jPlayer.getPlayer().getName()));
Bukkit.getPluginManager().callEvent(ev);
if (!ev.isCancelled()) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), ev.getCommand().startsWith("/") ? ev.getCommand().substring(1) : ev.getCommand());

View File

@ -574,14 +574,6 @@ public class JobsListener implements Listener {
String format = event.getFormat();
// check if the player is in the job
if (jPlayer != null)
for (Job job : Jobs.getJobs()) {
if (!jPlayer.isInJob(job))
format = format.replace("%1$s", "");
return;
}
format = format.replace("%1$s", honorific + "%1$s");
event.setFormat(format);
}
@ -598,13 +590,6 @@ public class JobsListener implements Listener {
if (honorific.equalsIgnoreCase(" "))
honorific = "";
String format = event.getFormat();
// check if the player is in the job
if (jPlayer != null)
for (Job job : Jobs.getJobs()) {
if (!jPlayer.isInJob(job))
format = format.replace("{jobs}", "");
return;
}
if (!format.contains("{jobs}"))
return;
format = format.replace("{jobs}", honorific);
@ -623,13 +608,6 @@ public class JobsListener implements Listener {
if (honorific.equalsIgnoreCase(" "))
honorific = "";
String format = event.getFormat();
// check if the player is in the job
if (jPlayer != null)
for (Job job : Jobs.getJobs()) {
if (!jPlayer.isInJob(job))
format = format.replace("{jobs}", "");
return;
}
if (!format.contains("{jobs}"))
return;
format = format.replace("{jobs}", honorific);