mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-02 14:29:07 +01:00
Fix signs command parsing issue on click
Now on the 3rd line the trailing spaces will get removed to successfully parse for example the join command.
This commit is contained in:
parent
9df1810732
commit
0d138d6664
@ -111,18 +111,6 @@ public class ItemBoostManager {
|
||||
if (one.equalsIgnoreCase("exampleBoost"))
|
||||
continue;
|
||||
|
||||
CMIMaterial mat = null;
|
||||
|
||||
if (cfg.getC().isString(one + ".id")) {
|
||||
mat = CMIMaterial.get(cfg.get(one + ".id", "Stone"));
|
||||
}
|
||||
|
||||
String name = null;
|
||||
|
||||
if (cfg.getC().isString(one + ".name")) {
|
||||
name = cfg.get(one + ".name", "");
|
||||
}
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
if (cfg.getC().isList(one + ".lore")) {
|
||||
for (String eachLine : cfg.get(one + ".lore", Arrays.asList(""))) {
|
||||
@ -130,15 +118,17 @@ public class ItemBoostManager {
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<Enchantment, Integer> enchants = new HashMap<>();
|
||||
Map<Enchantment, Integer> enchants = new HashMap<>();
|
||||
if (cfg.getC().isList(one + ".enchants"))
|
||||
for (String eachLine : cfg.get(one + ".enchants", Arrays.asList(""))) {
|
||||
if (!eachLine.contains("="))
|
||||
continue;
|
||||
Enchantment ench = CMIEnchantment.getEnchantment(eachLine.split("=")[0]);
|
||||
|
||||
String[] split = eachLine.split("=", 2);
|
||||
Enchantment ench = CMIEnchantment.getEnchantment(split[0]);
|
||||
Integer level = -1;
|
||||
try {
|
||||
level = Integer.parseInt(eachLine.split("=")[1]);
|
||||
level = Integer.parseInt(split[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
continue;
|
||||
}
|
||||
@ -148,28 +138,36 @@ public class ItemBoostManager {
|
||||
|
||||
BoostMultiplier b = new BoostMultiplier();
|
||||
for (CurrencyType oneC : CurrencyType.values()) {
|
||||
if (cfg.getC().isDouble(one + "." + oneC.toString().toLowerCase() + "Boost") || cfg.getC().isInt(one + "." + oneC.toString().toLowerCase() + "Boost"))
|
||||
b.add(oneC, cfg.get(one + "." + oneC.toString().toLowerCase() + "Boost", 1D) - 1);
|
||||
String typeName = oneC.toString().toLowerCase();
|
||||
if (cfg.getC().isDouble(one + "." + typeName + "Boost") || cfg.getC().isInt(one + "." + typeName + "Boost"))
|
||||
b.add(oneC, cfg.get(one + "." + typeName + "Boost", 1D) - 1);
|
||||
}
|
||||
|
||||
List<Job> jobs = new ArrayList<>();
|
||||
for (String oneJ : cfg.get(one + ".jobs", Arrays.asList(""))) {
|
||||
Job job = Jobs.getJob(oneJ);
|
||||
if (job == null && !oneJ.equalsIgnoreCase("all")) {
|
||||
Jobs.getPluginLogger().warning("Cant determine job by " + oneJ + " name for " + one + " boosted item!");
|
||||
continue;
|
||||
}
|
||||
if (oneJ.equalsIgnoreCase("all"))
|
||||
if (oneJ.equalsIgnoreCase("all")) {
|
||||
jobs.addAll(Jobs.getJobs());
|
||||
else if (job != null)
|
||||
jobs.add(job);
|
||||
} else {
|
||||
Job job = Jobs.getJob(oneJ);
|
||||
if (job != null) {
|
||||
jobs.add(job);
|
||||
} else {
|
||||
Jobs.getPluginLogger().warning("Cant determine job by " + oneJ + " name for " + one + " boosted item!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (jobs.isEmpty()) {
|
||||
Jobs.getPluginLogger().warning("Jobs list is empty for " + one + " boosted item!");
|
||||
continue;
|
||||
}
|
||||
JobItems item = new JobItems(one.toLowerCase(), mat, 1, name, lore, enchants, b, jobs);
|
||||
|
||||
CMIMaterial mat = cfg.getC().isString(one + ".id") ? CMIMaterial.get(cfg.get(one + ".id", "Stone")) : null;
|
||||
|
||||
String name = cfg.getC().isString(one + ".name") ? cfg.get(one + ".name", "") : null;
|
||||
String node = one.toLowerCase();
|
||||
|
||||
JobItems item = new JobItems(node, mat, 1, name, lore, enchants, b, jobs);
|
||||
|
||||
if (cfg.getC().isInt(one + ".levelFrom"))
|
||||
item.setFromLevel(cfg.get(one + ".levelFrom", 0));
|
||||
@ -178,16 +176,16 @@ public class ItemBoostManager {
|
||||
item.setUntilLevel(cfg.get(one + ".levelUntil", 1000));
|
||||
|
||||
for (Job oneJ : jobs) {
|
||||
oneJ.getItemBonus().put(one.toLowerCase(), item);
|
||||
oneJ.getItemBonus().put(node, item);
|
||||
}
|
||||
|
||||
// Lets add into legacy map
|
||||
if (one.contains("_")) {
|
||||
item.setLegacyKey((one.split("_")[1]).toLowerCase());
|
||||
item.setLegacyKey(one.split("_")[1].toLowerCase());
|
||||
LEGACY.put(item.getLegacyKey(), item);
|
||||
}
|
||||
ITEMS.put(one.toLowerCase(), item);
|
||||
|
||||
ITEMS.put(node, item);
|
||||
}
|
||||
|
||||
cfg.save();
|
||||
|
@ -189,27 +189,30 @@ public class Placeholder {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return pref + "_" + this.name();
|
||||
return pref + "_" + name();
|
||||
}
|
||||
|
||||
public String getFull() {
|
||||
if (this.isComplex()) {
|
||||
String name = this.getName();
|
||||
if (isComplex()) {
|
||||
String name = getName();
|
||||
int i = 0;
|
||||
for (String one : this.getName().split("_")) {
|
||||
for (String one : getName().split("_")) {
|
||||
if (!one.startsWith("$"))
|
||||
continue;
|
||||
|
||||
if (vars.length >= i - 1)
|
||||
name = name.replace(one, "[" + vars[i] + "]");
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return "%" + name + "%";
|
||||
}
|
||||
return "%" + this.getName() + "%";
|
||||
|
||||
return "%" + getName() + "%";
|
||||
}
|
||||
|
||||
public String getMVdW() {
|
||||
/*public String getMVdW() {
|
||||
if (this.isComplex()) {
|
||||
String name = this.getName();
|
||||
int i = 0;
|
||||
@ -224,7 +227,7 @@ public class Placeholder {
|
||||
return name;
|
||||
}
|
||||
return this.getName();
|
||||
}
|
||||
}*/
|
||||
|
||||
public List<String> getComplexRegexMatchers(String text) {
|
||||
List<String> lsInLs = new ArrayList<>();
|
||||
|
@ -123,15 +123,21 @@ public class PlayerManager {
|
||||
}
|
||||
|
||||
public void addPlayerToCache(JobsPlayer jPlayer) {
|
||||
if (!playersCache.containsKey(jPlayer.getName().toLowerCase()))
|
||||
playersCache.put(jPlayer.getName().toLowerCase(), jPlayer);
|
||||
String jName = jPlayer.getName().toLowerCase();
|
||||
|
||||
if (!playersCache.containsKey(jName))
|
||||
playersCache.put(jName, jPlayer);
|
||||
|
||||
if (jPlayer.getUniqueId() != null && !playersUUIDCache.containsKey(jPlayer.getUniqueId()))
|
||||
playersUUIDCache.put(jPlayer.getUniqueId(), jPlayer);
|
||||
}
|
||||
|
||||
public void addPlayer(JobsPlayer jPlayer) {
|
||||
if (!players.containsKey(jPlayer.getName().toLowerCase()))
|
||||
players.put(jPlayer.getName().toLowerCase(), jPlayer);
|
||||
String jName = jPlayer.getName().toLowerCase();
|
||||
|
||||
if (!players.containsKey(jName))
|
||||
players.put(jName, jPlayer);
|
||||
|
||||
if (jPlayer.getUniqueId() != null && !playersUUID.containsKey(jPlayer.getUniqueId()))
|
||||
playersUUID.put(jPlayer.getUniqueId(), jPlayer);
|
||||
}
|
||||
@ -334,9 +340,8 @@ public class PlayerManager {
|
||||
dao.recordPlayersLimits(jPlayer);
|
||||
|
||||
i++;
|
||||
y++;
|
||||
|
||||
if (y >= 1000) {
|
||||
if (y++ >= 1000) {
|
||||
Jobs.consoleMsg("&e[Jobs] Saved " + i + "/" + total + " players data");
|
||||
y = 0;
|
||||
}
|
||||
@ -380,8 +385,10 @@ public class PlayerManager {
|
||||
* @return {@link JobsPlayer} the player job info of the player
|
||||
*/
|
||||
public JobsPlayer getJobsPlayer(String playerName) {
|
||||
JobsPlayer jPlayer = players.get(playerName.toLowerCase());
|
||||
return jPlayer != null ? jPlayer : playersCache.get(playerName.toLowerCase());
|
||||
playerName = playerName.toLowerCase();
|
||||
|
||||
JobsPlayer jPlayer = players.get(playerName);
|
||||
return jPlayer != null ? jPlayer : playersCache.get(playerName);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -530,15 +537,11 @@ public class PlayerManager {
|
||||
* @param newjob - the new job
|
||||
*/
|
||||
public boolean transferJob(JobsPlayer jPlayer, Job oldjob, Job newjob) {
|
||||
if (!jPlayer.transferJob(oldjob, newjob))
|
||||
return false;
|
||||
|
||||
JobsDAO dao = Jobs.getJobsDAO();
|
||||
if (!dao.quitJob(jPlayer, oldjob))
|
||||
if (!jPlayer.transferJob(oldjob, newjob) || !Jobs.getJobsDAO().quitJob(jPlayer, oldjob))
|
||||
return false;
|
||||
|
||||
oldjob.updateTotalPlayers();
|
||||
dao.joinJob(jPlayer, jPlayer.getJobProgression(newjob));
|
||||
Jobs.getJobsDAO().joinJob(jPlayer, jPlayer.getJobProgression(newjob));
|
||||
newjob.updateTotalPlayers();
|
||||
jPlayer.save();
|
||||
return true;
|
||||
@ -836,11 +839,11 @@ public class PlayerManager {
|
||||
performCommandOnLevelUp(jPlayer, prog.getJob(), oldLevel);
|
||||
Jobs.getSignUtil().updateAllSign(job);
|
||||
|
||||
if (Jobs.getGCManager().titleMessageMaxLevelReached && prog.getLevel() == jPlayer.getMaxJobLevelAllowed(prog.getJob())) {
|
||||
TitleMessageManager.send(jPlayer.getPlayer(), Jobs.getLanguage().getMessage("message.max-level-reached.title",
|
||||
if (Jobs.getGCManager().titleMessageMaxLevelReached && player != null && prog.getLevel() == jPlayer.getMaxJobLevelAllowed(prog.getJob())) {
|
||||
TitleMessageManager.send(player, Jobs.getLanguage().getMessage("message.max-level-reached.title",
|
||||
"%jobname%", prog.getJob().getNameWithColor()),
|
||||
Jobs.getLanguage().getMessage("message.max-level-reached.subtitle", "%jobname%", prog.getJob().getNameWithColor()), 20, 40, 20);
|
||||
jPlayer.getPlayer().sendMessage(Jobs.getLanguage().getMessage("message.max-level-reached.chat", "%jobname%", prog.getJob().getNameWithColor()));
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("message.max-level-reached.chat", "%jobname%", prog.getJob().getNameWithColor()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -864,8 +867,8 @@ public class PlayerManager {
|
||||
&& newLevel <= command.getLevelUntil()) {
|
||||
for (String commandString : new ArrayList<>(command.getCommands())) {
|
||||
commandString = commandString.replace("[player]", player.getName());
|
||||
commandString = commandString.replace("[oldlevel]", String.valueOf(oldLevel));
|
||||
commandString = commandString.replace("[newlevel]", String.valueOf(newLevel));
|
||||
commandString = commandString.replace("[oldlevel]", Integer.toString(oldLevel));
|
||||
commandString = commandString.replace("[newlevel]", Integer.toString(newLevel));
|
||||
commandString = commandString.replace("[jobname]", job.getName());
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), commandString);
|
||||
}
|
||||
@ -984,7 +987,7 @@ public class PlayerManager {
|
||||
if (oneArmor != null && oneArmor.getType() != org.bukkit.Material.AIR) {
|
||||
jitems.add(getJobsItemByNbt(oneArmor));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (JobItems jitem : jitems) {
|
||||
@ -1063,8 +1066,10 @@ public class PlayerManager {
|
||||
if (player == null || !player.isOnline() || prog == null)
|
||||
return boost;
|
||||
|
||||
Player pl = player.getPlayer();
|
||||
|
||||
if (HookManager.getMcMMOManager().mcMMOPresent || HookManager.getMcMMOManager().mcMMOOverHaul)
|
||||
boost.add(BoostOf.McMMO, new BoostMultiplier().add(HookManager.getMcMMOManager().getMultiplier(player.getPlayer())));
|
||||
boost.add(BoostOf.McMMO, new BoostMultiplier().add(HookManager.getMcMMOManager().getMultiplier(pl)));
|
||||
|
||||
double petPay = 0D;
|
||||
|
||||
@ -1077,7 +1082,7 @@ public class PlayerManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (ent != null && HookManager.getMyPetManager() != null && HookManager.getMyPetManager().isMyPet(ent, player.getPlayer())) {
|
||||
if (ent != null && HookManager.getMyPetManager() != null && HookManager.getMyPetManager().isMyPet(ent, pl)) {
|
||||
if (petPay == 0D)
|
||||
petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay", false, false);
|
||||
if (petPay != 0D)
|
||||
@ -1093,10 +1098,11 @@ public class PlayerManager {
|
||||
if (getall) {
|
||||
if (petPay == 0D)
|
||||
petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay", force, false);
|
||||
if (petPay != 0D)
|
||||
else
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay));
|
||||
|
||||
Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner", force);
|
||||
if (amount != null)
|
||||
if (amount != 0D)
|
||||
boost.add(BoostOf.NearSpawner, new BoostMultiplier().add(amount));
|
||||
}
|
||||
|
||||
@ -1106,10 +1112,13 @@ public class PlayerManager {
|
||||
if (Jobs.getGCManager().useDynamicPayment)
|
||||
boost.add(BoostOf.Dynamic, new BoostMultiplier().add(prog.getBonus()));
|
||||
|
||||
boost.add(BoostOf.Item, getItemBoostNBT(player.getPlayer(), prog));
|
||||
if (pl != null) {
|
||||
boost.add(BoostOf.Item, getItemBoostNBT(pl, prog));
|
||||
}
|
||||
|
||||
if (!Jobs.getRestrictedAreaManager().getRestrictedAres().isEmpty())
|
||||
boost.add(BoostOf.Area, new BoostMultiplier().add(Jobs.getRestrictedAreaManager().getRestrictedMultiplier(player.getPlayer())));
|
||||
boost.add(BoostOf.Area, new BoostMultiplier().add(Jobs.getRestrictedAreaManager().getRestrictedMultiplier(pl)));
|
||||
|
||||
return boost;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -24,10 +25,10 @@ import com.gamingmesh.jobs.container.TopList;
|
||||
|
||||
public class SignUtil {
|
||||
|
||||
private final HashMap<String, HashMap<String, jobsSign>> signsByType = new HashMap<>();
|
||||
private final HashMap<String, jobsSign> signsByLocation = new HashMap<>();
|
||||
private final Map<String, Map<String, jobsSign>> signsByType = new HashMap<>();
|
||||
private final Map<String, jobsSign> signsByLocation = new HashMap<>();
|
||||
|
||||
public HashMap<String, HashMap<String, jobsSign>> getSigns() {
|
||||
public Map<String, Map<String, jobsSign>> getSigns() {
|
||||
return signsByType;
|
||||
}
|
||||
|
||||
@ -36,10 +37,11 @@ public class SignUtil {
|
||||
if (jSign == null)
|
||||
return false;
|
||||
|
||||
HashMap<String, jobsSign> sub = signsByType.get(jSign.getIdentifier().toLowerCase());
|
||||
Map<String, jobsSign> sub = signsByType.get(jSign.getIdentifier().toLowerCase());
|
||||
if (sub != null) {
|
||||
sub.remove(jSign.locToBlockString());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -53,15 +55,16 @@ public class SignUtil {
|
||||
|
||||
signsByLocation.put(jSign.locToBlockString(), jSign);
|
||||
|
||||
HashMap<String, jobsSign> old = signsByType.get(jSign.getIdentifier().toLowerCase());
|
||||
String identifier = jSign.getIdentifier().toLowerCase();
|
||||
Map<String, jobsSign> old = signsByType.get(identifier);
|
||||
if (old == null) {
|
||||
old = new HashMap<>();
|
||||
signsByType.put(jSign.getIdentifier().toLowerCase(), old);
|
||||
signsByType.put(identifier, old);
|
||||
}
|
||||
|
||||
old.put(jSign.locToBlockString(), jSign);
|
||||
|
||||
signsByType.put(jSign.getIdentifier().toLowerCase(), old);
|
||||
signsByType.put(identifier, old);
|
||||
}
|
||||
|
||||
public void LoadSigns() {
|
||||
@ -78,7 +81,7 @@ public class SignUtil {
|
||||
return;
|
||||
|
||||
ConfigurationSection confCategory = f.getConfigurationSection("Signs");
|
||||
ArrayList<String> categoriesList = new ArrayList<>(confCategory.getKeys(false));
|
||||
List<String> categoriesList = new ArrayList<>(confCategory.getKeys(false));
|
||||
if (categoriesList.isEmpty())
|
||||
return;
|
||||
|
||||
@ -104,11 +107,13 @@ public class SignUtil {
|
||||
}
|
||||
newTemp.setSpecial(nameSection.getBoolean("Special"));
|
||||
|
||||
HashMap<String, jobsSign> old = signsByType.get(newTemp.getIdentifier().toLowerCase());
|
||||
String identifier = newTemp.getIdentifier().toLowerCase();
|
||||
Map<String, jobsSign> old = signsByType.get(identifier);
|
||||
if (old == null) {
|
||||
old = new HashMap<>();
|
||||
signsByType.put(newTemp.getIdentifier().toLowerCase(), old);
|
||||
signsByType.put(identifier, old);
|
||||
}
|
||||
|
||||
String loc = newTemp.locToBlockString();
|
||||
old.put(loc, newTemp);
|
||||
signsByLocation.put(loc, newTemp);
|
||||
@ -133,8 +138,7 @@ public class SignUtil {
|
||||
|
||||
int i = 0;
|
||||
for (jobsSign sign : signsByLocation.values()) {
|
||||
++i;
|
||||
String path = "Signs." + i;
|
||||
String path = "Signs." + ++i;
|
||||
reader.set(path + ".Loc", sign.locToBlockString());
|
||||
reader.set(path + ".Number", sign.getNumber());
|
||||
reader.set(path + ".Type", sign.getType().toString());
|
||||
@ -169,7 +173,7 @@ public class SignUtil {
|
||||
|
||||
String jobNameOrType = jobsSign.getIdentifier(job, type);
|
||||
|
||||
HashMap<String, jobsSign> signs = this.signsByType.get(jobNameOrType.toLowerCase());
|
||||
Map<String, jobsSign> signs = signsByType.get(jobNameOrType.toLowerCase());
|
||||
if (signs == null || signs.isEmpty())
|
||||
return false;
|
||||
|
||||
@ -188,7 +192,7 @@ public class SignUtil {
|
||||
|
||||
int timelapse = 1;
|
||||
|
||||
HashMap<String, List<TopList>> temp = new HashMap<>();
|
||||
Map<String, List<TopList>> temp = new HashMap<>();
|
||||
|
||||
boolean save = false;
|
||||
for (jobsSign jSign : (new HashMap<>(signs)).values()) {
|
||||
@ -199,13 +203,13 @@ public class SignUtil {
|
||||
Block block = loc.getBlock();
|
||||
if (!(block.getState() instanceof Sign)) {
|
||||
if (!jobNameOrType.isEmpty()) {
|
||||
HashMap<String, jobsSign> tt = this.signsByType.get(jobNameOrType.toLowerCase());
|
||||
Map<String, jobsSign> tt = signsByType.get(jobNameOrType.toLowerCase());
|
||||
if (tt != null) {
|
||||
tt.remove(jSign.locToBlockString());
|
||||
}
|
||||
}
|
||||
|
||||
this.signsByLocation.remove(jSign.locToBlockString());
|
||||
signsByLocation.remove(jSign.locToBlockString());
|
||||
save = true;
|
||||
continue;
|
||||
}
|
||||
@ -253,7 +257,7 @@ public class SignUtil {
|
||||
Jobs.getInstance().getComplement().setLine(sign, i, line);
|
||||
}
|
||||
sign.update();
|
||||
if (!UpdateHead(sign, playerList.get(0).getPlayerInfo().getName(), timelapse)) {
|
||||
if (!updateHead(sign, playerList.get(0).getPlayerInfo().getName(), timelapse)) {
|
||||
timelapse--;
|
||||
}
|
||||
} else {
|
||||
@ -284,7 +288,7 @@ public class SignUtil {
|
||||
|
||||
Jobs.getInstance().getComplement().setLine(sign, 3, translateSignLine("signs.SpecialList.bottom", no, playerName, pl.getLevel(), signJobName));
|
||||
sign.update();
|
||||
if (!UpdateHead(sign, pl.getPlayerInfo().getName(), timelapse)) {
|
||||
if (!updateHead(sign, pl.getPlayerInfo().getName(), timelapse)) {
|
||||
timelapse--;
|
||||
}
|
||||
}
|
||||
@ -306,7 +310,7 @@ public class SignUtil {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean UpdateHead(final Sign sign, final String playerName, int timelapse) {
|
||||
public boolean updateHead(final Sign sign, final String playerName, int timelapse) {
|
||||
if (playerName == null)
|
||||
return false;
|
||||
|
||||
|
@ -69,11 +69,9 @@ public class join implements Cmd {
|
||||
}
|
||||
|
||||
JobProgression ajp = jPlayer.getArchivedJobProgression(job);
|
||||
if (ajp != null) {
|
||||
if (!ajp.canRejoin()) {
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.rejoin", "[time]", ajp.getRejoinTimeMessage()));
|
||||
return true;
|
||||
}
|
||||
if (ajp != null && !ajp.canRejoin()) {
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.rejoin", "[time]", ajp.getRejoinTimeMessage()));
|
||||
return true;
|
||||
}
|
||||
|
||||
Jobs.getPlayerManager().joinJob(jPlayer, job);
|
||||
|
@ -24,7 +24,7 @@ public class placeholders implements Cmd {
|
||||
if (sender instanceof Player && args[0].startsWith("-p:")) {
|
||||
try {
|
||||
page = Integer.parseInt(args[0].substring("-p:".length()));
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} else if (!(sender instanceof Player)) {
|
||||
player = Bukkit.getPlayer(args[0]);
|
||||
@ -69,8 +69,7 @@ public class placeholders implements Cmd {
|
||||
String place = one.getFull();
|
||||
String hover = "";
|
||||
if (plugin.isPlaceholderAPIEnabled()) {
|
||||
place = one.getFull();
|
||||
hover = one.getFull();
|
||||
hover = place = one.getFull();
|
||||
}
|
||||
// For MVdWPlaceholderAPI
|
||||
// if (plugin.isMVdWPlaceholderAPIEnabled()) {
|
||||
|
@ -54,7 +54,7 @@ public class JobItems {
|
||||
private int fromLevel = 0;
|
||||
private int untilLevel = Integer.MAX_VALUE;
|
||||
|
||||
public JobItems(String node, CMIMaterial mat, int amount, String name, List<String> lore, HashMap<Enchantment, Integer> enchants, BoostMultiplier boostMultiplier, List<Job> jobs) {
|
||||
public JobItems(String node, CMIMaterial mat, int amount, String name, List<String> lore, Map<Enchantment, Integer> enchants, BoostMultiplier boostMultiplier, List<Job> jobs) {
|
||||
this(node, mat, amount, name, lore, enchants, boostMultiplier, jobs, null);
|
||||
}
|
||||
|
||||
|
@ -28,19 +28,13 @@ import com.gamingmesh.jobs.container.CurrencyType;
|
||||
public class BufferedPayment {
|
||||
|
||||
private OfflinePlayer offlinePlayer;
|
||||
private final Map<CurrencyType, Double> payments = new HashMap<>();
|
||||
|
||||
@Deprecated
|
||||
public BufferedPayment(OfflinePlayer offlinePlayer, double amount, double points, double exp) {
|
||||
this.offlinePlayer = offlinePlayer;
|
||||
this.payments.put(CurrencyType.MONEY, amount);
|
||||
this.payments.put(CurrencyType.EXP, exp);
|
||||
this.payments.put(CurrencyType.POINTS, points);
|
||||
}
|
||||
private final Map<CurrencyType, Double> payments = new HashMap<>();
|
||||
|
||||
public BufferedPayment(OfflinePlayer offlinePlayer, Map<CurrencyType, Double> payments) {
|
||||
this.offlinePlayer = offlinePlayer;
|
||||
// This can contain only one value instead of all posible ones
|
||||
|
||||
// This can contain only one value instead of all possible ones
|
||||
this.payments.putAll(payments);
|
||||
}
|
||||
|
||||
@ -48,45 +42,12 @@ public class BufferedPayment {
|
||||
return offlinePlayer;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Double getAmount() {
|
||||
Double amount = this.payments.get(CurrencyType.MONEY);
|
||||
return amount == null ? 0 : amount;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public double getPoints() {
|
||||
Double amount = this.payments.get(CurrencyType.POINTS);
|
||||
return amount == null ? 0 : amount;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public double getExp() {
|
||||
Double amount = this.payments.get(CurrencyType.EXP);
|
||||
return amount == null ? 0 : amount;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setAmount(double amount) {
|
||||
this.payments.put(CurrencyType.MONEY, amount);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setPoints(double points) {
|
||||
this.payments.put(CurrencyType.POINTS, points);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setExp(double exp) {
|
||||
this.payments.put(CurrencyType.EXP, exp);
|
||||
}
|
||||
|
||||
public Double get(CurrencyType type) {
|
||||
return payments.getOrDefault(type, 0d);
|
||||
}
|
||||
|
||||
public Double set(CurrencyType type, double amount) {
|
||||
return this.payments.put(type, amount);
|
||||
return payments.put(type, amount);
|
||||
}
|
||||
|
||||
public boolean containsPayment() {
|
||||
|
@ -9,7 +9,7 @@ public class PaymentData {
|
||||
|
||||
private Long lastAnnouced = 0L;
|
||||
|
||||
private final HashMap<CurrencyType, LimitsData> payments = new HashMap<>();
|
||||
private final java.util.Map<CurrencyType, LimitsData> payments = new HashMap<>();
|
||||
|
||||
private boolean informed = false;
|
||||
|
||||
|
@ -29,8 +29,12 @@ public class MyPetManager extends HookPlugin {
|
||||
}
|
||||
|
||||
MyPetPlayer myPetPlayer = mp.getMyPetPlayer(owner);
|
||||
return myPetPlayer.hasMyPet() && myPetPlayer.getMyPet().getEntity().isPresent() &&
|
||||
myPetPlayer.getMyPet().getEntity().get().getType() == entity.getType();
|
||||
if (!myPetPlayer.hasMyPet()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
java.util.Optional<MyPetBukkitEntity> opt = myPetPlayer.getMyPet().getEntity();
|
||||
return opt.isPresent() && opt.get().getType() == entity.getType();
|
||||
}
|
||||
|
||||
public UUID getOwnerOfPet(Entity ent) {
|
||||
|
@ -19,14 +19,13 @@ public class MythicMobs4Listener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void OnMythicMobDeath(MythicMobDeathEvent event) {
|
||||
//disabling plugin in world
|
||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
// Entity that died must be living
|
||||
if (!(event.getEntity() instanceof LivingEntity))
|
||||
return;
|
||||
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
Player pDamager = null;
|
||||
|
||||
// Checking if killer is player
|
||||
@ -49,16 +48,14 @@ public class MythicMobs4Listener implements Listener {
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName()))
|
||||
return;
|
||||
|
||||
// pay
|
||||
JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(pDamager);
|
||||
if (jDamager == null)
|
||||
return;
|
||||
|
||||
// pay
|
||||
MythicMob lVictim = event.getMobType();
|
||||
if (lVictim == null) {
|
||||
return;
|
||||
if (lVictim != null) {
|
||||
Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), ent);
|
||||
}
|
||||
|
||||
Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), ent);
|
||||
}
|
||||
}
|
||||
|
@ -137,8 +137,7 @@ public class JobsListener implements Listener {
|
||||
}
|
||||
|
||||
if (Jobs.getSelectionManager().hasPlacedBoth(player)) {
|
||||
JobsAreaSelectionEvent jobsAreaSelectionEvent = new JobsAreaSelectionEvent(player, Jobs.getSelectionManager().getSelectionCuboid(player));
|
||||
plugin.getServer().getPluginManager().callEvent(jobsAreaSelectionEvent);
|
||||
plugin.getServer().getPluginManager().callEvent(new JobsAreaSelectionEvent(player, Jobs.getSelectionManager().getSelectionCuboid(player)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,7 +208,8 @@ public class JobsListener implements Listener {
|
||||
}
|
||||
|
||||
player.performCommand("jobs " + command + " " + CMIChatColor.stripColor(plugin.getComplement().getLine(sign, 2))
|
||||
+ " " + CMIChatColor.stripColor(plugin.getComplement().getLine(sign, 3)));
|
||||
+ " " + CMIChatColor.stripColor(plugin.getComplement()
|
||||
.getLine(sign, 3)).replace(" ", "")); // Replace trailing spaces at 3rd line to parse command
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
@ -313,8 +313,7 @@ public class JobsListener implements Listener {
|
||||
|
||||
if (CMIChatColor.stripColor(plugin.getComplement().getLine(event, 0))
|
||||
.equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.topline"))) && !CMIChatColor.stripColor(
|
||||
plugin.getComplement().getLine(event, 1))
|
||||
.equalsIgnoreCase("toplist"))
|
||||
plugin.getComplement().getLine(event, 1)).equalsIgnoreCase("toplist"))
|
||||
plugin.getComplement().setLine(event, 0, convert(Jobs.getLanguage().getMessage("signs.topline")));
|
||||
else
|
||||
return;
|
||||
@ -327,8 +326,9 @@ public class JobsListener implements Listener {
|
||||
|
||||
String command = CMIChatColor.stripColor(plugin.getComplement().getLine(event, 1)).toLowerCase();
|
||||
for (String key : Jobs.getLanguageManager().signKeys) {
|
||||
if (command.equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.secondline." + key)))) {
|
||||
plugin.getComplement().setLine(event, 1, convert(Jobs.getLanguage().getMessage("signs.secondline." + key)));
|
||||
String secondLine = Jobs.getLanguage().getMessage("signs.secondline." + key);
|
||||
if (command.equalsIgnoreCase(CMIChatColor.stripColor(secondLine))) {
|
||||
plugin.getComplement().setLine(event, 1, convert(secondLine));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -350,8 +350,9 @@ public class JobsListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onWorldLoad(WorldLoadEvent event) {
|
||||
PluginManager pm = plugin.getServer().getPluginManager();
|
||||
if (pm.getPermission("jobs.world." + event.getWorld().getName().toLowerCase()) == null)
|
||||
pm.addPermission(new Permission("jobs.world." + event.getWorld().getName().toLowerCase(), PermissionDefault.TRUE));
|
||||
String name = event.getWorld().getName().toLowerCase();
|
||||
if (pm.getPermission("jobs.world." + name) == null)
|
||||
pm.addPermission(new Permission("jobs.world." + name, PermissionDefault.TRUE));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
@ -452,11 +453,10 @@ public class JobsListener implements Listener {
|
||||
return;
|
||||
|
||||
boolean shift = false, numberkey = false;
|
||||
ClickType click = event.getClick();
|
||||
if (click == ClickType.SHIFT_LEFT || click == ClickType.SHIFT_RIGHT)
|
||||
if (event.getClick() == ClickType.SHIFT_LEFT || event.getClick() == ClickType.SHIFT_RIGHT)
|
||||
shift = true;
|
||||
|
||||
if (click == ClickType.NUMBER_KEY)
|
||||
if (event.getClick() == ClickType.NUMBER_KEY)
|
||||
numberkey = true;
|
||||
|
||||
SlotType slotType = event.getSlotType();
|
||||
|
Loading…
Reference in New Issue
Block a user