mirror of
https://github.com/Ne0nx3r0/BetterAlias.git
synced 2024-11-13 10:34:22 +01:00
Adding formal permissions support
This commit is contained in:
parent
154ff71195
commit
2fb62f22c0
@ -3,6 +3,7 @@ package com.gmail.Ne0nx3r0;
|
||||
import com.gmail.Ne0nx3r0.AliasManager.AliasManager;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -22,7 +23,6 @@ class BetterAliasPlayerListener implements Listener{
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent e)
|
||||
{
|
||||
|
||||
String[] cmd = e.getMessage().substring(1).split(" ");
|
||||
|
||||
if(aliasManager.isAliased(cmd[0])){
|
||||
@ -96,13 +96,19 @@ class BetterAliasPlayerListener implements Listener{
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
else if(cmd[0].equalsIgnoreCase("bareload") && (e.getPlayer().isOp() || e.getPlayer().hasPermission("BetterAlias.reload")))
|
||||
|
||||
if(cmd[0].equalsIgnoreCase("bareload"))
|
||||
{
|
||||
BetterAlias.aliasManager = new AliasManager(BetterAlias.self);
|
||||
|
||||
e.getPlayer().sendMessage("BetterAlias reloaded!");
|
||||
|
||||
e.setCancelled(true);
|
||||
if(e.getPlayer().isOp() || e.getPlayer().hasPermission("BetterAlias.reload"))
|
||||
{
|
||||
BetterAlias.aliasManager = new AliasManager(BetterAlias.self);
|
||||
|
||||
e.getPlayer().sendMessage(ChatColor.GOLD+"BetterAlias reloaded!");
|
||||
}
|
||||
else
|
||||
{
|
||||
e.getPlayer().sendMessage(ChatColor.RED+"You do not have permission to use /bareload (node: BetterAlias.reload)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
10
plugin.yml
10
plugin.yml
@ -1,5 +1,11 @@
|
||||
name: BetterAlias
|
||||
main: com.gmail.Ne0nx3r0.BetterAlias
|
||||
version: '0.4'
|
||||
version: '0.4.1'
|
||||
database: false
|
||||
description: Command alias system
|
||||
description: Command alias system
|
||||
commands:
|
||||
bareload:
|
||||
description: Reloads the aliases.yml file
|
||||
permissions:
|
||||
BetterAlias.reload:
|
||||
description: Allows reloading BetterAlias
|
Loading…
Reference in New Issue
Block a user