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

Fixed many bugs in BuildBattle plugin #86

Merged
merged 12 commits into from
Jun 28, 2024

Conversation

Waterman1001
Copy link
Contributor

Hi again, I have been working on resolving some bugs within BuildBattle that I found.
The most noticable error is the Menu Item not working when in-game, so it is impossible to open the BuildBattle menu for players.
I found out the reason for this is that BuildBattle uses the MiniGamesBox API at two different places regarding the menu item.

  • It registered it as special item using the API in registerSpecialItems() present in AdditionalValueInitializer.java
  • It registered it as a separate HandlerItem in getMenuItem() present in BaseArena.java.
    The first use did not provide an InteractHandler to the item (it takes it from the special_items.yml config and this one is empty), while the second use did actually correctly provide an InteractHandler. However, since it was looped through the array of special items and as soon as a matching ItemStack was found, a menu item having no Interact Handler was picked by the loop and therefore the correct item was dismissed, making the menu item not work anymore.

I have changed this now, such that the second use case is removed from the code and it only registers the menu item as a special item just like any other item. However, since the 'execute' path in special_items.yml needs to have some command, I also added an argument to the buildbattle command, namely /bb menu, which allows a player to open the BuildBattle menu. I then added this command argument to the config file and voila, once a player clicks the menu item (only while being in-game of course), the interacthandler properly fires and the Menu Item is fixed! :)

Next to this change, some other fixes have been applied:

  • Enderpearls allowed players to teleport through the arena and visit other players plots. It even allowed during voting period to teleport away out of the map. I have disabled throwing enderpearls.
  • RespawnAnchors could be loaded all up with glowstone and the explosion was not disabled. It could blow up the entire arena! I have disabled the explosion damage.
  • Place rewards were firing multiple times for the same players. So a player ending first place would also receive second place, third place rewards, etc. This was due to incorrect usage of the MiniGamesBox api. It was a quick fix, but it works.
  • Only the %player% placeholder works in the config.yml file, not uppercase %PLAYER%. I have changed the default generation of the config to the lowercase variant.
  • Clicking on the first clock provided in the time change menu in the BuildBattle menu generated an error. I have resolved this error.

Hopefully these changes are welcome. I have worked quite a bit on them while trying to change as minimal as possible. Only the bare necessities should be fixed by this PR.

Thank you in advance! 😄

@Lagggpixel Lagggpixel self-requested a review June 28, 2024 06:28
@Lagggpixel Lagggpixel assigned Lagggpixel and unassigned Lagggpixel Jun 28, 2024
@Lagggpixel Lagggpixel added the bug Something isn't working label Jun 28, 2024
@Lagggpixel
Copy link
Member

Thank you for your contributions.

@Lagggpixel Lagggpixel merged commit 6259422 into Plugily-Projects:development Jun 28, 2024
1 check failed
Tigerpanzer02 added a commit that referenced this pull request Jul 9, 2024
Special thanks to https://github.com/Waterman1001

* Bump version from 5.0.7-SNAPSHOT1 to 5.0.8

* Fixed many bugs in BuildBattle plugin (#86)

* Updated plugin.yml to prevent invalid file error on startup

* Changed version of dependency MiniGamesBox to circumvent build issues

* Fixed error in time change menu

* Fixed issue with %player% placeholder (should be lowercase)

* Bump version from 5.0.7-SNAPSHOT1 to 5.0.8

* Fixed problem in place rewards

* Cancelled BlockExplodeEvent to prevent blocks such as Respawn Anchor explode and damage the arena.

* Fixed BuildBattle menu item not working because API was used at 2 different places. Added bb menu command and used registerSpecialItem to fix.

* Disabled enderpearl throwing while in arena because it allows to teleport to other players plots or outside the arena map, even during voting stage.

* Changed back version number of MiniGamesBox to 1.3.10

* Fixed small error if non-player threw projectile.

---------

Co-authored-by: version-bump[github-action] <41898282+version-bump[github-action]@users.noreply.github.com>

* Bump version from 5.0.8 to 5.0.8-SNAPSHOT0

* fix: fixed ChunkManager.sendMapChunk

* Bump version from 5.0.8-SNAPSHOT0 to 5.0.8-SNAPSHOT1

* Updated to minigamesbox 1.3.11

* Bump version from 5.0.8-SNAPSHOT1 to 5.0.8-SNAPSHOT2

* Update CHANGELOG.md

---------

Co-authored-by: version-bump[github-action] <41898282+version-bump[github-action]@users.noreply.github.com>
Co-authored-by: Onno <emailodg@gmail.com>
Co-authored-by: Lagggpixel <lagggpixel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants