Skip to content

Commit

Permalink
Ignore events if plugin did not enable correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
NEZNAMY committed Jun 26, 2024
1 parent 0862975 commit 3c97303
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
public class VelocityScoreboardAPI {

private final ProxyServer server;
private boolean enabled;

/**
* Constructs new instance with given parameter
Expand Down Expand Up @@ -86,6 +87,7 @@ public void onProxyInitialization(ProxyInitializeEvent event) {

ScoreboardManager.setInstance(new VelocityScoreboardManager(server, this));
LoggerManager.log(Level.INFO,"<green>Successfully injected Scoreboard API.");
enabled = true;
}

/**
Expand All @@ -95,6 +97,7 @@ public void onProxyInitialization(ProxyInitializeEvent event) {
*/
@Subscribe
public void onJoin(PostLoginEvent e) {
if (!enabled) return;
((ConnectedPlayer) e.getPlayer()).getConnection().getChannel().pipeline().addBefore("handler", "VelocityPacketAPI", new ChannelInjection(e.getPlayer()));
}
}

0 comments on commit 3c97303

Please sign in to comment.