Skip to content

Commit

Permalink
Dev 1.20/1.21 support (#173)
Browse files Browse the repository at this point in the history
* Dev 1.20 support
- Add missing 1.19 mobs

* feat: 1.20.2 update

* feat: 1.20.4 update

* feat: 1.20.5/6 update

* feat: 1.21 update

* feat: Update gradle to 8.8

* feat: Update NBTEditor
  • Loading branch information
Aurelien30000 authored Jul 15, 2024
1 parent 47a0a0c commit c1249bc
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 22 deletions.
2 changes: 1 addition & 1 deletion LandLord-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
dependencies {
api(project(":LandLord-api"))
implementation("com.zaxxer:HikariCP:5.0.1")
implementation("io.github.bananapuncher714:nbteditor:7.18.6")
implementation("io.github.bananapuncher714:nbteditor:7.19.3")
implementation("de.eldoria:eldo-util:1.14.4")
implementation("io.papermc:paperlib:1.0.8")
compileOnly("org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public ItemStack getSkull(ILandLord plugin) {
return head;

SkullMeta headMeta = (SkullMeta) head.getItemMeta();
GameProfile profile = new GameProfile(uuid, null);
GameProfile profile = new GameProfile(uuid, uuid.toString());

profile.getProperties().put("textures", new Property("textures", texture));

Expand Down
4 changes: 2 additions & 2 deletions LandLord-latest/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ plugins {

dependencies {
implementation(project(":LandLord-core"))
compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT")
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.2.18")
compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.2.20")
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.9")
compileOnly("io.papermc:paperlib:1.0.8")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ protected boolean checkDependencies() {
String version = getServer().getVersion();
if (!version.contains("1.13.2") && !version.contains("1.14") && !version.contains("1.15")
&& !version.contains("1.16") && !version.contains("1.17") && !version.contains("1.18")
&& !version.contains("1.19")) {
&& !version.contains("1.19") && !version.contains("1.20") && !version.contains("1.21")) {
haltPlugin("Invalid Spigot version detected! LandLord latest requires " +
"1.13.2/1.14.x/1.15.x/1.16.x/1.17.x/1.18.x/1.19.x, use Legacy version for 1.12.2!");
"1.13.2/1.14.x/1.15.x/1.16.x/1.17.x/1.18.x/1.19.x/1.20.x/1.21.x, use Legacy version for 1.12.2!");
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ public Material getGrass() {

@Override
public Material getLongGrass() {
return Material.GRASS;
try {
return Material.TALL_GRASS;
} catch (Exception ignored) {
return Material.valueOf("GRASS");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ public MobsManager(ILandLord plugin) {
register1_17Entities();
}

if (currentDataVersion >= 3105) {
register1_19Entities();
}

if (currentDataVersion >= 3463) {
register1_20Entities();
}

if (currentDataVersion >= 3837) {
register1_20_5Entities();
}

if (currentDataVersion >= 3953) {
register1_21Entities();
}

MOBS.sort(Comparator.comparing(iMob -> iMob.getType().name()));
}

Expand Down Expand Up @@ -98,7 +114,13 @@ private void registerDefaultEntities() {
Mob TROPICAL_FISH = new Mob(EntityType.TROPICAL_FISH, Material.TROPICAL_FISH_SPAWN_EGG);
Mob DROWNED = new Mob(EntityType.DROWNED, Material.DROWNED_SPAWN_EGG);
Mob DOLPHIN = new Mob(EntityType.DOLPHIN, Material.DOLPHIN_SPAWN_EGG);
Mob MUSHROOM_COW = new Mob(EntityType.MUSHROOM_COW, Material.MOOSHROOM_SPAWN_EGG);

// MUSHROOM_COW still exists in 1.20.4-
if (currentDataVersion <= 3700) {
Mob MUSHROOM_COW = new Mob(EntityType.valueOf("MUSHROOM_COW"), Material.MOOSHROOM_SPAWN_EGG);
} else {
Mob MUSHROOM_COW = new Mob(EntityType.MOOSHROOM, Material.MOOSHROOM_SPAWN_EGG);
}

// PIG_ZOMBIE still exists in 1.15.1-
if (currentDataVersion <= 2227) {
Expand All @@ -125,7 +147,9 @@ private void register1_15Entities() {
private void register1_16Entities() {
// 1.16's entities
Mob HOGLIN = new Mob(EntityType.HOGLIN, Material.HOGLIN_SPAWN_EGG);
Mob PIGLIN = new Mob(EntityType.PIGLIN, Material.PIGLIN_SPAWN_EGG);
Mob PIGLIN = new Mob(EntityType.PIGLIN, currentDataVersion >= 3463
? Material.valueOf("PIGLIN_HEAD")
: Material.PIGLIN_SPAWN_EGG);
Mob STRIDER = new Mob(EntityType.STRIDER, Material.STRIDER_SPAWN_EGG);
Mob ZOGLIN = new Mob(EntityType.ZOGLIN, Material.ZOGLIN_SPAWN_EGG);
Mob ZOMBIFIED_PIGLIN = new Mob(EntityType.ZOMBIFIED_PIGLIN, Material.ZOMBIFIED_PIGLIN_SPAWN_EGG);
Expand All @@ -143,6 +167,31 @@ private void register1_17Entities() {
Mob GOAT = new Mob(EntityType.GOAT, Material.GOAT_SPAWN_EGG);
}

private void register1_19Entities() {
// 1.19's entities
Mob ALLAY = new Mob(EntityType.ALLAY, Material.ALLAY_SPAWN_EGG);
Mob FROG = new Mob(EntityType.FROG, Material.FROG_SPAWN_EGG);
Mob TADPOLE = new Mob(EntityType.TADPOLE, Material.TADPOLE_SPAWN_EGG);
Mob WARDEN = new Mob(EntityType.WARDEN, Material.WARDEN_SPAWN_EGG);
}

private void register1_20Entities() {
// 1.20's entities
Mob CAMEL = new Mob(EntityType.CAMEL, Material.CAMEL_SPAWN_EGG);
Mob SNIFFER = new Mob(EntityType.SNIFFER, Material.SNIFFER_SPAWN_EGG);
}

private void register1_20_5Entities() {
// 1.20.5's entities
Mob ARMADILLO = new Mob(EntityType.ARMADILLO, Material.ARMADILLO_SPAWN_EGG);
}

private void register1_21Entities() {
// 1.21's entities
Mob BOGGED = new Mob(EntityType.BOGGED, Material.BOGGED_SPAWN_EGG);
Mob BREEZE = new Mob(EntityType.BREEZE, Material.BREEZE_SPAWN_EGG);
}

@Override
public Collection<IMob> values() {
return MOBS;
Expand Down
5 changes: 5 additions & 0 deletions LandLord-latest/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,11 @@ Manage:
- FROG
- TADPOLE
- WARDEN
- CAMEL
- SNIFFER
- ARMADILLO
- BOGGED
- BREEZE

# Define how the claim height should be defined.
ClaimHeight:
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down

0 comments on commit c1249bc

Please sign in to comment.