diff --git a/src/main/java/ch/njol/skript/classes/data/DefaultComparators.java b/src/main/java/ch/njol/skript/classes/data/DefaultComparators.java index fee9c1ebce9..1fa65336b20 100644 --- a/src/main/java/ch/njol/skript/classes/data/DefaultComparators.java +++ b/src/main/java/ch/njol/skript/classes/data/DefaultComparators.java @@ -445,19 +445,6 @@ public boolean supportsOrdering() { } }); - // StructureType - StructureType - Comparators.registerComparator(StructureType.class, StructureType.class, new Comparator() { - @Override - public Relation compare(StructureType s1, StructureType s2) { - return Relation.get(CollectionUtils.containsAll(s2.getTypes(), s2.getTypes())); - } - - @Override - public boolean supportsOrdering() { - return false; - } - }); - // Object - ClassInfo Comparators.registerComparator(Object.class, ClassInfo.class, new Comparator() { @Override diff --git a/src/main/java/ch/njol/skript/classes/data/DefaultFunctions.java b/src/main/java/ch/njol/skript/classes/data/DefaultFunctions.java index 551107f9a69..ff604c3e9b7 100644 --- a/src/main/java/ch/njol/skript/classes/data/DefaultFunctions.java +++ b/src/main/java/ch/njol/skript/classes/data/DefaultFunctions.java @@ -602,28 +602,25 @@ public Long[] executeSimple(Object[][] params) { }.description("Calculates the total amount of experience needed to achieve given level from scratch in Minecraft.") .since("2.2-dev32")); - Functions.registerFunction(new SimpleJavaFunction("rgb", new Parameter[] { - new Parameter<>("red", DefaultClasses.LONG, true, null), - new Parameter<>("green", DefaultClasses.LONG, true, null), - new Parameter<>("blue", DefaultClasses.LONG, true, null), - new Parameter<>("alpha", DefaultClasses.LONG, true, new SimpleLiteral<>(255L,true)) - }, DefaultClasses.COLOR, true) { - @Override - public ColorRGB[] executeSimple(Object[][] params) { - Long red = (Long) params[0][0]; - Long green = (Long) params[1][0]; - Long blue = (Long) params[2][0]; - Long alpha = (Long) params[3][0]; - - return CollectionUtils.array(ColorRGB.fromRGBA(red.intValue(), green.intValue(), blue.intValue(), alpha.intValue())); - } - }).description("Returns a RGB color from the given red, green and blue parameters. Alpha values can be added optionally, " + - "but these only take affect in certain situations, like text display backgrounds.") + Functions.register(DefaultFunction.builder(skript, "rgb", Color.class) + .description(""" + Returns a RGB color from the given red, green and blue parameters. + Alpha values can be added optionally but these only take affect in certain situations, like text display backgrounds.""") .examples( "dye player's leggings rgb(120, 30, 45)", "set the colour of a text display to rgb(10, 50, 100, 50)" ) - .since("2.5, 2.10 (alpha)"); + .since("2.5, 2.10 (alpha)") + .parameter("red", Long.class, Modifier.ranged(0, 255)) + .parameter("green", Long.class, Modifier.ranged(0, 255)) + .parameter("blue", Long.class, Modifier.ranged(0, 255)) + .parameter("alpha", Long.class, Modifier.ranged(0, 255), Modifier.OPTIONAL) + .build(args -> ColorRGB.fromRGBA( + args.get("red").intValue(), + args.get("green").intValue(), + args.get("blue").intValue(), + args.getOrDefault("alpha", 255L).intValue() + ))); Functions.register(DefaultFunction.builder(skript, "player", Player.class) .description( diff --git a/src/main/java/ch/njol/skript/classes/data/SkriptClasses.java b/src/main/java/ch/njol/skript/classes/data/SkriptClasses.java index 64d87876962..e221e1518fc 100644 --- a/src/main/java/ch/njol/skript/classes/data/SkriptClasses.java +++ b/src/main/java/ch/njol/skript/classes/data/SkriptClasses.java @@ -374,32 +374,13 @@ public String toVariableNameString(Color color) { } })); - Classes.registerClass(new ClassInfo<>(StructureType.class, "structuretype") + Classes.registerClass(new EnumClassInfo<>(TreeSpecies.class, "treetype", "tree types") .user("tree ?types?", "trees?") .name("Tree Type") .description("A tree type represents a tree species or a huge mushroom species. These can be generated in a world with the generate tree effect.") - .usage("[any] , e.g. tree/any jungle tree/etc.", ", e.g. red mushroom/small jungle tree/big regular tree/etc.") .examples("grow any regular tree at the block", "grow a huge red mushroom above the block") - .since("") - .defaultExpression(new SimpleLiteral<>(StructureType.TREE, true)) - .parser(new Parser() { - @Override - @Nullable - public StructureType parse(final String s, final ParseContext context) { - return StructureType.fromName(s); - } - - @Override - public String toString(final StructureType o, final int flags) { - return o.toString(flags); - } - - @Override - public String toVariableNameString(final StructureType o) { - return "" + o.name().toLowerCase(Locale.ENGLISH); - } - }).serializer(new EnumSerializer<>(StructureType.class))); + .since("")); Classes.registerClass(new ClassInfo<>(EnchantmentType.class, "enchantmenttype") .user("enchant(ing|ment) types?") diff --git a/src/main/java/ch/njol/skript/effects/EffTree.java b/src/main/java/ch/njol/skript/effects/EffTree.java index 71f141eeff4..8b020454865 100644 --- a/src/main/java/ch/njol/skript/effects/EffTree.java +++ b/src/main/java/ch/njol/skript/effects/EffTree.java @@ -13,7 +13,7 @@ import ch.njol.skript.lang.Expression; import ch.njol.skript.lang.SkriptParser.ParseResult; import ch.njol.skript.util.Direction; -import ch.njol.skript.util.StructureType; +import ch.njol.skript.util.TreeSpecies; import ch.njol.util.Kleenean; /** @@ -28,26 +28,26 @@ public class EffTree extends Effect { static { Skript.registerEffect(EffTree.class, - "(grow|create|generate) tree [of type %structuretype%] %directions% %locations%", - "(grow|create|generate) %structuretype% %directions% %locations%"); + "(grow|create|generate) tree [of type %treetype%] %directions% %locations%", + "(grow|create|generate) %treetype% %directions% %locations%"); } @SuppressWarnings("null") private Expression blocks; @SuppressWarnings("null") - private Expression type; + private Expression type; @SuppressWarnings({"unchecked", "null"}) @Override public boolean init(final Expression[] exprs, final int matchedPattern, final Kleenean isDelayed, final ParseResult parser) { - type = (Expression) exprs[0]; + type = (Expression) exprs[0]; blocks = Direction.combine((Expression) exprs[1], (Expression) exprs[2]); return true; } @Override public void execute(final Event e) { - final StructureType type = this.type.getSingle(e); + final TreeSpecies type = this.type.getSingle(e); if (type == null) return; for (final Location l : blocks.getArray(e)) { diff --git a/src/main/java/ch/njol/skript/events/EvtGrow.java b/src/main/java/ch/njol/skript/events/EvtGrow.java index f5bdc5a6629..0a33e732408 100644 --- a/src/main/java/ch/njol/skript/events/EvtGrow.java +++ b/src/main/java/ch/njol/skript/events/EvtGrow.java @@ -7,7 +7,7 @@ import ch.njol.skript.lang.LiteralList; import ch.njol.skript.lang.SkriptEvent; import ch.njol.skript.lang.SkriptParser.ParseResult; -import ch.njol.skript.util.StructureType; +import ch.njol.skript.util.TreeSpecies; import ch.njol.util.coll.CollectionUtils; import org.bukkit.Material; import org.bukkit.TreeType; @@ -32,10 +32,10 @@ public class EvtGrow extends SkriptEvent { static { Skript.registerEvent("Grow", EvtGrow.class, CollectionUtils.array(StructureGrowEvent.class, BlockGrowEvent.class), - "grow[th] [of (1:%-structuretypes%|2:%-itemtypes/blockdatas%)]", + "grow[th] [of (1:%-treetypes%|2:%-itemtypes/blockdatas%)]", "grow[th] from %itemtypes/blockdatas%", - "grow[th] [in]to (1:%structuretypes%|2:%itemtypes/blockdatas%)", - "grow[th] from %itemtypes/blockdatas% [in]to (1:%structuretypes%|2:%itemtypes/blockdatas%)" + "grow[th] [in]to (1:%treetypes%|2:%itemtypes/blockdatas%)", + "grow[th] from %itemtypes/blockdatas% [in]to (1:%treetypes%|2:%itemtypes/blockdatas%)" ) .description( "Called when a tree, giant mushroom or plant grows to next stage.", @@ -174,8 +174,8 @@ private static boolean checkTo(Event event, Literal types) { if (event instanceof StructureGrowEvent) { TreeType species = ((StructureGrowEvent) event).getSpecies(); return types.check(event, type -> { - if (type instanceof StructureType) { - return ((StructureType) type).is(species); + if (type instanceof TreeSpecies) { + return ((TreeSpecies) type).is(species); } return false; }); diff --git a/src/main/java/ch/njol/skript/util/StructureType.java b/src/main/java/ch/njol/skript/util/StructureType.java deleted file mode 100644 index f15182c7892..00000000000 --- a/src/main/java/ch/njol/skript/util/StructureType.java +++ /dev/null @@ -1,103 +0,0 @@ -package ch.njol.skript.util; - -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.Map.Entry; -import java.util.regex.Pattern; - -import org.bukkit.Location; -import org.bukkit.TreeType; -import org.bukkit.block.Block; -import org.jetbrains.annotations.Nullable; - -import ch.njol.skript.localization.Language; -import ch.njol.skript.localization.Noun; -import ch.njol.util.coll.CollectionUtils; - -public enum StructureType { - TREE(TreeType.TREE, TreeType.BIG_TREE, TreeType.REDWOOD, TreeType.TALL_REDWOOD, TreeType.MEGA_REDWOOD, - TreeType.BIRCH, TreeType.TALL_BIRCH, TreeType.SMALL_JUNGLE, TreeType.JUNGLE, TreeType.COCOA_TREE, - TreeType.ACACIA, TreeType.DARK_OAK, TreeType.SWAMP), - - REGULAR(TreeType.TREE, TreeType.BIG_TREE), SMALL_REGULAR(TreeType.TREE), BIG_REGULAR(TreeType.BIG_TREE), - REDWOOD(TreeType.REDWOOD, TreeType.TALL_REDWOOD), SMALL_REDWOOD(TreeType.REDWOOD), BIG_REDWOOD(TreeType.TALL_REDWOOD), - MEGA_REDWOOD(TreeType.MEGA_REDWOOD), - BIRCH(TreeType.BIRCH), TALL_BIRCH(TreeType.TALL_BIRCH), - JUNGLE(TreeType.SMALL_JUNGLE, TreeType.JUNGLE), SMALL_JUNGLE(TreeType.SMALL_JUNGLE), BIG_JUNGLE(TreeType.JUNGLE), - JUNGLE_BUSH(TreeType.JUNGLE_BUSH), COCOA_TREE(TreeType.COCOA_TREE), - ACACIA(TreeType.ACACIA), DARK_OAK(TreeType.DARK_OAK), - SWAMP(TreeType.SWAMP), - - MUSHROOM(TreeType.RED_MUSHROOM, TreeType.BROWN_MUSHROOM), - RED_MUSHROOM(TreeType.RED_MUSHROOM), BROWN_MUSHROOM(TreeType.BROWN_MUSHROOM), - - ; - - private Noun name; - private final TreeType[] types; - - private StructureType(final TreeType... types) { - this.types = types; - name = new Noun("tree types." + name() + ".name"); - } - - public void grow(final Location loc) { - TreeType tree = CollectionUtils.getRandom(types); - assert tree != null; // No enum member causes empty types - loc.getWorld().generateTree(loc, tree); - } - - public void grow(final Block b) { - TreeType tree = CollectionUtils.getRandom(types); - assert tree != null; // No enum member causes empty types - b.getWorld().generateTree(b.getLocation(), tree); - } - - public TreeType[] getTypes() { - return types; - } - - @Override - public String toString() { - return name.toString(); - } - - public String toString(final int flags) { - return name.toString(flags); - } - - public Noun getName() { - return name; - } - - public boolean is(final TreeType type) { - return CollectionUtils.contains(types, type); - } - - /** - * lazy - */ - final static Map parseMap = new HashMap<>(); - - static { - Language.addListener(parseMap::clear); - } - - @Nullable - public static StructureType fromName(String s) { - if (parseMap.isEmpty()) { - for (final StructureType t : values()) { - final String pattern = Language.get("tree types." + t.name() + ".pattern"); - parseMap.put(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE), t); - } - } - s = "" + s.toLowerCase(Locale.ENGLISH); - for (final Entry e : parseMap.entrySet()) { - if (e.getKey().matcher(s).matches()) - return e.getValue(); - } - return null; - } - -} diff --git a/src/main/java/ch/njol/skript/util/TreeSpecies.java b/src/main/java/ch/njol/skript/util/TreeSpecies.java new file mode 100644 index 00000000000..760c1fe2f9b --- /dev/null +++ b/src/main/java/ch/njol/skript/util/TreeSpecies.java @@ -0,0 +1,86 @@ +package ch.njol.skript.util; + +import ch.njol.util.coll.CollectionUtils; +import org.bukkit.Location; +import org.bukkit.TreeType; +import org.bukkit.World; +import org.bukkit.block.Block; + +public enum TreeSpecies { + TREE(TreeType.values()), + + OAK(TreeType.TREE, TreeType.BIG_TREE), + SMALL_OAK(TreeType.TREE), + BIG_OAK(TreeType.BIG_TREE), + + SPRUCE(TreeType.REDWOOD, TreeType.TALL_REDWOOD), + SMALL_SPRUCE(TreeType.REDWOOD), + BIG_SPRUCE(TreeType.TALL_REDWOOD), + MEGA_SPRUCE(TreeType.MEGA_REDWOOD), + + BIRCH(TreeType.BIRCH, TreeType.TALL_BIRCH), + SMALL_BIRCH(TreeType.BIRCH), + TALL_BIRCH(TreeType.TALL_BIRCH), + + JUNGLE(TreeType.SMALL_JUNGLE, TreeType.JUNGLE, TreeType.COCOA_TREE), + SMALL_JUNGLE(TreeType.SMALL_JUNGLE), + BIG_JUNGLE(TreeType.JUNGLE), + COCOA_TREE(TreeType.COCOA_TREE), + + JUNGLE_BUSH(TreeType.JUNGLE_BUSH), + + ACACIA(TreeType.ACACIA), + DARK_OAK(TreeType.DARK_OAK), + SWAMP(TreeType.SWAMP), + + MUSHROOM(TreeType.RED_MUSHROOM, TreeType.BROWN_MUSHROOM), + RED_MUSHROOM(TreeType.RED_MUSHROOM), + BROWN_MUSHROOM(TreeType.BROWN_MUSHROOM), + + MANGROVE(TreeType.MANGROVE, TreeType.TALL_MANGROVE), + SMALL_MANGROVE(TreeType.MANGROVE), + BIG_MANGROVE(TreeType.TALL_MANGROVE), + + AZALEA(TreeType.AZALEA), + + PALE_OAK(TreeType.PALE_OAK, TreeType.PALE_OAK_CREAKING), + PALE_OAK_NORMAL(TreeType.PALE_OAK), + PALE_OAK_CREAKING(TreeType.PALE_OAK_CREAKING), + + CHERRY(TreeType.CHERRY), + + CRIMSON_FUNGUS(TreeType.CRIMSON_FUNGUS), + WARPED_FUNGUS(TreeType.WARPED_FUNGUS), + + CHORUS_PLANT(TreeType.CHORUS_PLANT), + ; + + private final TreeType[] types; + + TreeSpecies(TreeType... types) { + this.types = types; + } + + public void grow(Location location) { + TreeType tree = CollectionUtils.getRandom(types); + assert tree != null; // No enum member causes empty types + World world = location.getWorld(); + if (world == null) { + return; + } + world.generateTree(location, tree); + } + + public void grow(Block block) { + grow(block.getLocation()); + } + + public TreeType[] getTypes() { + return types; + } + + public boolean is(TreeType type) { + return CollectionUtils.contains(types, type); + } + +} diff --git a/src/main/java/org/skriptlang/skript/bukkit/loottables/elements/expressions/ExprLoot.java b/src/main/java/org/skriptlang/skript/bukkit/loottables/elements/expressions/ExprLoot.java index e8559171dd0..2e685859611 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/loottables/elements/expressions/ExprLoot.java +++ b/src/main/java/org/skriptlang/skript/bukkit/loottables/elements/expressions/ExprLoot.java @@ -5,16 +5,15 @@ import ch.njol.skript.doc.Description; import ch.njol.skript.doc.Example; import ch.njol.skript.doc.Name; -import ch.njol.skript.doc.RequiredPlugins; import ch.njol.skript.doc.Since; -import ch.njol.util.coll.CollectionUtils; -import org.bukkit.inventory.ItemStack; import ch.njol.skript.lang.Expression; import ch.njol.skript.lang.SkriptParser.ParseResult; import ch.njol.skript.lang.util.SimpleExpression; import ch.njol.util.Kleenean; +import ch.njol.util.coll.CollectionUtils; import org.bukkit.event.Event; import org.bukkit.event.world.LootGenerateEvent; +import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.Nullable; import org.skriptlang.skript.registration.SyntaxInfo; import org.skriptlang.skript.registration.SyntaxRegistry; @@ -26,12 +25,11 @@ @Description("The loot that will be generated in a 'loot generate' event.") @Example(""" on loot generate: - chance of %10 + chance of 10% add 64 diamonds to loot send "You hit the jackpot!!" """) @Since("2.7") -@RequiredPlugins("MC 1.16+") public class ExprLoot extends SimpleExpression { public static void register(SyntaxRegistry registry) { diff --git a/src/main/java/org/skriptlang/skript/bukkit/loottables/elements/expressions/ExprLootItems.java b/src/main/java/org/skriptlang/skript/bukkit/loottables/elements/expressions/ExprLootItems.java index 58de9d7a757..0020de9fc26 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/loottables/elements/expressions/ExprLootItems.java +++ b/src/main/java/org/skriptlang/skript/bukkit/loottables/elements/expressions/ExprLootItems.java @@ -30,11 +30,11 @@ + "Not specifying a loot context will use a loot context with a location at the world's origin." ) @Example(""" - set {_items::*} to loot items of the loot table "minecraft:chests/simple_dungeon" with loot context {_context} + set {_items::*} to loot of the loot table "minecraft:chests/simple_dungeon" with loot context {_context} # this will set {_items::*} to the items that would be dropped from the simple dungeon loot table with the given loot context """) @Example(""" - give player loot items of entity's loot table with loot context {_context} + give player loot of entity's loot table with loot context {_context} # this will give the player the items that the entity would drop with the given loot context """) @Since("2.10") @@ -45,8 +45,8 @@ public static void register(SyntaxRegistry registry) { SyntaxRegistry.EXPRESSION, SyntaxInfo.Expression.builder(ExprLootItems.class, ItemStack.class) .addPatterns( - "[the] loot of %loottables% [(with|using) %-lootcontext%]", - "%loottables%'[s] loot [(with|using) %-lootcontext%]" + "[the] loot of %loottables% [(with|using) [[loot] context] %-lootcontext%]", + "%loottables%'[s] loot [(with|using) [[loot] context] %-lootcontext%]" ) .supplier(ExprLootItems::new) .build() @@ -72,7 +72,7 @@ public boolean init(Expression[] exprs, int matchedPattern, Kleenean isDelaye if (context == null) return new ItemStack[0]; } else { - context = new LootContextWrapper(Bukkit.getWorlds().get(0).getSpawnLocation()).getContext(); + context = new LootContextWrapper(Bukkit.getWorlds().getFirst().getSpawnLocation()).getContext(); } List items = new ArrayList<>(); @@ -104,7 +104,7 @@ public String toString(@Nullable Event event, boolean debug) { builder.append("the loot of", lootTables); if (context != null) - builder.append("with", context); + builder.append("with loot context ", context); return builder.toString(); } diff --git a/src/main/resources/config.sk b/src/main/resources/config.sk index 6e99f846dab..ab9bb696660 100644 --- a/src/main/resources/config.sk +++ b/src/main/resources/config.sk @@ -304,9 +304,6 @@ databases: # # You can define as many databases as you want, just make sure to choose a distinct name for each one, and don't forget to set all options correctly. # - # To be able to use a database you'll need to download the plugin 'SQLibrary' from https://dev.bukkit.org/projects/sqlibrary/files - # and install it in your server's plugin directory like other plugins. - # # Please note that '/skript reload' will not reload this section, i.e. you'll have to restart Skript for changes to take effect. # Each database definition must be in a separate section. You can choose any name for the sections, as long as it's not already used. @@ -314,8 +311,8 @@ databases: # An example database to describe all possible options. type: disabled - # The type of this database. Allowed values are 'CSV', 'SQLite', 'MySQL' and 'disabled'. - # CSV uses a text file to store the variables, while SQLite and MySQL use databases, and 'disabled' makes Skript ignore the database as if it wasn't defined at all. + # The type of this database. Allowed values are 'CSV' and 'disabled'. + # CSV uses a text file to store the variables and 'disabled' makes Skript ignore the database as if it wasn't defined at all. pattern: .* # Defines which variables to save in this database. @@ -330,24 +327,11 @@ databases: # If 'monitor changes' is set to true, variables will repeatedly be checked for updates in the database (in intervals set in 'monitor interval'). # ! Please note that you should set 'pattern', 'monitor changes' and 'monitor interval' to the same values on all servers that access the same database! - # == MySQL configuration == - host: localhost # Where the database server is located at, e.g. 'example.com', 'localhost', or '192.168.1.100' - port: 3306 # 3306 is MySQL's default port, i.e. you likely won't need to change this value - user: root - password: pass - database: skript # The database to use, the table will be created in this database. - table: variables21 # The name of the table to create. 'variables21' is the default name, if this was to be omitted. - # (If the table exists but is defined differently that how Skript expects it to be you'll get errors and no variables will be saved and/or loaded) - # == SQLite/CSV configuration == + # == CSV configuration == file: ./plugins/Skript/variables.db # Where to save the variables to. For a CSV file, the file extension '.csv' is recommended, but not required, but SQLite database files must end in '.db' (SQLibrary forces this). # The file path can either be absolute (e.g. 'C:\whatever\...' [Windows] or '/usr/whatever/...' [Unix]), or relative to the server directory (e.g. './plugins/Skript/...'). - #table: variables21 - # The name of the table to create. 'variables21' is the default name, if this was to be omitted. - # (If the table exists but is defined differently that how Skript expects it to be you'll get errors and no variables will be saved and/or loaded) - # This is generally not required as the the .db file will only be used by Skript, unless you want to split different variables into different tables - backup interval: 2 hours # Creates a backup of the file every so often. This can be useful if you ever want to revert variables to an older state. # Variables are saved constantly no matter what is set here, thus a server crash will never make you lose any variables. @@ -359,44 +343,6 @@ databases: # If disabled (set to -1), no backup files will be deleted. # WARNING: Setting to 0 will delete all files located in the backup directory upon plugin start/reload - - MySQL example: - # A MySQL database example, with options unrelated to MySQL removed. - - type: disabled # change to line below to enable this database - # type: MySQL - - pattern: synced_.* # this pattern will save all variables that start with 'synced_' in this MySQL database. - - host: localhost - port: 3306 - user: root - password: pass - database: skript - table: variables21 - - monitor changes: true - monitor interval: 20 seconds - - SQLite example: - # An SQLite database example. - - type: disabled # change to line below to enable this database - # type: SQLite - - pattern: db_.* # this pattern will save all variables that start with 'db_' in this SQLite database. - - file: ./plugins/Skript/variables.db - # SQLite databases must end in '.db' - #table: variables21 - # Usually not required, if omitted defaults to variables21 (see above for more details) - - backup interval: 0 # 0 = don't create backups - monitor changes: false - monitor interval: 20 seconds - - backups to keep: -1 - default: # The default "database" is a simple text file, with each variable on a separate line and the variable's name, type, and value separated by commas. # This is the last database in this list to catch all variables that have not been saved anywhere else. diff --git a/src/main/resources/lang/default.lang b/src/main/resources/lang/default.lang index 540fa9cfb8f..30f9c65b0c7 100644 --- a/src/main/resources/lang/default.lang +++ b/src/main/resources/lang/default.lang @@ -289,69 +289,39 @@ biomes: # -- Tree Types -- tree types: - tree: - name: tree¦s - pattern: (any )?trees? - regular: - name: oak¦s - pattern: (any )?(regular|normal|oak)( tree)?s? - small_regular: - name: small oak¦s - pattern: small (regular|normal|oak)( tree)?s? - big_regular: - name: big tree¦s - pattern: (big|large) (regular|normal|oak)( tree)?s? - redwood: - name: redwood¦s - pattern: (any )?(fir|pine|spruce|redwood)( tree)?s? - small_redwood: - name: small redwood¦s - pattern: small (fir|pine|spruce|redwood)( tree)?s? - big_redwood: - name: tall redwood¦s - pattern: (big|tall) (fir|pine|spruce|redwood)( tree)?s? - mega_redwood: - name: mega redwood¦s - pattern: (mega|giant) (fir|pine|spruce|redwood)( tree)?s? - birch: - name: birch¦es - pattern: birch( trees?|es) - tall_birch: - name: tall birch¦es - pattern: (tall|big) birch( trees?|es) - jungle: - name: jungle tree¦s - pattern: (any )?jungle( tree)?s? - small_jungle: - name: small jungle tree¦s - pattern: small jungle( tree)?s? - big_jungle: - name: big jungle tree¦s - pattern: (big|tall|huge|giant|large) jungle( tree)?s? - cocoa_tree: - name: cocoa tree¦s - pattern: cocoa trees? - acacia: - name: acacia¦s - pattern: acacia( tree)?s? - dark_oak: - name: dark oak¦s - pattern: dark oak( tree)?s? - jungle_bush: - name: bush¦es - pattern: (jungle )?bush(es)? - swamp: - name: swamp tree¦s - pattern: swamp trees? - mushroom: - name: huge mushroom¦s - pattern: (any )?(huge|giant|large|big) mushrooms? - red_mushroom: - name: huge red mushroom¦s - pattern: (huge|giant|large|big) red mushrooms? - brown_mushroom: - name: huge brown mushroom¦s - pattern: (huge|giant|large|big) brown mushrooms? + tree: tree, any tree + oak: oak tree, any oak tree, any normal tree, any regular tree + small_oak: small oak tree, small normal tree, small regular tree + big_oak: big oak tree, big normal tree, big regular tree + spruce: spruce tree, any spruce tree + small_spruce: small spruce tree + big_spruce: big spruce tree, tall spruce tree + mega_spruce: mega spruce tree, giant spruce tree + birch: birch tree, any birch tree + small_birch: small birch tree + tall_birch: tall birch tree + jungle: jungle tree, any jungle tree + small_jungle: small jungle tree + big_jungle: big jungle tree, tall jungle tree, giant jungle tree + cocoa_tree: cocoa tree, jungle cocoa tree, cocoa jungle tree + jungle_bush: jungle bush, jungle bush tree + acacia: acacia tree + dark_oak: dark oak tree + swamp: swamp tree, swamp oak, swamp oak tree + mushroom: huge mushroom, any huge mushroom + red_mushroom: huge red mushroom + brown_mushroom: huge brown mushroom + mangrove: mangrove tree, any mangrove treee + small_mangrove: small mangrove tree + big_mangrove: big mangrove tree + azalea: azalea tree + pale_oak: pale oak tree, any pale oak tree + pale_oak_normal: normal pale oak tree + pale_oak_creaking: creaking pale oak tree + cherry: cherry tree + crimson_fungus: crimson fungus, crimson tree, crimson fungus tree + warped_fungus: warped fungus, warped tree, warped fungus tree + chorus_plant: chorus plant # -- Time -- time: @@ -2915,7 +2885,7 @@ types: direction: direction¦s @a slot: slot¦s @a color: color¦s @a - structuretype: tree type¦s @a + treetype: tree type¦s @a enchantmenttype: enchantment type¦s @an experience: experience point¦s @an experience.pattern: (e?xp|experience( points?)?) diff --git a/src/test/java/org/skriptlang/skript/test/tests/classes/ClassesTest.java b/src/test/java/org/skriptlang/skript/test/tests/classes/ClassesTest.java index edda38d818d..0d232e50719 100644 --- a/src/test/java/org/skriptlang/skript/test/tests/classes/ClassesTest.java +++ b/src/test/java/org/skriptlang/skript/test/tests/classes/ClassesTest.java @@ -18,7 +18,7 @@ import ch.njol.skript.util.Direction; import ch.njol.skript.util.Experience; import ch.njol.skript.util.SkriptColor; -import ch.njol.skript.util.StructureType; +import ch.njol.skript.util.TreeSpecies; import ch.njol.skript.util.Time; import ch.njol.skript.util.Timeperiod; import ch.njol.skript.util.Timespan; @@ -34,7 +34,7 @@ public void serializationTest() { "String", // Skript - SkriptColor.BLACK, StructureType.RED_MUSHROOM, WeatherType.THUNDER, + SkriptColor.BLACK, TreeSpecies.RED_MUSHROOM, WeatherType.THUNDER, new Date(System.currentTimeMillis()), new Timespan(1337), new Time(12000), new Timeperiod(1000, 23000), new Experience(15), new Direction(0, Math.PI, 10), new Direction(new double[] {0, 1, 0}), new EntityType(new SimpleEntityData(HumanEntity.class), 300),