Skip to content

Commit

Permalink
Merge pull request #17 from SkriptHub/dev/update
Browse files Browse the repository at this point in the history
Dev/Update - Future Release
  • Loading branch information
ShaneBeee authored Dec 5, 2024
2 parents e93e3fb + 2e018d6 commit 5e6c5ef
Show file tree
Hide file tree
Showing 16 changed files with 301 additions and 229 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ jobs:
uses: SkriptLang/[email protected]
with:
test_script_directory: src/test/scripts
skript_repo_ref: 2.9.3
skript_repo_ref: 2.9.5
extra_plugins_directory: extra-plugins/
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repositories {

dependencies {
// Paper
compileOnly("io.papermc.paper:paper-api:1.21.3-R0.1-SNAPSHOT")
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")

// Skript
compileOnly(group: 'com.github.SkriptLang', name: 'Skript', version: '2.8.7') {
Expand All @@ -46,7 +46,7 @@ dependencies {
compileOnly("org.apache.commons:commons-text:1.10.0")

// NBT-API
implementation("de.tr7zw:item-nbt-api:2.14.0") {
implementation("de.tr7zw:item-nbt-api:2.14.1-SNAPSHOT") { // TODO temporary (update before release)
transitive = false
}

Expand Down Expand Up @@ -100,7 +100,7 @@ shadowJar {
tasks.register('server', Copy) {
from shadowJar
// Change this to wherever you want your jar to build
into '/Users/ShaneBee/Desktop/Server/Skript/1-21-2/plugins'
into '/Users/ShaneBee/Desktop/Server/Skript/1-21-4/plugins'
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ private ParticleUtil() {

private static final Map<String, Particle> PARTICLES = new HashMap<>();
private static final Map<Particle, String> PARTICLE_NAMES = new HashMap<>();
// Added in Minecraft 1.21.2
public static final boolean HAS_TARGET_COLOR = Skript.classExists("org.bukkit.Particle$TargetColor");
// Added in Minecraft 1.21.4
public static final boolean HAS_TRAIL = Skript.classExists("org.bukkit.Particle$Trail");

static {
// Added in Spigot 1.20.2 (oct 20/2023)
Expand Down Expand Up @@ -147,8 +147,8 @@ private static String getDataType(Particle particle) {
return "number(float)";
} else if (dataType == Color.class) {
return "color/bukkitcolor";
} else if (HAS_TARGET_COLOR && dataType == Particle.TargetColor.class) {
return "targetColor";
} else if (HAS_TRAIL && dataType == Particle.Trail.class) {
return "trail";
}
// For future particle data additions that haven't been added here yet
Util.debug("Missing particle data type: '&e" + dataType.getName() + "&7'");
Expand Down Expand Up @@ -204,7 +204,7 @@ private static Object getData(Particle particle, Object data) {
return material.createBlockData();
}
}
} else if (HAS_TARGET_COLOR && dataType == Particle.TargetColor.class && data instanceof Particle.TargetColor) {
} else if (HAS_TRAIL && dataType == Particle.Trail.class && data instanceof Particle.Trail) {
return data;
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public ClassInfo<E> getClassInfoWithoutUsage(String codeName) {
}

private void registerComparator(Class<E> c) {
if (Comparators.exactComparatorExists(c, c)) return;
Comparators.registerComparator(c, c, (o1, o2) -> Relation.get(o1.equals(o2)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ private RegistryClassInfo(Registry<T> registry, Class<T> registryClass, boolean
this.registry = registry;
this.prefix = prefix;
this.suffix = suffix;
Comparators.registerComparator(registryClass, registryClass, (o1, o2) -> Relation.get(o1.equals(o2)));
if (!Comparators.exactComparatorExists(registryClass, registryClass)) {
Comparators.registerComparator(registryClass, registryClass, (o1, o2) -> Relation.get(o1.equals(o2)));
}
if (usage) this.usage(getNames());
this.parser(new Parser<>() {
@SuppressWarnings("NullableProblems")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@
public class Types {

static {

Classes.registerClass(RegistryClassInfo.create(Registry.GAME_EVENT, GameEvent.class, "gameevent")
.name("Game Event")
.user("game ?events?")
.description("Represents a Minecraft 'GameEvent', mainly used by Skulk Sensors. Requires MC 1.17+.",
"See [**GameEvents**](https://minecraft.wiki/w/Sculk_Sensor#Vibration_frequencies) on McWiki for more details.",
"NOTE: These are auto-generated and may differ between server versions.")
.after("itemtype")
.examples("")
.since("1.14.0"));
if (Classes.getExactClassInfo(GameEvent.class) == null) {
Classes.registerClass(RegistryClassInfo.create(Registry.GAME_EVENT, GameEvent.class, "gameevent")
.name("Game Event")
.user("game ?events?")
.description("Represents a Minecraft 'GameEvent', mainly used by Skulk Sensors. Requires MC 1.17+.",
"See [**GameEvents**](https://minecraft.wiki/w/Sculk_Sensor#Vibration_frequencies) on McWiki for more details.",
"NOTE: These are auto-generated and may differ between server versions.")
.after("itemtype")
.examples("")
.since("1.14.0"));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
public class Types {

static {
Classes.registerClass(new ClassInfo<>(Objective.class, "objective")
if (Classes.getExactClassInfo(Objective.class) == null) {
Classes.registerClass(new ClassInfo<>(Objective.class, "objective")
.user("objectives?")
.name("Scoreboard - Objective")
.description("Represents an objective in a scoreboard.",
"When deleting, the objective will be unregistered.")
"When deleting, the objective will be unregistered.")
.since("2.6.0")
.parser(new Parser<>() {

Expand Down Expand Up @@ -61,46 +62,51 @@ public void change(Objective[] what, @Nullable Object[] delta, ChangeMode mode)
}
}
}));
}

if (Skript.classExists("org.bukkit.scoreboard.Criteria")) {
if (Skript.classExists("org.bukkit.scoreboard.Criteria") && Classes.getExactClassInfo(Criteria.class) == null) {
Classes.registerClass(new ClassInfo<>(Criteria.class, "criteria")
.user("criterias?")
.name("Scoreboard - Criteria")
.description("Represents a criteria for a scoreboard objective.",
"See [**Scoreboard Criteria**](https://minecraft.wiki/w/Scoreboard#Criteria) on McWiki for more details.")
.since("2.6.0")
.parser(new Parser<>() {
.user("criterias?")
.name("Scoreboard - Criteria")
.description("Represents a criteria for a scoreboard objective.",
"See [**Scoreboard Criteria**](https://minecraft.wiki/w/Scoreboard#Criteria) on McWiki for more details.")
.since("2.6.0")
.parser(new Parser<>() {

@Override
public boolean canParse(@NotNull ParseContext context) {
return false;
}
@Override
public boolean canParse(@NotNull ParseContext context) {
return false;
}

@Override
public @NotNull String toString(Criteria o, int flags) {
return "criteria " + o.getName();
}
@Override
public @NotNull String toString(Criteria o, int flags) {
return "criteria " + o.getName();
}

@Override
public @NotNull String toVariableNameString(Criteria o) {
return "criteria{name=" + o.getName() + "}";
}
}));
}
@Override
public @NotNull String toVariableNameString(Criteria o) {
return "criteria{name=" + o.getName() + "}";
}
}));
}

EnumWrapper<RenderType> RENDER_ENUM = new EnumWrapper<>(RenderType.class);
Classes.registerClass(RENDER_ENUM.getClassInfo("rendertype")
if (Classes.getExactClassInfo(RenderType.class) == null) {
EnumWrapper<RenderType> RENDER_ENUM = new EnumWrapper<>(RenderType.class);
Classes.registerClass(RENDER_ENUM.getClassInfo("rendertype")
.user("render ?types?")
.name("Scoreboard - Objective Render Type")
.description("Controls the way in which an Objective is rendered client side.")
.since("2.6.0"));
}

EnumWrapper<DisplaySlot> DISPLAY_ENUM = new EnumWrapper<>(DisplaySlot.class);
Classes.registerClass(DISPLAY_ENUM.getClassInfo("displayslot")
if (Classes.getExactClassInfo(DisplaySlot.class) == null) {
EnumWrapper<DisplaySlot> DISPLAY_ENUM = new EnumWrapper<>(DisplaySlot.class);
Classes.registerClass(DISPLAY_ENUM.getClassInfo("displayslot")
.user("display ?slots?")
.name("Scoreboard - Objective Display Slot")
.description("Locations for displaying objectives to the player")
.since("2.6.0"));
}
}

}
Loading

0 comments on commit 5e6c5ef

Please sign in to comment.