mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-03 22:37:44 +01:00
+ NoCheatPlus is now hidden from the /plugins command
= Fixed an issue with the fly tracker and water
This commit is contained in:
parent
60802760f5
commit
4d99d24d64
@ -907,6 +907,12 @@
|
|||||||
------------------------------- CHAT Subsection --------------------------------
|
------------------------------- CHAT Subsection --------------------------------
|
||||||
|
|
||||||
Checks that at least technically have to do with chat or commands.
|
Checks that at least technically have to do with chat or commands.
|
||||||
|
|
||||||
|
hidenocheatplus:
|
||||||
|
|
||||||
|
Setting this to true will hide NoCheatPlus for the /plugins (or /pl) command
|
||||||
|
of Bukkit (only if typed by a player). This command might be used by some
|
||||||
|
griefing clients to try to detect and to apply bypasses to NoCheatPlus.
|
||||||
|
|
||||||
1) COLOR:
|
1) COLOR:
|
||||||
|
|
||||||
|
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<!-- Informations -->
|
<!-- Informations -->
|
||||||
<name>NoCheatPlus</name>
|
<name>NoCheatPlus</name>
|
||||||
<version>3.5.5</version>
|
<version>3.5.5_1</version>
|
||||||
<description>Detect and fight the exploitation of various flaws/bugs in Minecraft.</description>
|
<description>Detect and fight the exploitation of various flaws/bugs in Minecraft.</description>
|
||||||
<url>http://dev.bukkit.org/server-mods/nocheatplus</url>
|
<url>http://dev.bukkit.org/server-mods/nocheatplus</url>
|
||||||
|
|
||||||
|
@ -9,12 +9,15 @@ import me.neatmonster.nocheatplus.NoCheatPlusPlayer;
|
|||||||
import me.neatmonster.nocheatplus.config.ConfigurationCacheStore;
|
import me.neatmonster.nocheatplus.config.ConfigurationCacheStore;
|
||||||
import me.neatmonster.nocheatplus.config.Permissions;
|
import me.neatmonster.nocheatplus.config.Permissions;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Central location to listen to events that are
|
* Central location to listen to events that are
|
||||||
@ -86,6 +89,46 @@ public class ChatCheckListener implements Listener, EventManager {
|
|||||||
@EventHandler(
|
@EventHandler(
|
||||||
priority = EventPriority.LOWEST)
|
priority = EventPriority.LOWEST)
|
||||||
public void commandPreprocess(final PlayerCommandPreprocessEvent event) {
|
public void commandPreprocess(final PlayerCommandPreprocessEvent event) {
|
||||||
|
|
||||||
|
final NoCheatPlusPlayer player = plugin.getPlayer(event.getPlayer());
|
||||||
|
final ChatConfig cc = ChatCheck.getConfig(player);
|
||||||
|
|
||||||
|
// If the command is /plugins or /pl
|
||||||
|
if ((event.getMessage().equalsIgnoreCase("/plugins")
|
||||||
|
|| event.getMessage().toLowerCase().startsWith("/plugins ")
|
||||||
|
|| event.getMessage().equalsIgnoreCase("/pl") || event.getMessage().toLowerCase().startsWith("/pl "))
|
||||||
|
&& cc.hideNoCheatPlus) {
|
||||||
|
// If the player isn't allowed to use this command
|
||||||
|
if (!event.getPlayer().hasPermission("bukkit.command.plugins"))
|
||||||
|
// Fake the permissions error message
|
||||||
|
event.getPlayer().sendMessage(
|
||||||
|
ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. "
|
||||||
|
+ "Please contact the server administrators if you believe that this is in error.");
|
||||||
|
else {
|
||||||
|
// Fake the plugins list
|
||||||
|
final StringBuilder pluginList = new StringBuilder();
|
||||||
|
final Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
|
||||||
|
|
||||||
|
for (final Plugin plugin : plugins) {
|
||||||
|
// But make sure to hide NoCheatPlus
|
||||||
|
if (plugin.getName().equals("NoCheatPlus"))
|
||||||
|
continue;
|
||||||
|
if (pluginList.length() > 0) {
|
||||||
|
pluginList.append(ChatColor.WHITE);
|
||||||
|
pluginList.append(", ");
|
||||||
|
}
|
||||||
|
|
||||||
|
pluginList.append(plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED);
|
||||||
|
pluginList.append(plugin.getDescription().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Of course decrease the number of plugins
|
||||||
|
event.getPlayer().sendMessage("Plugins (" + (plugins.length - 1) + "): " + pluginList.toString());
|
||||||
|
}
|
||||||
|
// Cancel the event, we have already replied to the player
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
// This type of event is derived from PlayerChatEvent, therefore
|
// This type of event is derived from PlayerChatEvent, therefore
|
||||||
// just treat it like that
|
// just treat it like that
|
||||||
chat(event);
|
chat(event);
|
||||||
|
@ -17,6 +17,8 @@ import me.neatmonster.nocheatplus.config.Permissions;
|
|||||||
*/
|
*/
|
||||||
public class ChatConfig implements ConfigItem {
|
public class ChatConfig implements ConfigItem {
|
||||||
|
|
||||||
|
public final boolean hideNoCheatPlus;
|
||||||
|
|
||||||
public final boolean spamCheck;
|
public final boolean spamCheck;
|
||||||
public final String[] spamWhitelist;
|
public final String[] spamWhitelist;
|
||||||
public final long spamTimeframe;
|
public final long spamTimeframe;
|
||||||
@ -35,6 +37,7 @@ public class ChatConfig implements ConfigItem {
|
|||||||
|
|
||||||
public ChatConfig(final NoCheatPlusConfiguration data) {
|
public ChatConfig(final NoCheatPlusConfiguration data) {
|
||||||
|
|
||||||
|
hideNoCheatPlus = data.getBoolean(ConfPaths.CHAT_HIDENOCHEATPLUS);
|
||||||
spamCheck = data.getBoolean(ConfPaths.CHAT_SPAM_CHECK);
|
spamCheck = data.getBoolean(ConfPaths.CHAT_SPAM_CHECK);
|
||||||
spamWhitelist = splitWhitelist(data.getString(ConfPaths.CHAT_SPAM_WHITELIST));
|
spamWhitelist = splitWhitelist(data.getString(ConfPaths.CHAT_SPAM_WHITELIST));
|
||||||
spamTimeframe = data.getInt(ConfPaths.CHAT_SPAM_TIMEFRAME) * 1000L;
|
spamTimeframe = data.getInt(ConfPaths.CHAT_SPAM_TIMEFRAME) * 1000L;
|
||||||
|
@ -70,16 +70,22 @@ public class MovingCheckListener implements Listener, EventManager {
|
|||||||
final MovingConfig cc = MovingCheck.getConfig(player);
|
final MovingConfig cc = MovingCheck.getConfig(player);
|
||||||
final MovingData data = MovingCheck.getData(player);
|
final MovingData data = MovingCheck.getData(player);
|
||||||
|
|
||||||
|
final PreciseLocation location = new PreciseLocation();
|
||||||
|
location.x = bukkitPlayer.getLocation().getX();
|
||||||
|
location.y = bukkitPlayer.getLocation().getY();
|
||||||
|
location.z = bukkitPlayer.getLocation().getZ();
|
||||||
|
final int type = CheckUtil.evaluateLocation(bukkitPlayer.getWorld(), location);
|
||||||
|
final boolean isLiquid = CheckUtil.isLiquid(type);
|
||||||
|
|
||||||
// Do not do the check if it's disabled, if flying is allowed, if the player is
|
// Do not do the check if it's disabled, if flying is allowed, if the player is
|
||||||
// allowed to fly because of its game mode, if he has the required permission,
|
// allowed to fly because of its game mode, if he has the required permission,
|
||||||
// if he is in water or in vines.
|
// if he is in water or in vines.
|
||||||
if (!cc.tracker || cc.allowFlying || bukkitPlayer.getGameMode() == GameMode.CREATIVE
|
if (!cc.tracker || cc.allowFlying || bukkitPlayer.getGameMode() == GameMode.CREATIVE
|
||||||
|| bukkitPlayer.getAllowFlight() || bukkitPlayer.hasPermission(Permissions.MOVING_RUNFLY)
|
|| bukkitPlayer.getAllowFlight() || bukkitPlayer.hasPermission(Permissions.MOVING_RUNFLY)
|
||||||
|| bukkitPlayer.hasPermission(Permissions.MOVING_FLYING)
|
|| bukkitPlayer.hasPermission(Permissions.MOVING_FLYING) || isLiquid
|
||||||
|| bukkitPlayer.getLocation().getBlock().getType() == Material.WATER
|
|
||||||
|| bukkitPlayer.getLocation().getBlock().getType() == Material.STATIONARY_WATER
|
|
||||||
|| bukkitPlayer.getLocation().getBlock().getType() == Material.LADDER
|
|| bukkitPlayer.getLocation().getBlock().getType() == Material.LADDER
|
||||||
|| bukkitPlayer.getLocation().getBlock().getType() == Material.VINE) {
|
|| bukkitPlayer.getLocation().getBlock().getType() == Material.VINE
|
||||||
|
|| bukkitPlayer.getLocation().getX() < 0D) {
|
||||||
data.fallingSince = 0;
|
data.fallingSince = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -130,6 +130,8 @@ public abstract class ConfPaths {
|
|||||||
|
|
||||||
private final static String CHAT = CHECKS + "chat.";
|
private final static String CHAT = CHECKS + "chat.";
|
||||||
|
|
||||||
|
public final static String CHAT_HIDENOCHEATPLUS = CHAT + "hidenocheatplus";
|
||||||
|
|
||||||
private final static String CHAT_COLOR = CHAT + "color.";
|
private final static String CHAT_COLOR = CHAT + "color.";
|
||||||
public final static String CHAT_COLOR_CHECK = CHAT_COLOR + "active";
|
public final static String CHAT_COLOR_CHECK = CHAT_COLOR + "active";
|
||||||
public final static String CHAT_COLOR_ACTIONS = CHAT_COLOR + "actions";
|
public final static String CHAT_COLOR_ACTIONS = CHAT_COLOR + "actions";
|
||||||
|
@ -115,6 +115,8 @@ public class DefaultConfiguration extends NoCheatPlusConfiguration {
|
|||||||
|
|
||||||
/*** CHAT ***/
|
/*** CHAT ***/
|
||||||
|
|
||||||
|
set(ConfPaths.CHAT_HIDENOCHEATPLUS, true);
|
||||||
|
|
||||||
set(ConfPaths.CHAT_COLOR_CHECK, true);
|
set(ConfPaths.CHAT_COLOR_CHECK, true);
|
||||||
set(ConfPaths.CHAT_COLOR_ACTIONS, "log:color:0:1:if cancel");
|
set(ConfPaths.CHAT_COLOR_ACTIONS, "log:color:0:1:if cancel");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user