Skip to content

Commit

Permalink
boat patch 2
Browse files Browse the repository at this point in the history
  • Loading branch information
sovdeeth committed Nov 2, 2024
1 parent d89d654 commit 51d056d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/main/java/ch/njol/skript/entity/BoatChestData.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ protected boolean init(@Nullable Class<? extends ChestBoat> clazz, @Nullable Che

@Override
public void set(ChestBoat entity) {
if (IS_RUNNING_1_21_3)
return;
if (matchedPattern == 1) // If the type is 'any boat'.
matchedPattern += new Random().nextInt(Boat.Type.values().length); // It will spawn a random boat type in case is 'any boat'.
if (matchedPattern > 1) // 0 and 1 are excluded
Expand Down
24 changes: 17 additions & 7 deletions src/main/java/ch/njol/skript/entity/BoatData.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
package ch.njol.skript.entity;

import java.util.EnumMap;
import java.util.Locale;
import java.util.Random;

import ch.njol.skript.Skript;
import org.bukkit.Material;
import org.bukkit.entity.Boat;
import org.bukkit.entity.boat.*;
import ch.njol.skript.aliases.ItemType;
import ch.njol.skript.lang.Literal;
import ch.njol.skript.lang.SkriptParser.ParseResult;
import org.bukkit.Material;
import org.bukkit.entity.Boat;
import org.bukkit.entity.boat.AcaciaBoat;
import org.bukkit.entity.boat.BambooRaft;
import org.bukkit.entity.boat.BirchBoat;
import org.bukkit.entity.boat.CherryBoat;
import org.bukkit.entity.boat.DarkOakBoat;
import org.bukkit.entity.boat.JungleBoat;
import org.bukkit.entity.boat.MangroveBoat;
import org.bukkit.entity.boat.OakBoat;
import org.bukkit.entity.boat.SpruceBoat;
import org.jetbrains.annotations.Nullable;

import java.util.EnumMap;
import java.util.Locale;
import java.util.Random;

public class BoatData extends EntityData<Boat> {

private static final boolean IS_RUNNING_1_21_3 = Skript.isRunningMinecraft(1, 21, 3);
Expand Down Expand Up @@ -78,6 +86,8 @@ protected boolean init(@Nullable Class<? extends Boat> clazz, @Nullable Boat ent

@Override
public void set(Boat entity) {
if (IS_RUNNING_1_21_3)
return;
if (matchedPattern == 1) // If the type is 'any boat'.
matchedPattern += new Random().nextInt(Boat.Type.values().length); // It will spawn a random boat type in case is 'any boat'.
if (matchedPattern > 1) // 0 and 1 are excluded
Expand Down

0 comments on commit 51d056d

Please sign in to comment.