Rename TreeType ClassInfo code-name from structuretype to treetype#8636
Rename TreeType ClassInfo code-name from structuretype to treetype#8636adraarda23 wants to merge 3 commits into
Conversation
The code name "structuretype" was misleading — trees are not structures, and the identifier blocked introducing an actual StructureType class. Rename the ClassInfo code name, the matching pattern placeholders in EffTree and EvtGrow, and the localization key in default.lang. Also clean up the touched files: rename single-letter variables to descriptive names and drop unnecessary `final` modifiers on parameters, locals, and loop variables. Field finals are preserved. Resolves SkriptLang#8634
There was a problem hiding this comment.
this should not be named StructureType anymore, something like TreeVariant is better as TreeType is already taken by bukkit
make sure to update it in DefaultComparators too
There was a problem hiding this comment.
Hi @erenkarakal went with TreeSpecies instead of TreeVariant for two
reasons from the existing codebase:
- The
ClassInfodescription already says "a tree species or a huge mushroom
species" (SkriptClasses.java:380). - Bukkit itself calls a
TreeTypevalue a species —StructureGrowEvent.getSpecies()
returns one, andEvtGrow.java:175already usesspeciesas the local variable
name when reading from that event.
It also fits the grouping semantics a bit better than "variant" (each value
holds a group of TreeTypes — e.g. REDWOOD = small + tall). Happy to
switch to TreeVariant if you'd prefer, just wanted to flag the reasoning.
TreeType is taken by Bukkit, so use TreeSpecies — the term is already
used by the existing ClassInfo description ("a tree species or a huge
mushroom species") and by Bukkit's StructureGrowEvent.getSpecies(),
which returns the same kind of value this enum wraps.
Updates DefaultComparators, EffTree, EvtGrow, and ClassesTest to match.
Also drops the unnecessary "" + string coercion in TreeSpecies.fromName
and the toVariableNameString parser in SkriptClasses (Enum.name() never
returns null).
EffTree: drop unnecessary `final` modifiers on parameters/locals/loop variables and rename single-letter `e`, `l` to `event`, `location` — the cleanup that was promised in the original commit description but not actually applied to this file. EvtGrow: switch `instanceof` casts in checkFrom/checkTo to pattern variables for consistency. DefaultComparators: fix the TreeSpecies-vs-TreeSpecies comparator, which compared `s2` against itself and unconditionally returned Relation.EQUAL. The `s1` parameter was unused. Closes SkriptLang#8638
|
Hi, thank you for this PR, but I noticed that #8640 exists and does a more modern and comprehensive rework for structuretype, and doesn't rely as heavily on AI, so I'm going to be closing this one in favour of that pr. Thank you for your efforts, regardless. My apologies that this took a few days and a few reviews, but I was busy moving and didn't have time to check on the PRs. |
Problem
The
TreeTypeClassInfo is registered under the code name"structuretype", which is misleading: trees are not structures, and the identifier blocks introducing an actualStructureTypeclass in the future.Solution
"structuretype"to"treetype"inSkriptClasses.java.%structuretype(s)%→%treetype(s)%inEffTree.java(2 sites) andEvtGrow.java(3 sites).default.lang:structuretype:→treetype:.s,o,t,b,e) to descriptive names, and drop unnecessaryfinalmodifiers on parameters, locals, and loop variables. Field finals (real immutability) are preserved.The user-facing
.user("tree ?types?", "trees?")patterns are not changed, so existing user scripts continue to parse the same way.Testing Completed
./gradlew buildpasses locally on a Java 25 toolchain (Paper 26.1.1 environment).grepthat nostructuretypereferences remain in the codebase (Java, lang, resources).I did not add new test scripts.
EffTreeandEvtGrowhave no existing.skor JUnit coverage, and I judged that adding it was outside the scope of a code-name rename — happy to add aTree.skregression test if reviewers prefer.Supporting Information
StructureTypeis unchanged, so theEnumSerializer<>(StructureType.class)registration still produces the same serialized form — existing variable storage stays valid."structuretype"directly (e.g. third-party plugins doing class lookups by code name). The probability is very low; ShaneBeee already flagged this risk in the issue.Completes: #8634
Related: none
AI assistance: Claude Code (Anthropic CLI, Opus 4.7) was used extensively. Claude searched the affected files, performed the renames and cleanup edits, drafted the commit message, and ran the local build. All scope decisions (whether to rename the Java class, which
finals to remove, commit message wording) were made by me after reviewing Claude's proposals.