Need thevoidmanager.score to execute /void score

This commit is contained in:
Debucquoy Anthony 2024-02-04 21:27:53 +01:00
parent f36e6b1aa0
commit 30be45065f
Signed by: tonitch
GPG Key ID: A78D6421F083D42E
2 changed files with 14 additions and 9 deletions

View File

@ -14,10 +14,6 @@ import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import ovh.herisson.thevoidroad.DatabaseManager;
import ovh.herisson.thevoidroad.TheVoidRoad;
import ovh.herisson.thevoidroad.Voids;
import ovh.herisson.thevoidroad.Merchand;
public class VoidCommands implements CommandExecutor, TabCompleter{ public class VoidCommands implements CommandExecutor, TabCompleter{
private final Merchand m = Merchand.getInstance(); private final Merchand m = Merchand.getInstance();
@ -36,10 +32,13 @@ public class VoidCommands implements CommandExecutor, TabCompleter{
} }
switch (args[0]) { switch (args[0]) {
case "score": case "score":
if(!sender.hasPermission("void.score")){
Voids.scoreboard().forEach((p, a) -> { Voids.scoreboard().forEach((p, a) -> {
sender.sendMessage(p + " : " + a); sender.sendMessage(p + " : " + a);
}); });
return true; return true;
}
return false;
case "give": case "give":
if(args.length < 2) return false; if(args.length < 2) return false;
Player target = Bukkit.getPlayer(args[1]); Player target = Bukkit.getPlayer(args[1]);
@ -117,10 +116,13 @@ public class VoidCommands implements CommandExecutor, TabCompleter{
ArrayList<String> list = new ArrayList<>(); ArrayList<String> list = new ArrayList<>();
if(args.length == 1){ if(args.length == 1){
list.addAll(List.of("give","event", "score")); list.addAll(List.of("give","event"));
if(sender.hasPermission("void.manage")){ if(sender.hasPermission("void.manage")){
list.add("manage"); list.add("manage");
} }
if(sender.hasPermission("void.score")){
list.add("score");
}
} }
if(args.length >= 2){ if(args.length >= 2){
switch (args[0]) { switch (args[0]) {

View File

@ -16,6 +16,9 @@ permissions:
void.manage: void.manage:
description: "GameMaster's command" description: "GameMaster's command"
default: op default: op
void.score:
description: "score the voids"
default: op
void.balance: void.balance:
description: "User of thevoidroad" description: "User of thevoidroad"
default: not op default: not op