Skip to content

Commit

Permalink
A
Browse files Browse the repository at this point in the history
  • Loading branch information
shulng committed Jul 12, 2024
1 parent ae2c481 commit f5df3a0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/main/java/cc/baka9/catseedlogin/bukkit/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public static class Settings {
public static boolean LimitChineseID;
public static boolean BedrockLoginBypass;
public static boolean LoginwiththesameIP;
public static int IPTimeout;
public static int MaxLengthID;
public static int MinLengthID;
public static boolean BeforeLoginNoDamage;
Expand All @@ -107,6 +108,7 @@ public static void load(){
MinLengthID = config.getInt("MinLengthID", resourceConfig.getInt("MinLengthID"));
BedrockLoginBypass = config.getBoolean("BedrockLoginBypass", resourceConfig.getBoolean("BedrockLoginBypass"));
LoginwiththesameIP = config.getBoolean("LoginwiththesameIP", resourceConfig.getBoolean("LoginwiththesameIP"));
IPTimeout = config.getInt("IPTimeout", resourceConfig.getInt("IPTimeout"));
MaxLengthID = config.getInt("MaxLengthID", resourceConfig.getInt("MaxLengthID"));
BeforeLoginNoDamage = config.getBoolean("BeforeLoginNoDamage", resourceConfig.getBoolean("BeforeLoginNoDamage"));
ReenterInterval = config.getLong("ReenterInterval", resourceConfig.getLong("ReenterInterval"));
Expand Down Expand Up @@ -134,6 +136,7 @@ public static void save(){
config.set("LimitChineseID", LimitChineseID);
config.set("BedrockLoginBypass",BedrockLoginBypass);
config.set("LoginwiththesameIP",LoginwiththesameIP);
config.set("IPTimeout", IPTimeout);
config.set("MinLengthID", MinLengthID);
config.set("MaxLengthID", MaxLengthID);
config.set("BeforeLoginNoDamage", BeforeLoginNoDamage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ public static boolean recordCurrentIP(Player player) {
List<String> storedIPs = getStoredIPs(loginPlayer);
long lastLoginTime = loginPlayer.getLastAction();
long timeDifference = currentTime - lastLoginTime;
long timeoutInMillis = Config.Settings.IPTimeout * 1000; // 转换为毫秒
long timeoutInTicks = (Config.Settings.IPTimeout * 60 * 1000) / 50;

if (!currentIP.equals(storedIPs) || timeDifference > timeoutInMillis) {
if (!currentIP.equals(storedIPs) || timeDifference > timeoutInTicks) {
return false;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ IpCountLimit: 2
LimitChineseID: true
BedrockLoginBypass: true
LoginwiththesameIP: 0
IPTimeout: 2
MinLengthID: 2
MaxLengthID: 15
BeforeLoginNoDamage: true
Expand Down

0 comments on commit f5df3a0

Please sign in to comment.