Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preliminary 1.17 work #4070

Merged
merged 25 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5187d0f
Preliminary 1.17 work
ShaneBeee Jun 13, 2021
1b885bf
Switch to AxolotlData
ShaneBeee Jun 13, 2021
c9299b6
AxolotlData - small fixes
ShaneBeee Jun 13, 2021
50729ab
AxolotlData - license
ShaneBeee Jun 13, 2021
79d3f8e
GoatData - switched to goat data
ShaneBeee Jun 13, 2021
16aee58
SimpleEntityData - remove unneeded imports
ShaneBeee Jun 13, 2021
ee7ed17
GoatData - change hashcode
ShaneBeee Jun 13, 2021
b95aaf8
lang - add freeze damage cause
ShaneBeee Jun 13, 2021
efd4356
lang - add new biomes
ShaneBeee Jun 13, 2021
92e7192
lang - add missing spawn reason
ShaneBeee Jun 14, 2021
3eac11c
SimpleEntityData - register squid after glow squid
ShaneBeee Jun 16, 2021
a341ab7
build.gradle - update to Paper 1.17
ShaneBeee Jun 20, 2021
ae95720
Update aliases subproject
TPGamesNL Jun 22, 2021
c2ae2df
Merge remote-tracking branch 'upstream/master' into feature/prepare-117
TPGamesNL Jun 22, 2021
d1895c3
Update GH Actions workflow
TPGamesNL Jun 22, 2021
d0aea5c
workflows/gradle.yml - testing switching back to java 8 after Skript …
ShaneBeee Jun 22, 2021
7e27bd5
workflows/gradle.yml - remove test as it failed
ShaneBeee Jun 22, 2021
79be864
switch test 1.15.2 to 1.17
ShaneBeee Jun 22, 2021
6f12698
Merge branch 'master' into feature/prepare-117
ShaneBeee Jun 22, 2021
c4ca9b5
Merge branch 'master' into feature/prepare-117
ShaneBeee Jun 22, 2021
04d5195
lang - add composter inventory
ShaneBeee Jun 23, 2021
2bf33e4
AxolotlData - remove note
ShaneBeee Jun 23, 2021
2b434f1
Merge remote-tracking branch 'origin/feature/prepare-117' into featur…
ShaneBeee Jun 23, 2021
fdf94d8
Update english.lang
TPGamesNL Jun 23, 2021
b076230
Merge branch 'master' into feature/prepare-117
ShaneBeee Jun 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
- uses: actions/checkout@v2
- name: Checkout submodules
uses: textbook/[email protected]
- name: Set up JDK 1.8
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 16
- name: Build Skript
run: ./gradlew nightlyRelease
- name: Run test scripts
Expand Down
18 changes: 10 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ import org.apache.tools.ant.filters.ReplaceTokens
import java.time.LocalTime

plugins {
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'com.github.hierynomus.license' version '0.14.0'
id 'com.github.johnrengelman.shadow' version '7.0.0'
id 'com.github.hierynomus.license' version '0.16.1'
id 'java'
}

tasks.withType(JavaCompile).configureEach {
options.compilerArgs += ["-source", "1.8", "-target", "1.8"]
}

