mirror of
https://github.com/ME1312/SubServers-2.git
synced 2025-02-14 18:51:41 +01:00
Add support for console sudo in GalaxiBungee
This commit is contained in:
parent
8514ea5c26
commit
49036b8943
@ -30,9 +30,15 @@
|
||||
<dependency>
|
||||
<groupId>net.ME1312.Galaxi</groupId>
|
||||
<artifactId>GalaxiUtil</artifactId>
|
||||
<version>19w20k</version>
|
||||
<version>19w21a</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ME1312.Galaxi</groupId>
|
||||
<artifactId>GalaxiEngine</artifactId>
|
||||
<version>19w21a</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ME1312.SubData</groupId>
|
||||
<artifactId>Server</artifactId>
|
||||
|
@ -0,0 +1,39 @@
|
||||
package net.ME1312.SubServers.Bungee.Library.Compatibility;
|
||||
|
||||
import net.ME1312.Galaxi.Event.ConsoleInputEvent;
|
||||
import net.ME1312.Galaxi.Galaxi;
|
||||
import net.ME1312.Galaxi.Library.Event.ListenerOrder;
|
||||
import net.ME1312.Galaxi.Library.Event.Subscribe;
|
||||
import net.ME1312.SubServers.Bungee.SubPlugin;
|
||||
|
||||
/**
|
||||
* Galaxi Event Listener Class
|
||||
*/
|
||||
public class GalaxiEventListener {
|
||||
private SubPlugin plugin;
|
||||
|
||||
/**
|
||||
* Create & Register a Galaxi Event Listener
|
||||
*
|
||||
* @param plugin Plugin
|
||||
*/
|
||||
public GalaxiEventListener(SubPlugin plugin) throws Throwable {
|
||||
this.plugin = plugin;
|
||||
|
||||
Galaxi.getInstance().getPluginManager().registerListener(Galaxi.getInstance().getAppInfo(), this);
|
||||
plugin.canSudo = true;
|
||||
}
|
||||
|
||||
@Subscribe(order = ListenerOrder.FIRST, override = true)
|
||||
public void sudo(ConsoleInputEvent e) {
|
||||
if (plugin.sudo != null) {
|
||||
e.setCancelled(true);
|
||||
if (e.getInput().equalsIgnoreCase("exit")) {
|
||||
plugin.sudo = null;
|
||||
Logger.get("SubServers").info("Reverting to the BungeeCord Console");
|
||||
} else {
|
||||
plugin.sudo.command(e.getInput());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
|
||||
import net.ME1312.Galaxi.Library.NamedContainer;
|
||||
import net.ME1312.Galaxi.Library.UniversalFile;
|
||||
import net.ME1312.Galaxi.Library.Util;
|
||||
import net.ME1312.Galaxi.Plugin.PluginInfo;
|
||||
import net.ME1312.SubData.Server.*;
|
||||
import net.ME1312.SubData.Server.Encryption.AES;
|
||||
import net.ME1312.SubData.Server.Encryption.RSA;
|
||||
@ -226,6 +227,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
|
||||
|
||||
subprotocol = SubProtocol.get();
|
||||
Logger.get("SubServers").info("Loading BungeeCord Libraries...");
|
||||
if (isGalaxi) Util.reflect(net.ME1312.SubServers.Bungee.Library.Compatibility.GalaxiEventListener.class.getConstructor(SubPlugin.class), this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -857,7 +859,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
|
||||
ServerInfo next = new LinkedList<Map.Entry<String, ServerInfo>>(fallbacks.entrySet()).getFirst().getValue();
|
||||
e.setCancelServer(next);
|
||||
if (Util.isException(() -> Util.reflect(ServerKickEvent.class.getDeclaredMethod("setCancelServers", ServerInfo[].class), e, (Object) fallbacks.values().toArray(new ServerInfo[0])))) {
|
||||
((UserConnection) e.getPlayer()).setServerJoinQueue(new LinkedBlockingQueue<>(fallbacks.keySet()));
|
||||
((UserConnection) e.getPlayer()).setServerJoinQueue(new LinkedList<>(fallbacks.keySet()));
|
||||
((UserConnection) e.getPlayer()).connect(next, null, true);
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ME1312.Galaxi</groupId>
|
||||
<artifactId>GalaxiUtil</artifactId>
|
||||
<version>19w20k</version>
|
||||
<version>19w21a</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -30,7 +30,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ME1312.Galaxi</groupId>
|
||||
<artifactId>GalaxiUtil</artifactId>
|
||||
<version>19w20k</version>
|
||||
<version>19w21a</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -20,7 +20,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ME1312.Galaxi</groupId>
|
||||
<artifactId>GalaxiEngine</artifactId>
|
||||
<version>19w20k</version>
|
||||
<version>19w21a</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -30,9 +30,15 @@
|
||||
<dependency>
|
||||
<groupId>net.ME1312.Galaxi</groupId>
|
||||
<artifactId>GalaxiUtil</artifactId>
|
||||
<version>19w20k</version>
|
||||
<version>19w21a</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ME1312.Galaxi</groupId>
|
||||
<artifactId>GalaxiEngine</artifactId>
|
||||
<version>19w21a</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ME1312.SubData</groupId>
|
||||
<artifactId>Client</artifactId>
|
||||
|
@ -36,9 +36,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user