mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-27 20:27:37 +00:00
Prevent Muted players from using certain commands
Prevent non-superadmins from using /socialspy
This commit is contained in:
parent
68a225ed7e
commit
a1047b1811
@ -26,6 +26,8 @@ import org.bukkit.util.Vector;
|
||||
public class TFM_PlayerListener implements Listener
|
||||
{
|
||||
private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
||||
|
||||
private static final String[] MutedCommands = {"^/msg", "^/m","^/reply", "^/r", "^/tell", "^/me"};
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
@ -472,6 +474,14 @@ public class TFM_PlayerListener implements Listener
|
||||
{
|
||||
block_command = true;
|
||||
}
|
||||
else if (Pattern.compile("^/clear").matcher(command).find())
|
||||
{
|
||||
block_command = true;
|
||||
}
|
||||
else if (TFM_SuperadminList.isUserSuperadmin(p) && Pattern.compile("^/socialspy").matcher(command).find())
|
||||
{
|
||||
block_command = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (block_command)
|
||||
@ -480,6 +490,20 @@ public class TFM_PlayerListener implements Listener
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// block muted commands
|
||||
if(playerdata.isMuted())
|
||||
{
|
||||
for(String mc : MutedCommands)
|
||||
{
|
||||
if (Pattern.compile(mc).matcher(command).find())
|
||||
{
|
||||
p.sendMessage(ChatColor.RED + "You are muted, STFU!");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
|
Loading…
Reference in New Issue
Block a user