Made /(admin) limits calc <player> a subcommand + fix redstone displaying on GUI

This commit is contained in:
YellowZaki 2019-02-26 14:40:10 +01:00
parent 6b71b436b6
commit cb4adde31c
6 changed files with 23 additions and 18 deletions

View File

@ -6,7 +6,6 @@ import java.util.stream.Collectors;
import org.bukkit.World;
import bentobox.addon.limits.commands.AdminCommand;
import bentobox.addon.limits.commands.LimitCalcCommand;
import bentobox.addon.limits.commands.PlayerCommand;
import bentobox.addon.limits.listeners.BlockLimitsListener;
import bentobox.addon.limits.listeners.JoinListener;
@ -46,7 +45,6 @@ public class Limits extends Addon {
{
// Register commands
gm.getAdminCommand().ifPresent(a -> new AdminCommand(this, a));
gm.getAdminCommand().ifPresent(a -> new LimitCalcCommand(this, a));
gm.getPlayerCommand().ifPresent(a -> new PlayerCommand(this, a));
log("Limits will apply to " + gm.getDescription().getName());
}

View File

@ -26,6 +26,7 @@ public class AdminCommand extends CompositeCommand {
public AdminCommand(Limits addon, CompositeCommand parent) {
super(parent, "limits");
this.addon = addon;
new CalcCommand(addon, this);
}
/* (non-Javadoc)
@ -35,8 +36,8 @@ public class AdminCommand extends CompositeCommand {
public void setup() {
this.setPermission("limits.admin.limits");
this.setOnlyPlayer(true);
this.setParametersHelp("admin.limits.parameters");
this.setDescription("admin.limits.description");
this.setParametersHelp("admin.limits.main.parameters");
this.setDescription("admin.limits.main.description");
}
/* (non-Javadoc)

View File

@ -13,7 +13,7 @@ import world.bentobox.bentobox.util.Util;
*
* @author YellowZaki
*/
public class LimitCalcCommand extends CompositeCommand {
public class CalcCommand extends CompositeCommand {
private final Limits addon;
@ -22,8 +22,8 @@ public class LimitCalcCommand extends CompositeCommand {
*
* @param addon - addon
*/
public LimitCalcCommand(Limits addon, CompositeCommand parent) {
super(parent, "limitscalc");
public CalcCommand(Limits addon, CompositeCommand parent) {
super(parent, "calc");
this.addon = addon;
}
@ -32,10 +32,10 @@ public class LimitCalcCommand extends CompositeCommand {
*/
@Override
public void setup() {
this.setPermission("limits.admin.limitscalc");
this.setPermission("limits.admin.limits.calc");
this.setOnlyPlayer(false);
this.setParametersHelp("admin.limitscalc.parameters");
this.setDescription("admin.limitscalc.description");
this.setParametersHelp("admin.limits.calc.parameters");
this.setDescription("admin.limits.calc.description");
}
/* (non-Javadoc)

View File

@ -53,7 +53,12 @@ class LimitPanel {
for (Entry<Material, Integer> en : matLimits.entrySet()) {
PanelItemBuilder pib = new PanelItemBuilder();
pib.name(Util.prettifyText(en.getKey().toString()));
pib.icon(en.getKey());
if (en.getKey() == Material.REDSTONE_WIRE) {
pib.icon(Material.REDSTONE);
}
else {
pib.icon(en.getKey());
}
int count = ibc == null ? 0 : ibc.getBlockCount().getOrDefault(en.getKey(), 0);
String color = count >= en.getValue() ? user.getTranslation("island.limits.max-color") : user.getTranslation("island.limits.regular-color");
pib.description(color

View File

@ -137,7 +137,7 @@ public class LimitsCalc {
task.cancel();
ibc.setBlockCount(blockCount);
bll.setIsland(island.getUniqueId(), ibc);
sender.sendMessage("admin.limitscalc.finished");
sender.sendMessage("admin.limits.calc.finished");
}
}

View File

@ -9,12 +9,13 @@ limits:
admin:
limits:
parameters: "<player>"
description: "show the island limits for player"
limitscalc:
parameters: "<player>"
description: "recalculate the island limits for player"
finished: "&aIsland recalc finished sucessfully!"
main:
parameters: "<player>"
description: "show the island limits for player"
calc:
parameters: "<player>"
description: "recalculate the island limits for player"
finished: "&aIsland recalc finished sucessfully!"
island:
limits: