mirror of
https://github.com/funkemunky/AntiVPN.git
synced 2026-06-04 02:42:20 +00:00
Got Sponge support working, need to ensure other plugins are still working tho
This commit is contained in:
@@ -2,38 +2,35 @@ package dev.brighten.antivpn.sponge;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import dev.brighten.antivpn.AntiVPN;
|
||||
import dev.brighten.antivpn.sponge.command.SpongeCommand;
|
||||
import lombok.Getter;
|
||||
import org.spongepowered.api.Server;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.api.Sponge;
|
||||
import org.spongepowered.api.command.Command;
|
||||
import org.spongepowered.api.config.ConfigManager;
|
||||
import org.spongepowered.api.event.Listener;
|
||||
import org.spongepowered.api.event.lifecycle.*;
|
||||
import org.spongepowered.plugin.PluginContainer;
|
||||
import org.spongepowered.plugin.builtin.jvm.Plugin;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
@Plugin("kaurivpn")
|
||||
@Getter
|
||||
public class SpongePlugin {
|
||||
|
||||
//Plugin init
|
||||
private final PluginContainer container;
|
||||
private final Logger logger;
|
||||
|
||||
@Inject
|
||||
SpongePlugin(final PluginContainer container, final Logger logger) {
|
||||
this.container = container;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
private PluginContainer container;
|
||||
@Inject
|
||||
private Logger logger;
|
||||
@Getter
|
||||
private static SpongePlugin instance;
|
||||
|
||||
@Listener
|
||||
public void onServerStart(final ConstructPluginEvent event) {
|
||||
//Start AntiVPN
|
||||
public void onConstruct(final ConstructPluginEvent event) {
|
||||
instance = this;
|
||||
|
||||
ConfigManager configManager = Sponge.game().configManager();
|
||||
ConfigManager configManager = Sponge.configManager();
|
||||
SpongeListener spongeListener = new SpongeListener();
|
||||
|
||||
var path = configManager.sharedConfig(container).directory();
|
||||
@@ -48,8 +45,16 @@ public class SpongePlugin {
|
||||
AntiVPN.getInstance().getExecutor().disablePlugin();
|
||||
}
|
||||
|
||||
public static SpongePlugin getInstance() {
|
||||
return (SpongePlugin) Sponge.pluginManager().plugin("kaurivpn").get();
|
||||
@Listener
|
||||
public void onRegisterRawCommands(final RegisterCommandEvent<Command.Raw> event){
|
||||
if(AntiVPN.getInstance() == null) {
|
||||
for(int i = 0 ; i < 5 ; i++) System.out.println("FUCKING NULL");
|
||||
return;
|
||||
}
|
||||
AntiVPN.getInstance().getExecutor().log("Registering commands...");
|
||||
for (dev.brighten.antivpn.command.Command command : AntiVPN.getInstance().getCommands()) {
|
||||
AntiVPN.getInstance().getExecutor().log("Registering command %s...", command.name());
|
||||
event.register(this.container, new SpongeCommand(command), command.name(), command.aliases());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user