use of org.cubeengine.butler.parametric.Command in project modules-extra by CubeEngine.
the class VigilLookupCommands method lookup.
@Alias(value = "lookup")
@Command(desc = "Performs a lookup.")
public void lookup(Player context, @Named("radius") int radius) {
LookupData ld = new LookupData();
Lookup lookup = new Lookup(ld).with(context.getLocation()).withRadius(radius);
this.qm.queryAndShow(lookup, context);
}
use of org.cubeengine.butler.parametric.Command in project modules-extra by CubeEngine.
the class IgnoreCommands method ignore.
@Command(desc = "Ignores all messages from players")
public void ignore(CommandSource context, List<User> players) {
if (!(context instanceof Player)) {
int rand1 = new Random().nextInt(6) + 1;
int rand2 = new Random().nextInt(6 - rand1 + 1) + 1;
i18n.send(context, NEUTRAL, "Ignore ({text:8+:color=WHITE}): {integer#random} + {integer#random} = {integer#sum} -> {text:failed:color=RED}", rand1, rand2, rand1 + rand2);
return;
}
Player sender = ((Player) context);
List<String> added = new ArrayList<>();
for (User user : players) {
if (user == context) {
i18n.send(context, NEGATIVE, "If you do not feel like talking to yourself just don't talk.");
} else if (!this.addIgnore(sender, user)) {
if (user.hasPermission(module.perms().COMMAND_IGNORE_PREVENT.getId())) {
i18n.send(context, NEGATIVE, "You are not allowed to ignore {user}!", user);
continue;
}
i18n.send(context, NEGATIVE, "{user} is already on your ignore list!", user);
} else {
added.add(user.getName());
}
}
if (added.isEmpty()) {
return;
}
i18n.send(context, POSITIVE, "You added {user#list} to your ignore list!", StringUtils.implode(ChatFormat.WHITE + ", " + ChatFormat.DARK_GREEN, added));
}
use of org.cubeengine.butler.parametric.Command 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.parametric.Command 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.parametric.Command in project modules-extra by CubeEngine.
the class VoteCommands method vote.
@Command(desc = "Shows your current vote situation")
public void vote(CommandSource context) {
if (!(context instanceof Player)) {
i18n.send(context, NEUTRAL, "Well you wont get any rewards.");
if (!module.getConfig().voteUrl.isEmpty()) {
i18n.send(context, NEUTRAL, "But here go vote anyways: {name#voteurl}", module.getConfig().voteUrl);
}
return;
}
VoteModel voteModel = db.getDSL().selectFrom(TABLE_VOTE).where(TABLE_VOTE.ID.eq(((Player) context).getUniqueId())).fetchOne();
if (voteModel == null) {
i18n.send(context, NEUTRAL, "Sorry but you do not have any registered votes on this server!");
return;
}
i18n.send(context, POSITIVE, "You current vote-count is {amount}", voteModel.getVotes());
if (voteModel.timePassed(module.getConfig().voteBonusTime.toMillis())) {
i18n.send(context, NEUTRAL, "Sadly you did not vote in the last {input#time} so your vote-count will be reset to 1", TimeUtil.format(context.getLocale(), module.getConfig().voteBonusTime.toMillis()));
} else if (voteModel.timePassed(DAYS.toMillis(1))) {
i18n.send(context, NEUTRAL, "Voting now will increase your consecutive votes and result in higher reward!");
} else {
i18n.send(context, POSITIVE, "You voted {input#time} so you will probably not be able to vote again already!", TimeUtil.format(context.getLocale(), new Date(voteModel.getLastVote())));
}
if (!module.getConfig().voteUrl.isEmpty()) {
i18n.send(context, POSITIVE, "You can vote here now: {name#voteurl}", module.getConfig().voteUrl);
}
}
Aggregations