mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-02 14:29:07 +01:00
Misc improvements
This commit is contained in:
parent
28b9ebfab3
commit
70ba4ec203
@ -72,18 +72,23 @@ public class PermissionManager {
|
|||||||
|
|
||||||
private static List<String> remade(String perm) {
|
private static List<String> remade(String perm) {
|
||||||
List<String> perms = new ArrayList<>();
|
List<String> perms = new ArrayList<>();
|
||||||
|
|
||||||
for (Job oneJ : Jobs.getJobs()) {
|
for (Job oneJ : Jobs.getJobs()) {
|
||||||
String t = perm;
|
String t = perm;
|
||||||
|
|
||||||
if (t.contains("%JOBNAME%"))
|
if (t.contains("%JOBNAME%"))
|
||||||
t = t.replace("%JOBNAME%", oneJ.getName().toLowerCase());
|
t = t.replace("%JOBNAME%", oneJ.getName().toLowerCase());
|
||||||
if (t.contains("%AMOUNT%"))
|
|
||||||
t = t.replace("%AMOUNT%", "");
|
t = t.replace("%AMOUNT%", "");
|
||||||
|
|
||||||
perms.add(t);
|
perms.add(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (perm.contains("%WORLDNAME%"))
|
if (perm.contains("%WORLDNAME%"))
|
||||||
for (World oneJ : Bukkit.getWorlds()) {
|
for (World oneJ : Bukkit.getWorlds()) {
|
||||||
perms.add(perm.replace("%WORLDNAME%", oneJ.getName().toLowerCase()));
|
perms.add(perm.replace("%WORLDNAME%", oneJ.getName().toLowerCase()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return perms;
|
return perms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,13 +84,12 @@ public class Placeholder {
|
|||||||
user_archived_jobs_exp_$1("jname/number"),
|
user_archived_jobs_exp_$1("jname/number"),
|
||||||
|
|
||||||
maxjobs,
|
maxjobs,
|
||||||
|
total_workers,
|
||||||
|
|
||||||
limit_$1("money/exp/points"),
|
limit_$1("money/exp/points"),
|
||||||
plimit_$1("money/exp/points"),
|
plimit_$1("money/exp/points"),
|
||||||
plimit_tleft_$1("money/exp/points"),
|
plimit_tleft_$1("money/exp/points"),
|
||||||
|
|
||||||
total_workers,
|
|
||||||
|
|
||||||
name_$1("jname/number"),
|
name_$1("jname/number"),
|
||||||
shortname_$1("jname/number"),
|
shortname_$1("jname/number"),
|
||||||
chatcolor_$1("jname/number"),
|
chatcolor_$1("jname/number"),
|
||||||
@ -105,7 +104,6 @@ public class Placeholder {
|
|||||||
private String[] vars;
|
private String[] vars;
|
||||||
private List<Integer> groups = new ArrayList<>();
|
private List<Integer> groups = new ArrayList<>();
|
||||||
private ChatFilterRule rule;
|
private ChatFilterRule rule;
|
||||||
private boolean hidden = false;
|
|
||||||
|
|
||||||
JobsPlaceHolders(String... vars) {
|
JobsPlaceHolders(String... vars) {
|
||||||
Matcher matcher = numericalRule.getMatcher(toString());
|
Matcher matcher = numericalRule.getMatcher(toString());
|
||||||
@ -126,7 +124,6 @@ public class Placeholder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.vars = vars;
|
this.vars = vars;
|
||||||
this.hidden = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JobsPlaceHolders getByName(String name) {
|
public static JobsPlaceHolders getByName(String name) {
|
||||||
@ -249,7 +246,8 @@ public class Placeholder {
|
|||||||
|
|
||||||
public List<String> getComplexValues(String text) {
|
public List<String> getComplexValues(String text) {
|
||||||
List<String> lsInLs = new ArrayList<>();
|
List<String> lsInLs = new ArrayList<>();
|
||||||
if (!isComplex() || text == null)
|
|
||||||
|
if (text == null || !isComplex())
|
||||||
return lsInLs;
|
return lsInLs;
|
||||||
|
|
||||||
Matcher matcher = rule.getMatcher(text);
|
Matcher matcher = rule.getMatcher(text);
|
||||||
@ -276,10 +274,6 @@ public class Placeholder {
|
|||||||
public void setRule(ChatFilterRule rule) {
|
public void setRule(ChatFilterRule rule) {
|
||||||
this.rule = rule;
|
this.rule = rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHidden() {
|
|
||||||
return hidden;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> updatePlaceHolders(Player player, List<String> messages) {
|
public List<String> updatePlaceHolders(Player player, List<String> messages) {
|
||||||
@ -393,7 +387,7 @@ public class Placeholder {
|
|||||||
int id = Integer.parseInt(value);
|
int id = Integer.parseInt(value);
|
||||||
if (id > 0)
|
if (id > 0)
|
||||||
return Jobs.getJobs().get(id - 1);
|
return Jobs.getJobs().get(id - 1);
|
||||||
} catch (Exception e) {
|
} catch (IndexOutOfBoundsException | NumberFormatException e) {
|
||||||
return Jobs.getJob(value);
|
return Jobs.getJob(value);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -90,9 +90,11 @@ public class expboost implements Cmd {
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time.contains("h") || time.contains("hour")) {
|
String[] split = time.split("h|hour", 2);
|
||||||
|
|
||||||
|
if (split.length > 0) {
|
||||||
try {
|
try {
|
||||||
arr[2] = Integer.parseInt(time.split("h|hour", 2)[0]);
|
arr[2] = Integer.parseInt(split[0]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
arr[2] = 0;
|
arr[2] = 0;
|
||||||
}
|
}
|
||||||
@ -100,9 +102,9 @@ public class expboost implements Cmd {
|
|||||||
time = time.replaceAll(arr[2] + "+[h|hour]+", "");
|
time = time.replaceAll(arr[2] + "+[h|hour]+", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time.contains("m") || time.contains("minute")) {
|
if ((split = time.split("m|minute", 2)).length > 0) {
|
||||||
try {
|
try {
|
||||||
arr[1] = Integer.parseInt(time.split("m|minute", 2)[0]);
|
arr[1] = Integer.parseInt(split[0]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
arr[1] = 0;
|
arr[1] = 0;
|
||||||
}
|
}
|
||||||
@ -110,9 +112,9 @@ public class expboost implements Cmd {
|
|||||||
time = time.replaceAll(arr[1] + "+[m|minute]+", "");
|
time = time.replaceAll(arr[1] + "+[m|minute]+", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time.contains("s") || time.contains("second")) {
|
if ((split = time.split("s|second", 2)).length > 0) {
|
||||||
try {
|
try {
|
||||||
arr[0] = Integer.parseInt(time.split("s|second", 2)[0]);
|
arr[0] = Integer.parseInt(split[0]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
arr[0] = 0;
|
arr[0] = 0;
|
||||||
}
|
}
|
||||||
|
@ -29,13 +29,16 @@ public class explored implements Cmd {
|
|||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
|
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (chunk.isFullyExplored() && Jobs.getGCManager().ExploreCompact) {
|
|
||||||
|
if (Jobs.getGCManager().ExploreCompact && chunk.isFullyExplored()) {
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.fullExplore"));
|
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.fullExplore"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < chunk.getPlayers().size(); i++) {
|
java.util.List<Integer> players = chunk.getPlayers();
|
||||||
PlayerInfo ji = Jobs.getPlayerManager().getPlayerInfo(chunk.getPlayers().get(i));
|
|
||||||
|
for (int i = 0; i < players.size(); i++) {
|
||||||
|
PlayerInfo ji = Jobs.getPlayerManager().getPlayerInfo(players.get(i));
|
||||||
if (ji != null)
|
if (ji != null)
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.list", "%place%", i, "%playername%", ji.getName()));
|
player.sendMessage(Jobs.getLanguage().getMessage("command.explored.list", "%place%", i, "%playername%", ji.getName()));
|
||||||
}
|
}
|
||||||
|
@ -46,19 +46,15 @@ public class info implements Cmd {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int page = 1;
|
||||||
String type = "";
|
String type = "";
|
||||||
if (args.length >= 2) {
|
if (args.length >= 2) {
|
||||||
try {
|
try {
|
||||||
Integer.parseInt(args[1]);
|
page = Integer.parseInt(args[1]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
type = args[1];
|
type = args[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int page = 1;
|
|
||||||
try {
|
|
||||||
page = Integer.parseInt(args[args.length - 1]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
Jobs.getCommandManager().jobInfoMessage(pSender, jPlayer, job, type, page);
|
Jobs.getCommandManager().jobInfoMessage(pSender, jPlayer, job, type, page);
|
||||||
return true;
|
return true;
|
||||||
|
@ -14,6 +14,7 @@ import com.gamingmesh.jobs.container.BoostMultiplier;
|
|||||||
import com.gamingmesh.jobs.container.CurrencyType;
|
import com.gamingmesh.jobs.container.CurrencyType;
|
||||||
import com.gamingmesh.jobs.container.Job;
|
import com.gamingmesh.jobs.container.Job;
|
||||||
import com.gamingmesh.jobs.container.JobItems;
|
import com.gamingmesh.jobs.container.JobItems;
|
||||||
|
import com.gamingmesh.jobs.container.JobProgression;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
import com.gamingmesh.jobs.CMILib.CMIChatColor;
|
import com.gamingmesh.jobs.CMILib.CMIChatColor;
|
||||||
import com.gamingmesh.jobs.CMILib.CMIMaterial;
|
import com.gamingmesh.jobs.CMILib.CMIMaterial;
|
||||||
@ -41,10 +42,9 @@ public class itembonus implements Cmd {
|
|||||||
if (iih != null && iih.getType() != Material.AIR)
|
if (iih != null && iih.getType() != Material.AIR)
|
||||||
items.add(iih);
|
items.add(iih);
|
||||||
|
|
||||||
for (ItemStack OneArmor : player.getInventory().getArmorContents()) {
|
for (ItemStack oneArmor : player.getInventory().getArmorContents()) {
|
||||||
if (OneArmor == null || OneArmor.getType() == Material.AIR)
|
if (oneArmor != null && oneArmor.getType() != Material.AIR)
|
||||||
continue;
|
items.add(oneArmor);
|
||||||
items.add(OneArmor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.topline"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.topline"));
|
||||||
@ -55,12 +55,15 @@ public class itembonus implements Cmd {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (Job one : jitem.getJobs()) {
|
for (Job one : jitem.getJobs()) {
|
||||||
BoostMultiplier boost = !jPlayer.isInJob(one) ? jitem.getBoost() : jitem.getBoost(jPlayer.getJobProgression(one));
|
JobProgression prog = jPlayer.getJobProgression(one);
|
||||||
|
BoostMultiplier boost = prog == null ? jitem.getBoost() : jitem.getBoost(prog);
|
||||||
|
|
||||||
boolean any = false;
|
boolean any = false;
|
||||||
for (CurrencyType oneC : CurrencyType.values()) {
|
for (CurrencyType oneC : CurrencyType.values()) {
|
||||||
if (boost.get(oneC) != 0D)
|
if (boost.get(oneC) != 0D) {
|
||||||
any = true;
|
any = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!any)
|
if (!any)
|
||||||
@ -71,7 +74,7 @@ public class itembonus implements Cmd {
|
|||||||
ec = CMIChatColor.YELLOW.toString(),
|
ec = CMIChatColor.YELLOW.toString(),
|
||||||
msg = null;
|
msg = null;
|
||||||
|
|
||||||
if (jPlayer.isInJob(one))
|
if (prog != null)
|
||||||
msg = Jobs.getLanguage().getMessage("command.itembonus.output.list",
|
msg = Jobs.getLanguage().getMessage("command.itembonus.output.list",
|
||||||
"[jobname]", one.getName(),
|
"[jobname]", one.getName(),
|
||||||
"%money%", mc + formatText((int) (boost.get(CurrencyType.MONEY) * 100)),
|
"%money%", mc + formatText((int) (boost.get(CurrencyType.MONEY) * 100)),
|
||||||
|
@ -20,13 +20,11 @@ public class iteminfo implements Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args.length != 0) {
|
if (args.length != 0) {
|
||||||
Jobs.getCommandManager().sendUsage(sender, "blockinfo");
|
Jobs.getCommandManager().sendUsage(sender, "iteminfo");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) sender;
|
ItemStack iih = Jobs.getNms().getItemInMainHand((Player) sender);
|
||||||
|
|
||||||
ItemStack iih = Jobs.getNms().getItemInMainHand(player);
|
|
||||||
|
|
||||||
if (iih == null || iih.getType() == Material.AIR)
|
if (iih == null || iih.getType() == Material.AIR)
|
||||||
return true;
|
return true;
|
||||||
@ -39,14 +37,15 @@ public class iteminfo implements Cmd {
|
|||||||
EnchantmentTarget.FISHING_ROD.includes(iih))
|
EnchantmentTarget.FISHING_ROD.includes(iih))
|
||||||
tool = true;
|
tool = true;
|
||||||
|
|
||||||
String dataString = iih.getData().getData() == 0 ? "" : "-" + iih.getData().getData();
|
byte data = iih.getData().getData();
|
||||||
|
String dataString = data == 0 ? "" : "-" + data;
|
||||||
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.iteminfo.output.name", "%itemname%", iih.getType().name()));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.iteminfo.output.name", "%itemname%", iih.getType().name()));
|
||||||
if (Version.isCurrentEqualOrLower(Version.v1_13_R2))
|
if (Version.isCurrentEqualOrLower(Version.v1_13_R2))
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.iteminfo.output.id", "%itemid%", iih.getType().getId()));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.iteminfo.output.id", "%itemid%", iih.getType().getId()));
|
||||||
if (!tool)
|
if (!tool)
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.iteminfo.output.data", "%itemdata%", iih.getData().getData()));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.iteminfo.output.data", "%itemdata%", data));
|
||||||
|
|
||||||
if (Version.isCurrentEqualOrHigher(Version.v1_14_R1))
|
if (Version.isCurrentEqualOrHigher(Version.v1_14_R1))
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.iteminfo.output.usage", "%first%", "",
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.iteminfo.output.usage", "%first%", "",
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gamingmesh.jobs.commands.list;
|
package com.gamingmesh.jobs.commands.list;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ public class join implements Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
Bukkit.dispatchCommand(sender, "jobs browse");
|
plugin.getServer().dispatchCommand(sender, "jobs browse");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,9 +90,11 @@ public class moneyboost implements Cmd {
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time.contains("h") || time.contains("hour")) {
|
String[] split = time.split("h|hour", 2);
|
||||||
|
|
||||||
|
if (split.length > 0) {
|
||||||
try {
|
try {
|
||||||
arr[2] = Integer.parseInt(time.split("h|hour", 2)[0]);
|
arr[2] = Integer.parseInt(split[0]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
arr[2] = 0;
|
arr[2] = 0;
|
||||||
}
|
}
|
||||||
@ -100,9 +102,9 @@ public class moneyboost implements Cmd {
|
|||||||
time = time.replaceAll(arr[2] + "+[h|hour]+", "");
|
time = time.replaceAll(arr[2] + "+[h|hour]+", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time.contains("m") || time.contains("minute")) {
|
if ((split = time.split("m|minute", 2)).length > 0) {
|
||||||
try {
|
try {
|
||||||
arr[1] = Integer.parseInt(time.split("m|minute", 2)[0]);
|
arr[1] = Integer.parseInt(split[0]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
arr[1] = 0;
|
arr[1] = 0;
|
||||||
}
|
}
|
||||||
@ -110,9 +112,9 @@ public class moneyboost implements Cmd {
|
|||||||
time = time.replaceAll(arr[1] + "+[m|minute]+", "");
|
time = time.replaceAll(arr[1] + "+[m|minute]+", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time.contains("s") || time.contains("second")) {
|
if ((split = time.split("s|second", 2)).length > 0) {
|
||||||
try {
|
try {
|
||||||
arr[0] = Integer.parseInt(time.split("s|second", 2)[0]);
|
arr[0] = Integer.parseInt(split[0]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
arr[0] = 0;
|
arr[0] = 0;
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,6 @@ public class placeholders implements Cmd {
|
|||||||
PageInfo pi = new PageInfo(isPlayer ? Jobs.getGCManager().PlaceholdersPage : values.length, values.length, page);
|
PageInfo pi = new PageInfo(isPlayer ? Jobs.getGCManager().PlaceholdersPage : values.length, values.length, page);
|
||||||
|
|
||||||
for (JobsPlaceHolders one : values) {
|
for (JobsPlaceHolders one : values) {
|
||||||
if (one.isHidden())
|
|
||||||
continue;
|
|
||||||
if (pi.isBreak())
|
if (pi.isBreak())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -28,21 +28,17 @@ public class playerinfo implements Cmd {
|
|||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int page = 1;
|
||||||
String type = "";
|
String type = "";
|
||||||
if (args.length >= 3) {
|
if (args.length >= 3) {
|
||||||
try {
|
try {
|
||||||
Integer.parseInt(args[2]);
|
page = Integer.parseInt(args[2]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
type = args[2];
|
type = args[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int page = 1;
|
|
||||||
try {
|
|
||||||
page = Integer.parseInt(args[args.length - 1]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
Jobs.getCommandManager().jobInfoMessage(sender, jPlayer, job, type, page);
|
Jobs.getCommandManager().jobInfoMessage(sender, jPlayer, job, type, page);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -90,9 +90,11 @@ public class pointboost implements Cmd {
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time.contains("h") || time.contains("hour")) {
|
String[] split = time.split("h|hour", 2);
|
||||||
|
|
||||||
|
if (split.length > 0) {
|
||||||
try {
|
try {
|
||||||
arr[2] = Integer.parseInt(time.split("h|hour", 2)[0]);
|
arr[2] = Integer.parseInt(split[0]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
arr[2] = 0;
|
arr[2] = 0;
|
||||||
}
|
}
|
||||||
@ -100,9 +102,9 @@ public class pointboost implements Cmd {
|
|||||||
time = time.replaceAll(arr[2] + "+[h|hour]+", "");
|
time = time.replaceAll(arr[2] + "+[h|hour]+", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time.contains("m") || time.contains("minute")) {
|
if ((split = time.split("m|minute", 2)).length > 0) {
|
||||||
try {
|
try {
|
||||||
arr[1] = Integer.parseInt(time.split("m|minute", 2)[0]);
|
arr[1] = Integer.parseInt(split[0]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
arr[1] = 0;
|
arr[1] = 0;
|
||||||
}
|
}
|
||||||
@ -110,9 +112,9 @@ public class pointboost implements Cmd {
|
|||||||
time = time.replaceAll(arr[1] + "+[m|minute]+", "");
|
time = time.replaceAll(arr[1] + "+[m|minute]+", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time.contains("s") || time.contains("second")) {
|
if ((split = time.split("s|second", 2)).length > 0) {
|
||||||
try {
|
try {
|
||||||
arr[0] = Integer.parseInt(time.split("s|second", 2)[0]);
|
arr[0] = Integer.parseInt(split[0]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
arr[0] = 0;
|
arr[0] = 0;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.gamingmesh.jobs.commands.list;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -65,8 +64,10 @@ public class skipquest implements Cmd {
|
|||||||
Quest old = null;
|
Quest old = null;
|
||||||
|
|
||||||
for (QuestProgression one : quests) {
|
for (QuestProgression one : quests) {
|
||||||
if (one.getQuest().getQuestName().equalsIgnoreCase(questName) || one.getQuest().getConfigName().equalsIgnoreCase(questName)) {
|
Quest q = one.getQuest();
|
||||||
old = one.getQuest();
|
|
||||||
|
if (q.getQuestName().equalsIgnoreCase(questName) || q.getConfigName().equalsIgnoreCase(questName)) {
|
||||||
|
old = q;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,7 +91,7 @@ public class skipquest implements Cmd {
|
|||||||
BufferedEconomy econ = Jobs.getEconomy();
|
BufferedEconomy econ = Jobs.getEconomy();
|
||||||
Player player = jPlayer.getPlayer();
|
Player player = jPlayer.getPlayer();
|
||||||
|
|
||||||
if (amount > 0) {
|
if (amount > 0 && player != null) {
|
||||||
if (!econ.getEconomy().hasMoney(player, amount)) {
|
if (!econ.getEconomy().hasMoney(player, amount)) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("economy.error.nomoney"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("economy.error.nomoney"));
|
||||||
return false;
|
return false;
|
||||||
@ -101,8 +102,8 @@ public class skipquest implements Cmd {
|
|||||||
|
|
||||||
jPlayer.replaceQuest(old);
|
jPlayer.replaceQuest(old);
|
||||||
|
|
||||||
if (player.isOnline())
|
if (player != null)
|
||||||
Bukkit.dispatchCommand(player, "jobs quests");
|
plugin.getServer().dispatchCommand(player, "jobs quests");
|
||||||
|
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.skipquest.output.questSkipForCost", "%amount%", amount));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.skipquest.output.questSkipForCost", "%amount%", amount));
|
||||||
|
@ -328,7 +328,7 @@ public class JobsPlayer {
|
|||||||
public double getBoost(String jobName, CurrencyType type, boolean force) {
|
public double getBoost(String jobName, CurrencyType type, boolean force) {
|
||||||
double boost = 0D;
|
double boost = 0D;
|
||||||
|
|
||||||
if (!isOnline() || type == null)
|
if (type == null || !isOnline())
|
||||||
return boost;
|
return boost;
|
||||||
|
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
|
@ -1557,7 +1557,6 @@ public abstract class JobsDAO {
|
|||||||
if (conn == null)
|
if (conn == null)
|
||||||
return false;
|
return false;
|
||||||
PreparedStatement prest = null;
|
PreparedStatement prest = null;
|
||||||
boolean ok = true;
|
|
||||||
try {
|
try {
|
||||||
prest = conn.prepareStatement("DELETE FROM `" + getJobsTableName() + "` WHERE `" + JobsTableFields.userid.getCollumn() + "` = ? AND `" + JobsTableFields.jobid.getCollumn()
|
prest = conn.prepareStatement("DELETE FROM `" + getJobsTableName() + "` WHERE `" + JobsTableFields.userid.getCollumn() + "` = ? AND `" + JobsTableFields.jobid.getCollumn()
|
||||||
+ "` = ?;");
|
+ "` = ?;");
|
||||||
@ -1566,11 +1565,11 @@ public abstract class JobsDAO {
|
|||||||
prest.execute();
|
prest.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
ok = false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
close(prest);
|
close(prest);
|
||||||
}
|
}
|
||||||
return ok;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1630,13 +1629,15 @@ public abstract class JobsDAO {
|
|||||||
start = 0;
|
start = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int jobsTopAmount = Jobs.getGCManager().JobsTopAmount * 2;
|
||||||
|
|
||||||
PreparedStatement prest = null;
|
PreparedStatement prest = null;
|
||||||
ResultSet res = null;
|
ResultSet res = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
prest = conn.prepareStatement("SELECT " + JobsTableFields.userid.getCollumn()
|
prest = conn.prepareStatement("SELECT " + JobsTableFields.userid.getCollumn()
|
||||||
+ ", COUNT(*) AS amount, sum(" + JobsTableFields.level.getCollumn() + ") AS totallvl FROM `" + getJobsTableName()
|
+ ", COUNT(*) AS amount, sum(" + JobsTableFields.level.getCollumn() + ") AS totallvl FROM `" + getJobsTableName()
|
||||||
+ "` GROUP BY userid ORDER BY totallvl DESC LIMIT " + start + "," + (Jobs.getGCManager().JobsTopAmount * 2) + ";");
|
+ "` GROUP BY userid ORDER BY totallvl DESC LIMIT " + start + "," + jobsTopAmount + ";");
|
||||||
res = prest.executeQuery();
|
res = prest.executeQuery();
|
||||||
|
|
||||||
while (res.next()) {
|
while (res.next()) {
|
||||||
@ -1646,7 +1647,7 @@ public abstract class JobsDAO {
|
|||||||
|
|
||||||
names.add(new TopList(info, res.getInt("totallvl"), 0));
|
names.add(new TopList(info, res.getInt("totallvl"), 0));
|
||||||
|
|
||||||
if (names.size() >= Jobs.getGCManager().JobsTopAmount * 2)
|
if (names.size() >= jobsTopAmount)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
@ -84,7 +84,6 @@ public final class JobsPayment14Listener implements Listener {
|
|||||||
camps.remove(camp);
|
camps.remove(camp);
|
||||||
|
|
||||||
if (camps.isEmpty()) {
|
if (camps.isEmpty()) {
|
||||||
campPlayers.remove(event.getPlayer().getUniqueId());
|
|
||||||
campPlayers.remove(playerUId);
|
campPlayers.remove(playerUId);
|
||||||
} else {
|
} else {
|
||||||
campPlayers.put(playerUId, camps);
|
campPlayers.put(playerUId, camps);
|
||||||
|
@ -94,7 +94,9 @@ import java.util.concurrent.TimeUnit;
|
|||||||
|
|
||||||
public class JobsPaymentListener implements Listener {
|
public class JobsPaymentListener implements Listener {
|
||||||
|
|
||||||
private Jobs plugin;
|
private final Jobs plugin;
|
||||||
|
private final String blockMetadata = "BlockOwner";
|
||||||
|
|
||||||
private final Cache<UUID, Double> damageDealtByPlayers = CacheBuilder.newBuilder()
|
private final Cache<UUID, Double> damageDealtByPlayers = CacheBuilder.newBuilder()
|
||||||
.expireAfterWrite(5, TimeUnit.MINUTES)
|
.expireAfterWrite(5, TimeUnit.MINUTES)
|
||||||
.weakKeys()
|
.weakKeys()
|
||||||
@ -105,8 +107,6 @@ public class JobsPaymentListener implements Listener {
|
|||||||
.build();
|
.build();
|
||||||
private Cache<UUID, Long> cowMilkingTimer;
|
private Cache<UUID, Long> cowMilkingTimer;
|
||||||
|
|
||||||
private final String blockMetadata = "BlockOwner";
|
|
||||||
|
|
||||||
public JobsPaymentListener(Jobs plugin) {
|
public JobsPaymentListener(Jobs plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
@ -131,10 +131,10 @@ public class JobsPaymentListener implements Listener {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Jobs.getGCManager().canPerformActionInWorld(event.getWhoClicked().getWorld()))
|
if (event.getInventory().getType() != InventoryType.MERCHANT || event.getSlot() != 2 || event.getSlotType() != SlotType.RESULT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.getInventory().getType() != InventoryType.MERCHANT || event.getSlot() != 2 || event.getSlotType() != SlotType.RESULT)
|
if (!Jobs.getGCManager().canPerformActionInWorld(event.getWhoClicked().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ItemStack resultStack = event.getClickedInventory().getItem(2);
|
ItemStack resultStack = event.getClickedInventory().getItem(2);
|
||||||
@ -207,18 +207,13 @@ public class JobsPaymentListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onCowMilking(PlayerInteractEntityEvent event) {
|
public void onCowMilking(PlayerInteractEntityEvent event) {
|
||||||
Player player = event.getPlayer();
|
|
||||||
|
|
||||||
if (!player.isOnline() || !Jobs.getGCManager().canPerformActionInWorld(player.getWorld()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(event.getRightClicked() instanceof LivingEntity))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Entity cow = event.getRightClicked();
|
Entity cow = event.getRightClicked();
|
||||||
|
|
||||||
if (cow.getType() != EntityType.COW && cow.getType() != EntityType.MUSHROOM_COW)
|
if (cow.getType() != EntityType.COW && cow.getType() != EntityType.MUSHROOM_COW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
ItemStack itemInHand = Jobs.getNms().getItemInMainHand(player);
|
ItemStack itemInHand = Jobs.getNms().getItemInMainHand(player);
|
||||||
if (itemInHand.getType() != Material.BUCKET && itemInHand.getType() != Material.BOWL) {
|
if (itemInHand.getType() != Material.BUCKET && itemInHand.getType() != Material.BOWL) {
|
||||||
return;
|
return;
|
||||||
@ -228,6 +223,9 @@ public class JobsPaymentListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Jobs.getGCManager().canPerformActionInWorld(player.getWorld()))
|
||||||
|
return;
|
||||||
|
|
||||||
// check if in creative
|
// check if in creative
|
||||||
if (!payIfCreative(player))
|
if (!payIfCreative(player))
|
||||||
return;
|
return;
|
||||||
@ -250,7 +248,7 @@ public class JobsPaymentListener implements Listener {
|
|||||||
if (time != null) {
|
if (time != null) {
|
||||||
if (System.currentTimeMillis() < time + Jobs.getGCManager().CowMilkingTimer) {
|
if (System.currentTimeMillis() < time + Jobs.getGCManager().CowMilkingTimer) {
|
||||||
long timer = ((Jobs.getGCManager().CowMilkingTimer - (System.currentTimeMillis() - time)) / 1000);
|
long timer = ((Jobs.getGCManager().CowMilkingTimer - (System.currentTimeMillis() - time)) / 1000);
|
||||||
jPlayer.getPlayer().sendMessage(Jobs.getLanguage().getMessage("message.cowtimer", "%time%", timer));
|
player.sendMessage(Jobs.getLanguage().getMessage("message.cowtimer", "%time%", timer));
|
||||||
|
|
||||||
if (Jobs.getGCManager().CancelCowMilking)
|
if (Jobs.getGCManager().CancelCowMilking)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -268,10 +266,7 @@ public class JobsPaymentListener implements Listener {
|
|||||||
public void onEntityShear(PlayerShearEntityEvent event) {
|
public void onEntityShear(PlayerShearEntityEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!player.isOnline() || !Jobs.getGCManager().canPerformActionInWorld(player.getWorld()))
|
if (!(event.getEntity() instanceof Sheep) || !Jobs.getGCManager().canPerformActionInWorld(player.getWorld()))
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(event.getEntity() instanceof Sheep))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Sheep sheep = (Sheep) event.getEntity();
|
Sheep sheep = (Sheep) event.getEntity();
|
||||||
@ -345,12 +340,12 @@ public class JobsPaymentListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(uuid);
|
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(uuid);
|
||||||
if (jPlayer == null || !jPlayer.isOnline())
|
if (jPlayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = jPlayer.getPlayer();
|
Player player = jPlayer.getPlayer();
|
||||||
|
|
||||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
if (!player.isOnline() || !Jobs.getPermissionHandler().hasWorldPermission(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// check if player is riding
|
// check if player is riding
|
||||||
|
Loading…
Reference in New Issue
Block a user