Git Product home page Git Product logo

pledge's People

Contributors

samb440 avatar thomasom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pledge's Issues

Unable to join 1.8 server with 1.9+ client when Pledge is enabled

Server version: 1.8.8
Plugins: ViaVersion (4.7.0), PacketEventsTest

When using the PacketEvents test plugin (https://gist.github.com/ThomasOM/e25ec8605871933abbc848b94f4f9f6e), 1.9+ players get kicked immediately when trying to join a 1.8 server (with ViaVersion). I compiled the plugin with the latest snapshot of PacketEvents 2.0 but the issue was also present when using PacketEvents 1.8.4.

Using a 1.8 client works just fine, but 1.9+ versions result in an immediate kick.

Console output:

[20:53:29 INFO]: UUID of player TypicalFin is a6560d17-a5d5-3e5a-9d41-ab7942e0f228
[20:53:29 INFO]: TypicalFin[/127.0.0.1:55164] logged in with entity id 149 at ([world]204.84593849966896, 62.0, 177.20572391437955)
[20:53:29 INFO]: activate handler
[20:53:29 INFO]: create frame
[20:53:29 INFO]: server teleport
[20:53:29 INFO]: TypicalFin lost connection: Internal Exception: java.io.IOException: An established connection was aborted by the software in your host machine
[20:53:29 INFO]: TypicalFin left the game.

Kick message:
image

Server join broken

Hello! After the latest changes, joining the game broke for me.

Stacktrace:

[10:45:03] [Netty Server IO #1/WARN]: java.lang.reflect.InvocationTargetException
[10:45:03] [Netty Server IO #1/WARN]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[10:45:03] [Netty Server IO #1/WARN]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[10:45:03] [Netty Server IO #1/WARN]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[10:45:03] [Netty Server IO #1/WARN]: 	at java.lang.reflect.Method.invoke(Method.java:498)
[10:45:03] [Netty Server IO #1/WARN]: 	at dev.thomazz.pledge.util.ChannelHelper.encodeAndCompress(ChannelHelper.java:19)
[10:45:03] [Netty Server IO #1/WARN]: 	at dev.thomazz.pledge.network.handler.PacketFrameOutboundHeadHandler.flush(PacketFrameOutboundHeadHandler.java:88)
[10:45:03] [Netty Server IO #1/WARN]: 	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:776)
[10:45:03] [Netty Server IO #1/WARN]: 	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:768)
[10:45:03] [Netty Server IO #1/WARN]: 	at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:749)
[10:45:03] [Netty Server IO #1/WARN]: 	at io.netty.channel.ChannelOutboundHandlerAdapter.flush(ChannelOutboundHandlerAdapter.java:115)
[10:45:03] [Netty Server IO #1/WARN]: 	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:776)
[10:45:03] [Netty Server IO #1/WARN]: 	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:768)
[10:45:03] [Netty Server IO #1/WARN]: 	at io.netty.channel.AbstractChannelHandlerContext.access$1500(AbstractChannelHandlerContext.java:38)
[10:45:03] [Netty Server IO #1/WARN]: 	at io.netty.channel.AbstractChannelHandlerContext$16.run(AbstractChannelHandlerContext.java:756)
[10:45:03] [Netty Server IO #1/WARN]: 	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
[10:45:03] [Netty Server IO #1/WARN]: 	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
[10:45:03] [Netty Server IO #1/WARN]: 	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
[10:45:03] [Netty Server IO #1/WARN]: 	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
[10:45:03] [Netty Server IO #1/WARN]: 	at java.lang.Thread.run(Thread.java:750)
[10:45:03] [Netty Server IO #1/WARN]: Caused by: java.lang.ClassCastException: io.netty.buffer.PooledUnsafeDirectByteBuf cannot be cast to net.minecraft.server.v1_12_R1.Packet
[10:45:03] [Netty Server IO #1/WARN]: 	at net.minecraft.server.v1_12_R1.PacketEncoder.encode(PacketEncoder.java:17)
[10:45:03] [Netty Server IO #1/WARN]: 	... 19 more

Tested on: git-Paper-1618 (MC: 1.12.2) ; git-Paper-498 (MC: 1.19.4)

Also the problem persists with and w/o ViaVersion, ProtocolLib.

Thanks!

java.lang.ArrayIndexOutOfBoundsException: -1 when joining

Every time I join the server with Pledge enabled, I get an ArrayIndexOutOfBoundsException.

Server and client version: 1.8.9
Pledge version: 1.3
Only other plugins I have are Citizens and StrikePractice

Stacktrace:

[10:34:24 WARN]: A task raised an exception.
java.lang.ArrayIndexOutOfBoundsException: -1
        at io.netty.util.collection.IntObjectHashMap.put(IntObjectHashMap.java:109) ~[server.jar:git-Spigot-db6de12-18fbb24]
        at dev.thomazz.pledge.transaction.TransactionHandler.addIndex(TransactionHandler.java:158) ~[?:?]
        at dev.thomazz.pledge.transaction.TransactionHandler.lambda$tickStart$0(TransactionHandler.java:62) ~[?:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380) [server.jar:git-Spigot-db6de12-18fbb24]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [server.jar:git-Spigot-db6de12-18fbb24]
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [server.jar:git-Spigot-db6de12-18fbb24]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231]
[10:34:24 ERROR]: Could not read incoming packet!
[10:34:24 WARN]: java.lang.ArrayIndexOutOfBoundsException

3.0: Packets don't seem to be wrapped

I'm using createFramePinger. The transactions don't seem to wrap the packets of the server tick:
image
Pipeline is:
[pledge_queue_handler, FlushConsolidationHandler#0, timeout, decrypt, splitter, decompress, pe-decoder-pharus, decoder, encrypt, prepender, compress, pe-encoder-pharus, encoder, unbundler, bundler, FlowControlHandler#0, pledge_packet_listener, packet_handler, pledge_queue_primer, DefaultChannelPipeline$TailContext#0]

Using PacketSendEvent from packetevents makes the frame go around the next tick rather than the current packet/tick.

Hello,

When you use pledge.getOrCreateFrame() inside the PacketSendEvent on packetevents 2.0 (or probably any buffer-based packet system) the frame won't wrap around the current packet but only around the next tick's packets.

Here I used getOrCreateFrame() on the PlayerPosLook packet. That's the clientside log of incoming packets:
grafik

Looks like since Pledge's outbound handler comes before packetevent's encoder in the outbound netty pipeline, Pledge will queue the packets (aka cancel the write calls) and wait until the flush call. Then FIRST it checks if there has been any frames in the current tick, adds the frame's packets if there already is a frame and only then passes the write calls on to the next handlers, like packetevents, which means that when packetevents handler gets called for the packet Pledge already thinks this tick/packet doesn't have a frame since it hasnt even been created yet.

Pipeline:
grafik

In pledge's PacketFrameOutboundHandler:
grafik

I made a temporary fix for this which involves having Pledge's outbound handler sit after any packet system by adding it after the compress handler rather than the encoder. Since now pledge has to send buffers rather than packets I also had to change the PacketFactory to create a buffer rather than a packet. Idk if there's a better solution, this seems to work but I haven't tested it very much.
(top: PlayerHandler, bottom: TransactionPacketProvider, ping'd need the same)
grafik

I haven't tried other packet systems yet but my guess is that stuff like ProtocolLib 5 has similar problems since it's also buffer-based and therefore comes after pledge's handlers.

Could not get channel for player when joining

Happens quite often if you try to login with very high ping.

Caused by: java.lang.NoSuchFieldException: Could not find field in class net.minecraft.server.v1_8_R3.PacketStatusListener with names [EntityPlayer]

I've had the same error happen to me with PacketHandshakeListener instead.
Using ViaVersion 4.9.2 (joining on native server version, though) and ProtocolLib 5.1.0

[17:40:37 ERROR]: Could not pass event PlayerLoginEvent to Anticheat v1.0-SNAPSHOT
org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[patched_1.8.8.jar:git-PaperSpigot-445]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[patched_1.8.8.jar:git-PaperSpigot-445]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[patched_1.8.8.jar:git-PaperSpigot-445]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517) [patched_1.8.8.jar:git-PaperSpigot-445]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502) [patched_1.8.8.jar:git-PaperSpigot-445]
        at net.minecraft.server.v1_8_R3.PlayerList.attemptLogin(PlayerList.java:472) [patched_1.8.8.jar:git-PaperSpigot-445]
        at net.minecraft.server.v1_8_R3.LoginListener.b(LoginListener.java:118) [patched_1.8.8.jar:git-PaperSpigot-445]
        at net.minecraft.server.v1_8_R3.LoginListener.c(LoginListener.java:54) [patched_1.8.8.jar:git-PaperSpigot-445]
        at net.minecraft.server.v1_8_R3.NetworkManager.a(NetworkManager.java:231) [patched_1.8.8.jar:git-PaperSpigot-445]
        at net.minecraft.server.v1_8_R3.ServerConnection.c(ServerConnection.java:148) [patched_1.8.8.jar:git-PaperSpigot-445]
        at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:875) [patched_1.8.8.jar:git-PaperSpigot-445]
        at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [patched_1.8.8.jar:git-PaperSpigot-445]
        at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [patched_1.8.8.jar:git-PaperSpigot-445]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [patched_1.8.8.jar:git-PaperSpigot-445]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231]
Caused by: java.lang.RuntimeException: Could not get channel for player: TypicalFin
        at me.typicalfin.anticheat.shaded.pledge.channel.ReflectiveChannelAccess.getChannel(ReflectiveChannelAccess.java:68) ~[?:?]
        at me.typicalfin.anticheat.shaded.pledge.PledgeImpl.onPlayerLogin(PledgeImpl.java:218) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_231]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_231]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_231]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:300) ~[patched_1.8.8.jar:git-PaperSpigot-445]
        ... 14 more
Caused by: java.lang.NoSuchFieldException: Could not find field in class net.minecraft.server.v1_8_R3.PacketStatusListener with names [EntityPlayer]
        at me.typicalfin.anticheat.shaded.pledge.util.ReflectionUtil.getFieldByClassNames(ReflectionUtil.java:21) ~[?:?]        at me.typicalfin.anticheat.shaded.pledge.channel.ReflectiveChannelAccess.getChannel(ReflectiveChannelAccess.java:57) ~[?:?]
        at me.typicalfin.anticheat.shaded.pledge.PledgeImpl.onPlayerLogin(PledgeImpl.java:218) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_231]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_231]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_231]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:300) ~[patched_1.8.8.jar:git-PaperSpigot-445]
        ... 14 more```

Pledge interacts badly with PacketEvents

Hi, haven't used Pledge for a while but have started to again.

Pledge works fine by itself, and will still work when using PacketEvents alongside it, however using PacketEvent's write or send packet methods does not result in the packet being sent to the player. It does call PacketSendEvent (which is called when the packet is written, to my knowledge), but the player never actually receives the packet.

I don't think this is related to bundles. I tried forcefully disabling the bundle support but the same issue happened. This happens with any plugin on the server that uses PacketEvents, not just the one utilising Pledge.

This is the result of PE's ChannelHelper#pipelineHandlerNamesAsString (might be helpful?):
image

To easily reproduce, just setup a project with PacketEvents and Pledge and try sending a knockback packet to the player using PacketEvents.

Using Pledge 2.4, latest PacketEvents 2.0 and the server is Paper 1.19.4.

Client doesn't receive disconnect packets

When using for example, /kick, the client doesn't receive the disconnect packet and times out:
image

After some time (I believe this only appears with debug on in server.properties), the client disconnects and the following message appears:

[16:28:02 INFO]: Cotander issued server command: /kick Cotander
[16:28:02 INFO]: Cotander lost connection: Kicked by an operator
[16:28:02 INFO]: Cotander left the game.
[16:28:02 INFO]: [Cotander: Kicked Cotander: Kicked by an operator]
[16:28:06 WARN]: io.netty.channel.StacklessClosedChannelException
[16:28:06 WARN]:        at io.netty.channel.AbstractChannel.close(ChannelPromise)(Unknown Source)
[16:28:06 WARN]: io.netty.handler.timeout.ReadTimeoutException

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.