mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-02-05 22:31:26 +01:00
Move mod messages to a utility.
This commit is contained in:
parent
f3a5e572b3
commit
f9b45921b1
@ -36,6 +36,7 @@ import fr.neatmonster.nocheatplus.checks.combined.CombinedListener;
|
||||
import fr.neatmonster.nocheatplus.checks.fight.FightListener;
|
||||
import fr.neatmonster.nocheatplus.checks.inventory.InventoryListener;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.MovingListener;
|
||||
import fr.neatmonster.nocheatplus.clients.ModUtil;
|
||||
import fr.neatmonster.nocheatplus.command.CommandHandler;
|
||||
import fr.neatmonster.nocheatplus.command.INotifyReload;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
@ -613,95 +614,6 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
||||
|
||||
|
||||
/**
|
||||
* Send block codes to the player according to allowed or disallowed client-mods or client-mod features.
|
||||
* @param player
|
||||
*/
|
||||
protected void checkModsMessage(Player player) {
|
||||
String message = "";
|
||||
|
||||
// Check if we allow all the client mods.
|
||||
final boolean allowAll = ConfigManager.getConfigFile().getBoolean(ConfPaths.MISCELLANEOUS_ALLOWCLIENTMODS);
|
||||
|
||||
// Allow Rei's Minimap's cave mode.
|
||||
if (allowAll || player.hasPermission(Permissions.REI_CAVE))
|
||||
message += "§0§0§1§e§f";
|
||||
|
||||
// Allow Rei's Minimap's radar.
|
||||
if (allowAll || player.hasPermission(Permissions.REI_RADAR))
|
||||
message += "§0§0§2§3§4§5§6§7§e§f";
|
||||
|
||||
// If all the client mods are allowed, no need to go any further.
|
||||
if (allowAll) {
|
||||
if (!message.equals(""))
|
||||
player.sendMessage(message);
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable Zombe's fly mod.
|
||||
if (!player.hasPermission(Permissions.ZOMBE_FLY))
|
||||
message += "§f §f §1 §0 §2 §4";
|
||||
|
||||
// Disable Zombe's noclip.
|
||||
if (!player.hasPermission(Permissions.ZOMBE_NOCLIP))
|
||||
message += "§f §f §4 §0 §9 §6";
|
||||
|
||||
// Disable Zombe's cheat.
|
||||
if (!player.hasPermission(Permissions.ZOMBE_CHEAT))
|
||||
message += "§f §f §2 §0 §4 §8";
|
||||
|
||||
// Disable CJB's fly mod.
|
||||
if (!player.hasPermission(Permissions.CJB_FLY))
|
||||
message += "§3 §9 §2 §0 §0 §1";
|
||||
|
||||
// Disable CJB's xray.
|
||||
if (!player.hasPermission(Permissions.CJB_XRAY))
|
||||
message += "§3 §9 §2 §0 §0 §2";
|
||||
|
||||
// Disable CJB's radar.
|
||||
if (!player.hasPermission(Permissions.CJB_RADAR))
|
||||
message += "§3 §9 §2 §0 §0 §3";
|
||||
|
||||
// Disable Minecraft AutoMap's ores.
|
||||
if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_ORES))
|
||||
message += "§0§0§1§f§e";
|
||||
|
||||
// Disable Minecraft AutoMap's cave mode.
|
||||
if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_CAVE))
|
||||
message += "§0§0§2§f§e";
|
||||
|
||||
// Disable Minecraft AutoMap's radar.
|
||||
if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_RADAR))
|
||||
message += "§0§0§3§4§5§6§7§8§f§e";
|
||||
|
||||
// Disable Smart Moving's climbing.
|
||||
if (!player.hasPermission(Permissions.SMARTMOVING_CLIMBING))
|
||||
message += "§0§1§0§1§2§f§f";
|
||||
|
||||
// Disable Smart Moving's climbing.
|
||||
if (!player.hasPermission(Permissions.SMARTMOVING_SWIMMING))
|
||||
message += "§0§1§3§4§f§f";
|
||||
|
||||
// Disable Smart Moving's climbing.
|
||||
if (!player.hasPermission(Permissions.SMARTMOVING_CRAWLING))
|
||||
message += "§0§1§5§f§f";
|
||||
|
||||
// Disable Smart Moving's climbing.
|
||||
if (!player.hasPermission(Permissions.SMARTMOVING_SLIDING))
|
||||
message += "§0§1§6§f§f";
|
||||
|
||||
// Disable Smart Moving's climbing.
|
||||
if (!player.hasPermission(Permissions.SMARTMOVING_JUMPING))
|
||||
message += "§0§1§8§9§a§b§f§f";
|
||||
|
||||
// Disable Smart Moving's climbing.
|
||||
if (!player.hasPermission(Permissions.SMARTMOVING_FLYING))
|
||||
message += "§0§1§7§f§f";
|
||||
|
||||
if (!message.equals(""))
|
||||
player.sendMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick solution to hide the listener methods, expect refactoring.
|
||||
* @return
|
||||
*/
|
||||
@ -741,7 +653,7 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
||||
if (configOutdated) player.sendMessage(ChatColor.RED + "NCP: " + ChatColor.WHITE + "Your configuration might be outdated.\n" + "Some settings could have changed, you should regenerate it!");
|
||||
|
||||
}
|
||||
checkModsMessage(player);
|
||||
ModUtil.checkModsMessage(player);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -0,0 +1,105 @@
|
||||
package fr.neatmonster.nocheatplus.clients;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.config.ConfPaths;
|
||||
import fr.neatmonster.nocheatplus.config.ConfigManager;
|
||||
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
||||
|
||||
/**
|
||||
* Utilities for dealing with client mods. This is likely to by just a refactoring stage.
|
||||
* @author mc_dev
|
||||
*
|
||||
*/
|
||||
public class ModUtil {
|
||||
|
||||
/**
|
||||
* Send block codes to the player according to allowed or disallowed client-mods or client-mod features.
|
||||
* @param player
|
||||
*/
|
||||
public static void checkModsMessage(Player player) {
|
||||
String message = "";
|
||||
|
||||
// Check if we allow all the client mods.
|
||||
final boolean allowAll = ConfigManager.getConfigFile().getBoolean(ConfPaths.MISCELLANEOUS_ALLOWCLIENTMODS);
|
||||
|
||||
// Allow Rei's Minimap's cave mode.
|
||||
if (allowAll || player.hasPermission(Permissions.REI_CAVE))
|
||||
message += "§0§0§1§e§f";
|
||||
|
||||
// Allow Rei's Minimap's radar.
|
||||
if (allowAll || player.hasPermission(Permissions.REI_RADAR))
|
||||
message += "§0§0§2§3§4§5§6§7§e§f";
|
||||
|
||||
// If all the client mods are allowed, no need to go any further.
|
||||
if (allowAll) {
|
||||
if (!message.equals(""))
|
||||
player.sendMessage(message);
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable Zombe's fly mod.
|
||||
if (!player.hasPermission(Permissions.ZOMBE_FLY))
|
||||
message += "§f §f §1 §0 §2 §4";
|
||||
|
||||
// Disable Zombe's noclip.
|
||||
if (!player.hasPermission(Permissions.ZOMBE_NOCLIP))
|
||||
message += "§f §f §4 §0 §9 §6";
|
||||
|
||||
// Disable Zombe's cheat.
|
||||
if (!player.hasPermission(Permissions.ZOMBE_CHEAT))
|
||||
message += "§f §f §2 §0 §4 §8";
|
||||
|
||||
// Disable CJB's fly mod.
|
||||
if (!player.hasPermission(Permissions.CJB_FLY))
|
||||
message += "§3 §9 §2 §0 §0 §1";
|
||||
|
||||
// Disable CJB's xray.
|
||||
if (!player.hasPermission(Permissions.CJB_XRAY))
|
||||
message += "§3 §9 §2 §0 §0 §2";
|
||||
|
||||
// Disable CJB's radar.
|
||||
if (!player.hasPermission(Permissions.CJB_RADAR))
|
||||
message += "§3 §9 §2 §0 §0 §3";
|
||||
|
||||
// Disable Minecraft AutoMap's ores.
|
||||
if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_ORES))
|
||||
message += "§0§0§1§f§e";
|
||||
|
||||
// Disable Minecraft AutoMap's cave mode.
|
||||
if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_CAVE))
|
||||
message += "§0§0§2§f§e";
|
||||
|
||||
// Disable Minecraft AutoMap's radar.
|
||||
if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_RADAR))
|
||||
message += "§0§0§3§4§5§6§7§8§f§e";
|
||||
|
||||
// Disable Smart Moving's climbing.
|
||||
if (!player.hasPermission(Permissions.SMARTMOVING_CLIMBING))
|
||||
message += "§0§1§0§1§2§f§f";
|
||||
|
||||
// Disable Smart Moving's climbing.
|
||||
if (!player.hasPermission(Permissions.SMARTMOVING_SWIMMING))
|
||||
message += "§0§1§3§4§f§f";
|
||||
|
||||
// Disable Smart Moving's climbing.
|
||||
if (!player.hasPermission(Permissions.SMARTMOVING_CRAWLING))
|
||||
message += "§0§1§5§f§f";
|
||||
|
||||
// Disable Smart Moving's climbing.
|
||||
if (!player.hasPermission(Permissions.SMARTMOVING_SLIDING))
|
||||
message += "§0§1§6§f§f";
|
||||
|
||||
// Disable Smart Moving's climbing.
|
||||
if (!player.hasPermission(Permissions.SMARTMOVING_JUMPING))
|
||||
message += "§0§1§8§9§a§b§f§f";
|
||||
|
||||
// Disable Smart Moving's climbing.
|
||||
if (!player.hasPermission(Permissions.SMARTMOVING_FLYING))
|
||||
message += "§0§1§7§f§f";
|
||||
|
||||
if (!message.equals(""))
|
||||
player.sendMessage(message);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user