Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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: 4 additions & 0 deletions Essentials/src/main/java/com/earth2me/essentials/Mob.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ public enum Mob {
CREAKING("Creaking", Enemies.ENEMY, "CREAKING"),
HAPPY_GHAST("HappyGhast", Enemies.FRIENDLY, "HAPPY_GHAST"),
COPPER_GOLEM("CopperGolem", Enemies.FRIENDLY, "COPPER_GOLEM"),
CAMEL_HUSK("CamelHusk", Enemies.NEUTRAL, "CAMEL_HUSK"),
NAUTILUS("Nautilus", Enemies.NEUTRAL, "NAUTILUS"),
ZOMBIE_NAUTILUS("ZombieNautilus", Enemies.NEUTRAL, "ZOMBIE_NAUTILUS"),
PARCHED("Parched", Enemies.ENEMY, "PARCHED"),
;

private static final Map<String, Mob> hashMap = new HashMap<>();
Expand Down
29 changes: 29 additions & 0 deletions Essentials/src/main/java/com/earth2me/essentials/MobCompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.ess3.nms.refl.ReflUtil;
import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.entity.AbstractNautilus;
import org.bukkit.entity.Axolotl;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Camel;
Expand All @@ -26,6 +27,7 @@
import org.bukkit.entity.TropicalFish;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.ZombieNautilus;
import org.bukkit.inventory.ItemStack;

import java.lang.invoke.MethodHandle;
Expand Down Expand Up @@ -69,6 +71,9 @@ public final class MobCompat {
public static final EntityType FROG = getEntityType("FROG");
public static final EntityType CAMEL = getEntityType("CAMEL");
public static final EntityType SALMON = getEntityType("SALMON");
public static final EntityType CAMEL_HUSK = getEntityType("CAMEL_HUSK");
public static final EntityType NAUTILUS = getEntityType("NAUTILUS");
public static final EntityType ZOMBIE_NAUTILUS = getEntityType("ZOMBIE_NAUTILUS");

// Constants for mobs that have changed since earlier versions
public static final EntityType CAT = getEntityType("CAT", "OCELOT");
Expand Down Expand Up @@ -304,6 +309,30 @@ public static void setPigVariant(final Entity spawned, final String variant) {
}
}

public static void setZombieNautilusVariant(final Entity spawned, final String variant) {
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_21_11_R01)) {
return;
}

if (spawned instanceof ZombieNautilus) {
//noinspection DataFlowIssue
((ZombieNautilus) spawned).setVariant(RegistryUtil.valueOf(ZombieNautilus.Variant.class, variant));
}
}

public static void setNautilusSaddle(final Entity entity, final Player target) {
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_21_11_R01)) {
return;
}

if (entity instanceof AbstractNautilus) {
final AbstractNautilus nautilus = (AbstractNautilus) entity;
nautilus.setTamed(true);
nautilus.setOwner(target);
nautilus.getInventory().setSaddle(new ItemStack(Material.SADDLE, 1));
}
}

