mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-28 13:15:30 +01:00
Fix id-by-ip settings - not migrated to servlet code initialization
This commit is contained in:
parent
8d1def2ea0
commit
ecf3a64b74
@ -7,17 +7,20 @@ import static org.dynmap.JSONUtils.*;
|
||||
|
||||
public class InternalClientUpdateComponent extends ClientUpdateComponent {
|
||||
|
||||
public InternalClientUpdateComponent(final DynmapCore plugin, final ConfigurationNode configuration) {
|
||||
super(plugin, configuration);
|
||||
plugin.addServlet("/up/world/*", new ClientUpdateServlet(plugin));
|
||||
public InternalClientUpdateComponent(final DynmapCore dcore, final ConfigurationNode configuration) {
|
||||
super(dcore, configuration);
|
||||
dcore.addServlet("/up/world/*", new ClientUpdateServlet(dcore));
|
||||
|
||||
final Boolean allowwebchat = configuration.getBoolean("allowwebchat", false);
|
||||
final Boolean hidewebchatip = configuration.getBoolean("hidewebchatip", false);
|
||||
final Boolean trust_client_name = configuration.getBoolean("trustclientname", false);
|
||||
final float webchatInterval = configuration.getFloat("webchat-interval", 1);
|
||||
final String spammessage = plugin.configuration.getString("spammessage", "You may only chat once every %interval% seconds.");
|
||||
final String spammessage = dcore.configuration.getString("spammessage", "You may only chat once every %interval% seconds.");
|
||||
final Boolean use_player_ip = configuration.getBoolean("use-player-login-ip", true);
|
||||
final Boolean req_player_ip = configuration.getBoolean("require-player-login-ip", false);
|
||||
final Boolean block_banned_player_chat = configuration.getBoolean("block-banned-player-chat", false);
|
||||
|
||||
plugin.events.addListener("buildclientconfiguration", new Event.Listener<JSONObject>() {
|
||||
dcore.events.addListener("buildclientconfiguration", new Event.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void triggered(JSONObject t) {
|
||||
s(t, "allowwebchat", allowwebchat);
|
||||
@ -31,6 +34,11 @@ public class InternalClientUpdateComponent extends ClientUpdateComponent {
|
||||
spamMessage = "\""+spammessage+"\"";
|
||||
hideip = hidewebchatip;
|
||||
this.trustclientname = trust_client_name;
|
||||
this.use_player_login_ip = use_player_ip;
|
||||
this.require_player_login_ip = req_player_ip;
|
||||
this.check_user_ban = block_banned_player_chat;
|
||||
this.core = dcore;
|
||||
|
||||
onMessageReceived.addListener(new Event.Listener<Message> () {
|
||||
@Override
|
||||
public void triggered(Message t) {
|
||||
@ -38,7 +46,7 @@ public class InternalClientUpdateComponent extends ClientUpdateComponent {
|
||||
}
|
||||
});
|
||||
}};
|
||||
plugin.addServlet("/up/sendmessage", messageHandler);
|
||||
dcore.addServlet("/up/sendmessage", messageHandler);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class SendMessageServlet extends HttpServlet {
|
||||
public boolean use_player_login_ip = false;
|
||||
public boolean require_player_login_ip = false;
|
||||
public boolean check_user_ban = false;
|
||||
public DynmapCore plug_in;
|
||||
public DynmapCore core;
|
||||
|
||||
|
||||
@Override
|
||||
@ -72,11 +72,11 @@ public class SendMessageServlet extends HttpServlet {
|
||||
message.name = request.getRemoteAddr();
|
||||
}
|
||||
if (use_player_login_ip) {
|
||||
List<String> ids = plug_in.getIDsForIP(message.name);
|
||||
List<String> ids = core.getIDsForIP(message.name);
|
||||
if (ids != null) {
|
||||
String id = ids.get(0);
|
||||
if (check_user_ban) {
|
||||
if (plug_in.getServer().isPlayerBanned(id)) {
|
||||
if (core.getServer().isPlayerBanned(id)) {
|
||||
Log.info("Ignore message from '" + message.name + "' - banned player (" + id + ")");
|
||||
response.sendError(HttpStatus.Forbidden.getCode());
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user