EssentialsX / Essentials

The modern Essentials suite for Spigot and Paper.
https://essentialsx.net
GNU General Public License v3.0
1.95k stars 981 forks source link

Essentials AntiBuild doesn't protect against player destruction of Ender Crystals #4418

Open draand28 opened 3 years ago

draand28 commented 3 years ago

Type of bug

Exploit

/ess version output

[14:00:06 INFO]: Server version: 1.8.8-R0.1-SNAPSHOT git-PaperSpigot-"4c7641d" (MC: 1.8.8) [14:00:06 INFO]: Brand version: CraftBukkit [14:00:06 INFO]: EssentialsX version: 2.19.0-dev+226-17e026f [14:00:06 INFO]: PlaceholderAPI version: 2.10.4 [14:00:06 INFO]: Vault version: 1.7.3-b131 [14:00:06 INFO]: GroupManager version: 2.9 (Phoenix) [14:00:06 INFO]: Citizens version: 2.0.28-SNAPSHOT (build 2358) [14:00:06 INFO]: EssentialsXProtect version: 2.19.0-dev+226-17e026f [14:00:06 INFO]: EssentialsXChat version: 2.19.0-dev+226-17e026f [14:00:06 INFO]: EssentialsXAntiBuild version: 2.19.0-dev+226-17e026f [14:00:06 INFO]: EssentialsXSpawn version: 2.19.0-dev+226-17e026f [14:00:06 INFO]: Economy Layer: None [14:00:06 INFO]: You are running unsupported plugins! [14:00:06 INFO]: You are running a server with limited API functionality. EssentialsX will still work, but certain features may be disabled. [14:00:06 INFO]: Fetching version information... [14:00:06 INFO]: You're running the latest EssentialsX dev build!

Server startup log

https://paste.gg/p/anonymous/24234105af3148f181f9b4599d95626e

EssentialsX config files

https://paste.gg/p/anonymous/3268c383895141a6901ad601f3dc1de9

Error log (if applicable)

https://paste.gg/p/anonymous/1734efd2ce784964b1120fcbfd5e5a89

Bug description

When using latest dev version of EssentialsX, with Antibuild as well, any player can break the EnderCrystals by left clicking on them, even though they can't break any other block (as they don't have permission to). I have disabled the Ender Crystal explosion in config.yml but that doesn't solve my issue as it only prevents player from doing other block/entity damage with the crystals, they can still destroy the crystal. The error in the log happens exactly when any player decides to destroy an Ender Crystal.

Steps to reproduce

Use paper 1.8.8 and latest EssX dev and try to break an Ender Crystal (even if you are OP, the error persits in console).

Expected behaviour

There should be no error in the console and the players should not be able to destory the Ender Crystals.

Actual behaviour

There's the above mentioned error in console and players without build permission can break the Ender Crystal.

tatteaid commented 3 years ago

Probably happening because it's making the type = Material.END_CRYSTAL, which doesn't exist in versions that are below 1.9.

https://github.com/EssentialsX/Essentials/blob/e43f06bfa6db9fd449a29d072ca13a8aa3283468/EssentialsAntiBuild/src/main/java/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java#L252-L260

pop4959 commented 3 years ago

Looks like support for tile entities was added by mapping entities to their material counterparts, since that was the easiest implementation due to AntiBuild traditionally only dealing with blocks. However it's pretty obvious this causes a problem when the entity has no such mapping (such as here in 1.8 for ender crystals).

The error could be easily "fixed" by checking if the version is above 1.8, but then ender crystal protection would not be supported on that version using AntiBuild. A proper fix would involve building in full support for entities separate from materials, however that is far more extensive change, and may be overreaching. Typically behavior and entity protection such as for ender crystals are handled by the EssentialsProtect plugin.

StopUsingOutdatedCrap commented 2 years ago

@draand28 or just stop using ancient MC versions that have more bugs than features ¯\ (ツ)/¯ Easiest fix ever :)

osfanbuff63 commented 2 years ago

@draand28 or just stop using ancient MC versions that have more bugs than features ¯\ (ツ)/¯ Easiest fix ever :)

Not true, EssX AntiBuild is a plugin for 1.18/1.19 (whenever it's updated). This case might be true here, but that most likely won't think this issue.

StopUsingOutdatedCrap commented 2 years ago

Not true, EssX AntiBuild is a plugin for 1.18/1.19 (whenever it's updated). This case might be true here, but that most likely won't think this issue.

What? I said that his MC version is ancient...not the plugin

Chew commented 2 years ago

We still support 1.8.8, the version this issue occurs on. Obviously, it's not a high priority for us. Regardless, as much as you (and we both) do not like 1.8, suggesting we don't support it is not a valid fix to this issue.