mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-30 21:07:48 +01:00
new command to reset payment limit
This commit is contained in:
parent
ded9324c72
commit
5612becd6f
1
com/gamingmesh/jobs/commands/list/.gitignore
vendored
1
com/gamingmesh/jobs/commands/list/.gitignore
vendored
@ -55,3 +55,4 @@
|
||||
/entitylist.class
|
||||
/iteminfo.class
|
||||
/area.class
|
||||
/resetlimit.class
|
||||
|
31
com/gamingmesh/jobs/commands/list/resetlimit.java
Normal file
31
com/gamingmesh/jobs/commands/list/resetlimit.java
Normal file
@ -0,0 +1,31 @@
|
||||
package com.gamingmesh.jobs.commands.list;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobCommand;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
|
||||
public class resetlimit implements Cmd {
|
||||
|
||||
@Override
|
||||
@JobCommand(700)
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length != 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "resetlimit");
|
||||
return true;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
jPlayer.resetPaymentLimit();
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetlimit.output.reseted", "%playername%", jPlayer.getUserName()));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -141,7 +141,13 @@ public class LanguageManager {
|
||||
c.get("command.limit.output.reachedpointslimit", "&4You have reached exp limit in given time!");
|
||||
c.get("command.limit.output.reachedpointslimit2", "&eYou can check your limit with &2/jobs limit &ecommand");
|
||||
c.get("command.limit.output.notenabled", "&eMoney limit is not enabled");
|
||||
|
||||
|
||||
c.get("command.resetlimit.help.info", "Resets players payment limits");
|
||||
c.get("command.resetlimit.help.args", "[playername]");
|
||||
c.get("command.resetlimit.output.reseted", "&ePayment limits have been reset for: &2%playername%");
|
||||
|
||||
|
||||
c.get("command.help.output.info", "Type /jobs [cmd] ? for more information about a command.");
|
||||
c.get("command.help.output.usage", "Usage: %usage%");
|
||||
c.get("command.help.output.title", "&e-------&e ======= &6Jobs &e======= &e-------");
|
||||
|
@ -261,6 +261,7 @@ public class JobsPlayer {
|
||||
Parser eq = Jobs.getGCManager().currencyLimitUse.get(type).getMaxEquation();
|
||||
eq.setVariable("totallevel", TotalLevel);
|
||||
limits.put(type, (int) eq.getValue());
|
||||
setSaved(false);
|
||||
}
|
||||
|
||||
public void reloadLimits() {
|
||||
@ -273,6 +274,14 @@ public class JobsPlayer {
|
||||
return this.limits.get(type);
|
||||
}
|
||||
|
||||
public void resetPaymentLimit() {
|
||||
if (paymentLimits == null)
|
||||
getPaymentLimit();
|
||||
if (paymentLimits != null)
|
||||
paymentLimits.resetLimits();
|
||||
setSaved(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of job progressions
|
||||
* @return the list of job progressions
|
||||
|
@ -150,7 +150,7 @@ public class JobsPaymentListener implements Listener {
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
return;
|
||||
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
return;
|
||||
|
||||
@ -267,16 +267,11 @@ public class JobsPaymentListener implements Listener {
|
||||
if (player.getGameMode() == GameMode.CREATIVE && !Jobs.getGCManager().payInCreative())
|
||||
return;
|
||||
|
||||
long time = System.nanoTime();
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
return;
|
||||
Debug.D("time in " + (System.nanoTime() - time));
|
||||
|
||||
|
||||
time = System.nanoTime();
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission2(player, player.getLocation().getWorld().getName()))
|
||||
return;
|
||||
Debug.D("time in " + (System.nanoTime() - time));
|
||||
|
||||
BlockActionInfo bInfo = new BlockActionInfo(block, ActionType.BREAK);
|
||||
FastPayment fp = Jobs.FastPayment.get(player.getName());
|
||||
|
Loading…
Reference in New Issue
Block a user