mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2025-01-18 12:34:20 +08:00
Avoid use of deprecated newInstance method
This commit is contained in:
parent
d299e36a32
commit
36ab28897c
@ -158,7 +158,7 @@ public BukkitImplAdapter loadAdapter() throws AdapterLoadException {
|
||||
continue;
|
||||
}
|
||||
if (BukkitImplAdapter.class.isAssignableFrom(cls)) {
|
||||
return (BukkitImplAdapter) cls.newInstance();
|
||||
return (BukkitImplAdapter) cls.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
LOGGER.warn("Failed to load the Bukkit adapter class '" + className
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
/**
|
||||
* An enum of default region selector types.
|
||||
*/
|
||||
@ -56,8 +58,9 @@ public Class<? extends RegionSelector> getSelectorClass() {
|
||||
*/
|
||||
public RegionSelector createSelector() {
|
||||
try {
|
||||
return getSelectorClass().newInstance();
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
return getSelectorClass().getDeclaredConstructor().newInstance();
|
||||
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException
|
||||
| InvocationTargetException e) {
|
||||
throw new RuntimeException("Could not create selector", e);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user