Skip to content

Commit

Permalink
[1.3.1] Fix critical bug with update 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Wirlie committed Oct 19, 2021
1 parent c8eb762 commit e644634
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 26 deletions.
1 change: 0 additions & 1 deletion .idea/modules/EnhancedBungeeList.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'com.wirlie'
version '1.3'
version '1.3.1'

repositories {
mavenLocal()
Expand Down
28 changes: 6 additions & 22 deletions src/main/java/dev/wirlie/bungeecord/glist/EnhancedBCL.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@

public class EnhancedBCL extends Plugin {

public static EnhancedBCL INSTANCE;

public static final List<ConfigEntry<?>> CONFIGURATIONS_REGISTRY = new ArrayList<>();

private Configuration config = null;
private ConfigurationProvider yamlProvider = null;
private File configFile = null;
private GlistCommand commandExecutor = null;
public static GlistCommand commandExecutor = null;

private final List<GroupHook> groupHooks = new ArrayList<>();
private final List<ServerGroup> serverGroups = new ArrayList<>();
Expand All @@ -57,8 +59,8 @@ public class EnhancedBCL extends Plugin {

public boolean isPremiumVanishHooked = false;

private ScheduledTask registerGlistCommandTask;
private final Object registerGlistCommandTaskSyncObject = new Object();
public static ScheduledTask registerGlistCommandTask;
public final static Object registerGlistCommandTaskSyncObject = new Object();

//TODO: Implement update check every X minutes
private UpdateChecker updateChecker;
Expand All @@ -82,6 +84,7 @@ public class EnhancedBCL extends Plugin {
}

public void onEnable() {
INSTANCE = this;
this.adventure = BungeeAudiences.create(this);

//declaration of commons variables
Expand Down Expand Up @@ -388,23 +391,4 @@ public ActivityManager getActivityManager() {
return activityManager;
}

private class RegisterGlistListener implements Listener {

@EventHandler
public void event(PostLoginEvent e) {
synchronized (registerGlistCommandTaskSyncObject) {
if (registerGlistCommandTask != null) {
registerGlistCommandTask.cancel();
registerGlistCommandTask = null;

BungeeCord.getInstance().getPluginManager().registerCommand(EnhancedBCL.this, commandExecutor);
getLogger().info("Command /glist registered...");
}
}

ProxyServer.getInstance().getPluginManager().unregisterListener(this);
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package dev.wirlie.bungeecord.glist;

import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;

public class RegisterGlistListener implements Listener {

@EventHandler
public void event(PostLoginEvent e) {
synchronized (EnhancedBCL.registerGlistCommandTaskSyncObject) {
if (EnhancedBCL.registerGlistCommandTask != null) {
EnhancedBCL.registerGlistCommandTask.cancel();
EnhancedBCL.registerGlistCommandTask = null;

BungeeCord.getInstance().getPluginManager().registerCommand(EnhancedBCL.INSTANCE, EnhancedBCL.commandExecutor);
EnhancedBCL.INSTANCE.getLogger().info("Command /glist registered...");
}
}

ProxyServer.getInstance().getPluginManager().unregisterListener(this);
}

}
2 changes: 1 addition & 1 deletion src/main/resources/bungee.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: EnhancedBungeeList
author: Wirlie
version: "1.3"
version: "1.3.1"
main: dev.wirlie.bungeecord.glist.EnhancedBCL
softdepends:
- LuckPerms
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: EnhancedBungeeListBridge
author: Wirlie
version: "1.3"
version: "1.3.1"
main: dev.wirlie.spigot.glist.EnhancedBCLBridge
softdepend:
- Essentials
Expand Down

0 comments on commit e644634

Please sign in to comment.