mirror of
https://github.com/CarmJos/EasyPlugin.git
synced 2026-06-04 16:48:16 +08:00
fix(main): 移除 isInitialized() 方法 (与部分服务端冲突)
This commit is contained in:
@@ -45,8 +45,8 @@ public abstract class EasyPlugin extends JavaPlugin {
|
|||||||
this.messageProvider = messageProvider;
|
this.messageProvider = messageProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SchedulerUtils scheduler;
|
protected SchedulerUtils scheduler;
|
||||||
private boolean initialized = false;
|
protected boolean initialized = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void onLoad() {
|
public final void onLoad() {
|
||||||
@@ -79,7 +79,7 @@ public abstract class EasyPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void onDisable() {
|
public final void onDisable() {
|
||||||
if (!hasOverride("shutdown") || !isInitialized()) return;
|
if (!hasOverride("shutdown") || !this.initialized) return;
|
||||||
outputInfo();
|
outputInfo();
|
||||||
|
|
||||||
log(messageProvider.disabling(this));
|
log(messageProvider.disabling(this));
|
||||||
@@ -103,10 +103,6 @@ public abstract class EasyPlugin extends JavaPlugin {
|
|||||||
Optional.ofNullable(JarResourceUtils.readResource(this.getResource("PLUGIN_INFO"))).ifPresent(this::log);
|
Optional.ofNullable(JarResourceUtils.readResource(this.getResource("PLUGIN_INFO"))).ifPresent(this::log);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInitialized() {
|
|
||||||
return initialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDebugging() {
|
public boolean isDebugging() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -149,15 +145,16 @@ public abstract class EasyPlugin extends JavaPlugin {
|
|||||||
if (isDebugging()) print("&8[DEBUG] &r", messages);
|
if (isDebugging()) print("&8[DEBUG] &r", messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void callEventSync(Event event) {
|
public @NotNull <T extends Event> CompletableFuture<T> callSync(T event) {
|
||||||
getScheduler().run(() -> Bukkit.getPluginManager().callEvent(event));
|
CompletableFuture<T> future = new CompletableFuture<>();
|
||||||
|
getScheduler().run(() -> {
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
future.complete(event);
|
||||||
|
});
|
||||||
|
return future;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void callEventAsync(Event event) {
|
public @NotNull <T extends Event> CompletableFuture<T> callAsync(T event) {
|
||||||
getScheduler().runAsync(() -> Bukkit.getPluginManager().callEvent(event));
|
|
||||||
}
|
|
||||||
|
|
||||||
public @NotNull <T extends Event> CompletableFuture<T> callEventFuture(T event) {
|
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
return event;
|
return event;
|
||||||
|
|||||||
Reference in New Issue
Block a user