1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-02-12 18:31:32 +01:00

Jobs commands now works when level from or level until not specified

Closes #826
This commit is contained in:
montlikadani 2020-07-14 08:56:13 +02:00
parent 3fceed1beb
commit dcbe4f706a
4 changed files with 23 additions and 22 deletions

View File

@ -485,7 +485,7 @@ public class Placeholder {
return j == null ? "" : j.getJob().getName();
case user_title_$1:
if (j == null)
return "";
return "";
Title title = Jobs.gettitleManager().getTitle(j.getLevel(), j.getJob().getName());
return title == null ? "" : title.getChatColor() + title.getName();

View File

@ -781,7 +781,8 @@ public class PlayerManager {
return;
for (JobCommands command : job.getCommands()) {
if (newLevel >= command.getLevelFrom() && newLevel <= command.getLevelUntil()) {
if ((command.getLevelFrom() == 0 && command.getLevelUntil() == 0) || newLevel >= command.getLevelFrom()
&& newLevel <= command.getLevelUntil()) {
for (String commandString : new ArrayList<String>(command.getCommands())) {
commandString = commandString.replace("[player]", player.getName());
commandString = commandString.replace("[oldlevel]", String.valueOf(oldLevel));

View File

@ -160,17 +160,18 @@ public class ConfigManager {
cfg.get(pt + ".rejoinCooldown", 10);
cfg.addComment(pt + ".Gui", "GUI icon information when using GUI function");
cfg.addComment(pt + ".Gui.Item", "Name of the material");
cfg.addComment(pt + ".Gui.Item", "You can use the custom player head:",
"Item: player_head",
" CustomSkull: Notch",
"",
"Name of the material");
cfg.get(pt + ".Gui.Item", "LOG:2");
cfg.addComment(pt + ".Gui.slot", "Slot number to show the item in the specified row");
cfg.get(pt + ".Gui.slot", 5);
cfg.addComment(pt + ".Gui.Enchantments", "Enchants of the item");
cfg.get(pt + ".Gui.Enchantments", Arrays.asList("DURABILITY:1"));
cfg.addComment(pt + ".maxDailyQuests", "You can use the custom player head:",
"Item: player_head",
" CustomSkull: Notch",
"",
cfg.addComment(pt + ".maxDailyQuests",
"Defines maximum amount of daily quests player can have from THIS job",
"This will not have effect on overall quest amount player will have");
cfg.get(pt + ".maxDailyQuests", 3);
@ -963,8 +964,8 @@ public class ConfigManager {
else if (commandSection.isList("command"))
commands.addAll(commandSection.getStringList("command"));
int levelFrom = commandSection.getInt("levelFrom");
int levelUntil = commandSection.getInt("levelUntil");
int levelFrom = commandSection.getInt("levelFrom", 0);
int levelUntil = commandSection.getInt("levelUntil", maxLevel);
jobCommand.add(new JobCommands(commandKey.toLowerCase(), commands, levelFrom, levelUntil));
}
}

View File

@ -81,19 +81,21 @@ Jobs:
rejoinCooldown: 10
# GUI icon information when using GUI function
Gui:
# name of the block
# name of the material
# You can use the custom player head:
# Item: player_head
# CustomSkull: Notch
Item: LOG:2
# If you want to use this instead of Item name.
# id of block
# Id: 17
# data of block, usually its 0, but in example Diorite will have id of 1 and data of 3
# Data: 2
# enchants in the item
# If you want to use ID instead of material names.
# id of block
# Id: 17
# data of block, usually its 0, but in example Diorite will have id of 1 and data of 3
# Data: 2
# enchants in the item
Enchantments:
- 'DURABILITY:1'
# You can use the custom player head:
# Item: player_head
# CustomSkull: Notch
# Defines maximum amount of daily quests player can have from THIS job
# This will not have effect on overall quest amount player will have
maxDailyQuests: 3
@ -2242,9 +2244,6 @@ Jobs:
income: 5.0
points: 5
experience: 5.0
PIG_ZOMBIE:
income: 5.0
points: 5
experience: 5.0
SILVERFISH:
income: 3.0