mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-01-09 17:27:38 +00:00
Update BukkitImplLoader
This commit is contained in:
parent
fd8cf1ebba
commit
75a18b9d5b
@ -3,18 +3,18 @@
|
|||||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||||
* Copyright (C) WorldEdit team and contributors
|
* Copyright (C) WorldEdit team and contributors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* under the terms of the GNU Lesser General Public License as published by the
|
* it under the terms of the GNU General Public License as published by
|
||||||
* Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* This program is distributed in the hope that it will be useful,
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.sk89q.worldedit.bukkit.adapter;
|
package com.sk89q.worldedit.bukkit.adapter;
|
||||||
@ -47,15 +47,14 @@ public class BukkitImplLoader {
|
|||||||
private static final String CLASS_SUFFIX = ".class";
|
private static final String CLASS_SUFFIX = ".class";
|
||||||
|
|
||||||
private static final String LOAD_ERROR_MESSAGE =
|
private static final String LOAD_ERROR_MESSAGE =
|
||||||
"\n**********************************************\n" +
|
"\n**********************************************\n"
|
||||||
"** This WorldEdit version does not fully support your version of Bukkit.\n" +
|
+ "** This WorldEdit version does not fully support your version of Bukkit.\n"
|
||||||
"**\n" +
|
+ "**\n" + "** When working with blocks or undoing, chests will be empty, signs\n"
|
||||||
"** When working with blocks or undoing, chests will be empty, signs\n" +
|
+ "** will be blank, and so on. There will be no support for entity\n"
|
||||||
"** will be blank, and so on. There will be no support for entity\n" +
|
+ "** and block property-related functions.\n"
|
||||||
"** and block property-related functions.\n" +
|
+ "**\n"
|
||||||
"**\n" +
|
+ "** Please see https://worldedit.enginehub.org/en/latest/faq/#bukkit-adapters\n"
|
||||||
"** Please see https://worldedit.enginehub.org/en/latest/faq/#bukkit-adapters\n" +
|
+ "**********************************************\n";
|
||||||
"**********************************************\n";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
@ -97,7 +96,9 @@ public class BukkitImplLoader {
|
|||||||
|
|
||||||
String className = jarEntry.getName().replaceAll("[/\\\\]+", ".");
|
String className = jarEntry.getName().replaceAll("[/\\\\]+", ".");
|
||||||
|
|
||||||
if (!className.startsWith(SEARCH_PACKAGE_DOT) || jarEntry.isDirectory()) continue;
|
if (!className.startsWith(SEARCH_PACKAGE_DOT) || jarEntry.isDirectory()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int beginIndex = 0;
|
int beginIndex = 0;
|
||||||
int endIndex = className.length() - CLASS_SUFFIX.length();
|
int endIndex = className.length() - CLASS_SUFFIX.length();
|
||||||
@ -155,32 +156,23 @@ public class BukkitImplLoader {
|
|||||||
*/
|
*/
|
||||||
public BukkitImplAdapter loadAdapter() throws AdapterLoadException {
|
public BukkitImplAdapter loadAdapter() throws AdapterLoadException {
|
||||||
for (String className : adapterCandidates) {
|
for (String className : adapterCandidates) {
|
||||||
System.out.println("Candidate: " + className);
|
|
||||||
try {
|
try {
|
||||||
Class<?> cls = Class.forName(className);
|
Class<?> cls = Class.forName(className);
|
||||||
if (cls.isSynthetic()){
|
if (cls.isSynthetic()) {
|
||||||
System.out.println(className + " is synthetic, continuing");
|
|
||||||
continue;
|
continue;
|
||||||
}else{
|
|
||||||
System.out.println(className + " is not synthetic");
|
|
||||||
}
|
}
|
||||||
if (BukkitImplAdapter.class.isAssignableFrom(cls)) {
|
if (BukkitImplAdapter.class.isAssignableFrom(cls)) {
|
||||||
System.out.println(className + " is assignable from BukkitImplAdapter, returning");
|
|
||||||
return (BukkitImplAdapter) cls.newInstance();
|
return (BukkitImplAdapter) cls.newInstance();
|
||||||
}else{
|
|
||||||
System.out.println(className + " is NOT assignable from BukkitImplAdapter, returning");
|
|
||||||
}
|
}
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
log.warn("Failed to load the Bukkit adapter class '" + className +
|
log.warn("Failed to load the Bukkit adapter class '" + className
|
||||||
"' that is not supposed to be missing", e);
|
+ "' that is not supposed to be missing", e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
log.warn("Failed to load the Bukkit adapter class '" + className +
|
log.warn("Failed to load the Bukkit adapter class '" + className
|
||||||
"' that is not supposed to be raising this error", e);
|
+ "' that is not supposed to be raising this error", e);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
if (className.equals(customCandidate)) {
|
if (className.equals(customCandidate)) {
|
||||||
log.warn("Failed to load the Bukkit adapter class '" + className + "'", e);
|
log.warn("Failed to load the Bukkit adapter class '" + className + "'", e);
|
||||||
}else{
|
|
||||||
log.warn(className + " is not custom candidate.", e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user