mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
Added some PAPI placeholders
- Fix double checked Exception throws
This commit is contained in:
parent
db0675788a
commit
2b09ae73d6
BIN
libs/PlaceholderAPI-2.9.2.jar
Normal file
BIN
libs/PlaceholderAPI-2.9.2.jar
Normal file
Binary file not shown.
@ -876,25 +876,9 @@ public class Jobs extends JavaPlugin {
|
|||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
try {
|
try {
|
||||||
GUIManager.CloseInventories();
|
GUIManager.CloseInventories();
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
shopManager.CloseInventories();
|
shopManager.CloseInventories();
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
dao.saveExplore();
|
dao.saveExplore();
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
dao.saveBlockProtection();
|
dao.saveBlockProtection();
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
FurnaceBrewingHandling.save();
|
FurnaceBrewingHandling.save();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -23,9 +23,9 @@ public class ChatFilterRule {
|
|||||||
private String replaceWith;
|
private String replaceWith;
|
||||||
private ChatFilterBlockType blockType;
|
private ChatFilterBlockType blockType;
|
||||||
private String ruleName;
|
private String ruleName;
|
||||||
private List<Pattern> pattern = new ArrayList<Pattern>();
|
private List<Pattern> pattern = new ArrayList<>();
|
||||||
private String messageToStaff;
|
private String messageToStaff;
|
||||||
private List<String> commands = new ArrayList<String>();
|
private List<String> commands = new ArrayList<>();
|
||||||
private String group;
|
private String group;
|
||||||
|
|
||||||
public ChatFilterRule(String ruleName, String group, List<String> list, String replaceWith, ChatFilterBlockType blockType, String messageToStaff, List<String> commands) {
|
public ChatFilterRule(String ruleName, String group, List<String> list, String replaceWith, ChatFilterBlockType blockType, String messageToStaff, List<String> commands) {
|
||||||
|
@ -33,10 +33,23 @@ public class Placeholder {
|
|||||||
user_furncount,
|
user_furncount,
|
||||||
user_maxfurncount,
|
user_maxfurncount,
|
||||||
user_doneq,
|
user_doneq,
|
||||||
|
user_seen,
|
||||||
user_totallevels,
|
user_totallevels,
|
||||||
|
total_players,
|
||||||
|
user_issaved,
|
||||||
user_displayhonorific,
|
user_displayhonorific,
|
||||||
user_joinedjobcount,
|
user_joinedjobcount,
|
||||||
maxjobs,
|
maxjobs,
|
||||||
|
explimit,
|
||||||
|
pointslimit,
|
||||||
|
moneylimit,
|
||||||
|
payexplimam,
|
||||||
|
paymonlimam,
|
||||||
|
paypoinlimam,
|
||||||
|
paymexplimlef,
|
||||||
|
paymonlimlef,
|
||||||
|
paypoinlimlef,
|
||||||
|
|
||||||
name_$1("number/name"),
|
name_$1("number/name"),
|
||||||
shortname_$1("number/name"),
|
shortname_$1("number/name"),
|
||||||
chatcolor_$1("number/name"),
|
chatcolor_$1("number/name"),
|
||||||
@ -48,7 +61,9 @@ public class Placeholder {
|
|||||||
maxslots_$1("number/name"),
|
maxslots_$1("number/name"),
|
||||||
user_boost_$1_$2("jobname/number", "money/exp/points"),
|
user_boost_$1_$2("jobname/number", "money/exp/points"),
|
||||||
user_isin_$1("jobname/number"),
|
user_isin_$1("jobname/number"),
|
||||||
user_canjoin_$1("jobname/number");
|
user_canjoin_$1("jobname/number"),
|
||||||
|
bonus_$1("jobname/number"),
|
||||||
|
user_level("jobname/number");
|
||||||
|
|
||||||
private String[] vars;
|
private String[] vars;
|
||||||
private List<Integer> groups = new ArrayList<>();
|
private List<Integer> groups = new ArrayList<>();
|
||||||
@ -357,6 +372,12 @@ public class Placeholder {
|
|||||||
|
|
||||||
if (placeHolder == null)
|
if (placeHolder == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
List<String> vals = placeHolder.getComplexValues(value);
|
||||||
|
if (vals.size() < 2)
|
||||||
|
return "";
|
||||||
|
JobProgression j = getProgFromValue(user, vals.get(0));
|
||||||
|
|
||||||
// Placeholders by JobsPLayer object
|
// Placeholders by JobsPLayer object
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
switch (placeHolder) {
|
switch (placeHolder) {
|
||||||
@ -372,28 +393,46 @@ public class Placeholder {
|
|||||||
return String.valueOf(user.getMaxFurnacesAllowed());
|
return String.valueOf(user.getMaxFurnacesAllowed());
|
||||||
case user_doneq:
|
case user_doneq:
|
||||||
return String.valueOf(user.getDoneQuests());
|
return String.valueOf(user.getDoneQuests());
|
||||||
|
case user_seen:
|
||||||
|
return String.valueOf(user.getSeen());
|
||||||
case user_totallevels:
|
case user_totallevels:
|
||||||
return String.valueOf(user.getTotalLevels());
|
return String.valueOf(user.getTotalLevels());
|
||||||
|
case user_issaved:
|
||||||
|
return String.valueOf(user.isSaved());
|
||||||
case user_displayhonorific:
|
case user_displayhonorific:
|
||||||
return String.valueOf(user.getDisplayHonorific());
|
return String.valueOf(user.getDisplayHonorific());
|
||||||
case user_joinedjobcount:
|
case user_joinedjobcount:
|
||||||
return String.valueOf(user.getJobProgression().size());
|
return String.valueOf(user.getJobProgression().size());
|
||||||
|
case user_level:
|
||||||
|
return j == null ? "" : String.valueOf(user.getLevelAfterRejoin(j));
|
||||||
|
case total_players:
|
||||||
|
return j == null ? "" : String.valueOf(j.getJob().getTotalPlayers());
|
||||||
case user_boost_$1_$2:
|
case user_boost_$1_$2:
|
||||||
List<String> values = placeHolder.getComplexValues(value);
|
return j == null ? "" : simplifyDouble(user.getBoost(j.getJob().getName(), CurrencyType.getByName(vals.get(1))));
|
||||||
if (values.size() < 2)
|
|
||||||
return "";
|
|
||||||
JobProgression j = getProgFromValue(user, values.get(0));
|
|
||||||
if (j == null)
|
|
||||||
return "";
|
|
||||||
return simplifyDouble(user.getBoost(j.getJob().getName(), CurrencyType.getByName(values.get(1))));
|
|
||||||
case user_isin_$1:
|
case user_isin_$1:
|
||||||
values = placeHolder.getComplexValues(value);
|
vals = placeHolder.getComplexValues(value);
|
||||||
if (values.isEmpty())
|
if (vals.isEmpty())
|
||||||
return "";
|
return "";
|
||||||
Job job = getJobFromValue(values.get(0));
|
Job jobs = getJobFromValue(vals.get(0));
|
||||||
if (job == null)
|
return jobs == null ? "" : convert(user.isInJob(jobs));
|
||||||
return "";
|
case explimit:
|
||||||
return convert(user.isInJob(job));
|
return String.valueOf(user.getLimit(CurrencyType.EXP));
|
||||||
|
case moneylimit:
|
||||||
|
return String.valueOf(user.getLimit(CurrencyType.MONEY));
|
||||||
|
case pointslimit:
|
||||||
|
return String.valueOf(user.getLimit(CurrencyType.POINTS));
|
||||||
|
case payexplimam:
|
||||||
|
return String.valueOf(user.getPaymentLimit().GetAmount(CurrencyType.EXP));
|
||||||
|
case paymonlimam:
|
||||||
|
return String.valueOf(user.getPaymentLimit().GetAmount(CurrencyType.MONEY));
|
||||||
|
case paypoinlimam:
|
||||||
|
return String.valueOf(user.getPaymentLimit().GetAmount(CurrencyType.POINTS));
|
||||||
|
case paymexplimlef:
|
||||||
|
return String.valueOf(user.getPaymentLimit().GetLeftTime(CurrencyType.EXP));
|
||||||
|
case paymonlimlef:
|
||||||
|
return String.valueOf(user.getPaymentLimit().GetLeftTime(CurrencyType.MONEY));
|
||||||
|
case paypoinlimlef:
|
||||||
|
return String.valueOf(user.getPaymentLimit().GetLeftTime(CurrencyType.POINTS));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -448,29 +487,31 @@ public class Placeholder {
|
|||||||
values = placeHolder.getComplexValues(value);
|
values = placeHolder.getComplexValues(value);
|
||||||
if (values.isEmpty())
|
if (values.isEmpty())
|
||||||
return "";
|
return "";
|
||||||
Job j = getJobFromValue(values.get(0));
|
Job jo = getJobFromValue(values.get(0));
|
||||||
if (j == null)
|
if (jo == null)
|
||||||
return "";
|
return "";
|
||||||
// Global placeholders by jobname
|
// Global placeholders by jobname
|
||||||
switch (placeHolder) {
|
switch (placeHolder) {
|
||||||
case name_$1:
|
case name_$1:
|
||||||
return j.getName();
|
return jo.getName();
|
||||||
case shortname_$1:
|
case shortname_$1:
|
||||||
return j.getShortName();
|
return jo.getShortName();
|
||||||
case chatcolor_$1:
|
case chatcolor_$1:
|
||||||
return j.getChatColor().toString();
|
return jo.getChatColor().toString();
|
||||||
case description_$1:
|
case description_$1:
|
||||||
return j.getDescription();
|
return jo.getDescription();
|
||||||
case maxdailyq_$1:
|
case maxdailyq_$1:
|
||||||
return String.valueOf(j.getMaxDailyQuests());
|
return String.valueOf(jo.getMaxDailyQuests());
|
||||||
case maxlvl_$1:
|
case maxlvl_$1:
|
||||||
return String.valueOf(j.getMaxLevel());
|
return String.valueOf(jo.getMaxLevel());
|
||||||
case maxviplvl_$1:
|
case maxviplvl_$1:
|
||||||
return String.valueOf(j.getVipMaxLevel());
|
return String.valueOf(jo.getVipMaxLevel());
|
||||||
|
case bonus_$1:
|
||||||
|
return String.valueOf(jo.getBonus());
|
||||||
case totalplayers_$1:
|
case totalplayers_$1:
|
||||||
return String.valueOf(j.getTotalPlayers());
|
return String.valueOf(jo.getTotalPlayers());
|
||||||
case maxslots_$1:
|
case maxslots_$1:
|
||||||
return String.valueOf(j.getMaxSlots());
|
return String.valueOf(jo.getMaxSlots());
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user