mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2025-12-19 14:59:20 +00:00
Don't yell if Floodgate cannot remove the injection
This commit is contained in:
@@ -42,6 +42,16 @@ public interface PlatformInjector {
|
|||||||
*/
|
*/
|
||||||
boolean inject() throws Exception;
|
boolean inject() throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some platforms may not be able to remove their injection process. If so, this method will
|
||||||
|
* return false.
|
||||||
|
*
|
||||||
|
* @return true if it is safe to attempt to remove our injection performed in {@link #inject()}.
|
||||||
|
*/
|
||||||
|
default boolean canRemoveInjection() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the injection from the server. Please note that this function should only be used
|
* Removes the injection from the server. Please note that this function should only be used
|
||||||
* internally (on plugin shutdown). This method will also remove every added addon.
|
* internally (on plugin shutdown). This method will also remove every added addon.
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ public final class BungeeInjector extends CommonPlatformInjector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canRemoveInjection() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeInjection() {
|
public boolean removeInjection() {
|
||||||
logger.error("Floodgate cannot remove itself from Bungee without a reboot");
|
logger.error("Floodgate cannot remove itself from Bungee without a reboot");
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public class FloodgatePlatform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean disable() {
|
public boolean disable() {
|
||||||
if (injector != null) {
|
if (injector != null && injector.canRemoveInjection()) {
|
||||||
try {
|
try {
|
||||||
if (!injector.removeInjection()) {
|
if (!injector.removeInjection()) {
|
||||||
logger.error("Failed to remove the injection!");
|
logger.error("Failed to remove the injection!");
|
||||||
|
|||||||
Submodule common/src/main/resources/languages updated: ebbefaae95...8826fda0ea
@@ -75,6 +75,11 @@ public final class VelocityInjector extends CommonPlatformInjector {
|
|||||||
return injected = true;
|
return injected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canRemoveInjection() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeInjection() {
|
public boolean removeInjection() {
|
||||||
logger.error("Floodgate cannot remove itself from Bungee without a reboot");
|
logger.error("Floodgate cannot remove itself from Bungee without a reboot");
|
||||||
|
|||||||
Reference in New Issue
Block a user