Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

[WIP] MaterialMatchers: match material(data) to given condition (f.e. all wooden stairs) #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tonodus
Copy link

@Tonodus Tonodus commented Sep 9, 2014

While the Material enum grows and grows, there's the need for some kind of grouping Materials.

For now, we have to stick to EnchantmentTarget, however, this solution can't be extended for other purposes like to check for (Wooden)Stairs or even plugin-custom filters.

So (especially with the new updates for MC with more and more blocks) I started writing this little classes, to easily group Materials. It can also be used for some MaterialData (f.e. checking for salmon/pufferfish/clownfish) or any other object, f.e. ItemStack (there could be Matchers for finding ItemStacks containing max amount(64/16/1), durability (deterioration, data, ...)) and so on.

This adds just some features to the Bukkit-API, no plugin breaking nor must it be used with Glowstone.
It's not finished yet (only a few Material-Matcher in Materials), but I'd like to get some feedback before I (or everyone who likes) continues this.

/**
* Default Materials(Data) matchers
*/
public enum Materials implements Matcher<Material> {

Choose a reason for hiding this comment

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

This file looks like it would be difficult to maintain between releases...

Copy link
Author

Choose a reason for hiding this comment

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

Could you please elaborate? It basically uses the Material enum. It would be only need to changed when MC adds/remove blocks that matches in the groups.

Choose a reason for hiding this comment

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

Exactly. For Minecraft updates it could get difficult to keep this file up to date with the Material enum and other API. This file could also get very lengthy as time goes on.

Copy link
Author

Choose a reason for hiding this comment

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

Let's better say it isn't difficult but monotonous work. I don't want to deny this, and yes it may get some length.
I think it's woth it, but if you don't that's totally ok.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants