mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-01 15:03:36 +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
|
||||
@JobCommand(700)
|
||||
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");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
||||
return false;
|
||||
}
|
||||
JobsPlayer JPlayer = null;
|
||||
if (args.length >= 1)
|
||||
JPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
else if (sender instanceof Player)
|
||||
JPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
|
||||
Player player = (Player) sender;
|
||||
boolean disabled = true;
|
||||
for (CurrencyType type : CurrencyType.values()) {
|
||||
if (Jobs.getGCManager().currencyLimitUse.get(type).isEnabled()) {
|
||||
if (Jobs.getGCManager().getLimit(type).isEnabled()) {
|
||||
disabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
|
||||
for (CurrencyType type : CurrencyType.values()) {
|
||||
if (!Jobs.getGCManager().currencyLimitUse.get(type).isEnabled())
|
||||
if (!Jobs.getGCManager().getLimit(type).isEnabled())
|
||||
continue;
|
||||
PaymentData limit = JPlayer.getPaymentLimit();
|
||||
if (limit == null) {
|
||||
int lefttime1 = Jobs.getGCManager().currencyLimitUse.get(type).getTimeLimit() * 1000;
|
||||
player.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",
|
||||
int lefttime1 = Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000;
|
||||
sender.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() + "Limit",
|
||||
"%current%", "0.0",
|
||||
"%total%", JPlayer.getLimit(type)));
|
||||
continue;
|
||||
}
|
||||
if (limit.GetLeftTime(type) > 0) {
|
||||
player.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() + "time", "%time%", TimeManage.to24hourShort(limit.GetLeftTime(type))));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "Limit",
|
||||
"%current%", (int) (limit.GetAmount(type) * 100) / 100D,
|
||||
"%total%", JPlayer.getLimit(type)));
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class GeneralConfigManager {
|
||||
private int ResetTimeMinute;
|
||||
|
||||
// Limits
|
||||
public HashMap<CurrencyType, CurrencyLimit> currencyLimitUse = new HashMap<>();
|
||||
private HashMap<CurrencyType, CurrencyLimit> currencyLimitUse = new HashMap<>();
|
||||
|
||||
public boolean PayForRenaming, PayForEachCraft, SignsEnabled,
|
||||
SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useCoreProtect, BlockPlaceUse,
|
||||
|
@ -231,7 +231,7 @@ public class LanguageManager {
|
||||
c.get("command.convert.help.args", "");
|
||||
|
||||
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.moneyLimit", "&eMoney limit: &2%current%&e/&2%total%");
|
||||
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) {
|
||||
TotalLevel += prog.getLevel();
|
||||
}
|
||||
Parser eq = Jobs.getGCManager().currencyLimitUse.get(type).getMaxEquation();
|
||||
Parser eq = Jobs.getGCManager().getLimit(type).getMaxEquation();
|
||||
eq.setVariable("totallevel", TotalLevel);
|
||||
limits.put(type, (int) eq.getValue());
|
||||
setSaved(false);
|
||||
|
@ -2,9 +2,7 @@ package com.gamingmesh.jobs.nmsUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Guardian;
|
||||
|
@ -345,7 +345,7 @@ Jobs:
|
||||
Green:
|
||||
income: 2.0
|
||||
experience: 5.0
|
||||
Navy:
|
||||
Light_Blue:
|
||||
income: 2.0
|
||||
experience: 5.0
|
||||
Lime:
|
||||
@ -366,7 +366,7 @@ Jobs:
|
||||
Red:
|
||||
income: 2.0
|
||||
experience: 5.0
|
||||
Silver:
|
||||
Light_Gray:
|
||||
income: 2.0
|
||||
experience: 5.0
|
||||
White:
|
||||
@ -1749,7 +1749,7 @@ Jobs:
|
||||
income: 4.0
|
||||
points: 4.0
|
||||
experience: 5.0
|
||||
Navy:
|
||||
Light_Blue:
|
||||
income: 4.0
|
||||
points: 4.0
|
||||
experience: 5.0
|
||||
@ -1765,7 +1765,7 @@ Jobs:
|
||||
income: 4.0
|
||||
points: 4.0
|
||||
experience: 5.0
|
||||
Silver:
|
||||
Light_Gray:
|
||||
income: 4.0
|
||||
points: 4.0
|
||||
experience: 5.0
|
||||
|
@ -108,9 +108,9 @@ command:
|
||||
limit:
|
||||
help:
|
||||
info: 'Megmutatja a fizetési határértékeket a munkahelyekért.'
|
||||
args: ''
|
||||
args: '[playername]'
|
||||
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%'
|
||||
exptime: '&eAz exp limitig hátralévő idő marad vissza: &2%time%'
|
||||
expLimit: '&eExp limit: &2%current%&e/&2%total%'
|
||||
|
Loading…
Reference in New Issue
Block a user