Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 18:10:08 +01:00
Ignore CUI connections with more than 3 failed attempts.
Dieser Commit ist enthalten in:
Ursprung
df1a1d5183
Commit
52263ac3b7
@ -65,6 +65,7 @@ public class LocalSession {
|
|||||||
// Non-session related fields
|
// Non-session related fields
|
||||||
private transient LocalConfiguration config;
|
private transient LocalConfiguration config;
|
||||||
private transient final AtomicBoolean dirty = new AtomicBoolean();
|
private transient final AtomicBoolean dirty = new AtomicBoolean();
|
||||||
|
private transient int failedCuiAttempts = 0;
|
||||||
|
|
||||||
// Session related
|
// Session related
|
||||||
private transient RegionSelector selector = new CuboidRegionSelector();
|
private transient RegionSelector selector = new CuboidRegionSelector();
|
||||||
@ -772,14 +773,22 @@ public class LocalSession {
|
|||||||
*/
|
*/
|
||||||
public void handleCUIInitializationMessage(String text) {
|
public void handleCUIInitializationMessage(String text) {
|
||||||
checkNotNull(text);
|
checkNotNull(text);
|
||||||
|
if (this.failedCuiAttempts > 3) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String[] split = text.split("\\|");
|
String[] split = text.split("\\|", 2);
|
||||||
if (split.length > 1 && split[0].equalsIgnoreCase("v")) { // enough fields and right message
|
if (split.length > 1 && split[0].equalsIgnoreCase("v")) { // enough fields and right message
|
||||||
|
if (split[1].length() > 4) {
|
||||||
|
this.failedCuiAttempts ++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
setCUISupport(true);
|
setCUISupport(true);
|
||||||
try {
|
try {
|
||||||
setCUIVersion(Integer.parseInt(split[1]));
|
setCUIVersion(Integer.parseInt(split[1]));
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
WorldEdit.logger.warning("Error while reading CUI init message: " + e.getMessage());
|
WorldEdit.logger.warning("Error while reading CUI init message: " + e.getMessage());
|
||||||
|
this.failedCuiAttempts ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren