From db3f6c7b2be21d250f39fdd3cb135912273abff6 Mon Sep 17 00:00:00 2001 From: FeuSalamander Date: Sun, 1 Jan 2023 21:43:58 +0100 Subject: [PATCH] added the permission --- .../java/me/feusalamander/vmessage/ReloadCommand.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/feusalamander/vmessage/ReloadCommand.java b/src/main/java/me/feusalamander/vmessage/ReloadCommand.java index 74c9179..540ab2d 100644 --- a/src/main/java/me/feusalamander/vmessage/ReloadCommand.java +++ b/src/main/java/me/feusalamander/vmessage/ReloadCommand.java @@ -1,4 +1,5 @@ package me.feusalamander.vmessage; +import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.command.SimpleCommand; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.TextColor; @@ -17,15 +18,20 @@ public final class ReloadCommand implements SimpleCommand { @Override public void execute(final Invocation invocation) { + CommandSource source = invocation.source(); String[] args = invocation.arguments(); if(args.length == 0){ - invocation.source().sendMessage(Component.text("§cUsage: /vmessage reload")); + source.sendMessage(Component.text("§cUsage: /vmessage reload")); return; } String s = args[0]; if(s.equalsIgnoreCase("reload")){ + if(!source.hasPermission("*")){ + source.sendMessage(Component.text("§cYou don't have the permission to do that")); + return; + } config.reload(); - invocation.source().sendMessage(Component.text("The Vmessage's config has been succefully reloaded")); + source.sendMessage(Component.text("The Vmessage's config has been succefully reloaded")); } }