Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01: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,8 +105,12 @@ 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);
|
||||||
|
if (className.contains(minorMCVersion)) {
|
||||||
|
adapterCandidates.add(zeroth, className);
|
||||||
|
} else {
|
||||||
adapterCandidates.add(className);
|
adapterCandidates.add(className);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
closer.close();
|
closer.close();
|
||||||
}
|
}
|
||||||
@ -142,9 +150,13 @@ 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);
|
||||||
|
if (className.contains(minorMCVersion)) {
|
||||||
|
adapterCandidates.add(zeroth, className);
|
||||||
|
} else {
|
||||||
adapterCandidates.add(className);
|
adapterCandidates.add(className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate through the list of candidates and load an adapter.
|
* Iterate through the list of candidates and load an adapter.
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren