-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Update holograms on PlotChangeOwnerEvent in correct way #109
Conversation
I'd assume this call
to already prevent the issue from happening in the first place, do you know why that isn't the case? |
Ohh, I should have looked into the method updatePlayer. As far as I see it should handle the "replacement" of the lines, which is not working right, too. Sorry for my English. I am a German student. |
I found out why the updatePlayer methode isn't working in the way it should. I will investigate that when I have time in the next days. Edit: It is not working, because in this line the plot has a new owner, so the hash in the HoloPlotID instance is a different one, in comparison to the stored hologram in the HashMap.
Because of that it is entering following if statement block:
The options I am seeing to fix this, is (1) adding an UUID argument with the old player to the updatePlayer methode, which gets the result of e.getOldPlayer() on the call in onPlotChangeOwner and in the other calls from the other subscribed events null or (2) removing the hologram in onPlotChangeOwner (without missing to remove it from the HashMap) and then calling the updatePlayer methode again. If it would be my plugin i would solve it in the second way. @SirYwell just write me the way I should use (If there is a better one just write too) then I am going to make a new commit in this pr tomorrow. |
Good catch, that makes sense. I think your second suggestion makes sense, but there should be a comment in the code explaining it briefly. |
Now it is removing the HoloPlotID key completely from the HashMap. I also added an information comment, why this way is selected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor nitpick, but looks good otherwise.
Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable
Overview
Fixes #43
Description
This fixes a bug, where new holograms where created on PlotChangeOwnerEvent, but the old one wasn't removed. Because of that there was a huge stack of armorstands and unreadable text created over the time. With this pull request it is going to be deleted first and then the a new one ist created.
Submitter Checklist
@since TODO
.