mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-03 22:37:44 +01:00
+ Introduced the Unpushable check
= Changed the FastPlace's default settings = Fixed some issues with commands
This commit is contained in:
parent
44f4da5080
commit
4a3d4d4cac
@ -153,6 +153,10 @@
|
||||
"/nocheatplus reload" command, which will cause NoCheatPlus to reread its config
|
||||
files.
|
||||
|
||||
- nocheatplus.admin.plugins
|
||||
Give this permissions to the players you want to be able to see the plugins your
|
||||
server is using.
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
--------------------------- Permissions for CHECKS -----------------------------
|
||||
@ -206,6 +210,13 @@
|
||||
speed and causes the server to spent a lot of additional time for processing
|
||||
these movements.
|
||||
|
||||
- nocheatplus.checks.moving.waterwalk
|
||||
Allows players to walk on water (by using a griefing client). This functionality
|
||||
is also called Jesus mode.
|
||||
|
||||
- nocheatplus.checks.moving.unpushable
|
||||
Allows players to be unpushable (they can't be pushed by an other player).
|
||||
|
||||
- nocheatplus.checks.moving.boatonground
|
||||
Allows players to place boats on the ground (and not only on the water).
|
||||
|
||||
@ -483,6 +494,12 @@
|
||||
|
||||
Only allow the commands /op and /deop to be executed by the console.
|
||||
|
||||
protectplugins:
|
||||
|
||||
Don't not allow your players to access the /plugins, /pl, /? commands by
|
||||
default. Of course, the players having the explicit permisssion to use them
|
||||
won't be blocked.
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-------------------------------- CHECKS Section --------------------------------
|
||||
@ -742,7 +759,7 @@
|
||||
active:
|
||||
Should players be checked for this kind of cheating. If you are not
|
||||
interested in players that cheat that way, set this to false. It is a
|
||||
good idea to have this active, because player won't be able to cross
|
||||
good idea to have this active, because players won't be able to cross
|
||||
easily the oceans.
|
||||
|
||||
actions:
|
||||
@ -753,6 +770,17 @@
|
||||
the normal position if a player climbing a block. The VL increases with
|
||||
every failed check and slowly decreases for every passed check.
|
||||
|
||||
5) UNPUSHABLE:
|
||||
|
||||
This check is designed to prevent players from being unpushable. It'll handle
|
||||
"pushs" server-side instead of letting the client calculates them for the server.
|
||||
|
||||
active:
|
||||
Should players be checked for this kind of cheating. If you are not
|
||||
interested in players that cheat that way, set this to false. It is a
|
||||
good idea to have this active, because players won't be able to stay on
|
||||
a block and to do not fall when pushed by other players.
|
||||
|
||||
|
||||
---------------------------- BLOCKBREAK Subsection -----------------------------
|
||||
|
||||
|
10
plugin.yml
10
plugin.yml
@ -28,9 +28,11 @@ permissions:
|
||||
nocheatplus.admin.chatlog:
|
||||
description: Player can see NoCheatPlus' log messages in the ingame chat
|
||||
nocheatplus.admin.commands:
|
||||
description: allow use of the "nocheatplus" commands (may be given to players to allow them to check statistics)
|
||||
description: Allow use of the "nocheatplus" commands (may be given to players to allow them to check statistics)
|
||||
nocheatplus.admin.reload:
|
||||
description: allow access to the special "nocheatplus reload" command (only intended for the actual server administrator)
|
||||
description: Allow access to the special "nocheatplus reload" command (only intended for the actual server administrator)
|
||||
nocheatplus.admin.plugins:
|
||||
description: Allow the player to see the plugins installed on the server
|
||||
nocheatplus.checks:
|
||||
description: Allow the player to bypass all checks
|
||||
children:
|
||||
@ -51,6 +53,10 @@ permissions:
|
||||
description: Allow a player to send more move-event-packets than normal, causing him to move faster than normal
|
||||
nocheatplus.checks.moving.morepacketsvehicle:
|
||||
description: Allow a player to send more vehicule-move-event-packets than normal, causing him to move faster than normal
|
||||
nocheatplus.checks.moving.waterwalk:
|
||||
description: Allow a player to walk on the water
|
||||
nocheatplus.checks.moving.unpushable:
|
||||
description: Allow a player to be unpushable by the other players
|
||||
nocheatplus.checks.moving.boatonground:
|
||||
description: Allow a player to place a boat on the ground (not only on the water)
|
||||
nocheatplus.checks.moving.respawntrick:
|
||||
|
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
|
||||
<!-- Informations -->
|
||||
<name>NoCheatPlus</name>
|
||||
<version>3.5.7</version>
|
||||
<version>3.5.7_1</version>
|
||||
<description>Detect and fight the exploitation of various flaws/bugs in Minecraft.</description>
|
||||
<url>http://dev.bukkit.org/server-mods/nocheatplus</url>
|
||||
|
||||
|
@ -33,6 +33,7 @@ public class FastBreakCheck extends BlockBreakCheck {
|
||||
|
||||
// Has the player broken the blocks too quickly
|
||||
if (data.lastBreakTime != 0 && elapsedTime < breakTime) {
|
||||
if (!plugin.skipCheck()) {
|
||||
if (data.previousRefused) {
|
||||
// He failed, increase vl and statistics
|
||||
data.fastBreakVL += breakTime - elapsedTime;
|
||||
@ -42,6 +43,7 @@ public class FastBreakCheck extends BlockBreakCheck {
|
||||
cancel = executeActions(player, cc.fastBreakActions, data.fastBreakVL);
|
||||
}
|
||||
data.previousRefused = true;
|
||||
}
|
||||
} else {
|
||||
// Reward with lowering of the violation level
|
||||
data.fastBreakVL *= 0.90D;
|
||||
|
@ -23,6 +23,7 @@ public class FastPlaceCheck extends BlockPlaceCheck {
|
||||
|
||||
// Has the player placed blocks too quickly
|
||||
if (data.lastPlaceTime != 0 && System.currentTimeMillis() - data.lastPlaceTime < cc.fastPlaceInterval) {
|
||||
if (!plugin.skipCheck()) {
|
||||
if (data.previousRefused) {
|
||||
// He failed, increase vl and statistics
|
||||
data.fastPlaceVL += cc.fastPlaceInterval - System.currentTimeMillis() + data.lastPlaceTime;
|
||||
@ -34,6 +35,7 @@ public class FastPlaceCheck extends BlockPlaceCheck {
|
||||
cancel = executeActions(player, cc.fastPlaceActions, data.fastPlaceVL);
|
||||
}
|
||||
data.previousRefused = true;
|
||||
}
|
||||
} else {
|
||||
// Reward with lowering of the violation level
|
||||
data.fastPlaceVL *= 0.90D;
|
||||
|
@ -7,7 +7,6 @@ import java.util.List;
|
||||
import me.neatmonster.nocheatplus.EventManager;
|
||||
import me.neatmonster.nocheatplus.NoCheatPlus;
|
||||
import me.neatmonster.nocheatplus.NoCheatPlusPlayer;
|
||||
import me.neatmonster.nocheatplus.config.ConfPaths;
|
||||
import me.neatmonster.nocheatplus.config.ConfigurationCacheStore;
|
||||
import me.neatmonster.nocheatplus.config.Permissions;
|
||||
|
||||
@ -99,14 +98,29 @@ public class ChatCheckListener implements Listener, EventManager {
|
||||
priority = EventPriority.LOWEST)
|
||||
public void commandPreprocess(final PlayerCommandPreprocessEvent event) {
|
||||
|
||||
final NoCheatPlusPlayer player = plugin.getPlayer(event.getPlayer());
|
||||
final ChatConfig cc = ChatCheck.getConfig(player);
|
||||
|
||||
final String command = event.getMessage().split(" ")[0].substring(1).toLowerCase();
|
||||
|
||||
// Protect the /plugins, /pl, /? commands to prevent players for seeing which plugins are installed
|
||||
if (cc.protectPlugins && (command.equals("plugins") || command.equals("pl") || command.equals("?"))
|
||||
&& !event.getPlayer().hasPermission(Permissions.ADMIN_PLUGINS)) {
|
||||
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.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// If OP by console only is enabled, prevent the op/deop commands
|
||||
// to be used by a player who is OP or has the required permissions
|
||||
if (plugin.getConfig(event.getPlayer()).getConfiguration().getBoolean(ConfPaths.MISCELLANEOUS_OPBYCONSOLEONLY)
|
||||
&& (event.getMessage().startsWith("/op")
|
||||
&& (event.getPlayer().isOp() || event.getPlayer().hasPermission("bukkit.command.op.give")) || event
|
||||
.getMessage().startsWith("/deop")
|
||||
if (cc.opByConsoleOnly
|
||||
&& (command.equals("op")
|
||||
&& (event.getPlayer().isOp() || event.getPlayer().hasPermission("bukkit.command.op.give")) || command
|
||||
.equals("deop")
|
||||
&& (event.getPlayer().isOp() || event.getPlayer().hasPermission("bukkit.command.op.take")))) {
|
||||
event.getPlayer().sendMessage(ChatColor.RED + "This command can be executed from the console!");
|
||||
event.getPlayer().sendMessage(ChatColor.RED + "This command can only be executed from the console!");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -14,7 +14,8 @@ import me.neatmonster.nocheatplus.config.Permissions;
|
||||
*/
|
||||
public class ChatConfig implements ConfigItem {
|
||||
|
||||
public final boolean hideCommands;
|
||||
public final boolean opByConsoleOnly;
|
||||
public final boolean protectPlugins;
|
||||
|
||||
public final boolean noPwnageCheck;
|
||||
public final boolean noPwnageWarnPlayers;
|
||||
@ -72,7 +73,8 @@ public class ChatConfig implements ConfigItem {
|
||||
|
||||
public ChatConfig(final NoCheatPlusConfiguration data) {
|
||||
|
||||
hideCommands = data.getBoolean(ConfPaths.CHAT_HIDECOMMANDS);
|
||||
opByConsoleOnly = data.getBoolean(ConfPaths.MISCELLANEOUS_OPBYCONSOLEONLY);
|
||||
protectPlugins = data.getBoolean(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS);
|
||||
|
||||
noPwnageCheck = data.getBoolean(ConfPaths.CHAT_NOPWNAGE_CHECK);
|
||||
noPwnageWarnPlayers = data.getBoolean(ConfPaths.CHAT_NOPWNAGE_WARNPLAYERS);
|
||||
|
@ -10,10 +10,13 @@ import me.neatmonster.nocheatplus.checks.CheckUtil;
|
||||
import me.neatmonster.nocheatplus.config.ConfigurationCacheStore;
|
||||
import me.neatmonster.nocheatplus.config.Permissions;
|
||||
import me.neatmonster.nocheatplus.data.PreciseLocation;
|
||||
import net.minecraft.server.Entity;
|
||||
import net.minecraft.server.EntityLiving;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -133,6 +136,43 @@ public class MovingCheckListener implements Listener, EventManager {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
private PreciseLocation collide(final PreciseLocation to, final Player collider, final Player collided) {
|
||||
// Calculate some distances
|
||||
double moveX = collider.getLocation().getX() - collided.getLocation().getX();
|
||||
double moveZ = collider.getLocation().getZ() - collided.getLocation().getZ();
|
||||
double move = Math.max(Math.abs(moveX), Math.abs(moveZ));
|
||||
|
||||
// If the two players are close enough
|
||||
if (move >= 0.009999999776482582D) {
|
||||
|
||||
// Calculate the move
|
||||
move = Math.sqrt(move);
|
||||
moveX /= move;
|
||||
moveZ /= move;
|
||||
|
||||
double moveInv = 1D / move;
|
||||
if (moveInv > 1D)
|
||||
moveInv = 1D;
|
||||
|
||||
// More magic numbers...
|
||||
moveX *= moveInv * 0.05000000074505806D;
|
||||
moveZ *= moveInv * 0.05000000074505806D;
|
||||
|
||||
// Teleport the collided player to his new location
|
||||
// if he hasn't the required permission
|
||||
if (!collided.hasPermission(Permissions.MOVING_UNPUSHABLE))
|
||||
collided.teleport(collided.getLocation().add(-moveX, 0, -moveZ));
|
||||
|
||||
// Same for the collider, check his permissions
|
||||
to.x = to.x + moveX;
|
||||
to.z = to.z + moveZ;
|
||||
|
||||
if (!collider.hasPermission(Permissions.MOVING_UNPUSHABLE))
|
||||
return to;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getActiveChecks(final ConfigurationCacheStore cc) {
|
||||
final LinkedList<String> s = new LinkedList<String>();
|
||||
@ -260,6 +300,27 @@ public class MovingCheckListener implements Listener, EventManager {
|
||||
else if (newTo == null)
|
||||
newTo = morePacketsCheck.check(player, data, cc);
|
||||
|
||||
/** UNPUSHABLE CHECK SECTION **/
|
||||
if (newTo == null && cc.unpushableCheck) {
|
||||
final EntityLiving entity = ((CraftPlayer) event.getPlayer()).getHandle();
|
||||
|
||||
// List of the entities the player is colliding with
|
||||
final List<?> collisions = entity.world.getEntities(entity,
|
||||
entity.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
|
||||
|
||||
for (int i = 0; i < collisions.size(); i++) {
|
||||
final Entity collidedEntity = (Entity) collisions.get(i);
|
||||
|
||||
// Check if the entity is a player
|
||||
if (collidedEntity.getBukkitEntity() instanceof Player) {
|
||||
final Player collidedPlayer = (Player) collidedEntity.getBukkitEntity();
|
||||
|
||||
// Collide the two players
|
||||
newTo = collide(data.to, event.getPlayer(), collidedPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Did one of the check(s) decide we need a new "to"-location?
|
||||
if (newTo != null) {
|
||||
// Compose a new location based on coordinates of "newTo" and
|
||||
|
@ -43,6 +43,8 @@ public class MovingConfig implements ConfigItem {
|
||||
public final boolean waterWalkCheck;
|
||||
public final ActionList waterWalkActions;
|
||||
|
||||
public final boolean unpushableCheck;
|
||||
|
||||
public final int flyingHeightLimit;
|
||||
|
||||
public MovingConfig(final NoCheatPlusConfiguration data) {
|
||||
@ -85,5 +87,7 @@ public class MovingConfig implements ConfigItem {
|
||||
|
||||
waterWalkCheck = data.getBoolean(ConfPaths.MOVING_WATERWALK_CHECK);
|
||||
waterWalkActions = data.getActionList(ConfPaths.MOVING_WATERWALK_ACTIONS, Permissions.MOVING_WATERWALK);
|
||||
|
||||
unpushableCheck = data.getBoolean(ConfPaths.MOVING_UNPUSHABLE_CHECK);
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class CommandHandler {
|
||||
final ChatConfig cc = ChatCheck.getConfig(player);
|
||||
|
||||
// Hide NoCheatPlus's commands if the player doesn't have the required permission
|
||||
if (cc.hideCommands && !sender.hasPermission("nocheatplus.admin.commands")) {
|
||||
if (cc.protectPlugins && !sender.hasPermission("nocheatplus.admin.commands")) {
|
||||
sender.sendMessage("Unknown command. Type \"help\" for help.");
|
||||
return true;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ public abstract class ConfPaths {
|
||||
private static final String MISCELLANEOUS = "miscellaneous.";
|
||||
public static final String MISCELLANEOUS_ALLOWCLIENTMODS = MISCELLANEOUS + "allowclientmods";
|
||||
public static final String MISCELLANEOUS_OPBYCONSOLEONLY = MISCELLANEOUS + "opbyconsoleonly";
|
||||
public static final String MISCELLANEOUS_PROTECTPLUGINS = MISCELLANEOUS + "protectplugins";
|
||||
|
||||
private static final String CHECKS = "checks.";
|
||||
|
||||
@ -82,6 +83,9 @@ public abstract class ConfPaths {
|
||||
public static final String MOVING_WATERWALK_CHECK = MOVING_WATERWALK + "active";
|
||||
public static final String MOVING_WATERWALK_ACTIONS = MOVING_WATERWALK + "actions";
|
||||
|
||||
private static final String MOVING_UNPUSHABLE = MOVING + "unpushable.";
|
||||
public static final String MOVING_UNPUSHABLE_CHECK = MOVING_UNPUSHABLE + "active";
|
||||
|
||||
private static final String BLOCKBREAK = CHECKS + "blockbreak.";
|
||||
|
||||
private static final String BLOCKBREAK_FASTBREAK = BLOCKBREAK + "fastbreak.";
|
||||
@ -128,8 +132,6 @@ public abstract class ConfPaths {
|
||||
|
||||
private static final String CHAT = CHECKS + "chat.";
|
||||
|
||||
public static final String CHAT_HIDECOMMANDS = CHAT + "hidecommands";
|
||||
|
||||
private static final String CHAT_NOPWNAGE = CHAT + "nopwnage.";
|
||||
public static final String CHAT_NOPWNAGE_CHECK = CHAT_NOPWNAGE + "active";
|
||||
public static final String CHAT_NOPWNAGE_WARNPLAYERS = CHAT_NOPWNAGE + "warnplayers";
|
||||
|
@ -29,6 +29,7 @@ public class DefaultConfiguration extends NoCheatPlusConfiguration {
|
||||
|
||||
set(ConfPaths.MISCELLANEOUS_ALLOWCLIENTMODS, false);
|
||||
set(ConfPaths.MISCELLANEOUS_OPBYCONSOLEONLY, true);
|
||||
set(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS, true);
|
||||
|
||||
/*** INVENTORY ***/
|
||||
|
||||
@ -73,6 +74,8 @@ public class DefaultConfiguration extends NoCheatPlusConfiguration {
|
||||
set(ConfPaths.MOVING_WATERWALK_ACTIONS,
|
||||
"log:waterwalk:3:5:f cancel vl>100 log:waterwalk:0:5:if cancel vl>400 log:waterwalk:0:5:cif cancel");
|
||||
|
||||
set(ConfPaths.MOVING_UNPUSHABLE_CHECK, true);
|
||||
|
||||
/*** BLOCKBREAK ***/
|
||||
|
||||
set(ConfPaths.BLOCKBREAK_FASTBREAK_CHECK, true);
|
||||
@ -95,7 +98,7 @@ public class DefaultConfiguration extends NoCheatPlusConfiguration {
|
||||
/*** BLOCKPLACE ***/
|
||||
|
||||
set(ConfPaths.BLOCKPLACE_FASTPLACE_CHECK, true);
|
||||
set(ConfPaths.BLOCKPLACE_FASTPLACE_INTERVAL, 145);
|
||||
set(ConfPaths.BLOCKPLACE_FASTPLACE_INTERVAL, 95);
|
||||
set(ConfPaths.BLOCKPLACE_FASTPLACE_ACTIONS,
|
||||
"cancel vl>100 log:bpfastplace:3:5:cif cancel vl>2000 log:bpfastplace:3:5:cif cmd:kick cancel");
|
||||
|
||||
@ -114,8 +117,6 @@ public class DefaultConfiguration extends NoCheatPlusConfiguration {
|
||||
|
||||
/*** CHAT ***/
|
||||
|
||||
set(ConfPaths.CHAT_HIDECOMMANDS, false);
|
||||
|
||||
set(ConfPaths.CHAT_NOPWNAGE_CHECK, true);
|
||||
set(ConfPaths.CHAT_NOPWNAGE_WARNPLAYERS, false);
|
||||
set(ConfPaths.CHAT_NOPWNAGE_WARNOTHERS, false);
|
||||
|
@ -15,6 +15,7 @@ public class Permissions {
|
||||
public static final String ADMIN_CHATLOG = ADMIN + ".chatlog";
|
||||
public static final String ADMIN_COMMANDS = ADMIN + ".commands";
|
||||
public static final String ADMIN_RELOAD = ADMIN + ".reload";
|
||||
public static final String ADMIN_PLUGINS = ADMIN + ".plugins";
|
||||
|
||||
/** CHECKS **/
|
||||
private static final String BLOCKBREAK = CHECKS + ".blockbreak";
|
||||
@ -57,9 +58,10 @@ public class Permissions {
|
||||
public static final String MOVING_NOFALL = MOVING + ".nofall";
|
||||
public static final String MOVING_MOREPACKETS = MOVING + ".morepackets";
|
||||
public static final String MOVING_MOREPACKETSVEHICLE = MOVING + ".morepacketsvehicle";
|
||||
public static final String MOVING_BOATONGROUND = MOVING + ".boatonground";
|
||||
public static final String MOVING_WATERWALK = MOVING + ".waterwalk";
|
||||
public static final String MOVING_UNPUSHABLE = MOVING + ".unpushable";
|
||||
public static final String MOVING_RESPAWNTRICK = MOVING + ".respawntrick";
|
||||
public static final String MOVING_BOATONGROUND = MOVING + ".boatonground";
|
||||
|
||||
/** MODS **/
|
||||
private static final String CJB = MODS + ".cjb";
|
||||
|
Loading…
Reference in New Issue
Block a user