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

Release 1.5.0 #370

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open

Release 1.5.0 #370

wants to merge 36 commits into from

Conversation

tastybento
Copy link
Member

@tastybento tastybento commented Feb 7, 2025

This PR introduces improvements related to challenge tracking and completion logic, adding the ability to set up Island Range challenges that will complete based on block groups, e.g., 20 of any coral, entity groups, e.g., all undead, or challenges that have multiple statistics, e.g., kill 10 skeletons and kill 10 creepers.

Key Updates

Other Updates

  • The English text was reviewed and adjusted and formatted.
  • Icons for entities and statistics were added.

Statistic Challenges

More than one statistic can be required to complete a challenge. If more than one is set, all statistics have to be met in order for the challenge to be completed.

Block Groups and Entity Groups

For Island Challenges, these can be used. This allows challenges to be less specific and more general.

Reduce code duplication by abstracting classes
This enables things like a challenge to kill 10 creepers, 10 zombies,
and 10 skeletons.
Enable challenges to have multiple statistic requirements
public StatisticRequirements()
{
// Empty constructor
public record StatisticRec(@Expose Statistic statistic, @Expose EntityType entity, @Expose Material material,
Copy link
Member Author

Choose a reason for hiding this comment

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

Added a new record that contains all the data for a Statistic challenge.

// Section: Getters and setters
// ---------------------------------------------------------------------

@Expose
Copy link
Member Author

Choose a reason for hiding this comment

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

This entry is not removed to keep backward compatibility, however, it is never read directly by the code and instead is used when requesting the List of statistics.

{
return material;
}
private List<StatisticRec> statisticList;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the new Statistics list.

*/
public int getAmount()
@Override
public Requirements copy()
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy is easier.

{
this.amount = amount;
// TODO - do something here?
Copy link
Member Author

Choose a reason for hiding this comment

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

@BONNe I'm not sure what this is for. It used to be some self-check code. Is it required still?

public List<StatisticRec> getRequiredStatistics() {
if (statisticList == null) {
statisticList = new ArrayList<>();
// Convert old single statistic entries to new list of records
Copy link
Member Author

Choose a reason for hiding this comment

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

Backwards compatibility

"[warning-block]", warningBlocks, "[warning-entity]", warningEntities, "[search-radius]", searchRadius);
}

private String getBlocksTagsDescription(IslandRequirements requirement, String reference) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Add description for Block Tags AKA Block Groups

return tags;
}

private String getEntityTypeTagsDescription(IslandRequirements requirement, String reference) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Entity Tags description

* Stores filtered items.
*/
private List<EntityType> filterElements;
public class MultiEntitySelector extends UnifiedMultiSelector<EntityType> {
Copy link
Member Author

Choose a reason for hiding this comment

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

Added more abstraction to reduce code duplication

return true;
}).
build();
icon(ManageStatisticsPanel.getStatisticIcon(statistic)).description(description)
Copy link
Member Author

Choose a reason for hiding this comment

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

Use the new Statistic icons instead of just paper.

case STATISTIC_TYPE -> {
StatisticRequirements requirements = this.challenge.getRequirements();
}
case STATISTIC_TYPE -> {
Copy link
Member Author

Choose a reason for hiding this comment

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

The main change in this class is here where multiple stats are checked instead of just the one.

private Map<Material, Integer> requiredBlocks = new EnumMap<>(Material.class);

@Expose
private Map<Tag<Material>, Integer> requiredMaterialTags = new HashMap<>();
Copy link
Member Author

Choose a reason for hiding this comment

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

New block tags added

@Expose
private Map<Tag<Material>, Integer> requiredMaterialTags = new HashMap<>();
@Expose
private Map<Tag<Fluid>, Integer> requiredFluidTags = new HashMap<>();
Copy link
Member Author

Choose a reason for hiding this comment

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

New fluid tag map added, but this is not used right now. Could be used in the future maybe.

private Map<Tag<Material>, Integer> requiredMaterialTags = new HashMap<>();
@Expose
private Map<Tag<Fluid>, Integer> requiredFluidTags = new HashMap<>();
@Expose
Copy link
Member Author

Choose a reason for hiding this comment

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

Entity group map added

* Stores filtered items.
*/
private List<Material> filterElements;
public class MultiBlockSelector extends UnifiedMultiSelector<Material> {
Copy link
Member Author

Choose a reason for hiding this comment

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

Shrunk down by using Abstract class to reduce code duplication.

* @param et entity type
* @return ItemStack
*/
public static ItemStack getIcon(EntityType et) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Small method for entity icons. A big better than just eggs.

@tastybento tastybento requested a review from BONNe February 11, 2025 07:44
@tastybento
Copy link
Member Author

Hi @BONNe - this is just FYI - I am sure you are busy. Please feel free to try the SNAPSHOT. I am working on a couple of other additions, but I'd like to get this one out soon. I made the changes to support some of the challenges I want for Poseidon. I plan to put the Poseidon challenges on the web so they can be downloaded too.

Enables per-player permission waivers.
Add permission [gamemode].challenges.waiver-add.x to addon
The admin may want to hide the rewards and just use the reward
description. If the number of rewards is very long, it can be a problem
to list them all.
Add switch to hide reward items from the GUI list.
Added a PAPI formula option to Other challenge types.
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
13.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

1 participant