use of org.cubeengine.butler.filter.Restricted in project modules-extra by CubeEngine.
the class PowertoolCommand method list.
@Alias(value = "ptl")
@Command(desc = "Lists your powertool-bindings.")
@Restricted(value = Player.class, msg = "You already have enough power!")
public void list(Player context, @Flag boolean all) {
if (all) {
for (Inventory slot : context.getInventory().slots()) {
if (slot.peek().isPresent()) {
ItemStack item = slot.peek().get();
PowertoolData data = item.get(PowertoolData.class).orElse(null);
if (data != null) {
context.sendMessage(Text.of(GOLD, data.get(Keys.DISPLAY_NAME).orElse(Text.of(materialMatcher.getNameFor(item))), GOLD, ":"));
showPowerToolList(context, this.getPowerTools(item), false, false);
}
}
}
return;
}
if (!context.getItemInHand(HandTypes.MAIN_HAND).isPresent()) {
i18n.send(context, NEUTRAL, "You do not have an item in your hand.");
} else {
this.showPowerToolList(context, this.getPowerTools(context.getItemInHand(HandTypes.MAIN_HAND).get()), false, true);
}
}
use of org.cubeengine.butler.filter.Restricted in project modules-extra by CubeEngine.
the class PowertoolCommand method clear.
@Alias(value = "ptc")
@Command(desc = "Removes all commands from your powertool")
@Restricted(value = Player.class, msg = "No more power for you!")
public void clear(Player context, @Flag boolean all) {
if (all) {
for (Inventory slot : context.getInventory().slots()) {
if (slot.peek().isPresent()) {
slot.set(this.setPowerTool(slot.peek().get(), null));
}
}
i18n.send(context, POSITIVE, "Removed all commands bound to items in your inventory!");
return;
}
if (!context.getItemInHand(HandTypes.MAIN_HAND).isPresent()) {
i18n.send(context, NEUTRAL, "You are not holding any item in your hand.");
return;
}
context.setItemInHand(HandTypes.MAIN_HAND, this.setPowerTool(context.getItemInHand(HandTypes.MAIN_HAND).get(), null));
i18n.send(context, POSITIVE, "Removed all commands bound to the item in your hand!");
}
use of org.cubeengine.butler.filter.Restricted in project modules-extra by CubeEngine.
the class LogCommands method tool.
@Alias(value = "lt")
@Command(desc = "Gives you an item to check logs with.\n" + "no log-type: Shows everything\n" + "chest: Shows chest-interactions only\n" + "player: Shows player-interacions only\n" + "kills: Shows kill-interactions only\n" + "block: Shows block-changes only")
@Restricted(value = User.class, msg = "Why don't you check in your log-file? You won't need a block there!")
public void tool(User context, @Optional @Label("log-type") String logType) {
// TODO tabcompleter for logToolTypes (waiting for CE-389)
Material blockMaterial = this.matchType(logType, false);
if (blockMaterial == null) {
context.sendTranslated(NEGATIVE, "{input} is not a valid log-type. Use chest, container, player, block or kills instead!", logType);
return;
}
this.findLogTool(context, blockMaterial);
}
use of org.cubeengine.butler.filter.Restricted in project modules-extra by CubeEngine.
the class LogCommands method block.
@Alias(value = "lb")
@Command(desc = "Gives you a block to check logs with." + "no log-type: Shows everything\n" + "chest: Shows chest-interactions only\n" + "player: Shows player-interacions only\n" + "kills: Shows kill-interactions only\n" + "block: Shows block-changes only")
@Restricted(value = User.class, msg = "Why don't you check in your log-file? You won't need a block there!")
public void block(User context, @Optional @Label("log-type") String logType) {
// TODO tabcompleter for logBlockTypes (waiting for CE-389)
Material blockMaterial = this.matchType(logType, true);
if (blockMaterial == null) {
context.sendTranslated(NEGATIVE, "{input} is not a valid log-type. Use chest, container, player, block or kills instead!", logType);
return;
}
this.findLogTool(context, blockMaterial);
}
Aggregations