mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-04-27 00:49:44 +00:00
Add blacklist of commands for muted players. Adds #30.
This commit is contained in:
parent
6796d460dc
commit
d6eb846488
4 changed files with 37 additions and 0 deletions
|
@ -356,6 +356,12 @@ public class EssentialsPlayerListener implements Listener {
|
||||||
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) {
|
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final String cmd = event.getMessage().toLowerCase(Locale.ENGLISH).split(" ")[0].replace("/", "").toLowerCase(Locale.ENGLISH);
|
final String cmd = event.getMessage().toLowerCase(Locale.ENGLISH).split(" ")[0].replace("/", "").toLowerCase(Locale.ENGLISH);
|
||||||
|
if (ess.getUser(player).isMuted() && (ess.getSettings().getMuteCommands().contains(cmd) || ess.getSettings().getMuteCommands().contains("*"))) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage(tl("voiceSilenced"));
|
||||||
|
LOGGER.info(tl("mutedUserSpeaks", player.getName()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (ess.getSettings().getSocialSpyCommands().contains(cmd) || ess.getSettings().getSocialSpyCommands().contains("*")) {
|
if (ess.getSettings().getSocialSpyCommands().contains(cmd) || ess.getSettings().getSocialSpyCommands().contains("*")) {
|
||||||
for (User spyer : ess.getOnlineUsers()) {
|
for (User spyer : ess.getOnlineUsers()) {
|
||||||
if (spyer.isSocialSpyEnabled() && !player.equals(spyer.getBase())) {
|
if (spyer.isSocialSpyEnabled() && !player.equals(spyer.getBase())) {
|
||||||
|
|
|
@ -48,6 +48,8 @@ public interface ISettings extends IConf {
|
||||||
|
|
||||||
Set<String> getSocialSpyCommands();
|
Set<String> getSocialSpyCommands();
|
||||||
|
|
||||||
|
Set<String> getMuteCommands();
|
||||||
|
|
||||||
Map<String, Object> getKit(String name);
|
Map<String, Object> getKit(String name);
|
||||||
|
|
||||||
ConfigurationSection getKits();
|
ConfigurationSection getKits();
|
||||||
|
|
|
@ -254,6 +254,24 @@ public class Settings implements net.ess3.api.ISettings {
|
||||||
return socialSpyCommands;
|
return socialSpyCommands;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Set<String> muteCommands = new HashSet<String>();
|
||||||
|
|
||||||
|
private Set<String> _getMuteCommands() {
|
||||||
|
Set<String> muteCommands = new HashSet<String>();
|
||||||
|
if(config.isList("mute-commands")) {
|
||||||
|
for(String s : config.getStringList("mute-commands")) {
|
||||||
|
muteCommands.add(s.toLowerCase(Locale.ENGLISH));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return muteCommands;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getMuteCommands() {
|
||||||
|
return muteCommands;
|
||||||
|
}
|
||||||
|
|
||||||
private String nicknamePrefix = "~";
|
private String nicknamePrefix = "~";
|
||||||
|
|
||||||
private String _getNicknamePrefix() {
|
private String _getNicknamePrefix() {
|
||||||
|
@ -489,6 +507,7 @@ public class Settings implements net.ess3.api.ISettings {
|
||||||
isCustomJoinMessage = !customJoinMessage.equals("none");
|
isCustomJoinMessage = !customJoinMessage.equals("none");
|
||||||
customQuitMessage = _getCustomQuitMessage();
|
customQuitMessage = _getCustomQuitMessage();
|
||||||
isCustomQuitMessage = !customQuitMessage.equals("none");
|
isCustomQuitMessage = !customQuitMessage.equals("none");
|
||||||
|
muteCommands = _getMuteCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
||||||
|
|
|
@ -138,6 +138,16 @@ socialspy-commands:
|
||||||
- ewhisper
|
- ewhisper
|
||||||
- pm
|
- pm
|
||||||
|
|
||||||
|
# Mute Commands
|
||||||
|
# These commands will be disabled when a player is muted.
|
||||||
|
# Use '*' to disable every command.
|
||||||
|
# Essentials already disabled Essentials messaging commands by default.
|
||||||
|
# It only cars about the root command, not args after that (it sees /f chat the same as /f)
|
||||||
|
mute-commands:
|
||||||
|
- f
|
||||||
|
- kittycannon
|
||||||
|
# - '*'
|
||||||
|
|
||||||
# If you do not wish to use a permission system, you can define a list of 'player perms' below.
|
# If you do not wish to use a permission system, you can define a list of 'player perms' below.
|
||||||
# This list has no effect if you are using a supported permissions system.
|
# This list has no effect if you are using a supported permissions system.
|
||||||
# If you are using an unsupported permissions system, simply delete this section.
|
# If you are using an unsupported permissions system, simply delete this section.
|
||||||
|
|
Loading…
Reference in a new issue