OldCombatMechanics

OldCombatMechanics

46.1k Downloads

player collisions per world are not working - not working with MVdWPlaceholderAPI

AmazedMender16 opened this issue ยท 20 comments

commented

Version: Latest
Server Version: Spigot 1.12.2 (latest)

When trying to set per world collisions it doesnt work it basically applies everywhere
disable-player-collisions:
enabled: true
worlds: [world001,world002]

commented

When MVdWPlaceholderAPI is loaded the entire player collisions stops working

commented

Ok so do you mean that the no-collisions feature is not working at all or that it works in all worlds when it should just be working in those specified?

With the above configuration, do worlds world001 and world002 have player collisions enabled?

And what changes relative to the above situation when MVdWPlaceholderAPI is loaded/unloaded?

commented

the world option should enable that only in these worlds the player collision is disabled right? like you cannot push eachother.

When MVdWPlaceholderAPI is loaded the entire collisions stops working no matter what world. it just stops you can basically push any player.

commented

Any updates about this issue?

commented

I'm assuming this is related to issue #160 , just that you actually bothered to give more info than just "it doesn't work"... The problem is that this module is extremely fiddly and can easily break because of other plugins interfering.

commented

I assume so... i have done some testing and it doesnt happen when mvdwplaceholderapi is unloaded or not installed. Then it all works fine besides the world option

Would love to see a fix for this.

commented

Any ETA date for a fix?

commented

@AmazedMender16
Do you use any scoreboard plugin? If so, can you tell us if it works if you remove the scoreboard plugin but leave MVdWPlaceholderAPI there?

Can't reproduce it with:

Plugins: TNTSpawnEvents, OldCombatMechanics, MVdWPlaceholderAPI, Flash

[20:46:50 INFO]: This server is running CraftBukkit version git-Spigot-4bd94dc-9ab298d (MC: 1.12.2) (Implementing API version 1.12.2-R0.1-SNAPSHOT)
[20:46:50 INFO]: Checking version, please wait...
[20:46:51 INFO]: You are 31 version(s) behind
commented

I do run featherboard but i have tried loading up the server only with oldcombatmechanics and mvdwplaceholderapi and i still wasnt able to walk thru the players. When i restarted and removed the mvdwplaceholderapi i was able to walk thru the players

commented

@AmazedMender16 Can you tell me the minecraft version, the OCM version and the output of pl?

commented

They all running the newest versions

commented

@AmazedMender16
Have a look at this

This is what it looks like for me. I am not sure if gvlfm could reproduce it, but without a good way to reproduce it, debugging is essentially impossible.

[OldCombatMechanics] Enabling OldCombatMechanics v1.6.5
[OldCombatMechanics] OldCombatMechanics v1.6.5 has been enabled
[MVdWPlaceholderAPI] Enabling MVdWPlaceholderAPI v2.5.1

[21:13:07 INFO]: This server is running CraftBukkit version git-Spigot-2086bb0-1988d7f (MC: 1.12.2) (Implementing API version 1.12.2-R0.1-SNAPSHOT)
[21:13:07 INFO]: Checking version, please wait...
[21:13:08 INFO]: You are running the latest version

Above is what I am running, what do you use?

commented

I have rechecked it now seems to be AnimatedNames that is causing it to not work. When i remove that plugin it seems to work just fine .....

commented

And that is premium. Awesome...
But I just assumed that plugin fakes a scoreboard team packet and yea, that breaks the OCM plugin.

Unfortunately the only real way to fix it I am aware of is listening to outbound packets of that type and setting the collision rule:

    ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this,Server.SCOREBOARD_TEAM) {
      @Override
      public void onPacketSending(PacketEvent event) {
        if (event.getPacketType() != Server.SCOREBOARD_TEAM) {
          return;
        }

        WrapperPlayServerScoreboardTeam wrapper = new WrapperPlayServerScoreboardTeam(
            event.getPacket()
        );
        wrapper.setCollisionRule("never");
        event.setPacket(wrapper.getHandle());
      }
    });

The benefit with this is that no matter what plugin decides to be stupid or clever or god knows what, it should not compromise the collision removal feature.

It requires a dependency on ProtocolLib though (or you set all the garbage yourself, but listening for sent packets requires some interesting reflection hacks, namely registering your own ChannelDuplexHandler and injecting that into all online Players. I did that a year ago or so and it isn't exactly fun, but maybe it has changed by now).

@gvlfm78
@AmazedMender16

PS: A cheap way to reproduce it is:

    PacketContainer packetContainer = new PacketContainer(Server.SCOREBOARD_TEAM);
    WrapperPlayServerScoreboardTeam wrapperPlayServerScoreboardTeam = new WrapperPlayServerScoreboardTeam(
        packetContainer);
    wrapperPlayServerScoreboardTeam.setPlayers(
        Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList())
    );
    try {
      ProtocolLibrary.getProtocolManager().sendServerPacket((Player) sender, packetContainer);
    } catch (InvocationTargetException e) {
      e.printStackTrace();
    }

Send that in a command or whatever.

commented

Eeh well the point of OCM is to not have any dependencies at all, so if that is the only fix then it would have to be coded using reflection. I might have a look at this in about two weeks when I will have plenty of time, unless @rayzr522 works on it first.

commented

@gvlfm78 As I said, you can also roll it yourself. It is just not as pleasant and more prone to breaking in the future (if the protocol changes) than using ProtocolLib.

I just tried it out though and my classes are still working fine and are able to intercept and modify the outgoing packets, so it seems like nothing has really changed in the past year. If you wanna write your own the implementation of TinyProtocol can be found here and my own here. I am posting mine too as TinyProtocol does a few things you don't need here that increase the complexity by a lot IMHO.

To see if it is the only fix one would need to have a look at how that plugin works and what packets it sends/changes it makes. Maybe there is a way to correct it in a different way, this blanket change of all packets was just the easiest solution I think is likely to work in any case.

commented

@AmazedMender16 Can you try this version of OCM? The md5 is 781bc1996f7038d550e15c730e1c259b, if you wanna check it.

If you are sceptical of it and don't want to download a jar from a weirdo on the internet, I can push my fork to github alongside with instructions on how to build it.

Note that it disables collision everywhere, not just in the worlds in the config.

commented

@AmazedMender16 Yes, but if it works it at least fixes the issue and one can work on doing something similiar in OCM. At the moment it is my guess that it will solve the issue, not hard proof as I don't own the plugin in question.

commented

But this does not fix the issue with the original OCM :)

commented

@I-Al-Istannen The version you send earlier has fixed the issue..