Skip to content

Commit

Permalink
Merge branch 'Margouta:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dandan2611 authored Jul 4, 2024
2 parents a3b3ca9 + 232832c commit 8f7829d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.entity.Player;

public class VersionCommand implements CommandExecutor {

Expand All @@ -16,6 +17,13 @@ public VersionCommand(JavaPlugin plugin) {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("version")) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (!player.hasPermission("ayw.version")) {
player.sendMessage("Vous n'avez pas la permission d'utiliser cette commande.");
return true;
}
}
sender.sendMessage("Version du plugin : " + plugin.getDescription().getVersion());
return true;
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ api-version: '1.20'
commands:
version:
description: Affiche la version du plugin.
permission: ayw.version
permission-message: "Vous n'avez pas la permission d'utiliser cette commande."

permissions:
ayw.version:
description: Permission pour utiliser la commande /version
default: op

0 comments on commit 8f7829d

Please sign in to comment.