Skip to content

Commit

Permalink
Make the denylogin message configurable (strings section).
Browse files Browse the repository at this point in the history
  • Loading branch information
asofold committed May 7, 2016
1 parent beac108 commit 2281ba9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Expand Up @@ -545,6 +545,7 @@ public DefaultConfig() {
set(ConfPaths.STRINGS + ".kickwb", "ncp kick [player] Block breaking out of sync!");
set(ConfPaths.STRINGS + ".knockback", start + "tried to do a knockback but wasn't technically sprinting" + end);
set(ConfPaths.STRINGS + ".morepackets", start + "sent too many moves ([packets] [tags])" + end);
set(ConfPaths.STRINGS + ".msgtempdenylogin", "You are temporarily denied to join this server.");
set(ConfPaths.STRINGS + ".munchhausen", start + "almost made it off the pit" + end);
set(ConfPaths.STRINGS + ".nofall", start + "tried to avoid fall damage" + end);
set(ConfPaths.STRINGS + ".chatfast", start + "acted like spamming (IP: [ip])" + end);
Expand Down
Expand Up @@ -1212,16 +1212,21 @@ private Listener getCoreListener() {
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerLogin(final PlayerLoginEvent event) {
// (NORMAL to have chat checks come after this.)
if (event.getResult() != Result.ALLOWED) return;
if (event.getResult() != Result.ALLOWED) {
return;
}
final Player player = event.getPlayer();
// Check if login is denied:
checkDenyLoginsNames();
if (player.hasPermission(Permissions.BYPASS_DENY_LOGIN)) return;
if (player.hasPermission(Permissions.BYPASS_DENY_LOGIN)) {
return;
}
if (isLoginDenied(player.getName())) {
// TODO: display time for which the player is banned.
// TODO: Consider using the vanilla temporary ban feature instead (for an alternative?).
// TODO: Display time for which the player is banned.
event.setResult(Result.KICK_OTHER);
// TODO: Make message configurable.
event.setKickMessage("You are temporarily denied to join this server.");
// TODO: Some basic/language configuration object, possibly independent of checks.
event.setKickMessage(ColorUtil.replaceColors(ConfigManager.getConfigFile(player.getWorld().getName()).getString(ConfPaths.STRINGS + ".msgtempdenylogin")));
}
}

Expand Down

0 comments on commit 2281ba9

Please sign in to comment.