Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 16:12:51 +02:00
Add classes with the correct minor version to the start of the adapter candidates list
Dieser Commit ist enthalten in:
Ursprung
1715f35341
Commit
34f971c729
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.bukkit.adapter;
|
package com.sk89q.worldedit.bukkit.adapter;
|
||||||
|
|
||||||
|
import com.fastasyncworldedit.bukkit.util.MinecraftVersion;
|
||||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||||
import com.sk89q.worldedit.util.io.Closer;
|
import com.sk89q.worldedit.util.io.Closer;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -39,6 +40,8 @@ public class BukkitImplLoader {
|
|||||||
|
|
||||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||||
private final List<String> adapterCandidates = new ArrayList<>();
|
private final List<String> adapterCandidates = new ArrayList<>();
|
||||||
|
private final String minorMCVersion = String.valueOf(new MinecraftVersion().getMinor());
|
||||||
|
private int zeroth = 0;
|
||||||
private String customCandidate;
|
private String customCandidate;
|
||||||
|
|
||||||
private static final String SEARCH_PACKAGE = "com.sk89q.worldedit.bukkit.adapter.impl.fawe";
|
private static final String SEARCH_PACKAGE = "com.sk89q.worldedit.bukkit.adapter.impl.fawe";
|
||||||
@ -73,6 +76,7 @@ public class BukkitImplLoader {
|
|||||||
String className = System.getProperty("worldedit.bukkit.adapter");
|
String className = System.getProperty("worldedit.bukkit.adapter");
|
||||||
if (className != null) {
|
if (className != null) {
|
||||||
customCandidate = className;
|
customCandidate = className;
|
||||||
|
zeroth = 1;
|
||||||
adapterCandidates.add(className);
|
adapterCandidates.add(className);
|
||||||
LOGGER.info("-Dworldedit.bukkit.adapter used to add " + className + " to the list of available Bukkit adapters");
|
LOGGER.info("-Dworldedit.bukkit.adapter used to add " + className + " to the list of available Bukkit adapters");
|
||||||
}
|
}
|
||||||
@ -101,7 +105,11 @@ public class BukkitImplLoader {
|
|||||||
int beginIndex = 0;
|
int beginIndex = 0;
|
||||||
int endIndex = className.length() - CLASS_SUFFIX.length();
|
int endIndex = className.length() - CLASS_SUFFIX.length();
|
||||||
className = className.substring(beginIndex, endIndex);
|
className = className.substring(beginIndex, endIndex);
|
||||||
adapterCandidates.add(className);
|
if (className.contains(minorMCVersion)) {
|
||||||
|
adapterCandidates.add(zeroth, className);
|
||||||
|
} else {
|
||||||
|
adapterCandidates.add(className);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
closer.close();
|
closer.close();
|
||||||
@ -142,7 +150,11 @@ public class BukkitImplLoader {
|
|||||||
int beginIndex = 0;
|
int beginIndex = 0;
|
||||||
int endIndex = resource.length() - CLASS_SUFFIX.length();
|
int endIndex = resource.length() - CLASS_SUFFIX.length();
|
||||||
String className = resource.substring(beginIndex, endIndex);
|
String className = resource.substring(beginIndex, endIndex);
|
||||||
adapterCandidates.add(className);
|
if (className.contains(minorMCVersion)) {
|
||||||
|
adapterCandidates.add(zeroth, className);
|
||||||
|
} else {
|
||||||
|
adapterCandidates.add(className);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren