- Updated permissions descriptions to simpler format

- more info from "onliquid" check
- fixed bug in "chat.spam" check
This commit is contained in:
Evenprime 2011-09-22 19:44:08 +02:00
parent d435f7ab3c
commit 4569546b3a
7 changed files with 100 additions and 139 deletions

View File

@ -3,107 +3,58 @@ name: NoCheat
author: Evenprime
main: cc.co.evenprime.bukkit.nocheat.NoCheat
version: 2.06b
version: 2.07
permissions:
nocheat.*:
nocheat:
description: Allow a player to bypass all checks and give him all admin permissions
children:
nocheat.checks.*: true
nocheat.admin.*: true
nocheat.checks.*:
description: Allow the player to bypass all checks
children:
nocheat.checks.moving.*: true
nocheat.checks.blockbreak.*: true
nocheat.checks.blockplace.*: true
nocheat.checks.interact.*: true
nocheat.checks.chat.*: true
nocheat.checks.moving.*:
description: Allow the player to bypass all moving checks
children:
nocheat.checks.moving.runfly: true
nocheat.checks.moving.flying: true
nocheat.checks.moving.swimming: true
nocheat.checks.moving.sneaking: true
nocheat.checks.moving.noclip: true
nocheat.checks.moving.nofall: true
nocheat.checks.moving.morepackets: true
nocheat.checks.blockbreak.*:
description: Allow the player to bypass all blockbreak checks
children:
nocheat.checks.blockbreak.reach: true
nocheat.checks.blockbreak.direction: true
nocheat.checks.blockplace.*:
description: Allow the player to bypass all blockplace checks
children:
nocheat.checks.blockplace.reach: true
nocheat.checks.blockplace.onliquid: true
nocheat.checks.interact.*:
description: Allow the player to bypass all interact checks
children:
nocheat.checks.interact.durability: true
nocheat.checks.chat.*:
description: Allow the player to bypass all chat checks
children:
nocheat.checks.chat.spam: true
nocheat.checks.moving.runfly:
description: Allow a player to move as free and as fast as he wants (ignores flying, swimming and sneaking settings)
default: op
nocheat.checks.moving.flying:
description: Allow a player to fly, but only within given speed limits (ignores swimming and sneaking settings)
default: op
nocheat.checks.moving.swimming:
description: Allow a player to move through water without slowdown
default: op
nocheat.checks.moving.sneaking:
description: Allow a player to sneak without slowdown
default: op
nocheat.checks.moving.noclip:
description: Allow a player to walk through walls
default: op
nocheat.checks.moving.nofall:
description: Allow a player to cheat and not take fall damage at all
default: op
nocheat.checks.moving.morepackets:
description: Allow a player to send more move-event-packets than normal, causing him to move faster than normal
default: op
nocheat.checks.blockbreak.reach:
description: Allow a player to break blocks at maximum range (about 6-7 blocks)
default: op
nocheat.checks.blockbreak.direction:
description: Allow a player to break blocks that are not in front of them
default: op
nocheat.checks.blockplace.reach:
description: Allow a player to place blocks at maximum range (about 6-7 blocks)
default: op
nocheat.checks.blockplace.onliquid:
description: Allow a player to place non-liquid blocks on liquids
default: op
nocheat.checks.interact.durability:
description: Allow a player to use an infinite durability item hack
default: op
nocheat.checks.chat.spam:
description: Allow a player to send an infinite amount of chat messages
default: op
nocheat.admin.*:
description: Give a player all admin rights
children:
nocheat.admin.chatlog: true
nocheat.admin.chatlog:
description: Show log messages in the players chat
default: op
nocheat.admin:
description: Give a player all admin rights
children:
nocheat.admin.chatlog:
description: Show log messages in the players chat
nocheat.checks:
description: Allow the player to bypass all checks
children:
nocheat.checks.moving:
description: Allow the player to bypass all moving checks
children:
nocheat.checks.moving.runfly:
description: Allow a player to move as free and as fast as he wants (ignores flying, swimming and sneaking settings)
nocheat.checks.moving.flying:
description: Allow a player to fly, but only within given speed limits (ignores swimming and sneaking settings)
nocheat.checks.moving.swimming:
description: Allow a player to move through water without slowdown
nocheat.checks.moving.sneaking:
description: Allow a player to sneak without slowdown
nocheat.checks.moving.noclip:
description: Allow a player to walk through walls
nocheat.checks.moving.nofall:
description: Allow a player to cheat and not take fall damage at all
nocheat.checks.moving.morepackets:
description: Allow a player to send more move-event-packets than normal, causing him to move faster than normal
nocheat.checks.blockbreak:
description: Allow the player to bypass all blockbreak checks
children:
nocheat.checks.blockbreak.reach:
description: Allow a player to break blocks at maximum range (about 6-7 blocks, in creative mode unlimited)
nocheat.checks.blockbreak.direction:
description: Allow a player to break blocks that are not in front of them
nocheat.checks.blockplace:
description: Allow the player to bypass all blockplace checks
children:
nocheat.checks.blockplace.reach:
description: Allow a player to place blocks at maximum range (about 6-7 blocks)
nocheat.checks.blockplace.onliquid:
description: Allow a player to place non-liquid blocks on liquids
nocheat.checks.interact:
description: Allow the player to bypass all interact checks
children:
nocheat.checks.interact.durability:
description: Allow a player to use an infinite durability item hack
nocheat.checks.chat:
description: Allow the player to bypass all chat checks
children:
nocheat.checks.chat.spam:
description: Allow a player to send an infinite amount of chat messages

