1 parent
9ceca5f7b3
commit
859d901d9a
1 file changed
+21
-12
@@ -108,11 +108,11 @@ public class MQTTClient {
|
|||||||
Matcher matcher = pattern.matcher(topic);
|
Matcher matcher = pattern.matcher(topic);
|
||||||
|
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
UUID playerId = UUID.fromString(matcher.group(1));
|
UUID playerId = parsePlayerUuid(matcher.group(1));
|
||||||
|
if (playerId == null)
|
||||||
|
return;
|
||||||
|
|
||||||
InventoryRequest inventoryRequest = new InventoryRequest(playerId);
|
RequestManager.addRequest(new InventoryRequest(playerId));
|
||||||
|
|
||||||
RequestManager.addRequest(inventoryRequest);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,11 +121,11 @@ public class MQTTClient {
|
|||||||
Matcher matcher = pattern.matcher(topic);
|
Matcher matcher = pattern.matcher(topic);
|
||||||
|
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
UUID playerId = UUID.fromString(matcher.group(1));
|
UUID playerId = parsePlayerUuid(matcher.group(1));
|
||||||
|
if (playerId == null)
|
||||||
|
return;
|
||||||
|
|
||||||
PlayerOnlineRequest playerOnlineRequest = new PlayerOnlineRequest(playerId);
|
RequestManager.addRequest(new PlayerOnlineRequest(playerId));
|
||||||
|
|
||||||
RequestManager.addRequest(playerOnlineRequest);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,11 +134,11 @@ public class MQTTClient {
|
|||||||
Matcher matcher = pattern.matcher(topic);
|
Matcher matcher = pattern.matcher(topic);
|
||||||
|
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
UUID playerId = UUID.fromString(matcher.group(1));
|
UUID playerId = parsePlayerUuid(matcher.group(1));
|
||||||
|
if (playerId == null)
|
||||||
|
return;
|
||||||
|
|
||||||
PlayerPositionRequest request = new PlayerPositionRequest(playerId);
|
RequestManager.addRequest(new PlayerPositionRequest(playerId));
|
||||||
|
|
||||||
RequestManager.addRequest(request);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,4 +173,13 @@ public class MQTTClient {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static UUID parsePlayerUuid(String raw) {
|
||||||
|
try {
|
||||||
|
return UUID.fromString(raw);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
Loon.LOGGER.warn("Ignoring MQTT request with invalid player UUID: {}", raw);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user