mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-20 07:01:22 +01:00
2nd improvements
This commit is contained in:
parent
dbc0c8330a
commit
c8b4eaa479
@ -87,8 +87,10 @@ public class ChatFilterRule {
|
|||||||
|
|
||||||
public Matcher getMatcher(String msg) {
|
public Matcher getMatcher(String msg) {
|
||||||
for (Pattern one : pattern) {
|
for (Pattern one : pattern) {
|
||||||
if (one.matcher(msg).find()) {
|
Matcher matcher = one.matcher(msg);
|
||||||
return one.matcher(msg);
|
|
||||||
|
if (matcher.find()) {
|
||||||
|
return matcher;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -197,7 +197,8 @@ public class Placeholder {
|
|||||||
if (isComplex()) {
|
if (isComplex()) {
|
||||||
String name = getName();
|
String name = getName();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String one : getName().split("_")) {
|
|
||||||
|
for (String one : name.split("_")) {
|
||||||
if (!one.startsWith("$"))
|
if (!one.startsWith("$"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -409,7 +410,8 @@ public class Placeholder {
|
|||||||
JobsPlayer user = uuid == null ? null : Jobs.getPlayerManager().getJobsPlayer(uuid);
|
JobsPlayer user = uuid == null ? null : Jobs.getPlayerManager().getJobsPlayer(uuid);
|
||||||
// Placeholders by JobsPlayer object
|
// Placeholders by JobsPlayer object
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
NumberFormat format;
|
NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH);
|
||||||
|
|
||||||
switch (placeHolder) {
|
switch (placeHolder) {
|
||||||
case user_dailyquests_pending:
|
case user_dailyquests_pending:
|
||||||
Integer pendingQuests = (int) user.getQuestProgressions().stream().filter(q -> !q.isCompleted()).count();
|
Integer pendingQuests = (int) user.getQuestProgressions().stream().filter(q -> !q.isCompleted()).count();
|
||||||
@ -451,7 +453,6 @@ public class Placeholder {
|
|||||||
case user_points_fixed:
|
case user_points_fixed:
|
||||||
return Integer.toString((int) user.getPointsData().getCurrentPoints());
|
return Integer.toString((int) user.getPointsData().getCurrentPoints());
|
||||||
case user_total_points:
|
case user_total_points:
|
||||||
format = NumberFormat.getInstance(Locale.ENGLISH);
|
|
||||||
return format.format(user.getPointsData().getTotalPoints());
|
return format.format(user.getPointsData().getTotalPoints());
|
||||||
case user_issaved:
|
case user_issaved:
|
||||||
return convert(user.isSaved());
|
return convert(user.isSaved());
|
||||||
@ -511,10 +512,8 @@ public class Placeholder {
|
|||||||
case user_jlevel_$1:
|
case user_jlevel_$1:
|
||||||
return j == null ? "0" : Integer.toString(j.getLevel());
|
return j == null ? "0" : Integer.toString(j.getLevel());
|
||||||
case user_jexp_$1:
|
case user_jexp_$1:
|
||||||
format = NumberFormat.getInstance(Locale.ENGLISH);
|
|
||||||
return j == null ? "0" : format.format(j.getExperience());
|
return j == null ? "0" : format.format(j.getExperience());
|
||||||
case user_jmaxexp_$1:
|
case user_jmaxexp_$1:
|
||||||
format = NumberFormat.getInstance(Locale.ENGLISH);
|
|
||||||
return j == null ? "0" : format.format(j.getMaxExperience());
|
return j == null ? "0" : format.format(j.getMaxExperience());
|
||||||
case user_jexpunf_$1:
|
case user_jexpunf_$1:
|
||||||
return j == null ? "0" : Double.toString(j.getExperience());
|
return j == null ? "0" : Double.toString(j.getExperience());
|
||||||
|
@ -7,9 +7,11 @@ public class SignInfo {
|
|||||||
|
|
||||||
private final List<jobsSign> allSigns = new ArrayList<>();
|
private final List<jobsSign> allSigns = new ArrayList<>();
|
||||||
|
|
||||||
public void setAllSigns(List<jobsSign> AllSigns) {
|
public void setAllSigns(List<jobsSign> allSigns) {
|
||||||
this.allSigns.clear();
|
this.allSigns.clear();
|
||||||
this.allSigns.addAll(AllSigns == null ? new ArrayList<>() : AllSigns);
|
|
||||||
|
if (allSigns != null)
|
||||||
|
this.allSigns.addAll(allSigns);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<jobsSign> getAllSigns() {
|
public List<jobsSign> getAllSigns() {
|
||||||
|
@ -81,19 +81,21 @@ public class SignUtil {
|
|||||||
signsByLocation.clear();
|
signsByLocation.clear();
|
||||||
|
|
||||||
File file = new File(Jobs.getFolder(), "Signs.yml");
|
File file = new File(Jobs.getFolder(), "Signs.yml");
|
||||||
YamlConfiguration f = YamlConfiguration.loadConfiguration(file);
|
ConfigurationSection confCategory = YamlConfiguration.loadConfiguration(file).getConfigurationSection("Signs");
|
||||||
|
if (confCategory == null)
|
||||||
if (!f.isConfigurationSection("Signs"))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ConfigurationSection confCategory = f.getConfigurationSection("Signs");
|
|
||||||
List<String> categoriesList = new ArrayList<>(confCategory.getKeys(false));
|
List<String> categoriesList = new ArrayList<>(confCategory.getKeys(false));
|
||||||
if (categoriesList.isEmpty())
|
if (categoriesList.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (String category : categoriesList) {
|
for (String category : categoriesList) {
|
||||||
ConfigurationSection nameSection = confCategory.getConfigurationSection(category);
|
ConfigurationSection nameSection = confCategory.getConfigurationSection(category);
|
||||||
|
if (nameSection == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
jobsSign newTemp = new jobsSign();
|
jobsSign newTemp = new jobsSign();
|
||||||
|
|
||||||
if (nameSection.isString("World")) {
|
if (nameSection.isString("World")) {
|
||||||
newTemp.setWorldName(nameSection.getString("World"));
|
newTemp.setWorldName(nameSection.getString("World"));
|
||||||
newTemp.setX((int) nameSection.getDouble("X"));
|
newTemp.setX((int) nameSection.getDouble("X"));
|
||||||
@ -177,9 +179,9 @@ public class SignUtil {
|
|||||||
if (type == null)
|
if (type == null)
|
||||||
type = SignTopType.toplist;
|
type = SignTopType.toplist;
|
||||||
|
|
||||||
String jobNameOrType = jobsSign.getIdentifier(job, type);
|
String jobNameOrType = jobsSign.getIdentifier(job, type).toLowerCase();
|
||||||
|
|
||||||
Map<String, jobsSign> signs = signsByType.get(jobNameOrType.toLowerCase());
|
Map<String, jobsSign> signs = signsByType.get(jobNameOrType);
|
||||||
if (signs == null || signs.isEmpty())
|
if (signs == null || signs.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -209,7 +211,7 @@ public class SignUtil {
|
|||||||
Block block = loc.getBlock();
|
Block block = loc.getBlock();
|
||||||
if (!(block.getState() instanceof Sign)) {
|
if (!(block.getState() instanceof Sign)) {
|
||||||
if (!jobNameOrType.isEmpty()) {
|
if (!jobNameOrType.isEmpty()) {
|
||||||
Map<String, jobsSign> tt = signsByType.get(jobNameOrType.toLowerCase());
|
Map<String, jobsSign> tt = signsByType.get(jobNameOrType);
|
||||||
if (tt != null) {
|
if (tt != null) {
|
||||||
tt.remove(jSign.locToBlockString());
|
tt.remove(jSign.locToBlockString());
|
||||||
}
|
}
|
||||||
@ -243,7 +245,7 @@ public class SignUtil {
|
|||||||
String playerName = pl.getPlayerInfo().getName();
|
String playerName = pl.getPlayerInfo().getName();
|
||||||
if (playerName.length() > 15) {
|
if (playerName.length() > 15) {
|
||||||
// We need to split 10 char of name, because of sign rows
|
// We need to split 10 char of name, because of sign rows
|
||||||
playerName = playerName.split("(?<=\\G.{10})")[0] + "~";
|
playerName = playerName.split("(?<=\\G.{10})", 2)[0] + "~";
|
||||||
}
|
}
|
||||||
|
|
||||||
String line = "";
|
String line = "";
|
||||||
@ -273,7 +275,7 @@ public class SignUtil {
|
|||||||
TopList pl = playerList.get(jSign.getNumber() - 1);
|
TopList pl = playerList.get(jSign.getNumber() - 1);
|
||||||
String playerName = pl.getPlayerInfo().getName();
|
String playerName = pl.getPlayerInfo().getName();
|
||||||
if (playerName.length() > 15) {
|
if (playerName.length() > 15) {
|
||||||
playerName = playerName.split("(?<=\\G.{10})")[0] + "~";
|
playerName = playerName.split("(?<=\\G.{10})", 2)[0] + "~";
|
||||||
}
|
}
|
||||||
|
|
||||||
int no = jSign.getNumber() + number + 1;
|
int no = jSign.getNumber() + number + 1;
|
||||||
@ -283,7 +285,7 @@ public class SignUtil {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case toplist:
|
case toplist:
|
||||||
case gtoplist:
|
case gtoplist:
|
||||||
plugin.getComplement().setLine(sign, 2, Jobs.getLanguage().getMessage("signs.SpecialList.level", "[number]", no, "[player]", playerName, "[level]", pl.getLevel(), "[job]", signJobName));
|
plugin.getComplement().setLine(sign, 2, translateSignLine("signs.SpecialList.level", no, playerName, pl.getLevel(), signJobName));
|
||||||
break;
|
break;
|
||||||
case questtoplist:
|
case questtoplist:
|
||||||
plugin.getComplement().setLine(sign, 2, Jobs.getLanguage().getMessage("signs.SpecialList.quests", "[number]", no, "[player]", playerName, "[quests]", pl.getLevel(), "[job]", signJobName));
|
plugin.getComplement().setLine(sign, 2, Jobs.getLanguage().getMessage("signs.SpecialList.quests", "[number]", no, "[player]", playerName, "[quests]", pl.getLevel(), "[job]", signJobName));
|
||||||
|
@ -97,7 +97,7 @@ public class jobsSign {
|
|||||||
if (!string.contains(";"))
|
if (!string.contains(";"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String[] split = string.replace(',', '.').split(";");
|
String[] split = string.replace(',', '.').split(";", 4);
|
||||||
|
|
||||||
int x = 0, y = 0, z = 0;
|
int x = 0, y = 0, z = 0;
|
||||||
|
|
||||||
|
@ -22,14 +22,13 @@ public class leave implements Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player pSender = (Player) sender;
|
Player pSender = (Player) sender;
|
||||||
String jobName = args[0];
|
Job job = Jobs.getJob(args[0]);
|
||||||
Job job = Jobs.getJob(jobName);
|
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Jobs.getGCManager().UsePerPermissionForLeaving && !pSender.hasPermission("jobs.command.leave." + jobName.toLowerCase())) {
|
if (Jobs.getGCManager().UsePerPermissionForLeaving && !pSender.hasPermission("jobs.command.leave." + args[0].toLowerCase())) {
|
||||||
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission"));
|
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -21,17 +21,18 @@ public class quests implements Cmd {
|
|||||||
@Override
|
@Override
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
|
||||||
JobsPlayer jPlayer = null;
|
JobsPlayer jPlayer = null;
|
||||||
|
boolean isPlayer = sender instanceof Player;
|
||||||
|
|
||||||
if (args.length >= 1 && args[0].equals("next") && (!(args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("start")))) {
|
if (args.length >= 1 && isPlayer && args[0].equalsIgnoreCase("next")) {
|
||||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||||
jPlayer.resetQuests();
|
jPlayer.resetQuests();
|
||||||
} else {
|
} else {
|
||||||
if (args.length >= 1 && (!(args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("start")))) {
|
if (args.length >= 1 && !args[0].equalsIgnoreCase("stop") && !args[0].equalsIgnoreCase("start")) {
|
||||||
if (!Jobs.hasPermission(sender, "jobs.command.admin.quests", true))
|
if (!Jobs.hasPermission(sender, "jobs.command.admin.quests", true))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||||
} else if (sender instanceof Player)
|
} else if (isPlayer)
|
||||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +52,7 @@ public class quests implements Cmd {
|
|||||||
if (args.length >= 1) {
|
if (args.length >= 1) {
|
||||||
Boolean stopped = null;
|
Boolean stopped = null;
|
||||||
String cmd = args[args.length == 1 ? 0 : 1];
|
String cmd = args[args.length == 1 ? 0 : 1];
|
||||||
|
|
||||||
if (cmd.equalsIgnoreCase("stop") && Jobs.hasPermission(sender, "jobs.command.admin.quests.stop", false)) {
|
if (cmd.equalsIgnoreCase("stop") && Jobs.hasPermission(sender, "jobs.command.admin.quests.stop", false)) {
|
||||||
stopped = true;
|
stopped = true;
|
||||||
} else if (cmd.equalsIgnoreCase("start") && Jobs.hasPermission(sender, "jobs.command.admin.quests.start", false)) {
|
} else if (cmd.equalsIgnoreCase("start") && Jobs.hasPermission(sender, "jobs.command.admin.quests.start", false)) {
|
||||||
@ -58,10 +60,8 @@ public class quests implements Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stopped != null) {
|
if (stopped != null) {
|
||||||
for (JobProgression jobProg : jPlayer.getJobProgression()) {
|
for (QuestProgression q : jPlayer.getQuestProgressions()) {
|
||||||
for (QuestProgression q : jPlayer.getQuestProgressions(jobProg.getJob())) {
|
q.getQuest().setStopped(stopped);
|
||||||
q.getQuest().setStopped(stopped);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.status.changed", "%status%",
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.status.changed", "%status%",
|
||||||
@ -72,7 +72,8 @@ public class quests implements Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getName(), "[questsDone]", jPlayer.getDoneQuests()));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getName(), "[questsDone]", jPlayer.getDoneQuests()));
|
||||||
if (!(sender instanceof Player)) {
|
|
||||||
|
if (!isPlayer) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +129,7 @@ public class quests implements Cmd {
|
|||||||
rm.addText(msg).addHover(hover).addCommand("jobs skipquest " + jobProg.getJob().getName() + " " + q.getQuest().getConfigName() + " " + jPlayer.getName());
|
rm.addText(msg).addHover(hover).addCommand("jobs skipquest " + jobProg.getJob().getName() + " " + q.getQuest().getConfigName() + " " + jPlayer.getName());
|
||||||
} else
|
} else
|
||||||
rm.addText(msg).addHover(hover);
|
rm.addText(msg).addHover(hover);
|
||||||
|
|
||||||
rm.show(sender);
|
rm.show(sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -926,7 +926,6 @@ public class JobsPlayer {
|
|||||||
* @return true if yes
|
* @return true if yes
|
||||||
*/
|
*/
|
||||||
public boolean canGetPaid(ActionInfo info) {
|
public boolean canGetPaid(ActionInfo info) {
|
||||||
List<JobProgression> progression = getJobProgression();
|
|
||||||
int numjobs = progression.size();
|
int numjobs = progression.size();
|
||||||
|
|
||||||
if (numjobs == 0) {
|
if (numjobs == 0) {
|
||||||
@ -1013,7 +1012,9 @@ public class JobsPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void resetQuests() {
|
public void resetQuests() {
|
||||||
getJobProgression().forEach(one -> resetQuests(one.getJob()));
|
for (JobProgression prog : progression) {
|
||||||
|
resetQuests(prog.getJob());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getNewQuests() {
|
public void getNewQuests() {
|
||||||
@ -1029,7 +1030,7 @@ public class JobsPlayer {
|
|||||||
|
|
||||||
Quest q = quest.getJob().getNextQuest(getQuestNameList(quest.getJob(), null), getJobProgression(quest.getJob()).getLevel());
|
Quest q = quest.getJob().getNextQuest(getQuestNameList(quest.getJob(), null), getJobProgression(quest.getJob()).getLevel());
|
||||||
if (q == null) {
|
if (q == null) {
|
||||||
for (JobProgression one : this.getJobProgression()) {
|
for (JobProgression one : progression) {
|
||||||
if (one.getJob().isSame(quest.getJob()))
|
if (one.getJob().isSame(quest.getJob()))
|
||||||
continue;
|
continue;
|
||||||
q = one.getJob().getNextQuest(getQuestNameList(one.getJob(), null), getJobProgression(one.getJob()).getLevel());
|
q = one.getJob().getNextQuest(getQuestNameList(one.getJob(), null), getJobProgression(one.getJob()).getLevel());
|
||||||
@ -1066,7 +1067,7 @@ public class JobsPlayer {
|
|||||||
|
|
||||||
public List<QuestProgression> getQuestProgressions() {
|
public List<QuestProgression> getQuestProgressions() {
|
||||||
List<QuestProgression> g = new ArrayList<>();
|
List<QuestProgression> g = new ArrayList<>();
|
||||||
for (JobProgression one : getJobProgression()) {
|
for (JobProgression one : progression) {
|
||||||
g.addAll(getQuestProgressions(one.getJob()));
|
g.addAll(getQuestProgressions(one.getJob()));
|
||||||
}
|
}
|
||||||
return g;
|
return g;
|
||||||
|
@ -238,8 +238,8 @@ public class BufferedEconomy {
|
|||||||
* @param payment {@link BufferedPayment}
|
* @param payment {@link BufferedPayment}
|
||||||
*/
|
*/
|
||||||
public void showPayment(BufferedPayment payment) {
|
public void showPayment(BufferedPayment payment) {
|
||||||
if (payment.getOfflinePlayer() == null || !payment.getOfflinePlayer().isOnline() || !payment.containsPayment()
|
if (Jobs.getGCManager().aBarSilentMode || payment.getOfflinePlayer() == null || !payment.getOfflinePlayer().isOnline()
|
||||||
|| Jobs.getGCManager().aBarSilentMode)
|
|| !payment.containsPayment())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UUID playerUUID = payment.getOfflinePlayer().getUniqueId();
|
UUID playerUUID = payment.getOfflinePlayer().getUniqueId();
|
||||||
|
@ -45,8 +45,12 @@ public class PaymentData {
|
|||||||
return payments.get(type).isReseted();
|
return payments.get(type).isReseted();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getAmount(CurrencyType type) {
|
public double getAmount(CurrencyType type) {
|
||||||
return !payments.containsKey(type) ? 0D : (int) (payments.get(type).getAmount() * 100) / 100D;
|
if (type == null)
|
||||||
|
return 0D;
|
||||||
|
|
||||||
|
LimitsData data = payments.get(type);
|
||||||
|
return data == null ? 0D : (int) (data.getAmount() * 100) / 100D;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getAmountBylimit(CurrencyType type, int limit) {
|
public Double getAmountBylimit(CurrencyType type, int limit) {
|
||||||
|
@ -94,11 +94,13 @@ public class JobsListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInteractOk(Player player) {
|
private boolean isInteractOk(Player player) {
|
||||||
if (!interactDelay.containsKey(player.getUniqueId())) {
|
Long delay = interactDelay.get(player.getUniqueId());
|
||||||
|
if (delay == null) {
|
||||||
interactDelay.put(player.getUniqueId(), System.currentTimeMillis());
|
interactDelay.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
long time = System.currentTimeMillis() - interactDelay.get(player.getUniqueId());
|
|
||||||
|
long time = System.currentTimeMillis() - delay;
|
||||||
interactDelay.put(player.getUniqueId(), System.currentTimeMillis());
|
interactDelay.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
return time > 100;
|
return time > 100;
|
||||||
}
|
}
|
||||||
@ -124,8 +126,8 @@ public class JobsListener implements Listener {
|
|||||||
if (player.getGameMode() == GameMode.CREATIVE)
|
if (player.getGameMode() == GameMode.CREATIVE)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
Block block = event.getClickedBlock();
|
Location loc = event.getClickedBlock().getLocation();
|
||||||
Location loc = block.getLocation();
|
|
||||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
Jobs.getSelectionManager().placeLoc1(player, loc);
|
Jobs.getSelectionManager().placeLoc1(player, loc);
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.area.output.selected1", "%x%", loc.getBlockX(), "%y%", loc.getBlockY(), "%z%", loc.getBlockZ()));
|
player.sendMessage(Jobs.getLanguage().getMessage("command.area.output.selected1", "%x%", loc.getBlockX(), "%y%", loc.getBlockY(), "%z%", loc.getBlockZ()));
|
||||||
@ -424,7 +426,9 @@ public class JobsListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Entry<Enchantment, Integer> oneE : enchants.entrySet()) {
|
for (Entry<Enchantment, Integer> oneE : enchants.entrySet()) {
|
||||||
if (oneItem.getEnchants().containsKey(oneE.getKey()) && oneItem.getEnchants().get(oneE.getKey()) <= oneE.getValue()) {
|
Integer value = oneItem.getEnchants().get(oneE.getKey());
|
||||||
|
|
||||||
|
if (value != null && value <= oneE.getValue()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -565,7 +569,7 @@ public class JobsListener implements Listener {
|
|||||||
|
|
||||||
ItemStack item = event.getItem();
|
ItemStack item = event.getItem();
|
||||||
ArmorTypes type = ArmorTypes.matchType(item);
|
ArmorTypes type = ArmorTypes.matchType(item);
|
||||||
if (ArmorTypes.matchType(item) == null)
|
if (type == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Location loc = event.getBlock().getLocation();
|
Location loc = event.getBlock().getLocation();
|
||||||
|
@ -360,10 +360,8 @@ public class JobsPaymentListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ItemStack contents = event.getContents().getIngredient();
|
ItemStack contents = event.getContents().getIngredient();
|
||||||
if (contents == null)
|
if (contents != null)
|
||||||
return;
|
Jobs.action(jPlayer, new ItemActionInfo(contents, ActionType.BREW));
|
||||||
|
|
||||||
Jobs.action(jPlayer, new ItemActionInfo(contents, ActionType.BREW));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
@ -619,10 +617,10 @@ public class JobsPaymentListener implements Listener {
|
|||||||
if (s == null)
|
if (s == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (CMIMaterial.isDye(s.getType()))
|
CMIMaterial mat = CMIMaterial.get(s);
|
||||||
|
if (mat.isDye())
|
||||||
dyeStack.add(s);
|
dyeStack.add(s);
|
||||||
|
|
||||||
CMIMaterial mat = CMIMaterial.get(s);
|
|
||||||
if (mat != CMIMaterial.NONE && mat != CMIMaterial.AIR) {
|
if (mat != CMIMaterial.NONE && mat != CMIMaterial.AIR) {
|
||||||
y++;
|
y++;
|
||||||
|
|
||||||
@ -965,13 +963,15 @@ public class JobsPaymentListener implements Listener {
|
|||||||
Enchantment enchant = oneEnchant.getKey();
|
Enchantment enchant = oneEnchant.getKey();
|
||||||
if (enchant == null)
|
if (enchant == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String enchantName = null;
|
String enchantName = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
enchantName = enchant.getKey().getKey().toLowerCase().replace("_", "").replace("minecraft:", "");
|
enchantName = enchant.getKey().getKey().toLowerCase().replace("_", "").replace("minecraft:", "");
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
CMIEnchantment ench = CMIEnchantment.get(enchant);
|
CMIEnchantment ench = CMIEnchantment.get(enchant);
|
||||||
enchantName = ench == null ? null : ench.toString();
|
if (ench != null)
|
||||||
|
enchantName = ench.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enchantName != null)
|
if (enchantName != null)
|
||||||
@ -986,13 +986,10 @@ public class JobsPaymentListener implements Listener {
|
|||||||
if (!Jobs.getGCManager().PreventHopperFillUps)
|
if (!Jobs.getGCManager().PreventHopperFillUps)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String type = event.getDestination().getType().toString();
|
|
||||||
if (!type.equalsIgnoreCase("FURNACE") && !type.equalsIgnoreCase("SMOKER") && !type.equalsIgnoreCase("BLAST_FURNACE"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.getItem().getType() == Material.AIR)
|
if (event.getItem().getType() == Material.AIR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
String type = event.getDestination().getType().toString();
|
||||||
Block block = null;
|
Block block = null;
|
||||||
|
|
||||||
switch (type.toLowerCase()) {
|
switch (type.toLowerCase()) {
|
||||||
@ -1008,7 +1005,7 @@ public class JobsPaymentListener implements Listener {
|
|||||||
block = ((org.bukkit.block.BlastFurnace) event.getDestination().getHolder()).getBlock();
|
block = ((org.bukkit.block.BlastFurnace) event.getDestination().getHolder()).getBlock();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block == null || !Jobs.getGCManager().canPerformActionInWorld(block.getWorld()))
|
if (block == null || !Jobs.getGCManager().canPerformActionInWorld(block.getWorld()))
|
||||||
@ -1020,10 +1017,10 @@ public class JobsPaymentListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onInventoryMoveItemEventToBrewingStand(InventoryMoveItemEvent event) {
|
public void onInventoryMoveItemEventToBrewingStand(InventoryMoveItemEvent event) {
|
||||||
if (event.getDestination().getType() != InventoryType.BREWING)
|
if (!Jobs.getGCManager().PreventBrewingStandFillUps || event.getDestination().getType() != InventoryType.BREWING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Jobs.getGCManager().PreventBrewingStandFillUps || event.getItem().getType() == Material.AIR)
|
if (event.getItem().getType() == Material.AIR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final BrewingStand stand = (BrewingStand) event.getDestination().getHolder();
|
final BrewingStand stand = (BrewingStand) event.getDestination().getHolder();
|
||||||
@ -1227,11 +1224,10 @@ public class JobsPaymentListener implements Listener {
|
|||||||
if (jDamager == null)
|
if (jDamager == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (lVictim instanceof Player && !lVictim.hasMetadata("NPC")) {
|
boolean notNpc = lVictim instanceof Player && !lVictim.hasMetadata("NPC");
|
||||||
Player VPlayer = (Player) lVictim;
|
|
||||||
if (jDamager.getName().equalsIgnoreCase(VPlayer.getName()))
|
if (notNpc && jDamager.getName().equalsIgnoreCase(((Player) lVictim).getName()))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (Jobs.getGCManager().payForStackedEntities) {
|
if (Jobs.getGCManager().payForStackedEntities) {
|
||||||
if (JobsHook.WildStacker.isEnabled() && HookManager.getWildStackerHandler().isStackedEntity(lVictim)) {
|
if (JobsHook.WildStacker.isEnabled() && HookManager.getWildStackerHandler().isStackedEntity(lVictim)) {
|
||||||
@ -1252,7 +1248,7 @@ public class JobsPaymentListener implements Listener {
|
|||||||
Jobs.action(jDamager, new EntityActionInfo(lVictim, ActionType.KILL), e.getDamager(), lVictim);
|
Jobs.action(jDamager, new EntityActionInfo(lVictim, ActionType.KILL), e.getDamager(), lVictim);
|
||||||
|
|
||||||
// Payment for killing player with particular job, except NPC's
|
// Payment for killing player with particular job, except NPC's
|
||||||
if (lVictim instanceof Player && !lVictim.hasMetadata("NPC")) {
|
if (notNpc) {
|
||||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) lVictim);
|
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) lVictim);
|
||||||
if (jPlayer == null)
|
if (jPlayer == null)
|
||||||
return;
|
return;
|
||||||
@ -1368,13 +1364,14 @@ public class JobsPaymentListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onArmorstandBreak(EntityDeathEvent event) {
|
public void onArmorstandBreak(EntityDeathEvent event) {
|
||||||
Entity ent = event.getEntity();
|
Entity ent = event.getEntity();
|
||||||
|
|
||||||
if (!ent.getType().toString().equalsIgnoreCase("ARMOR_STAND"))
|
if (!ent.getType().toString().equalsIgnoreCase("ARMOR_STAND"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent))
|
if (!(ent.getLastDamageCause() instanceof EntityDamageByEntityEvent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event.getEntity().getLastDamageCause();
|
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) ent.getLastDamageCause();
|
||||||
|
|
||||||
//extra check for Citizens 2 sentry kills
|
//extra check for Citizens 2 sentry kills
|
||||||
if (!(e.getDamager() instanceof Player))
|
if (!(e.getDamager() instanceof Player))
|
||||||
@ -1480,11 +1477,7 @@ public class JobsPaymentListener implements Listener {
|
|||||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new ItemActionInfo(Jobs.getNms().getItemInMainHand(player), ActionType.EAT));
|
||||||
if (jPlayer == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Jobs.action(jPlayer, new ItemActionInfo(Jobs.getNms().getItemInMainHand(player), ActionType.EAT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
@ -32,10 +32,10 @@ public class TabComplete implements TabCompleter {
|
|||||||
|
|
||||||
for (int i = 1; i <= args.length; i++) {
|
for (int i = 1; i <= args.length; i++) {
|
||||||
if (args.length == i + 1) {
|
if (args.length == i + 1) {
|
||||||
if (!Jobs.getGCManager().getCommandArgs().containsKey(first))
|
List<String> argsList = Jobs.getGCManager().getCommandArgs().get(first);
|
||||||
|
if (argsList == null)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
List<String> argsList = Jobs.getGCManager().getCommandArgs().get(first);
|
|
||||||
if (argsList.size() < i)
|
if (argsList.size() < i)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -64,8 +64,7 @@ public class Util {
|
|||||||
name = name.replaceAll("[_|.|-]", "");
|
name = name.replaceAll("[_|.|-]", "");
|
||||||
|
|
||||||
for (World one : Bukkit.getWorlds()) {
|
for (World one : Bukkit.getWorlds()) {
|
||||||
String n = one.getName().replaceAll("[_|.|-]", "");
|
if (one.getName().replaceAll("[_|.|-]", "").equalsIgnoreCase(name))
|
||||||
if (n.equalsIgnoreCase(name))
|
|
||||||
return one;
|
return one;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,8 @@ public class blockLoc {
|
|||||||
public boolean fromString(String loc) {
|
public boolean fromString(String loc) {
|
||||||
if (!loc.contains(":"))
|
if (!loc.contains(":"))
|
||||||
return false;
|
return false;
|
||||||
String[] split = loc.split(":");
|
|
||||||
|
String[] split = loc.split(":", 4);
|
||||||
if (split.length == 0) {
|
if (split.length == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class Complement2 implements Complement {
|
|||||||
} catch (NoSuchMethodError e) {
|
} catch (NoSuchMethodError e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return dName == null ? null : serialize(dName);
|
return dName == null ? "" : serialize(dName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user