public enum CatType {
// These are (loosely) Mojang names for the cats
SIAMESE("SIAMESE", "SIAMESE_CAT"),
Expand Down
18 changes: 18 additions & 0 deletions Essentials/src/main/java/com/earth2me/essentials/MobData.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public enum MobData {
SADDLE_HORSE("saddle", EntityType.HORSE, Data.HORSESADDLE, true),
GOLD_ARMOR_HORSE("goldarmor", EntityType.HORSE, EnumUtil.getMaterial("GOLDEN_HORSE_ARMOR", "GOLD_BARDING"), true),
DIAMOND_ARMOR_HORSE("diamondarmor", EntityType.HORSE, EnumUtil.getMaterial("DIAMOND_HORSE_ARMOR", "DIAMOND_BARDING"), true),
NETHERITE_HORSE_ARMOR("netheritearmor", EntityType.HORSE, EnumUtil.getMaterial("NETHERITE_HORSE_ARMOR"), true),
ARMOR_HORSE("armor", EntityType.HORSE, EnumUtil.getMaterial("IRON_HORSE_ARMOR", "IRON_BARDING"), true),
SIAMESE_CAT("siamese", MobCompat.CAT, MobCompat.CatType.SIAMESE, true),
WHITE_CAT("white", MobCompat.CAT, MobCompat.CatType.WHITE, false),
Expand Down Expand Up @@ -231,6 +232,11 @@ public enum MobData {
TEMPERATE_PIG("temperate", Pig.class, "pig:TEMPERATE", true),
WARM_PIG("warm", Pig.class, "pig:WARM", true),
COLD_PIG("cold", Pig.class, "pig:COLD", true),
SADDLE_CAMEL_HUSK("saddle", MobCompat.CAMEL_HUSK, Data.CAMELHUSKSADDLE, true),
TEMPERATE_ZOMBIE_NAUTILUS("temperate", MobCompat.ZOMBIE_NAUTILUS, "zombienautilus:TEMPERATE", true),
WARM_ZOMBIE_NAUTILUS("warm", MobCompat.ZOMBIE_NAUTILUS, "zombienautilus:WARM", true),
SADDLE_NAUTILUS("saddle", MobCompat.NAUTILUS, Data.NAUTILUSSADDLE, true),
SADDLE_ZOMBIE_NAUTILUS("saddle", MobCompat.ZOMBIE_NAUTILUS, Data.NAUTILUSSADDLE, true)
;

final private String nickname;
Expand Down Expand Up @@ -411,6 +417,12 @@ public void setData(final Entity spawned, final Player target, final String rawD
((Goat) spawned).setScreaming(true);
} else if (this.value.equals(Data.CAMELSADDLE)) {
MobCompat.setCamelSaddle(spawned, target);
} else if (this.value.equals(Data.CAMELHUSKSADDLE)) {
MobCompat.setCamelSaddle(spawned, target);
} else if (this.value.equals(Data.NAUTILUSSADDLE)) {
MobCompat.setNautilusSaddle(spawned, target);
} else if (this.value.equals(Data.ZOMBIENAUTILUSSADDLE)) {
MobCompat.setNautilusSaddle(spawned, target);
} else if (this.value instanceof MobCompat.BoatVariant) {
MobCompat.setBoatVariant(spawned, (MobCompat.BoatVariant) this.value);
} else if (this.value instanceof String) {
Expand Down Expand Up @@ -461,6 +473,9 @@ public void setData(final Entity spawned, final Player target, final String rawD
case "pig":
MobCompat.setPigVariant(spawned, split[1]);
break;
case "zombienautilus":
MobCompat.setZombieNautilusVariant(spawned, split[1]);
break;
}
} else {
Essentials.getWrappedLogger().warning("Unknown mob data type: " + this.toString());
Expand All @@ -486,5 +501,8 @@ public enum Data {
FISH_PATTERN_COLOR,
GOAT_SCREAMING,
CAMELSADDLE,
CAMELHUSKSADDLE,
NAUTILUSSADDLE,
ZOMBIENAUTILUSSADDLE,
}
}
8 changes: 8 additions & 0 deletions Essentials/src/main/java/com/earth2me/essentials/Potions.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ public final class Potions {
ALIASPOTIONS.put("wind", PotionEffectType.WIND_CHARGED);
} catch (final Throwable ignored) {
}

// 1.21.11
try {
POTIONS.put("breathofthenautilus", PotionEffectType.BREATH_OF_THE_NAUTILUS);
ALIASPOTIONS.put("nautilusbreath", PotionEffectType.BREATH_OF_THE_NAUTILUS);
ALIASPOTIONS.put("nautilus", PotionEffectType.BREATH_OF_THE_NAUTILUS);
} catch (final Throwable ignored) {
}
}

private Potions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public final class VersionUtil {
public static final BukkitVersion v1_21_3_R01 = BukkitVersion.fromString("1.21.3-R0.1-SNAPSHOT");
public static final BukkitVersion v1_21_5_R01 = BukkitVersion.fromString("1.21.5-R0.1-SNAPSHOT");
public static final BukkitVersion v1_21_8_R01 = BukkitVersion.fromString("1.21.8-R0.1-SNAPSHOT");
public static final BukkitVersion v1_21_10_R01 = BukkitVersion.fromString("1.21.10-R0.1-SNAPSHOT");
public static final BukkitVersion v1_21_11_R01 = BukkitVersion.fromString("1.21.11-pre1-R0.1-SNAPSHOT");

private static final Set<BukkitVersion> supportedVersions = ImmutableSet.of(v1_8_8_R01, v1_9_4_R01, v1_10_2_R01, v1_11_2_R01, v1_12_2_R01, v1_13_2_R01, v1_14_4_R01, v1_15_2_R01, v1_16_5_R01, v1_17_1_R01, v1_18_2_R01, v1_19_4_R01, v1_20_6_R01, v1_21_10_R01);
private static final Set<BukkitVersion> supportedVersions = ImmutableSet.of(v1_8_8_R01, v1_9_4_R01, v1_10_2_R01, v1_11_2_R01, v1_12_2_R01, v1_13_2_R01, v1_14_4_R01, v1_15_2_R01, v1_16_5_R01, v1_17_1_R01, v1_18_2_R01, v1_19_4_R01, v1_20_6_R01, v1_21_11_R01);

public static final boolean PRE_FLATTENING = VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_13_0_R01);

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ however, have some new requirements:
* **EssentialsX requires CraftBukkit, Spigot or Paper to run.** Other server software may work, but these are not tested
by the team and we may not be able to help with any issues that occur.
* **EssentialsX currently supports Minecraft versions 1.8.8, 1.9.4, 1.10.2, 1.11.2, 1.12.2, 1.13.2, 1.14.4, 1.15.2,
1.16.5, 1.17.1, 1.18.2, 1.19.4, 1.20.6, and 1.21.10.**
1.16.5, 1.17.1, 1.18.2, 1.19.4, 1.20.6, and 1.21.11.**
* **EssentialsX currently requires Java 8 or higher.** We recommend using the latest Java version supported by your
server software.
* **EssentialsX requires [Vault](http://dev.bukkit.org/bukkit-plugins/vault/) to enable using chat prefix/suffixes and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
val baseExtension = extensions.create<EssentialsBaseExtension>("essentials", project)

val checkstyleVersion = "8.36.2"
val paperVersion = "1.21.10-R0.1-SNAPSHOT"
val paperVersion = "1.21.11-pre1-R0.1-SNAPSHOT"
val paperTestVersion = "1.21.8-R0.1-SNAPSHOT"
val junit5Version = "5.12.2"
val junitPlatformVersion = "1.12.2"
Expand Down
6 changes: 6 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
dependencyResolutionManagement {
repositories {
maven("https://maven-prs.papermc.io/Paper/pr13194") {
name = "Maven for PR #13194" // https://github.com/PaperMC/Paper/pull/13194
mavenContent {
includeModule("io.papermc.paper", "paper-api")
}
}
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://hub.spigotmc.org/nexus/content/groups/public/") {
content {
Expand Down