2022-10-29 20:02:09 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013-present RedisBungee contributors
|
|
|
|
*
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
*
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
*/
|
|
|
|
|
2022-07-22 08:29:39 +00:00
|
|
|
package com.imaginarycode.minecraft.redisbungee.api.config;
|
2022-04-13 13:14:08 +00:00
|
|
|
|
|
|
|
import com.google.common.collect.ImmutableList;
|
|
|
|
import com.google.common.net.InetAddresses;
|
|
|
|
|
2024-04-18 08:48:00 +00:00
|
|
|
import javax.annotation.Nullable;
|
2022-04-13 13:14:08 +00:00
|
|
|
import java.net.InetAddress;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
public class RedisBungeeConfiguration {
|
2022-11-11 16:30:16 +00:00
|
|
|
|
2022-07-17 11:38:00 +00:00
|
|
|
private final String proxyId;
|
2022-04-13 13:14:08 +00:00
|
|
|
private final List<InetAddress> exemptAddresses;
|
2023-08-31 10:26:21 +00:00
|
|
|
private final boolean kickWhenOnline;
|
2022-04-13 13:14:08 +00:00
|
|
|
|
2023-08-31 10:26:21 +00:00
|
|
|
private final boolean handleReconnectToLastServer;
|
|
|
|
private final boolean handleMotd;
|
2022-11-27 08:29:13 +00:00
|
|
|
|
2024-04-18 08:48:00 +00:00
|
|
|
private final CommandsConfiguration commandsConfiguration;
|
2023-08-31 10:26:21 +00:00
|
|
|
|
2024-04-18 08:48:00 +00:00
|
|
|
|
|
|
|
public RedisBungeeConfiguration(String proxyId, List<String> exemptAddresses, boolean kickWhenOnline, boolean handleReconnectToLastServer, boolean handleMotd, CommandsConfiguration commandsConfiguration) {
|
2022-07-17 11:38:00 +00:00
|
|
|
this.proxyId = proxyId;
|
2022-04-13 13:14:08 +00:00
|
|
|
ImmutableList.Builder<InetAddress> addressBuilder = ImmutableList.builder();
|
|
|
|
for (String s : exemptAddresses) {
|
|
|
|
addressBuilder.add(InetAddresses.forString(s));
|
|
|
|
}
|
|
|
|
this.exemptAddresses = addressBuilder.build();
|
2023-08-31 10:26:21 +00:00
|
|
|
this.kickWhenOnline = kickWhenOnline;
|
|
|
|
this.handleReconnectToLastServer = handleReconnectToLastServer;
|
|
|
|
this.handleMotd = handleMotd;
|
2024-04-18 08:48:00 +00:00
|
|
|
this.commandsConfiguration = commandsConfiguration;
|
2022-04-13 13:14:08 +00:00
|
|
|
}
|
2024-04-12 18:37:02 +00:00
|
|
|
|
2022-07-17 11:38:00 +00:00
|
|
|
public String getProxyId() {
|
|
|
|
return proxyId;
|
2022-04-13 13:14:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public List<InetAddress> getExemptAddresses() {
|
|
|
|
return exemptAddresses;
|
|
|
|
}
|
|
|
|
|
2023-08-31 10:26:21 +00:00
|
|
|
public boolean kickWhenOnline() {
|
|
|
|
return kickWhenOnline;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean handleMotd() {
|
|
|
|
return this.handleMotd;
|
2022-11-27 08:29:13 +00:00
|
|
|
}
|
2023-08-31 10:26:21 +00:00
|
|
|
|
|
|
|
public boolean handleReconnectToLastServer() {
|
|
|
|
return this.handleReconnectToLastServer;
|
|
|
|
}
|
|
|
|
|
2024-04-18 08:48:00 +00:00
|
|
|
public record CommandsConfiguration(boolean redisbungeeEnabled, boolean redisbungeeLegacyEnabled,
|
|
|
|
@Nullable LegacySubCommandsConfiguration legacySubCommandsConfiguration) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public record LegacySubCommandsConfiguration(boolean findEnabled, boolean glistEnabled, boolean ipEnabled,
|
|
|
|
boolean lastseenEnabled, boolean plistEnabled, boolean pproxyEnabled,
|
|
|
|
boolean sendtoallEnabled, boolean serveridEnabled,
|
|
|
|
boolean serveridsEnabled, boolean installFind, boolean installGlist, boolean installIp,
|
|
|
|
boolean installLastseen, boolean installPlist, boolean installPproxy,
|
|
|
|
boolean installSendtoall, boolean installServerid,
|
|
|
|
boolean installServerids) {
|
|
|
|
}
|
2023-08-31 10:26:21 +00:00
|
|
|
|
2024-04-18 08:48:00 +00:00
|
|
|
public CommandsConfiguration commandsConfiguration() {
|
|
|
|
return commandsConfiguration;
|
|
|
|
}
|
2022-04-13 13:14:08 +00:00
|
|
|
}
|