diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
index ba6fc7e..895f78f 100644
--- a/dependency-reduced-pom.xml
+++ b/dependency-reduced-pom.xml
@@ -4,7 +4,7 @@
net
communityanalytics
communityanalytics
- 1.0.6
+ 1.0.7
http://maven.apache.org
diff --git a/pom.xml b/pom.xml
index 969e378..f885e80 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
net
communityanalytics
- 1.0.6
+ 1.0.7
jar
communityanalytics
diff --git a/src/main/java/net/communityanalytics/common/RegexUtil.java b/src/main/java/net/communityanalytics/common/RegexUtil.java
index a837180..0d66429 100644
--- a/src/main/java/net/communityanalytics/common/RegexUtil.java
+++ b/src/main/java/net/communityanalytics/common/RegexUtil.java
@@ -1,5 +1,8 @@
package net.communityanalytics.common;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
public class RegexUtil {
/**
* Check if a string is a valid domain
@@ -15,4 +18,18 @@ public static boolean isDomain(String domain) {
return isDomain(domain.split(":")[0]);
return false;
}
+
+ /**
+ * @param message String
+ * @return String
+ */
+ public static String extractIp(String message) {
+ Pattern pattern = Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");
+ Matcher matcher = pattern.matcher(message);
+
+ if (matcher.find()) {
+ return matcher.group();
+ }
+ return null;
+ }
}
diff --git a/src/main/java/net/communityanalytics/spigot/data/Session.java b/src/main/java/net/communityanalytics/spigot/data/Session.java
index 3855439..528ec7b 100644
--- a/src/main/java/net/communityanalytics/spigot/data/Session.java
+++ b/src/main/java/net/communityanalytics/spigot/data/Session.java
@@ -89,9 +89,16 @@ public void finish() {
*/
public boolean isValid() {
if (!RegexUtil.isDomain(this.ip_connect)) {
- SpigotPlugin.logger().printError("The ip_connect is not a valid domain name: " + this.ip_connect);
- SpigotPlugin.logger().printError("Contact CommunityAnalytics on Discord, if you can't solve this problem.");
- return false;
+ String ip = RegexUtil.extractIp(this.ip_connect);
+ if(ip == null) {
+ // Try to fix it
+ SpigotPlugin.logger().printError("The ip_connect is not a valid domain name: " + this.ip_connect);
+ SpigotPlugin.logger().printError("Contact CommunityAnalytics on Discord, if you can't solve this problem.");
+ return false;
+ }
+
+ // pe.zedeztsmp.fun123.246.47.444110de2f1a3c47ab Bedrock Error
+ this.ip_connect = this.ip_connect.split(ip)[0];
}
return ChronoUnit.SECONDS.between(this.join_at, this.quit_at) >= SpigotPlugin.config().getMinimumsSessionDuration();
}
diff --git a/src/main/java/net/communityanalytics/spigot/managers/PlatformManager.java b/src/main/java/net/communityanalytics/spigot/managers/PlatformManager.java
index 555fc11..369392b 100644
--- a/src/main/java/net/communityanalytics/spigot/managers/PlatformManager.java
+++ b/src/main/java/net/communityanalytics/spigot/managers/PlatformManager.java
@@ -6,7 +6,7 @@
public class PlatformManager {
public boolean success = false;
- public String version = "1.0.6";
+ public String version = "1.0.7";
public void getPlatformInfo() {
try {
diff --git a/src/main/java/net/communityanalytics/velocity/VelocityPlugin.java b/src/main/java/net/communityanalytics/velocity/VelocityPlugin.java
index e42ac45..d674e62 100644
--- a/src/main/java/net/communityanalytics/velocity/VelocityPlugin.java
+++ b/src/main/java/net/communityanalytics/velocity/VelocityPlugin.java
@@ -13,7 +13,7 @@
import org.bstats.velocity.Metrics;
import org.slf4j.Logger;
-@Plugin(id = "communityanalytics", name = "CommunityAnalytics", version = "1.0.6")
+@Plugin(id = "communityanalytics", name = "CommunityAnalytics", version = "1.0.7")
public class VelocityPlugin {
public static VelocityPlugin instance;
private final ChannelIdentifier channel = new LegacyChannelIdentifier(CommunityAnalytics.CHANNEL_INFO);
diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml
index ad59b64..128ffcd 100644
--- a/src/main/resources/bungee.yml
+++ b/src/main/resources/bungee.yml
@@ -1,4 +1,4 @@
name: CommunityAnalytics
author: FNetwork
main: net.communityanalytics.bungee.BungeePlugin
-version: 1.0.6
\ No newline at end of file
+version: 1.0.7
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 7dadc5f..9790c61 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -2,7 +2,7 @@ name: CommunityAnalytics
author: FNetwork
main: net.communityanalytics.spigot.SpigotPlugin
website: https://communityanalytics.net
-version: 1.0.6
+version: 1.0.7
api-version: 1.13
commands:
communityanalytics:
diff --git a/src/main/resources/velocity-plugin.json b/src/main/resources/velocity-plugin.json
index 21a2a9b..12fe28c 100644
--- a/src/main/resources/velocity-plugin.json
+++ b/src/main/resources/velocity-plugin.json
@@ -1,7 +1,7 @@
{
"id": "communityanalytics",
"name": "CommunityAnalytics",
- "version": "1.0.6",
+ "version": "1.0.7",
"authors": [
"FNetwork"
],