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

Add missing tree types to prevent EvtGrow causing errors. #7230

Merged
merged 3 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/main/java/ch/njol/skript/bukkitutil/ItemUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,16 @@ public static boolean isAir(Material type) {
// cherry
if (Skript.isRunningMinecraft(1, 19, 4))
TREE_TO_SAPLING_MAP.put(TreeType.CHERRY, Material.CHERRY_SAPLING);

// mega pine (2x2 spruce tree with minimal leaves at top)
if (Skript.isRunningMinecraft(1, 20,5))
Moderocky marked this conversation as resolved.
Show resolved Hide resolved
TREE_TO_SAPLING_MAP.put(TreeType.MEGA_PINE, Material.SPRUCE_SAPLING);

// pale oak
if (Skript.isRunningMinecraft(1, 21, 3)) {
TREE_TO_SAPLING_MAP.put(TreeType.PALE_OAK, Material.PALE_OAK_SAPLING);
TREE_TO_SAPLING_MAP.put(TreeType.PALE_OAK_CREAKING, Material.PALE_OAK_SAPLING);
}
}

public static Material getTreeSapling(TreeType treeType) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.skriptlang.skript.test.tests.regression;

import ch.njol.skript.bukkitutil.ItemUtils;
import org.bukkit.TreeType;
import org.junit.Assert;
import org.junit.Test;

public class MissingTreeSaplingMapEntriesTest {

@Test
public void test() {
for (TreeType type : TreeType.values()) {
Assert.assertNotNull("Tree type " + type + " has no mapped sapling in ItemUtils#getTreeSapling().", ItemUtils.getTreeSapling(type));
}
}

}