allprojects {
repositories {
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
Expand All @@ -24,7 +27,7 @@ allprojects {

dependencies {
shadow group: 'io.papermc', name: 'paperlib', version: '1.0.6'
implementation group: 'com.destroystokyo.paper', name: 'paper-api', version: '1.16.5-R0.1-SNAPSHOT'
implementation group: 'io.papermc.paper', name: 'paper-api', version: '1.17-R0.1-SNAPSHOT'
implementation group: 'org.eclipse.jdt', name: 'org.eclipse.jdt.annotation', version: '1.1.0'
implementation group: 'com.google.code.findbugs', name: 'findbugs', version: '3.0.1'
implementation group: 'com.sk89q.worldguard', name: 'worldguard-legacy', version: '7.0.0-SNAPSHOT'
Expand Down Expand Up @@ -70,8 +73,7 @@ task sourceJar(type: Jar) {
tasks.withType(ShadowJar) {
dependsOn relocateShadowJar
configurations = [
project.configurations.shadow,
project.configurations.compile
project.configurations.shadow
]
dependencies {
include(dependency('io.papermc:paperlib'))
Expand Down Expand Up @@ -164,11 +166,11 @@ void createTestTask(String name, String environments, boolean devMode) {
}

// Register different Skript testing tasks
createTestTask('quickTest', 'src/test/skript/environments/main/paper-1.16.5.json', false)
createTestTask('quickTest', 'src/test/skript/environments/main/paper-1.17.json', false)
createTestTask('skriptTest', 'src/test/skript/environments/main', false)
createTestTask('skriptTestFull', 'src/test/skript/environments/', false)
createTestTask('skriptTestDev', 'src/test/skript/environments/main/' + (project.property('testEnv') == null
? 'paper-1.16.5.json' : project.property('testEnv') + '.json'), true)
? 'paper-1.17.json' : project.property('testEnv') + '.json'), true)

// Build flavor configurations
task githubResources(type: ProcessResources) {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
101 changes: 101 additions & 0 deletions src/main/java/ch/njol/skript/entity/AxolotlData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/**
* This file is part of Skript.
*
* Skript is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Skript is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Skript. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright Peter Güttinger, SkriptLang team and contributors
*/
package ch.njol.skript.entity;

import ch.njol.skript.Skript;
import ch.njol.skript.lang.Literal;
import ch.njol.skript.lang.SkriptParser.ParseResult;
import org.bukkit.entity.Axolotl;
import org.bukkit.entity.Axolotl.Variant;
import org.jetbrains.annotations.Nullable;

public class AxolotlData extends EntityData<Axolotl> {

static {
if (Skript.classExists("org.bukkit.entity.Axolotl")) {
EntityData.register(AxolotlData.class, "axolotl", Axolotl.class, 0,
"axolotl", "lucy axolotl", "wild axolotl", "gold axolotl", "cyan axolotl", "blue axolotl");
}
}

@Nullable
private Variant variant = null;

public AxolotlData() {}

public AxolotlData(@Nullable Variant variant) {
this.variant = variant;
matchedPattern = variant != null ? variant.ordinal() + 1 : 0;
}

@Override
protected boolean init(Literal<?>[] exprs, int matchedPattern, ParseResult parseResult) {
if (matchedPattern > 0)
variant = Variant.values()[matchedPattern - 1];
return true;
}

@Override
protected boolean init(@Nullable Class<? extends Axolotl> c, @Nullable Axolotl axolotl) {
if (axolotl != null)
variant = axolotl.getVariant();
return true;
}

@Override
public void set(Axolotl entity) {
if (variant != null)
entity.setVariant(variant);
}

@Override
protected boolean match(Axolotl entity) {
return variant == null || variant == entity.getVariant();
}

@Override
public Class<? extends Axolotl> getType() {
return Axolotl.class;
}

@Override
public EntityData getSuperType() {
return new AxolotlData(variant);
}

@Override
protected int hashCode_i() {
return variant != null ? variant.hashCode() : 0;
}

@Override
protected boolean equals_i(EntityData<?> data) {
if (!(data instanceof AxolotlData))
return false;
return variant == ((AxolotlData) data).variant;
}

@Override
public boolean isSupertypeOf(EntityData<?> data) {
if (!(data instanceof AxolotlData))
return false;
return variant == null || variant == ((AxolotlData) data).variant;
}

}
98 changes: 98 additions & 0 deletions src/main/java/ch/njol/skript/entity/GoatData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/**
* This file is part of Skript.
*
* Skript is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Skript is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Skript. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright Peter Güttinger, SkriptLang team and contributors
*/
package ch.njol.skript.entity;

import ch.njol.skript.Skript;
import ch.njol.skript.lang.Literal;
import ch.njol.skript.lang.SkriptParser.ParseResult;
import org.bukkit.entity.Goat;
import org.jetbrains.annotations.Nullable;

public class GoatData extends EntityData<Goat> {

static {
if (Skript.classExists("org.bukkit.entity.Goat"))
EntityData.register(GoatData.class, "goat", Goat.class, 0,
"goat", "screaming goat", "quiet goat");
}

private int screaming = 0; // 0 = random, 1 = screaming, 2 = quiet

public GoatData() {}

public GoatData(int screaming) {
this.screaming = screaming;
}

@Override
protected boolean init(Literal<?>[] exprs, int matchedPattern, ParseResult parseResult) {
screaming = matchedPattern;
return true;
}

@Override
protected boolean init(@Nullable Class<? extends Goat> c, @Nullable Goat goat) {
if (goat != null && matchedPattern > 0)
goat.setScreaming(matchedPattern == 1);
return true;
}

@Override
public void set(Goat entity) {
if (matchedPattern > 0)
entity.setScreaming(screaming == 1);
}

@Override
protected boolean match(Goat entity) {
if (matchedPattern > 0)
return entity.isScreaming() ? screaming == 1 : screaming == 2;
return true;
}

@Override
public Class<? extends Goat> getType() {
return Goat.class;
}

@Override
public EntityData getSuperType() {
return new GoatData(screaming);
}

@Override
protected int hashCode_i() {
return screaming;
}

@Override
protected boolean equals_i(EntityData<?> data) {
if (!(data instanceof GoatData))
return false;
return screaming == ((GoatData) data).screaming;
}

@Override
public boolean isSupertypeOf(EntityData<?> data) {
if (!(data instanceof GoatData))
return false;
return screaming == ((GoatData) data).screaming;
}

}
12 changes: 11 additions & 1 deletion src/main/java/ch/njol/skript/entity/SimpleEntityData.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
import org.bukkit.entity.FishHook;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Giant;
import org.bukkit.entity.GlowItemFrame;
import org.bukkit.entity.GlowSquid;
import org.bukkit.entity.Golem;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.Hoglin;
Expand All @@ -73,6 +75,7 @@
import org.bukkit.entity.Llama;
import org.bukkit.entity.LlamaSpit;
import org.bukkit.entity.MagmaCube;
import org.bukkit.entity.Marker;
import org.bukkit.entity.Mob;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Mule;
Expand Down Expand Up @@ -205,7 +208,6 @@ public boolean equals(final @Nullable Object obj) {
types.add(new SimpleEntityDataInfo("snowball", Snowball.class));
types.add(new SimpleEntityDataInfo("snow golem", Snowman.class));
types.add(new SimpleEntityDataInfo("spider", Spider.class));
types.add(new SimpleEntityDataInfo("squid", Squid.class));
types.add(new SimpleEntityDataInfo("bottle of enchanting", ThrownExpBottle.class));
types.add(new SimpleEntityDataInfo("tnt", TNTPrimed.class));
types.add(new SimpleEntityDataInfo("leash hitch", LeashHitch.class));
Expand Down Expand Up @@ -295,9 +297,17 @@ public boolean equals(final @Nullable Object obj) {

if (Skript.classExists("org.bukkit.entity.PiglinBrute")) // Added in 1.16.2
types.add(new SimpleEntityDataInfo("piglin brute", PiglinBrute.class));

if (Skript.isRunningMinecraft(1, 17)) {
types.add(new SimpleEntityDataInfo("glow squid", GlowSquid.class));
types.add(new SimpleEntityDataInfo("marker", Marker.class));
types.add(new SimpleEntityDataInfo("glow item frame", GlowItemFrame.class));
}

// Register zombie after Husk and Drowned to make sure both work
types.add(new SimpleEntityDataInfo("zombie", Zombie.class));
// Register squid after glow squid to make sure both work
types.add(new SimpleEntityDataInfo("squid", Squid.class));

// TODO !Update with every version [entities]

Expand Down
12 changes: 12 additions & 0 deletions src/main/java/ch/njol/skript/util/BlockStateBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.BoundingBox;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;
import org.bukkit.util.VoxelShape;
import org.eclipse.jdt.annotation.Nullable;

import com.destroystokyo.paper.block.BlockSoundGroup;
Expand Down Expand Up @@ -486,4 +488,14 @@ public boolean isValidTool(@NotNull ItemStack itemStack) {
return state.getBlock().getDestroySpeed(itemStack, considerEnchants);
}

@Override
public @NotNull VoxelShape getCollisionShape() {
return state.getBlock().getCollisionShape();
}

@Override
public float getBreakSpeed(@NotNull Player player) {
return state.getBlock().getBreakSpeed(player);
}

}
15 changes: 14 additions & 1 deletion src/main/java/ch/njol/skript/util/DelayedChangeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.BoundingBox;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;
import org.bukkit.util.VoxelShape;
import org.eclipse.jdt.annotation.Nullable;

import com.destroystokyo.paper.block.BlockSoundGroup;
Expand Down Expand Up @@ -446,8 +448,19 @@ public boolean isValidTool(@NotNull ItemStack itemStack) {
}

@Override
public @NotNull float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants) {
public float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants) {
return b.getDestroySpeed(itemStack, considerEnchants);
}

@Override
@NotNull
public VoxelShape getCollisionShape() {
return b.getCollisionShape();
}

@Override
public float getBreakSpeed(@NotNull Player player) {
return b.getBreakSpeed(player);
}

}
Loading