mirror of
https://github.com/Ne0nx3r0/BetterAlias.git
synced 2024-09-28 04:17:28 +02:00
Finishing up for release
This commit is contained in:
parent
d4ae745e59
commit
1f87b909c5
@ -3,11 +3,11 @@ banhammer:
|
|||||||
1: /ban !1
|
1: /ban !1
|
||||||
#name parameter is replaced with the command users name
|
#name parameter is replaced with the command users name
|
||||||
gmon:
|
gmon:
|
||||||
0: /gamemode !name 1
|
0: /gamemode creative !name
|
||||||
1: /gamemode !1 1
|
1: /gamemode creative !1
|
||||||
gmoff:
|
gmoff:
|
||||||
0: /gamemode !name 0
|
0: /gamemode survival !name
|
||||||
1: /gamemode !1 0
|
1: /gamemode survival !1
|
||||||
# putting a P after the parameter specifies this is a player, and BA should try to guess which player
|
# putting a P after the parameter specifies this is a player, and BA should try to guess which player
|
||||||
# useful for things like "/to e0n" instead of "/to Ne0nx3r0"
|
# useful for things like "/to e0n" instead of "/to Ne0nx3r0"
|
||||||
# This will ONLY look for players that are online
|
# This will ONLY look for players that are online
|
||||||
|
@ -57,9 +57,9 @@ public class AliasManager
|
|||||||
{
|
{
|
||||||
Alias alias;
|
Alias alias;
|
||||||
|
|
||||||
if(yml.isString(sAlias+".permission"))
|
if(yml.getString(sAlias+".permission") != null)
|
||||||
{
|
{
|
||||||
alias = new Alias(sAlias,yml.getString("permission"));
|
alias = new Alias(sAlias,yml.getString(sAlias+".permission"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -179,7 +179,11 @@ public class AliasManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cs.sendMessage(ChatColor.RED+"[BA] A parameter of this alias requires a player.");
|
cs.sendMessage("[BetterAlias] "+ChatColor.RED+"A parameter of this alias requires a player.");
|
||||||
|
|
||||||
|
cs.sendMessage("[BetterAlias] Line: "+ac.command);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(text.equalsIgnoreCase("handItemName"))
|
else if(text.equalsIgnoreCase("handItemName"))
|
||||||
@ -190,7 +194,11 @@ public class AliasManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cs.sendMessage(ChatColor.RED+"[BA] A parameter of this alias requires a player.");
|
cs.sendMessage("[BetterAlias] "+ChatColor.RED+"A parameter of this alias requires a player.");
|
||||||
|
|
||||||
|
cs.sendMessage("[BetterAlias] Line: "+ac.command);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(text.equalsIgnoreCase("handItemID"))
|
else if(text.equalsIgnoreCase("handItemID"))
|
||||||
@ -201,7 +209,11 @@ public class AliasManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cs.sendMessage(ChatColor.RED+"[BA] A parameter of this alias requires a player.");
|
cs.sendMessage("[BetterAlias] "+ChatColor.RED+"A parameter of this alias requires a player.");
|
||||||
|
|
||||||
|
cs.sendMessage("[BetterAlias] Line: "+ac.command);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(text.length() >= 2 && text.substring(1,2).equalsIgnoreCase("p"))
|
else if(text.length() >= 2 && text.substring(1,2).equalsIgnoreCase("p"))
|
||||||
@ -266,14 +278,14 @@ public class AliasManager
|
|||||||
{
|
{
|
||||||
if(player != null)
|
if(player != null)
|
||||||
{
|
{
|
||||||
plugin.getLogger().log(Level.INFO,"[BA] Running console command for "+player.getName()+": "+sNewCommand);
|
plugin.getLogger().log(Level.INFO,"[BetterAlias] "+ChatColor.AQUA+"Running console command for "+player.getName()+": "+sNewCommand);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cs.sendMessage(ChatColor.AQUA+"[BA] Running: "+sNewCommand);
|
cs.sendMessage("[BetterAlias] "+ChatColor.AQUA+"Running: "+sNewCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), sNewCommand);
|
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), sNewCommand.substring(1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,19 @@ public class BetterAliasCommandListener implements Listener
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent e)
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent e)
|
||||||
{
|
{
|
||||||
String sCommand = e.getMessage().substring(0,e.getMessage().indexOf(" "));
|
String sCommand = null;
|
||||||
|
String sArgs = "";
|
||||||
|
|
||||||
|
if(e.getMessage().contains(" "))
|
||||||
|
{
|
||||||
|
sCommand = e.getMessage().substring(1,e.getMessage().indexOf(" "));
|
||||||
|
sArgs = e.getMessage().substring(e.getMessage().indexOf(" ")+1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sCommand = e.getMessage().substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
Alias alias = plugin.aliasManager.getAlias(sCommand);
|
Alias alias = plugin.aliasManager.getAlias(sCommand);
|
||||||
|
|
||||||
if(alias != null)
|
if(alias != null)
|
||||||
@ -33,14 +45,16 @@ public class BetterAliasCommandListener implements Listener
|
|||||||
if(alias.hasPermission()
|
if(alias.hasPermission()
|
||||||
&& !player.hasPermission("betteralias."+alias.getPermissionNode()))
|
&& !player.hasPermission("betteralias."+alias.getPermissionNode()))
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.RED+"You do not have permission to use this command.");
|
player.sendMessage(ChatColor.RED+"You do not have permission to use this alias.");
|
||||||
|
|
||||||
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(plugin.aliasManager.sendAliasCommands(
|
if(plugin.aliasManager.sendAliasCommands(
|
||||||
alias,
|
alias,
|
||||||
(CommandSender) e.getPlayer(),
|
(CommandSender) e.getPlayer(),
|
||||||
e.getMessage().substring(e.getMessage().indexOf(" ")+1)))
|
sArgs));
|
||||||
{
|
{
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user