mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 09:07:37 +00:00
CommandSpy now works with permissions
This commit is contained in:
parent
97117c0e97
commit
d785ef31c8
@ -24,7 +24,7 @@ public class CommandListener extends PlexListener
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
Bukkit.getOnlinePlayers().stream().filter(pl -> plugin.getPlayerCache().getPlexPlayer(pl.getUniqueId()).isCommandSpy() && plugin.getPlayerCache().getPlexPlayer(pl.getUniqueId()).isAdminActive()).forEach(pl ->
|
||||
Bukkit.getOnlinePlayers().stream().filter(pl -> plugin.getPlayerCache().getPlexPlayer(pl.getUniqueId()).isCommandSpy() && hasCommandSpy(plugin.getPlayerCache().getPlexPlayer(pl.getUniqueId()))).forEach(pl ->
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
String command = event.getMessage();
|
||||
@ -127,6 +127,18 @@ public class CommandListener extends PlexListener
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasCommandSpy(PlexPlayer plexPlayer)
|
||||
{
|
||||
if (plugin.getSystem().equalsIgnoreCase("ranks"))
|
||||
{
|
||||
return plexPlayer.isAdminActive();
|
||||
}
|
||||
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
{
|
||||
return plexPlayer.getPlayer().hasPermission("plex.commandspy");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user