mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
Added player argument to /job limit command
- Fix sheep color not work properly
This commit is contained in:
parent
aadf514dba
commit
2215c57791
@ -16,46 +16,53 @@ public class limit implements Cmd {
|
|||||||
@Override
|
@Override
|
||||||
@JobCommand(700)
|
@JobCommand(700)
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
if (args.length > 0) {
|
if (args.length != 0 && args.length != 1) {
|
||||||
Jobs.getCommandManager().sendUsage(sender, "limit");
|
Jobs.getCommandManager().sendUsage(sender, "limit");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(sender instanceof Player)) {
|
JobsPlayer JPlayer = null;
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
if (args.length >= 1)
|
||||||
return false;
|
JPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||||
}
|
else if (sender instanceof Player)
|
||||||
|
JPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||||
|
|
||||||
Player player = (Player) sender;
|
|
||||||
boolean disabled = true;
|
boolean disabled = true;
|
||||||
for (CurrencyType type : CurrencyType.values()) {
|
for (CurrencyType type : CurrencyType.values()) {
|
||||||
if (Jobs.getGCManager().currencyLimitUse.get(type).isEnabled()) {
|
if (Jobs.getGCManager().getLimit(type).isEnabled()) {
|
||||||
disabled = false;
|
disabled = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.notenabled"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.notenabled"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JPlayer == null) {
|
||||||
|
if (args.length >= 1)
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo"));
|
||||||
|
else if (!(sender instanceof Player))
|
||||||
|
Jobs.getCommandManager().sendUsage(sender, "limit");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
|
||||||
|
|
||||||
for (CurrencyType type : CurrencyType.values()) {
|
for (CurrencyType type : CurrencyType.values()) {
|
||||||
if (!Jobs.getGCManager().currencyLimitUse.get(type).isEnabled())
|
if (!Jobs.getGCManager().getLimit(type).isEnabled())
|
||||||
continue;
|
continue;
|
||||||
PaymentData limit = JPlayer.getPaymentLimit();
|
PaymentData limit = JPlayer.getPaymentLimit();
|
||||||
if (limit == null) {
|
if (limit == null) {
|
||||||
int lefttime1 = Jobs.getGCManager().currencyLimitUse.get(type).getTimeLimit() * 1000;
|
int lefttime1 = Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000;
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "time", "%time%", TimeManage.to24hourShort((long) lefttime1)));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "time", "%time%", TimeManage.to24hourShort((long) lefttime1)));
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "Limit",
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "Limit",
|
||||||
"%current%", "0.0",
|
"%current%", "0.0",
|
||||||
"%total%", JPlayer.getLimit(type)));
|
"%total%", JPlayer.getLimit(type)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (limit.GetLeftTime(type) > 0) {
|
if (limit.GetLeftTime(type) > 0) {
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "time", "%time%", TimeManage.to24hourShort(limit.GetLeftTime(type))));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "time", "%time%", TimeManage.to24hourShort(limit.GetLeftTime(type))));
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "Limit",
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "Limit",
|
||||||
"%current%", (int) (limit.GetAmount(type) * 100) / 100D,
|
"%current%", (int) (limit.GetAmount(type) * 100) / 100D,
|
||||||
"%total%", JPlayer.getLimit(type)));
|
"%total%", JPlayer.getLimit(type)));
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ public class GeneralConfigManager {
|
|||||||
private int ResetTimeMinute;
|
private int ResetTimeMinute;
|
||||||
|
|
||||||
// Limits
|
// Limits
|
||||||
public HashMap<CurrencyType, CurrencyLimit> currencyLimitUse = new HashMap<>();
|
private HashMap<CurrencyType, CurrencyLimit> currencyLimitUse = new HashMap<>();
|
||||||
|
|
||||||
public boolean PayForRenaming, PayForEachCraft, SignsEnabled,
|
public boolean PayForRenaming, PayForEachCraft, SignsEnabled,
|
||||||
SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useCoreProtect, BlockPlaceUse,
|
SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useCoreProtect, BlockPlaceUse,
|
||||||
|
@ -231,7 +231,7 @@ public class LanguageManager {
|
|||||||
c.get("command.convert.help.args", "");
|
c.get("command.convert.help.args", "");
|
||||||
|
|
||||||
c.get("command.limit.help.info", "Shows payment limits for jobs");
|
c.get("command.limit.help.info", "Shows payment limits for jobs");
|
||||||
c.get("command.limit.help.args", "");
|
c.get("command.limit.help.args", "[playername]");
|
||||||
c.get("command.limit.output.moneytime", "&eTime left until money limit resets: &2%time%");
|
c.get("command.limit.output.moneytime", "&eTime left until money limit resets: &2%time%");
|
||||||
c.get("command.limit.output.moneyLimit", "&eMoney limit: &2%current%&e/&2%total%");
|
c.get("command.limit.output.moneyLimit", "&eMoney limit: &2%current%&e/&2%total%");
|
||||||
c.get("command.limit.output.exptime", "&eTime left until Exp limit resets: &2%time%");
|
c.get("command.limit.output.exptime", "&eTime left until Exp limit resets: &2%time%");
|
||||||
|
@ -291,7 +291,7 @@ public class JobsPlayer {
|
|||||||
for (JobProgression prog : progression) {
|
for (JobProgression prog : progression) {
|
||||||
TotalLevel += prog.getLevel();
|
TotalLevel += prog.getLevel();
|
||||||
}
|
}
|
||||||
Parser eq = Jobs.getGCManager().currencyLimitUse.get(type).getMaxEquation();
|
Parser eq = Jobs.getGCManager().getLimit(type).getMaxEquation();
|
||||||
eq.setVariable("totallevel", TotalLevel);
|
eq.setVariable("totallevel", TotalLevel);
|
||||||
limits.put(type, (int) eq.getValue());
|
limits.put(type, (int) eq.getValue());
|
||||||
setSaved(false);
|
setSaved(false);
|
||||||
|
@ -2,9 +2,7 @@ package com.gamingmesh.jobs.nmsUtil;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Guardian;
|
import org.bukkit.entity.Guardian;
|
||||||
|
@ -345,7 +345,7 @@ Jobs:
|
|||||||
Green:
|
Green:
|
||||||
income: 2.0
|
income: 2.0
|
||||||
experience: 5.0
|
experience: 5.0
|
||||||
Navy:
|
Light_Blue:
|
||||||
income: 2.0
|
income: 2.0
|
||||||
experience: 5.0
|
experience: 5.0
|
||||||
Lime:
|
Lime:
|
||||||
@ -366,7 +366,7 @@ Jobs:
|
|||||||
Red:
|
Red:
|
||||||
income: 2.0
|
income: 2.0
|
||||||
experience: 5.0
|
experience: 5.0
|
||||||
Silver:
|
Light_Gray:
|
||||||
income: 2.0
|
income: 2.0
|
||||||
experience: 5.0
|
experience: 5.0
|
||||||
White:
|
White:
|
||||||
@ -1749,7 +1749,7 @@ Jobs:
|
|||||||
income: 4.0
|
income: 4.0
|
||||||
points: 4.0
|
points: 4.0
|
||||||
experience: 5.0
|
experience: 5.0
|
||||||
Navy:
|
Light_Blue:
|
||||||
income: 4.0
|
income: 4.0
|
||||||
points: 4.0
|
points: 4.0
|
||||||
experience: 5.0
|
experience: 5.0
|
||||||
@ -1765,7 +1765,7 @@ Jobs:
|
|||||||
income: 4.0
|
income: 4.0
|
||||||
points: 4.0
|
points: 4.0
|
||||||
experience: 5.0
|
experience: 5.0
|
||||||
Silver:
|
Light_Gray:
|
||||||
income: 4.0
|
income: 4.0
|
||||||
points: 4.0
|
points: 4.0
|
||||||
experience: 5.0
|
experience: 5.0
|
||||||
|
@ -108,9 +108,9 @@ command:
|
|||||||
limit:
|
limit:
|
||||||
help:
|
help:
|
||||||
info: 'Megmutatja a fizetési határértékeket a munkahelyekért.'
|
info: 'Megmutatja a fizetési határértékeket a munkahelyekért.'
|
||||||
args: ''
|
args: '[playername]'
|
||||||
output:
|
output:
|
||||||
moneytime: '&eAz idő marad, amíg a pénzkorlát visszaáll: &2%time%'
|
moneytime: '&eIdő maradt, míg a pénzkorlát visszaáll: &2%time%'
|
||||||
moneyLimit: '&ePénzkorlát: &2%current%&e/&2%total%'
|
moneyLimit: '&ePénzkorlát: &2%current%&e/&2%total%'
|
||||||
exptime: '&eAz exp limitig hátralévő idő marad vissza: &2%time%'
|
exptime: '&eAz exp limitig hátralévő idő marad vissza: &2%time%'
|
||||||
expLimit: '&eExp limit: &2%current%&e/&2%total%'
|
expLimit: '&eExp limit: &2%current%&e/&2%total%'
|
||||||
|
Loading…
Reference in New Issue
Block a user