From 6a461c1f5c4cc59e55eac46367fcae5549b55840 Mon Sep 17 00:00:00 2001 From: t3hk0d3 Date: Fri, 6 Apr 2012 19:56:55 +0400 Subject: [PATCH] Added configurable whitelist kick message option. --- .../java/ru/tehkode/modifyworld/ModifyworldListener.java | 1 - .../java/ru/tehkode/modifyworld/bukkit/Modifyworld.java | 2 -- .../ru/tehkode/modifyworld/handlers/PlayerListener.java | 8 ++++++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/ru/tehkode/modifyworld/ModifyworldListener.java b/src/main/java/ru/tehkode/modifyworld/ModifyworldListener.java index 92d07f7..20d4bc2 100644 --- a/src/main/java/ru/tehkode/modifyworld/ModifyworldListener.java +++ b/src/main/java/ru/tehkode/modifyworld/ModifyworldListener.java @@ -27,7 +27,6 @@ import org.bukkit.event.Listener; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; -import org.bukkit.util.config.ConfigurationNode; import ru.tehkode.permissions.PermissionManager; import ru.tehkode.permissions.bukkit.PermissionsEx; diff --git a/src/main/java/ru/tehkode/modifyworld/bukkit/Modifyworld.java b/src/main/java/ru/tehkode/modifyworld/bukkit/Modifyworld.java index 004a726..131c44b 100644 --- a/src/main/java/ru/tehkode/modifyworld/bukkit/Modifyworld.java +++ b/src/main/java/ru/tehkode/modifyworld/bukkit/Modifyworld.java @@ -18,8 +18,6 @@ */ package ru.tehkode.modifyworld.bukkit; -import java.io.File; -import java.io.IOException; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/ru/tehkode/modifyworld/handlers/PlayerListener.java b/src/main/java/ru/tehkode/modifyworld/handlers/PlayerListener.java index 11bf8ce..9457eb8 100644 --- a/src/main/java/ru/tehkode/modifyworld/handlers/PlayerListener.java +++ b/src/main/java/ru/tehkode/modifyworld/handlers/PlayerListener.java @@ -80,9 +80,13 @@ public class PlayerListener extends ModifyworldListener { } PermissionUser user = this.permissionsManager.getUser(event.getName()); + + String worldName = Bukkit.getServer().getWorlds().get(0).getName(); - if (user != null && !user.has("modifyworld.login", Bukkit.getServer().getWorlds().get(0).getName())) { - event.disallow(PlayerPreLoginEvent.Result.KICK_WHITELIST, whitelistKickMessage); + if (user != null && !user.has("modifyworld.login", worldName)) { + String whiteListMessage = user.getOption("kick-message", worldName, this.whitelistKickMessage); + + event.disallow(PlayerPreLoginEvent.Result.KICK_WHITELIST, whiteListMessage); Logger.getLogger("Minecraft").info("Player \"" + user.getName() + "\" were kicked by Modifyworld - lack of modifyworld.login permission"); } }