mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-02 08:40:01 +01:00
Attempt to merge.
This commit is contained in:
parent
2906a33bec
commit
4bb760e46b
@ -50,7 +50,6 @@ public enum CheckType {
|
|||||||
BLOCKPLACE_SPEED(BLOCKPLACE, "speed", Permissions.BLOCKPLACE_SPEED),
|
BLOCKPLACE_SPEED(BLOCKPLACE, "speed", Permissions.BLOCKPLACE_SPEED),
|
||||||
|
|
||||||
CHAT(ChatConfig.class, ChatData.class),
|
CHAT(ChatConfig.class, ChatData.class),
|
||||||
CHAT_ARRIVALS(CHAT, "arrivals", Permissions.CHAT_ARRIVALS),
|
|
||||||
CHAT_COLOR(CHAT, "color", Permissions.CHAT_COLOR),
|
CHAT_COLOR(CHAT, "color", Permissions.CHAT_COLOR),
|
||||||
CHAT_NOPWNAGE(CHAT, "noPwnage", Permissions.CHAT_NOPWNAGE),
|
CHAT_NOPWNAGE(CHAT, "noPwnage", Permissions.CHAT_NOPWNAGE),
|
||||||
|
|
||||||
|
@ -23,15 +23,12 @@ import fr.neatmonster.nocheatplus.players.Permissions;
|
|||||||
* MMMMMMMMMMM MMMMMMMMMMM
|
* MMMMMMMMMMM MMMMMMMMMMM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// TODO: SYNC
|
// TODO: SYNC
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Central location to listen to events that are relevant for the chat checks.
|
* Central location to listen to events that are relevant for the chat checks.
|
||||||
*/
|
*/
|
||||||
public class ChatListener implements Listener {
|
public class ChatListener implements Listener {
|
||||||
private final Arrivals arrivals = new Arrivals();
|
|
||||||
private final Color color = new Color();
|
private final Color color = new Color();
|
||||||
private final NoPwnage noPwnage = new NoPwnage();
|
private final NoPwnage noPwnage = new NoPwnage();
|
||||||
|
|
||||||
@ -100,6 +97,14 @@ public class ChatListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prevent /op and /deop commands from being used in chat.
|
||||||
|
if (ChatConfig.getConfig(player).opInConsoleOnly && (command.equals("op") || command.equals("deop"))) {
|
||||||
|
event.getPlayer().sendMessage(
|
||||||
|
ChatColor.RED + "I'm sorry, but this command can't be executed in chat. Use the console instead!");
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// First the color check.
|
// First the color check.
|
||||||
if (color.isEnabled(player))
|
if (color.isEnabled(player))
|
||||||
event.setMessage(color.check(player, event.getMessage()));
|
event.setMessage(color.check(player, event.getMessage()));
|
||||||
@ -129,11 +134,6 @@ public class ChatListener implements Listener {
|
|||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final ChatConfig cc = ChatConfig.getConfig(player); // Non critical use (concurrency).
|
final ChatConfig cc = ChatConfig.getConfig(player); // Non critical use (concurrency).
|
||||||
|
|
||||||
// First the arrivals check, if enabled of course.
|
|
||||||
if (arrivals.isEnabled(player) && arrivals.check(player))
|
|
||||||
// The player failed the check, disallow the login.
|
|
||||||
event.disallow(Result.KICK_OTHER, cc.arrivalsMessage);
|
|
||||||
|
|
||||||
// Then the no pwnage check, if the login isn't already disallowed.
|
// Then the no pwnage check, if the login isn't already disallowed.
|
||||||
if (event.getResult() != Result.KICK_OTHER && noPwnage.check(player))
|
if (event.getResult() != Result.KICK_OTHER && noPwnage.check(player))
|
||||||
event.disallow(Result.KICK_OTHER, cc.noPwnageReloginKickMessage);
|
event.disallow(Result.KICK_OTHER, cc.noPwnageReloginKickMessage);
|
||||||
|
@ -39,6 +39,7 @@ public abstract class ConfPaths {
|
|||||||
*/
|
*/
|
||||||
private static final String MISCELLANEOUS = "miscellaneous.";
|
private static final String MISCELLANEOUS = "miscellaneous.";
|
||||||
public static final String MISCELLANEOUS_ALLOWCLIENTMODS = MISCELLANEOUS + "allowclientmods";
|
public static final String MISCELLANEOUS_ALLOWCLIENTMODS = MISCELLANEOUS + "allowclientmods";
|
||||||
|
public static final String MISCELLANEOUS_OPINCONSOLEONLY = MISCELLANEOUS + "opinconsoleonly";
|
||||||
public static final String MISCELLANEOUS_PROTECTPLUGINS = MISCELLANEOUS + "protectplugins";
|
public static final String MISCELLANEOUS_PROTECTPLUGINS = MISCELLANEOUS + "protectplugins";
|
||||||
|
|
||||||
private static final String CHECKS = "checks.";
|
private static final String CHECKS = "checks.";
|
||||||
@ -129,13 +130,6 @@ public abstract class ConfPaths {
|
|||||||
*/
|
*/
|
||||||
private static final String CHAT = CHECKS + "chat.";
|
private static final String CHAT = CHECKS + "chat.";
|
||||||
|
|
||||||
private static final String CHAT_ARRIVALS = CHAT + "arrivals.";
|
|
||||||
public static final String CHAT_ARRIVALS_CHECK = CHAT_ARRIVALS + "active";
|
|
||||||
public static final String CHAT_ARRIVALS_JOINSLIMIT = CHAT_ARRIVALS + "joinslimit";
|
|
||||||
public static final String CHAT_ARRIVALS_MESSAGE = CHAT_ARRIVALS + "message";
|
|
||||||
public static final String CHAT_ARRIVALS_TIMELIMIT = CHAT_ARRIVALS + "timelimit";
|
|
||||||
public static final String CHAT_ARRIVALS_ACTIONS = CHAT_ARRIVALS + "actions";
|
|
||||||
|
|
||||||
private static final String CHAT_COLOR = CHAT + "color.";
|
private static final String CHAT_COLOR = CHAT + "color.";
|
||||||
public static final String CHAT_COLOR_CHECK = CHAT_COLOR + "active";
|
public static final String CHAT_COLOR_CHECK = CHAT_COLOR + "active";
|
||||||
public static final String CHAT_COLOR_ACTIONS = CHAT_COLOR + "actions";
|
public static final String CHAT_COLOR_ACTIONS = CHAT_COLOR + "actions";
|
||||||
|
@ -47,6 +47,7 @@ public class DefaultConfig extends ConfigFile {
|
|||||||
* d888b Y8b Y8b 888 d,dP "88,e8' "YeeP" 888 888 "88 888 888 888 "YeeP" "88 88" "88 88" d,dP
|
* d888b Y8b Y8b 888 d,dP "88,e8' "YeeP" 888 888 "88 888 888 888 "YeeP" "88 88" "88 88" d,dP
|
||||||
*/
|
*/
|
||||||
set(ConfPaths.MISCELLANEOUS_ALLOWCLIENTMODS, false);
|
set(ConfPaths.MISCELLANEOUS_ALLOWCLIENTMODS, false);
|
||||||
|
set(ConfPaths.MISCELLANEOUS_OPINCONSOLEONLY, false);
|
||||||
set(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS, true);
|
set(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS, true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -117,12 +118,6 @@ public class DefaultConfig extends ConfigFile {
|
|||||||
* Y888 ,d 888 888 ,ee 888 888
|
* Y888 ,d 888 888 ,ee 888 888
|
||||||
* "88,d88 888 888 "88 888 888
|
* "88,d88 888 888 "88 888 888
|
||||||
*/
|
*/
|
||||||
set(ConfPaths.CHAT_ARRIVALS_CHECK, false);
|
|
||||||
set(ConfPaths.CHAT_ARRIVALS_JOINSLIMIT, 3);
|
|
||||||
set(ConfPaths.CHAT_ARRIVALS_MESSAGE, "Please try again later!");
|
|
||||||
set(ConfPaths.CHAT_ARRIVALS_TIMELIMIT, 5000L);
|
|
||||||
set(ConfPaths.CHAT_ARRIVALS_ACTIONS, "cancel");
|
|
||||||
|
|
||||||
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");
|
||||||
|
|
||||||
@ -162,7 +157,7 @@ public class DefaultConfig extends ConfigFile {
|
|||||||
set(ConfPaths.CHAT_NOPWNAGE_RELOGIN_WARNING_MESSAGE,
|
set(ConfPaths.CHAT_NOPWNAGE_RELOGIN_WARNING_MESSAGE,
|
||||||
"&cYou relogged really fast! If you keep doing that, you're going to be banned.");
|
"&cYou relogged really fast! If you keep doing that, you're going to be banned.");
|
||||||
set(ConfPaths.CHAT_NOPWNAGE_RELOGIN_WARNING_NUMBER, 1);
|
set(ConfPaths.CHAT_NOPWNAGE_RELOGIN_WARNING_NUMBER, 1);
|
||||||
set(ConfPaths.CHAT_NOPWNAGE_RELOGIN_KICKMESSAGE, "Please try again later!");
|
set(ConfPaths.CHAT_NOPWNAGE_RELOGIN_KICKMESSAGE, "You've relogged too fast, joining cancelled!");
|
||||||
set(ConfPaths.CHAT_NOPWNAGE_RELOGIN_WARNING_TIMEOUT, 60000L);
|
set(ConfPaths.CHAT_NOPWNAGE_RELOGIN_WARNING_TIMEOUT, 60000L);
|
||||||
|
|
||||||
set(ConfPaths.CHAT_NOPWNAGE_REPEAT_CHECK, true);
|
set(ConfPaths.CHAT_NOPWNAGE_REPEAT_CHECK, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user