Skip to content

Commit

Permalink
Add missing tree types to prevent EvtGrow causing errors. (#7230)
Browse files Browse the repository at this point in the history
  • Loading branch information
sovdeeth authored Dec 1, 2024
1 parent 876aee2 commit b163e26
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
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))
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));
}
}

}

0 comments on commit b163e26

Please sign in to comment.