Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of onTNTExitPortal #2124

Merged
merged 6 commits into from
Oct 4, 2023

Conversation

TreemanKing
Copy link

@TreemanKing TreemanKing commented Aug 6, 2023

Removes the entity preemptively rather than reactively.

Edit: Removes the event entirely.

Fixes #2119

{
if (event.getEntityType() != EntityType.PRIMED_TNT)
return;
if (event.getTo().getWorld().getEnvironment() != Environment.THE_END)
if (event.getLocation().getBlock().getType() == Material.END_PORTAL)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this handle cases of end portal blocks that don't actually end up teleporting an entity/are plugin-handled/end portals in non-default worlds?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, will deal with all of the above.

Using the EntityEnterPortalEvent, you can only determine the location of entry and what block it is.

It shouldn't interfere with any portal plugins, however would probably be best to be configurable for future references if the server admins would like it to be close to the vanilla state.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Robo's more asking "will this result in TNT that is not teleporting being removed" and I believe the answer is yes, though I'm not sure that it matters much. We could swap to the EntityTeleportEvent instead and see if it's from an end world to a non-end world with the correct cause.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it would although as you said I don't believe there are many problems that could arise as a result of this change. In most cases, if the End hasn't been generated, the TNT will just drop into the lava at the end portal structure.

In terms of clashes with other possible plugins which use portals, they would probably there own instances to remove other entities from teleporting.

I've attempted the EntityTeleportEvent before this and it would still crash the server.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It crashes even when cancelled? That seems shocking, honestly. Either way, yeah, I don't see this implementation as being problematic.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I tried that method first before attempting this one. Obviously the destination would be a lot better to use but it would also crash the server.

@RoboMWM
Copy link

RoboMWM commented Aug 14, 2023

My modification of Portalstick (well, an addon) uses the gateway portal blocks. I know it isn't the same portal block being used here (though I did initially use this), but if I were using that block in another plugin, I wouldn't want to have teleporting entities just get deleted on me.

@Jikoo
Copy link
Member

Jikoo commented Aug 15, 2023

I wouldn't want to have teleporting entities just get deleted on me.

That does make sense, but I think the key part here is that the entity is TNT - teleporting TNT smells of some weird niche grief attempt.

Could add a config option for it, i.e. "BlockTeleportTNT" and just deny TP rather than remove?

@TreemanKing
Copy link
Author

TreemanKing commented Aug 18, 2023

If you just cancel the event, wouldn't it just be the same as removing the entity?

I also agree that if it's TNT, it would only cause harm and would probably be disabled for most plugins regardless due to its functionality only being for excavating, grief or farms.

I'll have a go at the configuration as well.

@TreemanKing
Copy link
Author

I've chucked it in. Let me know if it's alright. Also let me know if you want me to revert back to the other method (even though it isn't efficient in the slightest to do it like it was)

@RoboMWM
Copy link

RoboMWM commented Aug 24, 2023

The more I think about this the more I see that it's better to just remove. This does appear to be a weird niche, where it could be attempts to cause issues with overworld or the_end spawn. Given the comments, it's probably about the latter. Either way, I don't really see much of a use case for either situation - if the end spawn is desired to be protected, then a claim will solve that immediately. The only thing then I could think of is explosion damage.

The config is a bit ambiguous, and would require looking at documentation to determine what it is. I'm more in favor of just removing this for now. However, since it was reported - I do wonder if it's still a concern for grief... who else has encountered this bug? I want more input on this.

Also it seems that Paper has pushed a fix to this. PaperMC/Paper@408a905

@TreemanKing
Copy link
Author

The more I think about this the more I see that it's better to just remove. This does appear to be a weird niche, where it could be attempts to cause issues with overworld or the_end spawn. Given the comments, it's probably about the latter. Either way, I don't really see much of a use case for either situation - if the end spawn is desired to be protected, then a claim will solve that immediately. The only thing then I could think of is explosion damage.

The config is a bit ambiguous, and would require looking at documentation to determine what it is. I'm more in favor of just removing this for now. However, since it was reported - I do wonder if it's still a concern for grief... who else has encountered this bug? I want more input on this.

Also it seems that Paper has pushed a fix to this. PaperMC/Paper@408a905

I encountered the crash in testing but I honestly think it is completely redundant. It can honestly just be admin claimed and you'll be protected on the platform spawn. I'll edit the PR to remove it entirely if so.

@RoboMWM
Copy link

RoboMWM commented Sep 11, 2023

ya, I don't have much feedback on this (idk who else I should ask) but I see no need to handle it, so can just remove it ye.

Retire Event - Redundant
@RoboMWM RoboMWM merged commit 5d428d8 into GriefPrevention:master Oct 4, 2023
@TreemanKing TreemanKing deleted the fixPrimedTNTCrash branch October 5, 2023 01:45
@TreemanKing TreemanKing changed the title Update EntityEventHandler.java - Replace EntityPortalExitEvent with EntityPortalEnterEvent Removal of onTNTExitPortal Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server crash when TnT goes through end portal
3 participants