(1.2.0) Fixed various issues with the plugin
This commit is contained in:
parent
4bd1aebd04
commit
32fda35ace
Binary file not shown.
|
@ -67,6 +67,7 @@ public class EaglerXBungee extends Plugin {
|
|||
private static EaglerXBungee instance = null;
|
||||
private EaglerBungeeConfig conf = null;
|
||||
private EventLoopGroup eventLoopGroup;
|
||||
private EventLoopGroup eventLoopGroupBoss;
|
||||
private Collection<Channel> openChannels;
|
||||
private Timer closeInactiveConnections = null;
|
||||
private Timer skinServiceTasks = null;
|
||||
|
@ -103,6 +104,7 @@ public class EaglerXBungee extends Plugin {
|
|||
} catch (NoSuchFieldError e) {
|
||||
try {
|
||||
eventLoopGroup = (EventLoopGroup) BungeeCord.class.getField("workerEventLoopGroup").get(getProxy());
|
||||
eventLoopGroupBoss = (EventLoopGroup) BungeeCord.class.getField("bossEventLoopGroup").get(getProxy());
|
||||
} catch (IllegalAccessException | NoSuchFieldException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
@ -273,9 +275,13 @@ public class EaglerXBungee extends Plugin {
|
|||
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||
bootstrap.option(ChannelOption.SO_REUSEADDR, true)
|
||||
.childOption(ChannelOption.TCP_NODELAY, true)
|
||||
.channel(PipelineUtils.getServerChannel(addr))
|
||||
.group(eventLoopGroup)
|
||||
.childAttr(EaglerPipeline.LISTENER, confData)
|
||||
.channel(PipelineUtils.getServerChannel(addr));
|
||||
if(eventLoopGroupBoss != null) {
|
||||
bootstrap.group(eventLoopGroupBoss, eventLoopGroup);
|
||||
}else {
|
||||
bootstrap.group(eventLoopGroup);
|
||||
}
|
||||
bootstrap.childAttr(EaglerPipeline.LISTENER, confData)
|
||||
.attr(EaglerPipeline.LOCAL_ADDRESS, addr)
|
||||
.localAddress(addr)
|
||||
.childHandler(EaglerPipeline.SERVER_CHILD)
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.api.event;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class EaglercraftRegisterCapeEvent extends Event {
|
||||
|
||||
private final String username;
|
||||
private final UUID uuid;
|
||||
private byte[] customTex = null;
|
||||
|
||||
public EaglercraftRegisterCapeEvent(String username, UUID uuid) {
|
||||
this.username = username;
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setForceUsePreset(int p) {
|
||||
customTex = new byte[5];
|
||||
customTex[0] = (byte)1;
|
||||
customTex[1] = (byte)(p >> 24);
|
||||
customTex[2] = (byte)(p >> 16);
|
||||
customTex[3] = (byte)(p >> 8);
|
||||
customTex[4] = (byte)(p & 0xFF);
|
||||
}
|
||||
|
||||
public void setForceUseCustom(byte[] tex) {
|
||||
customTex = new byte[1 + tex.length];
|
||||
customTex[0] = (byte)2;
|
||||
System.arraycopy(tex, 0, customTex, 1, tex.length);
|
||||
}
|
||||
|
||||
public void setForceUseCustomByPacket(byte[] packet) {
|
||||
customTex = packet;
|
||||
}
|
||||
|
||||
public byte[] getForceSetUseCustomPacket() {
|
||||
return customTex;
|
||||
}
|
||||
}
|
|
@ -26,7 +26,6 @@ public class EaglercraftRegisterSkinEvent extends Event {
|
|||
private final UUID uuid;
|
||||
private Property useMojangProfileProperty = null;
|
||||
private boolean useLoginResultTextures = false;
|
||||
private int presetId = -1;
|
||||
private byte[] customTex = null;
|
||||
private String customURL = null;
|
||||
|
||||
|
@ -38,7 +37,6 @@ public class EaglercraftRegisterSkinEvent extends Event {
|
|||
public void setForceUseMojangProfileProperty(Property prop) {
|
||||
useMojangProfileProperty = prop;
|
||||
useLoginResultTextures = false;
|
||||
presetId = -1;
|
||||
customTex = null;
|
||||
customURL = null;
|
||||
}
|
||||
|
@ -46,7 +44,6 @@ public class EaglercraftRegisterSkinEvent extends Event {
|
|||
public void setForceUseLoginResultObjectTextures(boolean b) {
|
||||
useMojangProfileProperty = null;
|
||||
useLoginResultTextures = b;
|
||||
presetId = -1;
|
||||
customTex = null;
|
||||
customURL = null;
|
||||
}
|
||||
|
@ -54,7 +51,6 @@ public class EaglercraftRegisterSkinEvent extends Event {
|
|||
public void setForceUsePreset(int p) {
|
||||
useMojangProfileProperty = null;
|
||||
useLoginResultTextures = false;
|
||||
presetId = p;
|
||||
customTex = new byte[5];
|
||||
customTex[0] = (byte)1;
|
||||
customTex[1] = (byte)(p >> 24);
|
||||
|
@ -67,7 +63,6 @@ public class EaglercraftRegisterSkinEvent extends Event {
|
|||
public void setForceUseCustom(int model, byte[] tex) {
|
||||
useMojangProfileProperty = null;
|
||||
useLoginResultTextures = false;
|
||||
presetId = -1;
|
||||
customTex = new byte[2 + tex.length];
|
||||
customTex[0] = (byte)2;
|
||||
customTex[1] = (byte)model;
|
||||
|
@ -78,7 +73,6 @@ public class EaglercraftRegisterSkinEvent extends Event {
|
|||
public void setForceUseCustomByPacket(byte[] packet) {
|
||||
useMojangProfileProperty = null;
|
||||
useLoginResultTextures = false;
|
||||
presetId = -1;
|
||||
customTex = packet;
|
||||
customURL = null;
|
||||
}
|
||||
|
@ -86,7 +80,6 @@ public class EaglercraftRegisterSkinEvent extends Event {
|
|||
public void setForceUseURL(String url) {
|
||||
useMojangProfileProperty = null;
|
||||
useLoginResultTextures = false;
|
||||
presetId = -1;
|
||||
customTex = null;
|
||||
customURL = url;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ public interface MOTDConnection {
|
|||
}
|
||||
|
||||
void sendToUser();
|
||||
void setKeepAlive(boolean enable);
|
||||
|
||||
String getLine1();
|
||||
String getLine2();
|
||||
|
|
|
@ -43,6 +43,7 @@ import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.api.event.Eaglerc
|
|||
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.api.event.EaglercraftIsAuthRequiredEvent.AuthMethod;
|
||||
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.api.event.EaglercraftIsAuthRequiredEvent.AuthResponse;
|
||||
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.api.event.EaglercraftMOTDEvent;
|
||||
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.api.event.EaglercraftRegisterCapeEvent;
|
||||
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.api.event.EaglercraftRegisterSkinEvent;
|
||||
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.auth.DefaultAuthSystem;
|
||||
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.command.CommandConfirmCode;
|
||||
|
@ -950,6 +951,15 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
EaglercraftRegisterCapeEvent registerCapeEvent = new EaglercraftRegisterCapeEvent(usernameStr, clientUUID);
|
||||
|
||||
bungee.getPluginManager().callEvent(registerCapeEvent);
|
||||
|
||||
byte[] forceCape = registerCapeEvent.getForceSetUseCustomPacket();
|
||||
if(forceCape != null) {
|
||||
profileData.put("cape_v1", forceCape);
|
||||
}
|
||||
|
||||
if(profileData.containsKey("cape_v1")) {
|
||||
try {
|
||||
CapePackets.registerEaglerPlayer(clientUUID, profileData.get("cape_v1"),
|
||||
|
@ -1085,6 +1095,7 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
|
|||
if(handler != null) {
|
||||
ctx.pipeline().replace(HttpWebSocketHandler.this, "HttpServerQueryHandler", handler);
|
||||
ctx.pipeline().addBefore("HttpServerQueryHandler", "WriteTimeoutHandler", new WriteTimeoutHandler(5l, TimeUnit.SECONDS));
|
||||
ctx.channel().attr(EaglerPipeline.CONNECTION_INSTANCE).get().hasBeenForwarded = true;
|
||||
handler.beginHandleQuery(conf, ctx, str);
|
||||
if(handler instanceof MOTDQueryHandler) {
|
||||
EaglercraftMOTDEvent evt = new EaglercraftMOTDEvent((MOTDQueryHandler)handler);
|
||||
|
|
|
@ -62,7 +62,7 @@ public class EaglerDrivers {
|
|||
EaglerXBungee.logger().severe("Invalid JDBC driver path: " + address);
|
||||
throw new ExceptionInInitializerError(ex);
|
||||
}
|
||||
classLoader = new URLClassLoader(new URL[] { driverURL }, ClassLoader.getSystemClassLoader());
|
||||
classLoader = URLClassLoader.newInstance(new URL[] { driverURL }, ClassLoader.getSystemClassLoader());
|
||||
driversJARs.put(address, classLoader);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: EaglercraftXBungee
|
||||
main: net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.EaglerXBungee
|
||||
version: 1.1.1
|
||||
version: 1.2.0
|
||||
description: Plugin to allow EaglercraftX 1.8 players to join your network, or allow EaglercraftX 1.8 players to use your network as a proxy to join other networks
|
||||
author: lax1dude
|
|
@ -1 +1 @@
|
|||
1.1.1
|
||||
1.2.0
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.1.1","pluginButton":"Download \"EaglerXBungee-1.1.1.jar\"","pluginFilename":"EaglerXBungee.zip"}
|
||||
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.2.0","pluginButton":"Download \"EaglerXBungee-1.2.0.jar\"","pluginFilename":"EaglerXBungee.zip"}
|
Loading…
Reference in New Issue
Block a user