Skip to content

Commit

Permalink
Add info base command, rename version to 2.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
md5sha256 committed Mar 23, 2024
1 parent ec36996 commit 0305ec3
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package me.wiefferink.areashop.commands;

import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import me.wiefferink.areashop.MessageBridge;
import me.wiefferink.areashop.commands.util.AreashopCommandBean;
import org.bukkit.command.CommandSender;
import org.incendo.cloud.Command;
import org.incendo.cloud.bean.CommandProperties;
import org.incendo.cloud.context.CommandContext;

import javax.annotation.Nonnull;

@Singleton
public class InfoBaseCommand extends AreashopCommandBean {

private final MessageBridge messageBridge;

@Inject
public InfoBaseCommand(
@Nonnull MessageBridge messageBridge
) {
this.messageBridge = messageBridge;
}

@Override
public String stringDescription() {
return null;
}

@Override
public String getHelpKey(CommandSender target) {
if (target.hasPermission("areashop.info")) {
return "help-info";
}
return null;
}

@Override
protected @Nonnull Command.Builder<? extends CommandSender> configureCommand(@Nonnull Command.Builder<CommandSender> builder) {
return builder.literal("info").handler(this::handleCommand);
}

@Override
protected @Nonnull CommandProperties properties() {
return CommandProperties.of("info");
}

private void handleCommand(@Nonnull CommandContext<CommandSender> context) {
CommandSender sender = context.sender();
if (!sender.hasPermission("areashop.info")) {
messageBridge.message(sender, "info-noPermission");
return;
}
this.messageBridge.message(sender, "info-help");
}

}


























Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import me.wiefferink.areashop.commands.GroupInfoCommand;
import me.wiefferink.areashop.commands.GroupListCommand;
import me.wiefferink.areashop.commands.HelpCommand;
import me.wiefferink.areashop.commands.InfoBaseCommand;
import me.wiefferink.areashop.commands.InfoCommand;
import me.wiefferink.areashop.commands.LinkSignsCommand;
import me.wiefferink.areashop.commands.MeCommand;
Expand Down Expand Up @@ -80,6 +81,7 @@ public class AreashopCommands {
GroupListCommand.class,
HelpCommand.class,
InfoCommand.class,
InfoBaseCommand.class,
LinkSignsCommand.class,
MeCommand.class,
MessageCommand.class,
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
}

group = "me.wiefferink"
version = "2.8"
version = "2.8.0"

val targetJavaVersion = 17
val encoding = Charsets.UTF_8
Expand Down

0 comments on commit 0305ec3

Please sign in to comment.