mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 20:03:21 +00:00
Add check for legacy API method calls on plugins
This commit is contained in:
parent
fd40575cb4
commit
deaa13c2af
@ -1,17 +1,18 @@
|
||||
package emu.grasscutter.plugin;
|
||||
|
||||
import static emu.grasscutter.utils.lang.Language.translate;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.server.event.*;
|
||||
import emu.grasscutter.utils.*;
|
||||
import lombok.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.jar.*;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.*;
|
||||
|
||||
import static emu.grasscutter.utils.lang.Language.translate;
|
||||
|
||||
/** Manages the server's plugins and the event system. */
|
||||
public final class PluginManager {
|
||||
@ -216,9 +217,14 @@ public final class PluginManager {
|
||||
Grasscutter.getLogger().info(translate("plugin.enabling_plugin", name));
|
||||
try {
|
||||
plugin.onEnable();
|
||||
return;
|
||||
} catch (NoSuchMethodError ignored) {
|
||||
Grasscutter.getLogger().error(translate("plugin.invalid_api.outdated", name));
|
||||
} catch (Throwable exception) {
|
||||
Grasscutter.getLogger().error(translate("plugin.enabling_failed", name), exception);
|
||||
}
|
||||
|
||||
this.disablePlugin(plugin);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -463,7 +463,8 @@
|
||||
"disabling_failed": "Failed to disable plugin: %s",
|
||||
"invalid_api": {
|
||||
"not_present": "Plugin %s does not specify an API version.",
|
||||
"lower": "Plugin %s is using API version %s, while the server is using API version %s."
|
||||
"lower": "Plugin %s is using API version %s, while the server is using API version %s.",
|
||||
"outdated": "Plugin %s is using an outdated API method."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +463,8 @@
|
||||
"disabling_failed": "Error al desactivar el plugin: %s",
|
||||
"invalid_api": {
|
||||
"not_present": "🇺🇸Plugin %s does not specify an API version.",
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s."
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s.",
|
||||
"outdated": "🇺🇸Plugin %s is using an outdated API method."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +463,8 @@
|
||||
"disabling_failed": "Impossible de désactiver le plugin %s",
|
||||
"invalid_api": {
|
||||
"not_present": "🇺🇸Plugin %s does not specify an API version.",
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s."
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s.",
|
||||
"outdated": "🇺🇸Plugin %s is using an outdated API method."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +463,8 @@
|
||||
"disabling_failed": "Impossibile disabilitare il plug-in: %s",
|
||||
"invalid_api": {
|
||||
"not_present": "🇺🇸Plugin %s does not specify an API version.",
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s."
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s.",
|
||||
"outdated": "🇺🇸Plugin %s is using an outdated API method."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +463,8 @@
|
||||
"disabling_failed": "プラグインの無効化に失敗しました: %s",
|
||||
"invalid_api": {
|
||||
"not_present": "🇺🇸Plugin %s does not specify an API version.",
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s."
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s.",
|
||||
"outdated": "🇺🇸Plugin %s is using an outdated API method."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +463,8 @@
|
||||
"disabling_failed": "플러그인을 비활성화하는데 실패했습니다: %s",
|
||||
"invalid_api": {
|
||||
"not_present": "🇺🇸Plugin %s does not specify an API version.",
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s."
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s.",
|
||||
"outdated": "🇺🇸Plugin %s is using an outdated API method."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +463,8 @@
|
||||
"disabling_failed": "Nie udało się wyłączyć pluginu: %s",
|
||||
"invalid_api": {
|
||||
"not_present": "🇺🇸Plugin %s does not specify an API version.",
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s."
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s.",
|
||||
"outdated": "🇺🇸Plugin %s is using an outdated API method."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +463,8 @@
|
||||
"disabling_failed": "🇺🇸Failed to disable plugin: %s",
|
||||
"invalid_api": {
|
||||
"not_present": "🇺🇸Plugin %s does not specify an API version.",
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s."
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s.",
|
||||
"outdated": "🇺🇸Plugin %s is using an outdated API method."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +463,8 @@
|
||||
"disabling_failed": "Ошибка отключения Плагина: %s",
|
||||
"invalid_api": {
|
||||
"not_present": "🇺🇸Plugin %s does not specify an API version.",
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s."
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s.",
|
||||
"outdated": "🇺🇸Plugin %s is using an outdated API method."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +463,8 @@
|
||||
"disabling_failed": "无法禁用插件:%s",
|
||||
"invalid_api": {
|
||||
"not_present": "🇺🇸Plugin %s does not specify an API version.",
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s."
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s.",
|
||||
"outdated": "🇺🇸Plugin %s is using an outdated API method."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +463,8 @@
|
||||
"disabling_failed": "🇺🇸Failed to disable plugin: %s",
|
||||
"invalid_api": {
|
||||
"not_present": "🇺🇸Plugin %s does not specify an API version.",
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s."
|
||||
"lower": "🇺🇸Plugin %s is using API version %s, while the server is using API version %s.",
|
||||
"outdated": "🇺🇸Plugin %s is using an outdated API method."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user