Skip to content

Add BedWars2023 compatibility + 2 new tasks#818

Open
josemarcellio wants to merge 5 commits intoLMBishop:masterfrom
josemarcellio:master
Open

Add BedWars2023 compatibility + 2 new tasks#818
josemarcellio wants to merge 5 commits intoLMBishop:masterfrom
josemarcellio:master

Conversation

@josemarcellio
Copy link
Contributor

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

@Krakenied Krakenied self-assigned this Nov 28, 2025
@Krakenied
Copy link
Collaborator

Krakenied commented Jan 15, 2026

That's quite a lot of code to review man

I will try to merge it this week

Task task = pendingTask.task();
TaskProgress taskProgress = pendingTask.taskProgress();

String requiredId = (String) task.getConfigValue("item");
Copy link
Collaborator

Choose a reason for hiding this comment

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

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;
Copy link
Collaborator

Choose a reason for hiding this comment

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

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;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above.

Comment on lines +85 to +89
int progress = taskProgress.getProgress() instanceof Integer
? (int) taskProgress.getProgress()
: 0;
progress += boughtAmount;
taskProgress.setProgress(progress);
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's dedicated method for that. Take a look into other task types.

return;
}

String collectedMaterial = collectedStack.getType().name();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as the above.

return;
}

String collectedMaterial = collectedStack.getType().name();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above.

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;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above.

quest.getId(), task.getId(), player.getUniqueId());

int progress = TaskUtils.incrementIntegerTaskProgress(taskProgress, collectedAmount);
int amount = ((int) task.getConfigValue("amount"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Redundant parentheses.

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please keep alphabetical order.


## Options

| Key | Description | Type | Required | Default | Notes |
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's not formatted properly here and in other docs, however I can do that automatically right before merging as my IDE supports it.

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.

2 participants