[SPIGOT-5309] Invisible armorstands can't be removed by players (no plugins installed) Created: 04/Sep/19 Updated: 06/Oct/19 Resolved: 06/Oct/19 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | LoneDev | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 3 |
| Labels: | 1.14.4 | ||
| Version: | This server is running CraftBukkit version git-Spigot-065a373-763e560 (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT) |
| Plugin: | No plugins, server is clean |
| Guidelines Read: | Yes |
| Description |
|
Armor stand can't be removed by player, it was possible back in previous versions of spigot 1.14.4 (something like a week ago). Seems this is the bad patch: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/6ed8a189660db58e31d4768a1916a3e79a73d544
Spawn an invisible armorstand and you can't break it. /summon minecraft:armor_stand ~ ~ ~ {Invisible:true}
Was this an intentional behaviour? I don't see why because Minecraft has Invincible tag, I don't think it's right to make Invisible tag also apply the Invincible behaviour to the ArmorStand{{}}
Thanks a lot |
| Comments |
| Comment by Andreu Bacardit Font [ 06/Oct/19 ] |
|
ok thanks friend when I have time I try it, I hope I don't have to touch code since I have little time with work, thanks for the information xD |
| Comment by jojokobi [ 06/Oct/19 ] |
|
I made that the event just fires as before but when the armor stand hit is invisible the event is already fired in a cancelled state. So I'm pretty sure you won't have to change anything and just run the BuildTools to get the newest Spigot build. And btw.: Thank you @md_5 for helping me with the PR and responding so fast
|
| Comment by Andreu Bacardit Font [ 06/Oct/19 ] |
|
In the end how has it been fixed? Where can I see the resolution? Thank you |
| Comment by Phoenix616 [ 29/Sep/19 ] |
|
Imo. instead of not firing the entity damage event it should fire cancelled with the amount of damage that would've been done if it wasn't invulnerable in Vanilla. (and apply that damage if uncancelled) At least that behaviour would be in line with how other events work in respect to vanilla behaviour. |
| Comment by jojokobi [ 23/Sep/19 ] |
|
As it seems this issue still, isn't fixed so I decided to make pull request. Should I modify EntityDamageEvent to have a special flag or something (which is the option that I'd prefer) or implement a new EntityLeftClickEvent. And if I do it with EntityDamageEvent should I add a boolean called "invisble" or something, that indicates if the damage has been blocked because the armor stand was invisible and makes getTotalDamage () return 0.0 or should I make a new DamageModifier? I know that DamageModifier is deprecated but the whole EntityDamageEvent is still implemented through them.
Thanks in advance, jojokobi |
| Comment by Andreu Bacardit Font [ 11/Sep/19 ] |
|
Thanks friends, I hope not to have to use more accessories and the resolution is good for everyone, for now I use a previous spigot since I do not have more time for now to have to modify a hundred lines of code ... but thanks for the help friend xD |
| Comment by LoneDev [ 11/Sep/19 ] |
|
Andreu just use my method with ProtocolLib. Btw I hope to see an update in the next month Thanks md5 for the efforts |
| Comment by md_5 [ 11/Sep/19 ] |
|
>This was done expressly for developers [[citation needed]] |
| Comment by Andreu Bacardit Font [ 11/Sep/19 ] |
|
This was done expressly for developers so that they could make vehicle plugins, totally different mobs etc .. customizations, this was created so that this type of development could be done has always been known is always known, really not It is a mistake since it was expressly controlled, the best solution would be to leave it as before, cordial greetings friend xD |
| Comment by LoneDev [ 11/Sep/19 ] |
|
Problem is that this was a bug since early Bukkit releases (I think). I don't really like bugs to be used as features, so, it's right to change how it works, but I hope we'll have the best fix that doesn't introduce new headaches to devs |
| Comment by Andreu Bacardit Font [ 11/Sep/19 ] |
|
please! leave it as it was before and that each programmer manages the events as best interests him since the armorstands are used for many plugins and many functions please leave it as before just ask for this thanks! |
| Comment by LoneDev [ 11/Sep/19 ] |
|
You're right @md_5. So I don't find any other solutions beside these:
I don't think editing PlayerInteractEntityEvent will fit since has a different usage, it's called when user right clicks an entity. If you modify it to be called also when user left clicks an entity it would be bad since a lot of plugins would be broken (plugins which listen to this event to get right click to open a GUI will open the GUI also in attack, for example). |
| Comment by md_5 [ 11/Sep/19 ] |
|
>Wait... I already edited that PR. It uses interact event now. No, but the point is all its doing is throwing in a damage event.... when no damage is occurring. |
| Comment by jojokobi [ 10/Sep/19 ] |
|
I know thank you, but I want to avoid using a library for something that will be fixed soon anyways. I'm just going to stick with an older build till it gets fixed. |
| Comment by LoneDev [ 10/Sep/19 ] |
|
As I've said before you can just use my method while you're waiting md5 to fix the issue in the best way: https://www.spigotmc.org/threads/check-if-armorstand-is-left-clicked-by-player.394264/#post-3542242
ProtocolManager manager = ProtocolLibrary.getProtocolManager(); manager.addPacketListener(new PacketAdapter(Main.main, PacketType.Play.Client.USE_ENTITY) { @Override public void onPacketReceiving(PacketEvent e) { PacketContainer packet = e.getPacket(); if(packet.getEntityUseActions().getValues().get(0) != EnumWrappers.EntityUseAction.ATTACK) return; Entity entity = null; for(Entity entry : e.getPlayer().getWorld().getNearbyEntities(e.getPlayer().getLocation(), 10, 10, 10)) { if(entry.getEntityId() == packet.getIntegers().read(0)) entity = entry; } } @Override public void onPacketSending(PacketEvent event){} }); |
| Comment by jojokobi [ 10/Sep/19 ] |
|
I'm actually pretty sure it's possible. Tell me what your custom mobs should do and maybe I can help. You I also did it with armor stands and it looks like I'm going to have to switch to zombies. |
| Comment by Andreu Bacardit Font [ 10/Sep/19 ] |
|
Impossible, I have vehicles, mobs larger than a zombie a long etc. It is impossible I have already looked at it the best is what LoneDev says and that each programmer controls it as he needs since you have the event option canceled as very well says LoneDev . Greetings. |
| Comment by jojokobi [ 10/Sep/19 ] |
|
@Andreu: If the final solution will not have an option to detectd, if mobs are trying to hit the armor stand, you can simply use another entity (e.g. a zombie) to make custom mobs. You can clear the goal pathfinder goals, so it will not move and you can do everything with it you did with the armor stand.
EDIT: I skipped some words in a sentence |
| Comment by LoneDev [ 10/Sep/19 ] |
|
Andreu, Just chill, we are all frustrated but md5 is doing his best to keep code cleaner as possible. Btw I would love the event to be left as it was before, because setting it as cancelled is not a good solution. The reason is that plugins check if event is canceled to know if user has permission to attack mobs in protected areas, that's why a special flag would be better. If you leave the event as it was before, coders just need to check if entity is armorstand and if it's invisible, I don't see the problem on leaving it as it was before. Another solution is to add another event to avoid misunderstanding above all modding community, something like PlayerLeftClickArmorStandEvent would be nice it would be triggered everytime a player attacks armorstand
|
| Comment by Andreu Bacardit Font [ 10/Sep/19 ] |
|
because you harm people who develop very clearly such as the chunregen that no longer exists in the 14th, it is now impossible to maintain a map etc., now with the armorstands we could develop PERSONALIZED mobs with their textures etc. and simulate damage by throwing, arrows etc ... now with this change they have stopped working, each time you leave the most defenseless programmers and do not let them carry out the actions of the events and the treatment of the same as each developer considers, the armor stand if it is invisible matter is an entity and must be able to function the same etc. So I can justify my anger because they are shared by many people who have already stopped programming for minecraft, I still follow but my anger is more than justified and shared. I just hope you leave as before as it was because the few plugins for minecraft have stopped working. Greetings. |
| Comment by Duy Anh [ 10/Sep/19 ] |
|
Wait... I already edited that PR. It uses interact event now. |
| Comment by md_5 [ 10/Sep/19 ] |
|
Andreu, Your attitude on every ticket I have seen you participate in on this bug tracker has been terrible. Keep it up and you will be banned. Re: the issue - regardless of how you look at it the old behaviour was wrong. It was calling a damage event when no damage was actually happening. My preferred solution would be expanding the interact event to handle left clicks, which is not what the PR does (as I recall it just adds a new dummy damage event which is perhaps even more questionable). |
| Comment by Andreu Bacardit Font [ 10/Sep/19 ] |
|
This is a terrible false solution, bad solution and forces to change a lot of unnecessary code! Please simply leave it as it has always worked and for each programmer to do what is most useful, necessary in their code but do not remove the invisible armorstand from the event, please! since it is not invulnerable mode only invisible and have to go out in the EVENTS PLEASE! Thank you! |
| Comment by Duy Anh [ 10/Sep/19 ] |
|
idk but it would take time about 2-3 days for md_5 to review the code |
| Comment by jojokobi [ 10/Sep/19 ] |
|
I'd prefer a special flag than setting the damage to 0. This way nothing would have to be changed in existing plugins. @Duv Anh: Any progress with your Pull Request and how long does it usually take for a Pull Request to be accepted? I'm new here. |
| Comment by LoneDev [ 09/Sep/19 ] |
|
Just make the event called like before but set damage to 0 or add a special flag
|
| Comment by Duy Anh [ 08/Sep/19 ] |
|
make sense |
| Comment by Andreu Bacardit Font [ 08/Sep/19 ] |
|
Simply put the code as before! and each programmer carry out the controls that he thinks is appropriate! please stop complicating the lives of those who create plugins or have servers please! |
| Comment by jojokobi [ 08/Sep/19 ] |
|
I'd also prefer this solution @Black Hole, since it would save me some time refactoring my code, but I'm comfortable with any solution as long as it will be fixed soon |
| Comment by Black Hole [ 08/Sep/19 ] |
|
PlayerInteractEntityEvent and PlayerInteractAtEntityEvent should be called for right clicking an entity only. |
| Comment by Duy Anh [ 08/Sep/19 ] |
|
Hey, you are wrong because armor stand is an entity, there is at least one possible event that can be triggered: CreatureSpawnEvent *surprise* |
| Comment by Andreu Bacardit Font [ 08/Sep/19 ] |
|
It is terrible if the armor-stand is invisible does not trigger any events! it's terrible! It does not work: PlayerInteractEntityEvent, PlayerArmorStandManipulateEvent, EntityDamageEvent etc. none!! big mistake big bug !! please fix this !! |
| Comment by Andreu Bacardit Font [ 08/Sep/19 ] |
|
It is insufficient! because I can't detect when they shoot with arrows, balls etc ... I need events to be activated as before please! |
| Comment by Duy Anh [ 08/Sep/19 ] |
|
@jojokobi, you can look at PlayerInteractEntityEvent and PlayerArmorStandManipulateEvent, the first one for left-click and the second one for right-click (there are two events because you can get the item stack from armor stand, so it need a separate event; but if you do this with other entities, only PlayerInteractEntityEvent is needed) |
| Comment by Andreu Bacardit Font [ 08/Sep/19 ] |
|
I have the same problem! my plugins with armor-stand have stopped working because events are not activated! EntityDamageEvent etc ... because they are invisible now the user cannot remove them! please why are you doing these things? Fixing this is not invulnerable if you are invisible or do not have to activate events please! fix this thanks! |
| Comment by jojokobi [ 08/Sep/19 ] |
|
Ok thank you. I hope your PR will be merged soon. And beacause you asked why i want to make zombies aggressive towards armor stands:
EDIT: Will the event also have a boolean or something to determine if it's a right or a left click? |
| Comment by Duy Anh [ 08/Sep/19 ] |
|
In vanilla, there is no vulnerable and invisible armor stand, because once it is invisible, it also means it is invulnerable. (Armor stand is something special, as other invisible mobs can get damaged as well) |
| Comment by LoneDev [ 08/Sep/19 ] |
|
How can you make armorstands vulnerable and invisible at same time? That's the question. |
| Comment by Duy Anh [ 08/Sep/19 ] |
|
I already made a PR for this, from Ugleh's suggestion, PlayerInteractEntityEvent is now triggered if a player left-clicks invulnerable entities (include invisible armor stand). So all plugins just need to listen to this event along with the old event EntityDamageEvent. No need to make a separate 1.14 branch. |
| Comment by jojokobi [ 07/Sep/19 ] |
|
I think it would also be good if the EntityDamageEvent still would be fired, cause otherwise it would break a lot of plugins (including all of mine). Maybe adding a boolean field to EntityDamageEvent that indicates if the damage is really applied (or just setting the value of getFinalDamage() to 0) would be an option. For example in my plugin I make zombies aggressive against an armor stand an need to get the damage they would deal, which wouldnt be possible with a PlayerLeftClickEntityEvent.
Btw: @Ugleh did you already submit a commit or are you still working on it? |
| Comment by LoneDev [ 05/Sep/19 ] |
|
It's okay That's why I prefer not to messup with that logic and create a new event PlayerLeftClickEntityEvent |
| Comment by Ugleh [ 05/Sep/19 ] |
|
I totally forgot about that. Thanks for reminding me. |
| Comment by LoneDev [ 05/Sep/19 ] |
|
Currently PlayerInteractEntityEvent is called two times, first with OFFHAND slot and the second one with HAND slot, which has no sense to me, so I think your idea to add getClickedEntity would fit. |
| Comment by Ugleh [ 05/Sep/19 ] |
|
I spoke briefly in IRC asking for advice but further looking into it PlayerArmorStandManipulateEvent extends PlayerInteractEntityEvent, which is defined in the javadocs as a right-click event. Not sure if that is entirely correct nowadays seeing as PlayerInteractEntityEvent has an EquipmentSlot enum it uses to determine which hand was used. I will deprecate getRightClicked(), add getClickedEntity(), and take advantage of the already existing getSlot() method. All I would need to do is add the event call in the EnttiyArmorStand class. |
| Comment by LoneDev [ 04/Sep/19 ] |
|
PlayerInteractAtEntityEvent is not fired when armorstand is attacked by player. Also PlayerArmorStandManipulateEvent is not called |
| Comment by md_5 [ 04/Sep/19 ] |
|
Doesn’t https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerInteractEntityEvent.html or one of its subclasses already fire. |
| Comment by LoneDev [ 04/Sep/19 ] |
|
If anyone's interested I ended up using packets to detect this behaviour, but I still hope spigot will have a leftclick event implemented. https://www.spigotmc.org/threads/check-if-armorstand-is-left-clicked-by-player.394264/#post-3542242 |
| Comment by LoneDev [ 04/Sep/19 ] |
|
I think that could work, but would be wrongly detected as "no entity damage permission" by plugins that want to check if user can attack mobs in other users protected areas. For example GriefPrevention or Worldguard which surely check if (event.isCancelled())
|
| Comment by Black Hole [ 04/Sep/19 ] |
|
Spigot could call a damage event which is cancelled already. |
| Comment by LoneDev [ 04/Sep/19 ] |
|
Wouldn't a PlayerLeftClickArmorStandEvent event be nice to be added? Since now we have no way to tell if user left clicked an hologram |
| Comment by LoneDev [ 04/Sep/19 ] |
|
So it's a vanilla behaviour and not a bug, thanks for the clarification.
The purpose is that I need to check if a user is trying to remove an invisible armorstand that is used to create a furniture using items in head and arms. Is there another event I can listen to in order to check if a user is trying to remove an invisible armorstand/left click it?
Thanks a lot |
| Comment by Black Hole [ 04/Sep/19 ] |
|
It seems in vanilla Minecraft you can't damage an invisible or marker armorstand. So you're asking to reintroduce a bug? What's the use case for this? |
| Comment by Duy Anh [ 04/Sep/19 ] |
|
You can't damage an invisible armor stand, even in creative mode. |