BungeeCord: VotifierEvent is not Async anymore

This commit is contained in:
JOO200 committed 2022-04-09 10:09:55 +02:00
1 parent ede5cae333
commit 3d0f255ab4
2 files changed
+8 -13

No files matched your search

@@ -364,15 +364,12 @@ public class NuVotifier extends Plugin implements VoteHandler, ProxyVotifierPlug
}
}
getProxy().getPluginManager().callEvent(new VotifierEvent(vote, (result, error) -> {
if (error != null) {
getLogger().log(Level.WARNING, "Unable to process the votifier event due to an error", error);
return;
getProxy().getScheduler().runAsync(this, () -> {
VotifierEvent event = getProxy().getPluginManager().callEvent(new VotifierEvent(vote));
if (!event.isCancelled() && forwardingMethod != null) {
forwardingMethod.forward(vote);
}
if (!result.isCancelled() && forwardingMethod != null) {
getProxy().getScheduler().runAsync(this, () -> forwardingMethod.forward(vote));
}
}));
});
}
@Override
@@ -1,15 +1,14 @@
package com.vexsoftware.votifier.bungee.events;
import com.vexsoftware.votifier.model.Vote;
import net.md_5.bungee.api.Callback;
import net.md_5.bungee.api.event.AsyncEvent;
import net.md_5.bungee.api.plugin.Cancellable;
import net.md_5.bungee.api.plugin.Event;
/**
* {@code VotifierEvent} is a custom BungeeCord event class that is sent
* asynchronously allowing other plugins to listen for votes.
*/
public class VotifierEvent extends AsyncEvent<VotifierEvent> implements Cancellable {
public class VotifierEvent extends Event implements Cancellable {
/**
* The vote.
**/
@@ -17,8 +16,7 @@ public class VotifierEvent extends AsyncEvent<VotifierEvent> implements Cancella
private boolean cancelled;
public VotifierEvent(Vote vote, Callback<VotifierEvent> done) {
super(done);
public VotifierEvent(Vote vote) {
this.vote = vote;
}