forked from NLthijs48/AreaShop
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add info base command, rename version to 2.8.0
- Loading branch information
Showing
3 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
AreaShop/src/main/java/me/wiefferink/areashop/commands/InfoBaseCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters