Fix permissions issue
This commit is contained in:
@@ -3,7 +3,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'xyz.lncvrt'
|
||||
version = '1.0.0'
|
||||
version = '1.0.1'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package xyz.lncvrt.setmaxplayers;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public final class SetMaxPlayers extends JavaPlugin {
|
||||
public FileConfiguration config;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
saveDefaultConfig();
|
||||
config = getConfig();
|
||||
getCommand("setmaxplayers").setExecutor(new SetMaxPlayersCommand(this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ public class SetMaxPlayersCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
||||
if (!commandSender.hasPermission(plugin.config.getString("permission", "lncvrt.setmaxplayers.use"))) {
|
||||
commandSender.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||
return true;
|
||||
}
|
||||
if (strings.length != 1) {
|
||||
commandSender.sendMessage(ChatColor.RED + "Correct usage: /setmaxplayers <amount>");
|
||||
return true;
|
||||
|
||||
1
src/main/resources/config.yml
Normal file
1
src/main/resources/config.yml
Normal file
@@ -0,0 +1 @@
|
||||
permission: 'lncvrt.setmaxplayers.use'
|
||||
Reference in New Issue
Block a user