Add BedWars2023 compatibility + 2 new tasks#818
Open
josemarcellio wants to merge 5 commits intoLMBishop:masterfrom
Open
Add BedWars2023 compatibility + 2 new tasks#818josemarcellio wants to merge 5 commits intoLMBishop:masterfrom
josemarcellio wants to merge 5 commits intoLMBishop:masterfrom
Conversation
Collaborator
|
That's quite a lot of code to review man I will try to merge it this week |
Krakenied
requested changes
Feb 3, 2026
| Task task = pendingTask.task(); | ||
| TaskProgress taskProgress = pendingTask.taskProgress(); | ||
|
|
||
| String requiredId = (String) task.getConfigValue("item"); |
Collaborator
There was a problem hiding this comment.
Cannot be null if there's required config validator on that.
|
|
||
| String boughtIdentifier = boughtContent.getIdentifier(); | ||
| ItemStack boughtStack = boughtContent.getItemStack(buyer); | ||
| String boughtMaterial = boughtStack != null ? boughtStack.getType().name() : null; |
Collaborator
There was a problem hiding this comment.
We use ItemStacks directly with exact-match option for checking materials (with a cache).
Take a look into other task types with item option.
Comment on lines
+65
to
+81
| if (requiredId.equalsIgnoreCase(boughtIdentifier)) { | ||
| matched = true; | ||
| super.debug("Matched identifier " + boughtIdentifier, | ||
| quest.getId(), task.getId(), buyer.getUniqueId()); | ||
| } | ||
|
|
||
| if (!matched && requiredId.equalsIgnoreCase(boughtMaterial)) { | ||
| matched = true; | ||
| super.debug("Matched material " + boughtMaterial, | ||
| quest.getId(), task.getId(), buyer.getUniqueId()); | ||
| } | ||
|
|
||
| if (!matched) { | ||
| super.debug("Bought item (" + boughtIdentifier + "/" + boughtMaterial + ") does not match required " + requiredId, | ||
| quest.getId(), task.getId(), buyer.getUniqueId()); | ||
| continue; | ||
| } |
Comment on lines
+85
to
+89
| int progress = taskProgress.getProgress() instanceof Integer | ||
| ? (int) taskProgress.getProgress() | ||
| : 0; | ||
| progress += boughtAmount; | ||
| taskProgress.setProgress(progress); |
Collaborator
There was a problem hiding this comment.
There's dedicated method for that. Take a look into other task types.
| return; | ||
| } | ||
|
|
||
| String collectedMaterial = collectedStack.getType().name(); |
| return; | ||
| } | ||
|
|
||
| String collectedMaterial = collectedStack.getType().name(); |
Comment on lines
+56
to
+64
| if (requiredId == null) { | ||
| continue; | ||
| } | ||
|
|
||
| if (!requiredId.equalsIgnoreCase(collectedMaterial)) { | ||
| super.debug("Collected " + collectedMaterial + " does not match required " + requiredId, | ||
| quest.getId(), task.getId(), player.getUniqueId()); | ||
| continue; | ||
| } |
| quest.getId(), task.getId(), player.getUniqueId()); | ||
|
|
||
| int progress = TaskUtils.incrementIntegerTaskProgress(taskProgress, collectedAmount); | ||
| int amount = ((int) task.getConfigValue("amount")); |
| taskTypeManager.registerTaskType(() -> new BedWars1058FinalKillTask(this), () -> CompatUtils.isPluginEnabled("BedWars1058")); // not tested | ||
| taskTypeManager.registerTaskType(() -> new BedWars1058LoseTask(this), () -> CompatUtils.isPluginEnabled("BedWars1058")); // not tested | ||
| taskTypeManager.registerTaskType(() -> new BedWars1058WinTask(this), () -> CompatUtils.isPluginEnabled("BedWars1058")); // not tested | ||
| taskTypeManager.registerTaskType(() -> new BedWars1058BuyTask(this), () -> CompatUtils.isPluginEnabled("BedWars1058")); // not tested |
Collaborator
There was a problem hiding this comment.
Please keep alphabetical order.
|
|
||
| ## Options | ||
|
|
||
| | Key | Description | Type | Required | Default | Notes | |
Collaborator
There was a problem hiding this comment.
It's not formatted properly here and in other docs, however I can do that automatically right before merging as my IDE supports it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added compatibility for BedWars2023: https://github.com/tomkeuper/BedWars2023/ and implemented two new tasks for both BedWars1058 and BedWars2023: purchasing items from the shop and collecting items from the generator