View File

@ -330,7 +330,7 @@ public class DefaultConfiguration {
w(w, "log reachLog 0 1 med NC: [player] failed [check]: tried to interact with a block over distance [distance].");
w(w, "log directionLog 2 1 med NC: [player] failed [check]: tried to destroy a block out of line of sight.");
w(w, "log durabilityLog 0 1 med NC: [player] failed [check]: tried to use infinity durability hack.");
w(w, "log onliquidLog 2 1 med NC: [player] failed [check]: tried to place a block on liquids.");
w(w, "log onliquidLog 2 1 med NC: [player] failed [check]: tried to place a [blocktype] block at [placelocation] against block at [placeagainst].");
w(w, "log spamLog 0 4 med NC: [player] failed [check]: Last sent message \"[text]\".");
w(w, "log nofallLog 0 1 med NC: [player] failed [check]: tried to avoid fall damage for ~[distance] blocks.");
w(w, "");

View File

@ -72,7 +72,7 @@ public class NoCheat extends JavaPlugin {
this.log = new LogManager(this);
log.logToConsole(LogLevel.MED, "[NoCheat] This version is EXPERIMENTAL and built specifically for CB #1150. It may break at any time and for any other version.");
log.logToConsole(LogLevel.LOW, "[NoCheat] This version is for CB #1185. It may break at any time and for any other version.");
this.data = new DataManager();

View File

@ -8,39 +8,34 @@ package cc.co.evenprime.bukkit.nocheat;
*/
public class Permissions {
private final static String _NOCHEAT = "nocheat";
private final static String _ADMIN = _NOCHEAT + ".admin";
private final static String _CHECKS = _NOCHEAT + ".checks";
private final static String _MOVE = _CHECKS + ".moving";
private final static String _BLOCKBREAK = _CHECKS + ".blockbreak";
private final static String _BLOCKPLACE = _CHECKS + ".blockplace";
private final static String _INTERACT = _CHECKS + ".interact";
private final static String _CHAT = _CHECKS + ".chat";
private final static String NOCHEAT = "nocheat";
private final static String ADMIN = NOCHEAT + ".admin";
private final static String CHECKS = NOCHEAT + ".checks";
public final static String MOVE = _CHECKS + ".moving.*";
public final static String MOVE_RUNFLY = _MOVE + ".runfly";
public final static String MOVE_SNEAK = _MOVE + ".sneaking";
public final static String MOVE_SWIM = _MOVE + ".swimming";
public final static String MOVE_FLY = _MOVE + ".flying";
public final static String MOVE_NOCLIP = _MOVE + ".noclip";
public final static String MOVE_NOFALL = _MOVE + ".nofall";
public final static String MOVE_MOREPACKETS = _MOVE + ".morepackets";
public final static String MOVE = CHECKS + ".moving";
public final static String MOVE_RUNFLY = MOVE + ".runfly";
public final static String MOVE_SNEAK = MOVE + ".sneaking";
public final static String MOVE_SWIM = MOVE + ".swimming";
public final static String MOVE_FLY = MOVE + ".flying";
public final static String MOVE_NOCLIP = MOVE + ".noclip";
public final static String MOVE_NOFALL = MOVE + ".nofall";
public final static String MOVE_MOREPACKETS = MOVE + ".morepackets";
public final static String BLOCKBREAK = _CHECKS + ".blockbreak.*";
public final static String BLOCKBREAK_REACH = _BLOCKBREAK + ".reach";
public final static String BLOCKBREAK_DIRECTION = _BLOCKBREAK + ".direction";
public final static String BLOCKBREAK = CHECKS + ".blockbreak";
public final static String BLOCKBREAK_REACH = BLOCKBREAK + ".reach";
public final static String BLOCKBREAK_DIRECTION = BLOCKBREAK + ".direction";
public final static String INTERACT = _CHECKS + ".interact.*";
public final static String INTERACT_DURABILITY = _INTERACT + ".durability";
public final static String INTERACT = CHECKS + ".interact";
public final static String INTERACT_DURABILITY = INTERACT + ".durability";
public final static String BLOCKPLACE = _CHECKS + ".blockplace.*";
public final static String BLOCKPLACE_ONLIQUID = _BLOCKPLACE + ".onliquid";
public final static String BLOCKPLACE_REACH = _BLOCKPLACE + ".reach";
public final static String BLOCKPLACE = CHECKS + ".blockplace";
public final static String BLOCKPLACE_ONLIQUID = BLOCKPLACE + ".onliquid";
public final static String BLOCKPLACE_REACH = BLOCKPLACE + ".reach";
public final static String CHAT = _CHECKS + ".chat.*";
public final static String CHAT_SPAM = _CHAT + ".spam";
public final static String CHAT = CHECKS + ".chat";
public final static String CHAT_SPAM = CHAT + ".spam";
public final static String ADMIN_CHATLOG = _ADMIN + ".chatlog";
public final static String ADMIN_CHATLOG = ADMIN + ".chatlog";
private Permissions() {}
}

View File

@ -14,17 +14,21 @@ import cc.co.evenprime.bukkit.nocheat.log.LogLevel;
public class LogAction extends Action {
// Default stuff
public static final String PLAYER = "\\[player\\]";
public static final String LOCATION = "\\[location\\]";
public static final String WORLD = "\\[world\\]";
public static final String VIOLATIONS = "\\[violations\\]";
public static final String PLAYER = "\\[player\\]";
public static final String LOCATION = "\\[location\\]";
public static final String WORLD = "\\[world\\]";
public static final String VIOLATIONS = "\\[violations\\]";
// Event dependent stuff
public static final String DISTANCE = "\\[distance\\]";
public static final String LOCATION_TO = "\\[locationto\\]";
public static final String CHECK = "\\[check\\]";
public static final String PACKETS = "\\[packets\\]";
public static final String TEXT = "\\[text\\]";
public static final String DISTANCE = "\\[distance\\]";
public static final String LOCATION_TO = "\\[locationto\\]";
public static final String CHECK = "\\[check\\]";
public static final String PACKETS = "\\[packets\\]";
public static final String TEXT = "\\[text\\]";
public static final String PLACE_LOCATION = "\\[placelocation\\]";
public static final String PLACE_AGAINST = "\\[placeagainst\\]";
public static final String BLOCK_TYPE = "\\[blocktype\\]";
public final LogLevel level;
private final String message;

View File

@ -1,6 +1,7 @@
package cc.co.evenprime.bukkit.nocheat.checks.blockplace;
import java.util.HashMap;
import java.util.Locale;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -41,6 +42,14 @@ public class OnLiquidCheck {
data.onliquidViolationLevel += 1;
HashMap<String, String> params = new HashMap<String, String>();
params.put(LogAction.CHECK, "blockplace.onliquid");
params.put(LogAction.BLOCK_TYPE, blockPlaced.getType().toString());
params.put(LogAction.PLACE_LOCATION, String.format(Locale.US, "%d %d %d", blockPlaced.getX(), blockPlaced.getY(), blockPlaced.getZ()));
if(blockPlacedAgainst != null) {
params.put(LogAction.PLACE_AGAINST, String.format(Locale.US, "%d %d %d", blockPlacedAgainst.getX(), blockPlacedAgainst.getY(), blockPlacedAgainst.getZ()));
}
else {
params.put(LogAction.PLACE_AGAINST, "null");
}
cancel = action.executeActions(player, cc.blockplace.onliquidActions, (int) data.onliquidViolationLevel, params, cc);
}

View File

@ -1,6 +1,7 @@
package cc.co.evenprime.bukkit.nocheat.checks.chat;
import java.util.HashMap;
import java.util.regex.Matcher;
import org.bukkit.entity.Player;
@ -51,7 +52,8 @@ public class ChatCheck {
// actions
HashMap<String, String> params = new HashMap<String, String>();
params.put(LogAction.CHECK, "chat.spam");
params.put(LogAction.TEXT, message);
// Escape the message, to avoid errors
params.put(LogAction.TEXT, Matcher.quoteReplacement(message));
cancel = action.executeActions(player, cc.chat.spamActions, data.messageCount - cc.chat.spamLimit, params, cc);
}
}