diff --git a/Essentials/pom.xml b/Essentials/pom.xml
index 5bfda19c7..7262ea086 100644
--- a/Essentials/pom.xml
+++ b/Essentials/pom.xml
@@ -52,6 +52,12 @@
com.github.milkbowl
VaultAPI
1.7
+
+
+ org.bukkit
+ bukkit
+
+
provided
@@ -76,6 +82,12 @@
net.ess3
NMSReflectionProvider
2.17.2
+
+
+ org.bukkit
+ bukkit
+
+
compile
@@ -90,5 +102,17 @@
compile
+
+ net.ess3
+ 1_8Provider
+ 2.17.2
+
+
+ org.bukkit
+ bukkit
+
+
+ compile
+
diff --git a/Essentials/src/com/earth2me/essentials/AsyncTeleport.java b/Essentials/src/com/earth2me/essentials/AsyncTeleport.java
index 26059dec8..0f59a7ad5 100644
--- a/Essentials/src/com/earth2me/essentials/AsyncTeleport.java
+++ b/Essentials/src/com/earth2me/essentials/AsyncTeleport.java
@@ -356,17 +356,18 @@ public class AsyncTeleport implements IAsyncTeleport {
void respawnNow(IUser teleportee, TeleportCause cause, CompletableFuture future) {
final Player player = teleportee.getBase();
- Location bed = player.getBedSpawnLocation();
- if (bed != null) {
- nowAsync(teleportee, new LocationTarget(bed), cause, future);
- } else {
- if (ess.getSettings().isDebug()) {
- ess.getLogger().info("Could not find bed spawn, forcing respawn event.");
+ PaperLib.getBedSpawnLocationAsync(player, true).thenAccept(location -> {
+ if (location != null) {
+ nowAsync(teleportee, new LocationTarget(location), cause, future);
+ } else {
+ if (ess.getSettings().isDebug()) {
+ ess.getLogger().info("Could not find bed spawn, forcing respawn event.");
+ }
+ final PlayerRespawnEvent pre = new PlayerRespawnEvent(player, player.getWorld().getSpawnLocation(), false);
+ ess.getServer().getPluginManager().callEvent(pre);
+ nowAsync(teleportee, new LocationTarget(pre.getRespawnLocation()), cause, future);
}
- final PlayerRespawnEvent pre = new PlayerRespawnEvent(player, player.getWorld().getSpawnLocation(), false);
- ess.getServer().getPluginManager().callEvent(pre);
- nowAsync(teleportee, new LocationTarget(pre.getRespawnLocation()), cause, future);
- }
+ });
}
@Override
diff --git a/Essentials/src/com/earth2me/essentials/Enchantments.java b/Essentials/src/com/earth2me/essentials/Enchantments.java
index 0a519f4d2..33bb8d29d 100644
--- a/Essentials/src/com/earth2me/essentials/Enchantments.java
+++ b/Essentials/src/com/earth2me/essentials/Enchantments.java
@@ -251,6 +251,15 @@ public class Enchantments {
}
} catch (IllegalArgumentException ignored) {}
+ try { // 1.16
+ Enchantment soulspeed = Enchantment.getByName("SOUL_SPEED");
+ if (soulspeed != null) {
+ ENCHANTMENTS.put("soulspeed", soulspeed);
+ ALIASENCHANTMENTS.put("soilspeed", soulspeed);
+ ALIASENCHANTMENTS.put("sandspeed", soulspeed);
+ }
+ } catch (IllegalArgumentException ignored) {}
+
try {
Class> namespacedKeyClass = Class.forName("org.bukkit.NamespacedKey");
Class> enchantmentClass = Class.forName("org.bukkit.enchantments.Enchantment");
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index bc9327bbd..6c0e68b18 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -122,15 +122,6 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
super(new JavaPluginLoader(server), new PluginDescriptionFile("Essentials", "", "com.earth2me.essentials.Essentials"), null, null);
}
- @SuppressWarnings("unused")
- public void forceLoadClasses() {
- try {
- Class.forName(OfflinePlayer.class.getName());
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- }
-
@Override
public ISettings getSettings() {
return settings;
@@ -193,8 +184,6 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
}
}
- forceLoadClasses();
-
try {
final EssentialsUpgrade upgrade = new EssentialsUpgrade(this);
upgrade.beforeSettings();
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index 3fdc2db30..4eaebedf4 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -399,11 +399,14 @@ public class EssentialsPlayerListener implements Listener {
Location loc = user.getHome(user.getLocation());
if (loc == null) {
- loc = user.getBase().getBedSpawnLocation();
- }
- if (loc != null) {
- user.getBase().setCompassTarget(loc);
+ PaperLib.getBedSpawnLocationAsync(user.getBase(), false).thenAccept(location -> {
+ if (location != null) {
+ user.getBase().setCompassTarget(location);
+ }
+ });
+ return;
}
+ user.getBase().setCompassTarget(loc);
}
@EventHandler(priority = EventPriority.LOW)
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java
index 7fa544f83..5453f5265 100644
--- a/Essentials/src/com/earth2me/essentials/ISettings.java
+++ b/Essentials/src/com/earth2me/essentials/ISettings.java
@@ -3,8 +3,6 @@ package com.earth2me.essentials;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.signs.EssentialsSign;
import com.earth2me.essentials.textreader.IText;
-
-import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.event.EventPriority;
@@ -93,7 +91,7 @@ public interface ISettings extends IConf {
String getNicknamePrefix();
- ChatColor getOperatorColor() throws Exception;
+ String getOperatorColor() throws Exception;
boolean getPerWarpPermission();
diff --git a/Essentials/src/com/earth2me/essentials/Mob.java b/Essentials/src/com/earth2me/essentials/Mob.java
index 21550d853..db36f113a 100644
--- a/Essentials/src/com/earth2me/essentials/Mob.java
+++ b/Essentials/src/com/earth2me/essentials/Mob.java
@@ -23,7 +23,8 @@ public enum Mob {
GIANT("Giant", Enemies.ENEMY, EntityType.GIANT),
HORSE("Horse", Enemies.FRIENDLY, EntityType.HORSE),
PIG("Pig", Enemies.FRIENDLY, EntityType.PIG),
- PIGZOMB("PigZombie", Enemies.NEUTRAL, EntityType.PIG_ZOMBIE),
+ PIGZOMB("PigZombie", Enemies.NEUTRAL, MobCompat.ZOMBIFIED_PIGLIN),
+ ZOMBIFIED_PIGLIN("ZombifiedPiglin", Enemies.NEUTRAL, MobCompat.ZOMBIFIED_PIGLIN),
SHEEP("Sheep", Enemies.FRIENDLY, "", EntityType.SHEEP),
SKELETON("Skeleton", Enemies.ENEMY, EntityType.SKELETON),
SLIME("Slime", Enemies.ENEMY, EntityType.SLIME),
@@ -90,7 +91,12 @@ public enum Mob {
RAVAGER("Ravager", Enemies.ENEMY, "RAVAGER"),
TRADER_LLAMA("TraderLlama", Enemies.FRIENDLY, "TRADER_LLAMA"),
WANDERING_TRADER("WanderingTrader", Enemies.FRIENDLY, "WANDERING_TRADER"),
- BEE("Bee", Enemies.NEUTRAL, "BEE")
+ BEE("Bee", Enemies.NEUTRAL, "BEE"),
+ STRAY("Stray", Enemies.ENEMY, "STRAY"),
+ HOGLIN("Hoglin", Enemies.ADULT_ENEMY, "HOGLIN"),
+ PIGLIN("Piglin", Enemies.ADULT_ENEMY, "PIGLIN"),
+ STRIDER("Strider", Enemies.FRIENDLY, "STRIDER"),
+ ZOGLIN("Zoglin", Enemies.ENEMY, "ZOGLIN"),
;
public static final Logger logger = Logger.getLogger("Essentials");
@@ -154,7 +160,8 @@ public enum Mob {
public enum Enemies {
FRIENDLY("friendly"),
NEUTRAL("neutral"),
- ENEMY("enemy");
+ ENEMY("enemy"),
+ ADULT_ENEMY("adult_enemy");
Enemies(final String type) {
this.type = type;
diff --git a/Essentials/src/com/earth2me/essentials/MobCompat.java b/Essentials/src/com/earth2me/essentials/MobCompat.java
index 37f51ac0c..9107ba32c 100644
--- a/Essentials/src/com/earth2me/essentials/MobCompat.java
+++ b/Essentials/src/com/earth2me/essentials/MobCompat.java
@@ -1,28 +1,42 @@
package com.earth2me.essentials;
import com.earth2me.essentials.utils.EnumUtil;
+import com.earth2me.essentials.utils.VersionUtil;
import net.ess3.nms.refl.ReflUtil;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Fox;
+import org.bukkit.entity.Llama;
+import org.bukkit.entity.MushroomCow;
import org.bukkit.entity.Ocelot;
+import org.bukkit.entity.Panda;
+import org.bukkit.entity.Parrot;
+import org.bukkit.entity.TropicalFish;
import org.bukkit.entity.Villager;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import static com.earth2me.essentials.utils.EnumUtil.getEntityType;
public class MobCompat {
+ // Constants for mob interfaces added in later versions
+ public static final Class RAIDER = ReflUtil.getClassCached("org.bukkit.entity.Raider");
+
// Constants for mobs added in later versions
public static final EntityType LLAMA = getEntityType("LLAMA");
public static final EntityType PARROT = getEntityType("PARROT");
public static final EntityType TROPICAL_FISH = getEntityType("TROPICAL_FISH");
public static final EntityType PANDA = getEntityType("PANDA");
public static final EntityType TRADER_LLAMA = getEntityType("TRADER_LLAMA");
+ public static final EntityType SHULKER = getEntityType("SHULKER");
+ public static final EntityType STRAY = getEntityType("STRAY");
+ public static final EntityType FOX = getEntityType("FOX");
+ public static final EntityType PHANTOM = getEntityType("PHANTOM");
// Constants for mobs that have changed since earlier versions
public static final EntityType CAT = getEntityType("CAT", "OCELOT");
+ public static final EntityType ZOMBIFIED_PIGLIN = getEntityType("ZOMBIFIED_PIGLIN", "PIG_ZOMBIE");
public enum CatType {
// These are (loosely) Mojang names for the cats
@@ -64,7 +78,7 @@ public class MobCompat {
NITWIT("NITWIT", "NITWIT"),
SHEPHERD("FARMER", "SHEPHERD"),
TOOLSMITH("BLACKSMITH", "TOOL_SMITH", "TOOLSMITH"),
- WEAPONSMITH("BLACKSMITH", "WEAPON_SMITH", "WEAPONSMITH")
+ WEAPONSMITH("BLACKSMITH", "WEAPON_SMITH", "WEAPONSMITH"),
;
private final String oldProfession;
@@ -89,41 +103,33 @@ public class MobCompat {
}
// Older cats are Ocelots, whereas 1.14+ cats are Cats
- private static final Class catClass = ReflUtil.getClassCached("org.bukkit.entity.Cat");
- private static final Class catTypeClass = ReflUtil.getClassCached("org.bukkit.entity.Cat.Type");
- private static final Method catSetTypeMethod = (catClass == null || catTypeClass == null) ? null : ReflUtil.getMethodCached(catClass, "setCatType", catTypeClass);
-
- private static boolean isNewCat() {
- return (catClass != null && catTypeClass != null && catSetTypeMethod != null);
- }
-
public static void setCatType(final Entity entity, final CatType type) {
- if (isNewCat()) {
+ if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_14_R01)) {
+ ((Ocelot) entity).setCatType(Ocelot.Type.valueOf(type.ocelotTypeName));
+ } else {
+ Class cat = ReflUtil.getClassCached("org.bukkit.entity.Cat");
+ Class catType = ReflUtil.getClassCached("org.bukkit.entity.Cat$Type");
+ Method setCatType = ReflUtil.getMethodCached(cat, "setCatType", catType);
try {
- catSetTypeMethod.invoke(entity, EnumUtil.valueOf(catTypeClass, type.catTypeName));
- } catch (IllegalAccessException | InvocationTargetException e) {
+ setCatType.invoke(entity, EnumUtil.valueOf(catType, type.catTypeName));
+ } catch (Exception e) {
e.printStackTrace();
}
- } else {
- ((Ocelot) entity).setCatType(Ocelot.Type.valueOf(type.ocelotTypeName));
}
}
// Older villagers have professions and careers, 1.14+ villagers only have professions
- private static final Class villagerCareerClass = ReflUtil.getClassCached("org.bukkit.entity.Villager.Career");
- private static final Method villagerSetCareerMethod = (villagerCareerClass == null) ? null : ReflUtil.getMethodCached(Villager.class, "setCareer", villagerCareerClass);
-
- private static boolean isCareerVillager() {
- return (villagerCareerClass != null && villagerSetCareerMethod != null);
- }
-
public static void setVillagerProfession(final Entity entity, final VillagerProfession profession) {
- if (!isCareerVillager()) {
- ((Villager) entity).setProfession(profession.asEnum());
- } else {
- ((Villager) entity).setProfession(profession.asEnum());
+ if (!(entity instanceof Villager)) {
+ return;
+ }
+ Villager villager = (Villager) entity;
+ villager.setProfession(profession.asEnum());
+ if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_14_R01)) {
+ Class villagerCareer = ReflUtil.getClassCached("org.bukkit.entity.Villager$Career");
+ Method setCareer = ReflUtil.getMethodCached(Villager.class, "setCareer", villagerCareer);
try {
- villagerSetCareerMethod.invoke(entity, EnumUtil.valueOf(villagerCareerClass, profession.oldCareer));
+ setCareer.invoke(entity, EnumUtil.valueOf(villagerCareer, profession.oldCareer));
} catch (Exception e) {
e.printStackTrace();
}
@@ -132,92 +138,77 @@ public class MobCompat {
// Only 1.14+ villagers have biome variants
public static void setVillagerType(final Entity entity, final String type) {
- Class typeEnum = ReflUtil.getClassCached("org.bukkit.entity.Villager.Type");
- if (typeEnum == null) return;
-
- Method villagerSetTypeMethod = ReflUtil.getMethodCached(Villager.class, "setVillagerType", typeEnum);
- try {
- villagerSetTypeMethod.invoke(entity, EnumUtil.valueOf(typeEnum, type));
- } catch (Exception e) {
- e.printStackTrace();
+ if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_14_R01)) {
+ return;
+ }
+ if (entity instanceof Villager) {
+ ((Villager) entity).setVillagerType(Villager.Type.valueOf(type));
}
}
// Llamas only exist in 1.11+
public static void setLlamaColor(final Entity entity, final String color) {
- Class llamaClass = ReflUtil.getClassCached("org.bukkit.entity.Llama");
- if (llamaClass == null) return;
-
- Class colorEnum = ReflUtil.getClassCached("org.bukkit.entity.Llama.Color");
- Method setVariantMethod = ReflUtil.getMethodCached(llamaClass, "setColor");
-
- try {
- setVariantMethod.invoke(entity, EnumUtil.valueOf(colorEnum, color));
- } catch (Exception e) {
- e.printStackTrace();
+ if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_11_R01)) {
+ return;
+ }
+ if (entity instanceof Llama) {
+ ((Llama) entity).setColor(Llama.Color.valueOf(color));
}
}
// Parrots only exist in 1.12+
public static void setParrotVariant(final Entity entity, final String variant) {
- Class parrotClass = ReflUtil.getClassCached("org.bukkit.entity.Parrot");
- if (parrotClass == null) return;
-
- Class variantEnum = ReflUtil.getClassCached("org.bukkit.entity.Parrot.Variant");
- Method setVariantMethod = ReflUtil.getMethodCached(parrotClass, "setVariant");
- try {
- setVariantMethod.invoke(entity, EnumUtil.valueOf(variantEnum, variant));
- } catch (Exception e) {
- e.printStackTrace();
+ if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_12_0_R01)) {
+ return;
+ }
+ if (entity instanceof Parrot) {
+ ((Parrot) entity).setVariant(Parrot.Variant.valueOf(variant));
}
}
// Tropical fish only exist in 1.13+
public static void setTropicalFishPattern(final Entity entity, final String pattern) {
- Class tropicalFishClass = ReflUtil.getClassCached("org.bukkit.entity.TropicalFish");
- if (tropicalFishClass == null) return;
-
- Class patternEnum = ReflUtil.getClassCached("org.bukkit.entity.TropicalFish.Pattern");
- Method setPatternMethod = ReflUtil.getMethodCached(tropicalFishClass, "setPattern");
- try {
- setPatternMethod.invoke(entity, EnumUtil.valueOf(patternEnum, pattern));
- } catch (Exception e) {
- e.printStackTrace();
+ if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_12_0_R01)) {
+ return;
+ }
+ if (entity instanceof TropicalFish) {
+ ((TropicalFish) entity).setPattern(TropicalFish.Pattern.valueOf(pattern));
}
}
// Mushroom cow variant API only exists in 1.14+
public static void setMooshroomVariant(final Entity entity, final String variant) {
- Class mushroomCowClass = ReflUtil.getClassCached("org.bukkit.entity.MushroomCow");
- Class variantEnum = ReflUtil.getClassCached("org.bukkit.entity.MushroomCow.Variant");
- if (mushroomCowClass == null || variantEnum == null) return;
-
- Method setVariantMethod = ReflUtil.getMethodCached(mushroomCowClass, "setVariant");
- try {
- setVariantMethod.invoke(entity, EnumUtil.valueOf(variantEnum, variant));
- } catch (Exception e) {
- e.printStackTrace();
+ if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_14_R01)) {
+ return;
+ }
+ if (entity instanceof MushroomCow) {
+ ((MushroomCow) entity).setVariant(MushroomCow.Variant.valueOf(variant));
}
}
// Pandas only exists in 1.14+
public static void setPandaGene(final Entity entity, final String gene, final boolean mainGene) {
- Class pandaClass = ReflUtil.getClassCached("org.bukkit.entity.Panda");
- if (pandaClass == null) return;
-
- Class geneEnum = ReflUtil.getClassCached("org.bukkit.entity.Panda.Gene");
- Method setGeneMethod;
-
- if (mainGene) {
- setGeneMethod = ReflUtil.getMethodCached(pandaClass, "setMainGene");
- } else {
- setGeneMethod = ReflUtil.getMethodCached(pandaClass, "setHiddenGene");
+ if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_14_R01)) {
+ return;
}
+ if (entity instanceof Panda) {
+ Panda panda = (Panda) entity;
+ Panda.Gene pandaGene = Panda.Gene.valueOf(gene);
+ if (mainGene) {
+ panda.setMainGene(pandaGene);
+ } else {
+ panda.setHiddenGene(pandaGene);
+ }
+ }
+ }
- try {
- setGeneMethod.invoke(entity, EnumUtil.valueOf(geneEnum, gene));
- } catch (Exception e) {
- e.printStackTrace();
+ // Foxes only exist in 1.14+
+ public static void setFoxType(final Entity entity, final String type) {
+ if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_14_R01)) {
+ return;
+ }
+ if (entity instanceof Fox) {
+ ((Fox) entity).setFoxType(Fox.Type.valueOf(type));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/MobData.java b/Essentials/src/com/earth2me/essentials/MobData.java
index b7b564d05..67653e4d9 100644
--- a/Essentials/src/com/earth2me/essentials/MobData.java
+++ b/Essentials/src/com/earth2me/essentials/MobData.java
@@ -12,6 +12,7 @@ import org.bukkit.material.Colorable;
import java.util.*;
import java.util.logging.Logger;
+import java.util.stream.Collectors;
import static com.earth2me.essentials.I18n.tl;
@@ -32,7 +33,7 @@ public enum MobData {
TAMED_TAMEABLE("tamed", Tameable.class, Data.TAMED, true),
TAME_TAMEABLE("tame", Tameable.class, Data.TAMED, false),
RANDOM_SHEEP("random", EntityType.SHEEP, Data.COLORABLE, true),
- COLORABLE_SHEEP("", StringUtil.joinList(DyeColor.values()).toLowerCase(Locale.ENGLISH), EntityType.SHEEP, Data.COLORABLE, true),
+ COLORABLE_SHEEP("", Arrays.stream(DyeColor.values()).map(color -> color.name().toLowerCase(Locale.ENGLISH)).collect(Collectors.toList()), EntityType.SHEEP, Data.COLORABLE, true),
POLKA_HORSE("polka", EntityType.HORSE, Horse.Style.BLACK_DOTS, true),
SOOTY_HORSE("sooty", EntityType.HORSE, Horse.Style.BLACK_DOTS, false),
BLAZE_HORSE("blaze", EntityType.HORSE, Horse.Style.WHITE, true),
@@ -113,8 +114,8 @@ public enum MobData {
SNOWY_VILLAGER("snowy", EntityType.VILLAGER, "villagertype:SNOWY", true),
SWAMP_VILLAGER("swamp", EntityType.VILLAGER, "villagertype:SWAMP", true),
TAIGA_VILLAGER("taiga", EntityType.VILLAGER, "villagertype:TAIGA", true),
- SIZE_SLIME("", "<1-100>", EntityType.SLIME.getEntityClass(), Data.SIZE, true),
- NUM_EXPERIENCE_ORB("", "<1-2000000000>", EntityType.EXPERIENCE_ORB, Data.EXP, true),
+ SIZE_SLIME("", Collections.singletonList("<1-100>"), EntityType.SLIME.getEntityClass(), Data.SIZE, true),
+ NUM_EXPERIENCE_ORB("", Collections.singletonList("<1-2000000000>"), EntityType.EXPERIENCE_ORB, Data.EXP, true),
RED_PARROT("red", MobCompat.PARROT, "parrot:RED", true),
GREEN_PARROT("green", MobCompat.PARROT, "parrot:GREEN", true),
BLUE_PARROT("blue", MobCompat.PARROT, "parrot:BLUE", true),
@@ -153,7 +154,15 @@ public enum MobData {
CREAMY_TRADER_LLAMA("creamy", MobCompat.TRADER_LLAMA, "llama:CREAMY", true),
WHITE_TRADER_LLAMA("white", MobCompat.TRADER_LLAMA, "llama:WHITE", true),
BROWN_TRADER_LLAMA("brown", MobCompat.TRADER_LLAMA, "llama:BROWN", true),
- GRAY_TRADER_LLAMA("gray", MobCompat.TRADER_LLAMA, "llama:GRAY", true)
+ GRAY_TRADER_LLAMA("gray", MobCompat.TRADER_LLAMA, "llama:GRAY", true),
+ RANDOM_SHULKER("random", MobCompat.SHULKER, Data.COLORABLE, true),
+ COLORABLE_SHULKER("", Arrays.stream(DyeColor.values()).map(color -> color.name().toLowerCase(Locale.ENGLISH)).collect(Collectors.toList()), MobCompat.SHULKER, Data.COLORABLE, true),
+ RED_FOX("red", MobCompat.FOX, "fox:RED", true),
+ SNOW_FOX("snow", MobCompat.FOX, "fox:SNOW", true),
+ SIZE_PHANTOM("", Collections.singletonList("<1-100>"), MobCompat.PHANTOM, Data.SIZE, true),
+ RAID_LEADER("leader", MobCompat.RAIDER, Data.RAID_LEADER, true),
+ TROPICAL_FISH_BODY_COLOR("fish_body_color", Arrays.stream(DyeColor.values()).map(color -> color.name().toLowerCase(Locale.ENGLISH) + "body").collect(Collectors.toList()), MobCompat.TROPICAL_FISH, Data.FISH_BODY_COLOR, true),
+ TROPICAL_FISH_PATTERN_COLOR("fish_pattern_color", Arrays.stream(DyeColor.values()).map(color -> color.name().toLowerCase(Locale.ENGLISH) + "pattern").collect(Collectors.toList()), MobCompat.TROPICAL_FISH, Data.FISH_PATTERN_COLOR, true),
;
@@ -170,43 +179,46 @@ public enum MobData {
TAMED,
COLORABLE,
EXP,
- SIZE
+ SIZE,
+ RAID_LEADER,
+ FISH_BODY_COLOR,
+ FISH_PATTERN_COLOR,
}
-
public static final Logger logger = Logger.getLogger("Essentials");
- MobData(String n, Object type, Object value, boolean isPublic) {
- this.nickname = n;
- this.matched = n;
- this.helpMessage = n;
- this.type = type;
- this.value = value;
- this.isPublic = isPublic;
- }
-
- MobData(String n, String h, Object type, Object value, boolean isPublic) {
- this.nickname = n;
- this.matched = n;
- this.helpMessage = h;
- this.type = type;
- this.value = value;
- this.isPublic = isPublic;
- }
-
final private String nickname;
- final private String helpMessage;
+ final private List suggestions;
final private Object type;
final private Object value;
final private boolean isPublic;
private String matched;
+ MobData(String n, Object type, Object value, boolean isPublic) {
+ this.nickname = n;
+ this.matched = n;
+ this.suggestions = Collections.singletonList(n);
+ this.type = type;
+ this.value = value;
+ this.isPublic = isPublic;
+ }
+
+ MobData(String n, List s, Object type, Object value, boolean isPublic) {
+ this.nickname = n;
+ this.matched = n;
+ this.suggestions = s;
+ this.type = type;
+ this.value = value;
+ this.isPublic = isPublic;
+ }
+
public static LinkedHashMap getPossibleData(final Entity spawned, boolean publicOnly) {
LinkedHashMap mobList = new LinkedHashMap<>();
for (MobData data : MobData.values()) {
- if (data.type == null || (publicOnly && !data.isPublic)) continue;
-
+ if (data.type == null || (publicOnly && !data.isPublic)) {
+ continue;
+ }
if (data.type instanceof EntityType && spawned.getType().equals(data.type)) {
mobList.put(data.nickname.toLowerCase(Locale.ENGLISH), data);
} else if (data.type instanceof Class && ((Class) data.type).isAssignableFrom(spawned.getClass())) {
@@ -222,7 +234,7 @@ public enum MobData {
LinkedHashMap posData = getPossibleData(spawned, true);
for (MobData data : posData.values()) {
- output.add(data.helpMessage);
+ output.add(StringUtil.joinList(data.suggestions));
}
return output;
}
@@ -233,9 +245,11 @@ public enum MobData {
}
LinkedHashMap posData = getPossibleData(spawned, false);
- for (String data : posData.keySet()) {
- if (name.contains(data)) {
- return posData.get(data);
+ for (MobData data : posData.values()) {
+ for (String suggestion : data.suggestions) {
+ if (name.contains(suggestion)) {
+ return data;
+ }
}
}
return null;
@@ -291,7 +305,12 @@ public enum MobData {
}
} else if (this.value.equals(Data.SIZE)) {
try {
- ((Slime) spawned).setSize(Integer.parseInt(rawData));
+ int size = Integer.parseInt(rawData);
+ if (spawned instanceof Slime) {
+ ((Slime) spawned).setSize(size);
+ } else if (spawned.getType() == MobCompat.PHANTOM) {
+ ((Phantom) spawned).setSize(size);
+ }
this.matched = rawData;
} catch (NumberFormatException e) {
throw new Exception(tl("slimeMalformedSize"), e);
@@ -313,6 +332,26 @@ public enum MobData {
InventoryWorkaround.setItemInMainHand(invent, new ItemStack((Material) this.value, 1));
InventoryWorkaround.setItemInMainHandDropChance(invent, 0.1f);
}
+ } else if (this.value.equals(Data.RAID_LEADER)) {
+ ((Raider) spawned).setPatrolLeader(true);
+ } else if (this.value.equals(Data.FISH_BODY_COLOR)) {
+ for (String match : TROPICAL_FISH_BODY_COLOR.suggestions) {
+ if (rawData.contains(match)) {
+ this.matched = match;
+ final String color = match.substring(0, match.indexOf("body")).toUpperCase(Locale.ENGLISH);
+ ((TropicalFish) spawned).setBodyColor(DyeColor.valueOf(color));
+ break;
+ }
+ }
+ } else if (this.value.equals(Data.FISH_PATTERN_COLOR)) {
+ for (String match : TROPICAL_FISH_PATTERN_COLOR.suggestions) {
+ if (rawData.contains(match)) {
+ this.matched = match;
+ final String color = match.substring(0, match.indexOf("pattern")).toUpperCase(Locale.ENGLISH);
+ ((TropicalFish) spawned).setPatternColor(DyeColor.valueOf(color));
+ break;
+ }
+ }
} else if (this.value instanceof String) {
final String[] split = ((String) this.value).split(":");
switch (split[0]) {
@@ -337,6 +376,9 @@ public enum MobData {
case "villagertype":
MobCompat.setVillagerType(spawned, split[1]);
break;
+ case "fox":
+ MobCompat.setFoxType(spawned, split[1]);
+ break;
}
} else {
logger.warning("Unknown mob data type: " + this.toString());
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index 5fb42dacf..d8dbbe89a 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -365,29 +365,37 @@ public class Settings implements net.ess3.api.ISettings {
return config.getBoolean("skip-used-one-time-kits-from-kit-list", false);
}
- private ChatColor operatorColor = null;
+ private String operatorColor = null;
@Override
- public ChatColor getOperatorColor() {
+ public String getOperatorColor() {
return operatorColor;
}
- private ChatColor _getOperatorColor() {
+ private String _getOperatorColor() {
String colorName = config.getString("ops-name-color", null);
if (colorName == null) {
- return ChatColor.DARK_RED;
- }
- if ("none".equalsIgnoreCase(colorName) || colorName.isEmpty()) {
+ return ChatColor.RED.toString();
+ } else if (colorName.equalsIgnoreCase("none") || colorName.isEmpty()) {
return null;
}
try {
- return ChatColor.valueOf(colorName.toUpperCase(Locale.ENGLISH));
+ return FormatUtil.parseHexColor(colorName);
+ } catch (NumberFormatException ignored) {
+ }
+
+ try {
+ return ChatColor.valueOf(colorName.toUpperCase(Locale.ENGLISH)).toString();
} catch (IllegalArgumentException ignored) {
}
- return ChatColor.getByChar(colorName);
+ ChatColor lastResort = ChatColor.getByChar(colorName);
+ if (lastResort != null) {
+ return lastResort.toString();
+ }
+ return null;
}
@Override
diff --git a/Essentials/src/com/earth2me/essentials/SpawnMob.java b/Essentials/src/com/earth2me/essentials/SpawnMob.java
index a09d0518e..e9e100629 100644
--- a/Essentials/src/com/earth2me/essentials/SpawnMob.java
+++ b/Essentials/src/com/earth2me/essentials/SpawnMob.java
@@ -235,30 +235,20 @@ public class SpawnMob {
final EntityEquipment invent = ((LivingEntity) spawned).getEquipment();
InventoryWorkaround.setItemInMainHand(invent, new ItemStack(Material.BOW, 1));
InventoryWorkaround.setItemInMainHandDropChance(invent, 0.1f);
-
- invent.setBoots(new ItemStack(GOLDEN_BOOTS, 1));
- invent.setBootsDropChance(0.0f);
}
- if (type == EntityType.PIG_ZOMBIE) {
+ if (type == MobCompat.ZOMBIFIED_PIGLIN) {
final PigZombie zombie = ((PigZombie) spawned);
setVillager(zombie, false);
final EntityEquipment invent = zombie.getEquipment();
InventoryWorkaround.setItemInMainHand(invent, new ItemStack(GOLDEN_SWORD, 1));
InventoryWorkaround.setItemInMainHandDropChance(invent, 0.1f);
-
- invent.setBoots(new ItemStack(GOLDEN_BOOTS, 1));
- invent.setBootsDropChance(0.0f);
}
if (type == EntityType.ZOMBIE) {
final Zombie zombie = ((Zombie) spawned);
setVillager(zombie, false);
-
- final EntityEquipment invent = zombie.getEquipment();
- invent.setBoots(new ItemStack(GOLDEN_BOOTS, 1));
- invent.setBootsDropChance(0.0f);
}
if (type == EntityType.HORSE) {
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java
index a8660c4ff..2ebd6a052 100644
--- a/Essentials/src/com/earth2me/essentials/User.java
+++ b/Essentials/src/com/earth2me/essentials/User.java
@@ -16,7 +16,6 @@ import net.ess3.api.events.JailStatusChangeEvent;
import net.ess3.api.events.MuteStatusChangeEvent;
import net.ess3.api.events.UserBalanceUpdateEvent;
import net.ess3.nms.refl.ReflUtil;
-import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@@ -27,7 +26,13 @@ import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.math.BigDecimal;
-import java.util.*;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.UUID;
+import java.util.WeakHashMap;
import java.util.concurrent.CompletableFuture;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -338,12 +343,15 @@ public class User extends UserData implements Comparable, IMessageRecipien
if (this.getBase().isOp()) {
try {
- final ChatColor opPrefix = ess.getSettings().getOperatorColor();
- if (opPrefix != null && opPrefix.toString().length() > 0) {
- prefix.insert(0, opPrefix.toString());
+ final String opPrefix = ess.getSettings().getOperatorColor();
+ if (opPrefix != null && !opPrefix.isEmpty()) {
+ prefix.insert(0, opPrefix);
suffix = "§r";
}
- } catch (Exception ignored) {
+ } catch (Exception e) {
+ if (ess.getSettings().isDebug()) {
+ e.printStackTrace();
+ }
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
index c57bbe99a..3aa4efa6b 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
@@ -65,7 +65,7 @@ public class Commandspawnmob extends EssentialsCommand {
@Override
protected List getTabCompleteOptions(Server server, User user, String commandLabel, String[] args) {
if (args.length == 1) {
- return Lists.newArrayList(SpawnMob.mobParts(args[0]));
+ return Lists.newArrayList(Mob.getMobList());
} else {
return Collections.emptyList();
}
diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java
index 78146c4f6..4665d76c3 100644
--- a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java
+++ b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java
@@ -1,11 +1,37 @@
package com.earth2me.essentials.craftbukkit;
-import org.bukkit.*;
+import org.bukkit.BlockChangeDelegate;
+import org.bukkit.Chunk;
+import org.bukkit.ChunkSnapshot;
+import org.bukkit.Difficulty;
+import org.bukkit.Effect;
+import org.bukkit.FluidCollisionMode;
+import org.bukkit.GameRule;
+import org.bukkit.HeightMap;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Particle;
+import org.bukkit.Raid;
+import org.bukkit.Sound;
+import org.bukkit.SoundCategory;
+import org.bukkit.StructureType;
+import org.bukkit.TreeType;
+import org.bukkit.World;
+import org.bukkit.WorldBorder;
+import org.bukkit.WorldType;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.boss.DragonBattle;
-import org.bukkit.entity.*;
+import org.bukkit.entity.AbstractArrow;
+import org.bukkit.entity.Arrow;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.FallingBlock;
+import org.bukkit.entity.Item;
+import org.bukkit.entity.LightningStrike;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.ItemStack;
@@ -140,45 +166,46 @@ public class FakeWorld implements World {
}
@Override
- public boolean isChunkForceLoaded(int x, int z) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean isChunkForceLoaded(int i, int i1) {
+ return false;
}
@Override
- public void setChunkForceLoaded(int x, int z, boolean forced) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public void setChunkForceLoaded(int i, int i1, boolean b) {
+
}
@Override
public Collection getForceLoadedChunks() {
- throw new UnsupportedOperationException("Not supported yet.");
+ return null;
}
@Override
public boolean addPluginChunkTicket(int i, int i1, Plugin plugin) {
- throw new UnsupportedOperationException("Not supported yet.");
+ return false;
}
@Override
public boolean removePluginChunkTicket(int i, int i1, Plugin plugin) {
- throw new UnsupportedOperationException("Not supported yet.");
+ return false;
}
@Override
public void removePluginChunkTickets(Plugin plugin) {
- throw new UnsupportedOperationException("Not supported yet.");
+
}
@Override
public Collection getPluginChunkTickets(int i, int i1) {
- throw new UnsupportedOperationException("Not supported yet.");
+ return null;
}
@Override
public Map> getPluginChunkTickets() {
- throw new UnsupportedOperationException("Not supported yet.");
+ return null;
}
+
@Override
public Item dropItem(Location lctn, ItemStack is) {
throw new UnsupportedOperationException("Not supported yet.");
@@ -195,7 +222,7 @@ public class FakeWorld implements World {
}
@Override
- public T spawnArrow(Location location, Vector direction, float speed, float spread, Class clazz) {
+ public T spawnArrow(Location location, Vector vector, float v, float v1, Class aClass) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -378,20 +405,15 @@ public class FakeWorld implements World {
public boolean createExplosion(Location lctn, float f, boolean bln) {
throw new UnsupportedOperationException("Not supported yet.");
}
-
+
@Override
- public boolean createExplosion(double d, double d1, double d2, float f, boolean bln, boolean bln1, Entity entity) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean createExplosion(Location location, float v, boolean b, boolean b1) {
+ return false;
}
@Override
- public boolean createExplosion(Location lctn, float f, boolean bln, boolean bln1) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean createExplosion(Location lctn, float f, boolean bln, boolean bln1, Entity entity) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean createExplosion(Location location, float v, boolean b, boolean b1, Entity entity) {
+ return false;
}
@Override
@@ -451,22 +473,22 @@ public class FakeWorld implements World {
@Override
public int getHighestBlockYAt(int i, int i1, HeightMap heightMap) {
- throw new UnsupportedOperationException("Not supported yet.");
+ return 0;
}
@Override
public int getHighestBlockYAt(Location location, HeightMap heightMap) {
- throw new UnsupportedOperationException("Not supported yet.");
+ return 0;
}
@Override
public Block getHighestBlockAt(int i, int i1, HeightMap heightMap) {
- throw new UnsupportedOperationException("Not supported yet.");
+ return null;
}
@Override
public Block getHighestBlockAt(Location location, HeightMap heightMap) {
- throw new UnsupportedOperationException("Not supported yet.");
+ return null;
}
@Override
@@ -476,7 +498,7 @@ public class FakeWorld implements World {
@Override
public Biome getBiome(int i, int i1, int i2) {
- throw new UnsupportedOperationException("Not supported yet.");
+ return null;
}
@Override
@@ -486,7 +508,7 @@ public class FakeWorld implements World {
@Override
public double getTemperature(int i, int i1, int i2) {
- throw new UnsupportedOperationException("Not supported yet.");
+ return 0;
}
@Override
@@ -496,7 +518,7 @@ public class FakeWorld implements World {
@Override
public double getHumidity(int i, int i1, int i2) {
- throw new UnsupportedOperationException("Not supported yet.");
+ return 0;
}
@Override
@@ -576,12 +598,12 @@ public class FakeWorld implements World {
@Override
public boolean isHardcore() {
- throw new UnsupportedOperationException("Not supported yet.");
+ return false;
}
@Override
- public void setHardcore(boolean hardcore) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public void setHardcore(boolean b) {
+
}
@Override
@@ -606,22 +628,32 @@ public class FakeWorld implements World {
@Override
public long getTicksPerWaterSpawns() {
- throw new UnsupportedOperationException("Not supported yet.");
+ return 0;
}
@Override
public void setTicksPerWaterSpawns(int i) {
- throw new UnsupportedOperationException("Not supported yet.");
+
+ }
+
+ @Override
+ public long getTicksPerWaterAmbientSpawns() {
+ return 0;
+ }
+
+ @Override
+ public void setTicksPerWaterAmbientSpawns(int i) {
+
}
@Override
public long getTicksPerAmbientSpawns() {
- throw new UnsupportedOperationException("Not supported yet.");
+ return 0;
}
@Override
public void setTicksPerAmbientSpawns(int i) {
- throw new UnsupportedOperationException("Not supported yet.");
+
}
@Override
@@ -671,7 +703,7 @@ public class FakeWorld implements World {
@Override
public void setBiome(int i, int i1, int i2, Biome biome) {
- throw new UnsupportedOperationException("Not supported yet.");
+
}
@Override
@@ -704,6 +736,16 @@ public class FakeWorld implements World {
throw new UnsupportedOperationException("Not supported yet.");
}
+ @Override
+ public int getWaterAmbientSpawnLimit() {
+ return 0;
+ }
+
+ @Override
+ public void setWaterAmbientSpawnLimit(int i) {
+
+ }
+
@Override
public Entity spawnEntity(Location lctn, EntityType et) {
throw new UnsupportedOperationException("Not supported yet.");
@@ -774,6 +816,11 @@ public class FakeWorld implements World {
throw new UnsupportedOperationException("Not supported yet.");
}
+ @Override
+ public boolean createExplosion(double v, double v1, double v2, float v3, boolean b, boolean b1, Entity entity) {
+ return false;
+ }
+
@Override
public WorldBorder getWorldBorder() {
throw new UnsupportedOperationException("Not supported yet.");
@@ -855,18 +902,28 @@ public class FakeWorld implements World {
}
@Override
- public Raid locateNearestRaid(Location location, int radius) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public int getViewDistance() {
+ return 0;
+ }
+
+ @Override
+ public Spigot spigot() {
+ return null;
+ }
+
+ @Override
+ public Raid locateNearestRaid(Location location, int i) {
+ return null;
}
@Override
public List getRaids() {
- throw new UnsupportedOperationException("Not supported yet.");
+ return null;
}
@Override
public DragonBattle getEnderDragonBattle() {
- throw new UnsupportedOperationException("Not supported yet.");
+ return null;
}
@Override
@@ -875,58 +932,58 @@ public class FakeWorld implements World {
}
@Override
- public Collection getNearbyEntities(Location location, double x, double y, double z, Predicate filter) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public Collection getNearbyEntities(Location location, double v, double v1, double v2, Predicate predicate) {
+ return null;
}
@Override
public Collection getNearbyEntities(BoundingBox boundingBox) {
- throw new UnsupportedOperationException("Not supported yet.");
+ return null;
}
@Override
- public Collection getNearbyEntities(BoundingBox boundingBox, Predicate filter) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public Collection getNearbyEntities(BoundingBox boundingBox, Predicate predicate) {
+ return null;
}
@Override
- public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public RayTraceResult rayTraceEntities(Location location, Vector vector, double v) {
+ return null;
}
@Override
- public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance, double raySize) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public RayTraceResult rayTraceEntities(Location location, Vector vector, double v, double v1) {
+ return null;
}
@Override
- public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance, Predicate filter) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public RayTraceResult rayTraceEntities(Location location, Vector vector, double v, Predicate predicate) {
+ return null;
}
@Override
- public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance, double raySize, Predicate filter) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public RayTraceResult rayTraceEntities(Location location, Vector vector, double v, double v1, Predicate predicate) {
+ return null;
}
@Override
- public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public RayTraceResult rayTraceBlocks(Location location, Vector vector, double v) {
+ return null;
}
@Override
- public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public RayTraceResult rayTraceBlocks(Location location, Vector vector, double v, FluidCollisionMode fluidCollisionMode) {
+ return null;
}
@Override
- public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public RayTraceResult rayTraceBlocks(Location location, Vector vector, double v, FluidCollisionMode fluidCollisionMode, boolean b) {
+ return null;
}
@Override
- public RayTraceResult rayTrace(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, Predicate filter) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public RayTraceResult rayTrace(Location location, Vector vector, double v, FluidCollisionMode fluidCollisionMode, boolean b, double v1, Predicate predicate) {
+ return null;
}
@Override
diff --git a/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java b/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java
index f77843384..0fde02afb 100644
--- a/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java
+++ b/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java
@@ -3,6 +3,7 @@ package com.earth2me.essentials.utils;
import net.ess3.api.IUser;
import org.bukkit.ChatColor;
+import java.awt.Color;
import java.util.EnumSet;
import java.util.Locale;
import java.util.Set;
@@ -19,6 +20,8 @@ public class FormatUtil {
private static final Pattern STRIP_ALL_PATTERN = Pattern.compile("\u00a7+([0-9a-fk-orA-FK-OR])");
//Essentials '&' convention colour codes
private static final Pattern REPLACE_ALL_PATTERN = Pattern.compile("(&)?&([0-9a-fk-orA-FK-OR])");
+
+ private static final Pattern REPLACE_ALL_RGB_PATTERN = Pattern.compile("(&)?([0-9a-fA-F]{6})");
//Used to prepare xmpp output
private static final Pattern LOGCOLOR_PATTERN = Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]");
private static final Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-zA-Z]{2,3}(?:/\\S+)?)");
@@ -57,28 +60,70 @@ public class FormatUtil {
if (input == null) {
return null;
}
- return replaceColor(input, EnumSet.allOf(ChatColor.class));
+ return replaceColor(input, EnumSet.allOf(ChatColor.class), true);
}
- static String replaceColor(final String input, final Set supported) {
- StringBuffer builder = new StringBuffer();
- Matcher matcher = REPLACE_ALL_PATTERN.matcher(input);
- searchLoop: while (matcher.find()) {
- boolean isEscaped = (matcher.group(1) != null);
+ static String replaceColor(final String input, final Set supported, boolean rgb) {
+ StringBuffer legacyBuilder = new StringBuffer();
+ Matcher legacyMatcher = REPLACE_ALL_PATTERN.matcher(input);
+ legacyLoop: while (legacyMatcher.find()) {
+ boolean isEscaped = (legacyMatcher.group(1) != null);
if (!isEscaped) {
- char code = matcher.group(2).toLowerCase(Locale.ROOT).charAt(0);
+ char code = legacyMatcher.group(2).toLowerCase(Locale.ROOT).charAt(0);
for (ChatColor color : supported) {
if (color.getChar() == code) {
- matcher.appendReplacement(builder, "\u00a7$2");
- continue searchLoop;
+ legacyMatcher.appendReplacement(legacyBuilder, "\u00a7$2");
+ continue legacyLoop;
}
}
}
// Don't change & to section sign (or replace two &'s with one)
- matcher.appendReplacement(builder, "&$2");
+ legacyMatcher.appendReplacement(legacyBuilder, "&$2");
}
- matcher.appendTail(builder);
- return builder.toString();
+ legacyMatcher.appendTail(legacyBuilder);
+
+ if (rgb) {
+ StringBuffer rgbBuilder = new StringBuffer();
+ Matcher rgbMatcher = REPLACE_ALL_RGB_PATTERN.matcher(legacyBuilder.toString());
+ while (rgbMatcher.find()) {
+ boolean isEscaped = (rgbMatcher.group(1) != null);
+ if (!isEscaped) {
+ try {
+ String hexCode = rgbMatcher.group(2);
+ rgbMatcher.appendReplacement(rgbBuilder, parseHexColor(hexCode));
+ continue;
+ } catch (NumberFormatException ignored) {
+ }
+ }
+ rgbMatcher.appendReplacement(rgbBuilder, "$2");
+ }
+ rgbMatcher.appendTail(rgbBuilder);
+ return rgbBuilder.toString();
+ }
+ return legacyBuilder.toString();
+ }
+
+ /**
+ * @throws NumberFormatException If the provided hex color code is invalid or if version is lower than 1.16.
+ */
+ public static String parseHexColor(String hexColor) throws NumberFormatException {
+ if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_16_1_R01)) {
+ throw new NumberFormatException("Cannot use RGB colors in versions < 1.16");
+ }
+
+ if (hexColor.startsWith("#")) {
+ hexColor = hexColor.substring(1); //fuck you im reassigning this.
+ }
+ if (hexColor.length() != 6) {
+ throw new NumberFormatException("Invalid hex length");
+ }
+ Color.decode("#" + hexColor);
+ StringBuilder assembledColorCode = new StringBuilder();
+ assembledColorCode.append("\u00a7x");
+ for (char curChar : hexColor.toCharArray()) {
+ assembledColorCode.append("\u00a7").append(curChar);
+ }
+ return assembledColorCode.toString();
}
static String stripColor(final String input, final Set strip) {
@@ -134,8 +179,9 @@ public class FormatUtil {
}
EnumSet strip = EnumSet.complementOf(supported);
- if (!supported.isEmpty()) {
- message = replaceColor(message, supported);
+ boolean rgb = user.isAuthorized(permBase + ".rgb");
+ if (!supported.isEmpty() || rgb) {
+ message = replaceColor(message, supported, rgb);
}
if (!strip.isEmpty()) {
message = stripColor(message, strip);
diff --git a/Essentials/src/com/earth2me/essentials/utils/VersionUtil.java b/Essentials/src/com/earth2me/essentials/utils/VersionUtil.java
index 7688a9cf8..a559f39d9 100644
--- a/Essentials/src/com/earth2me/essentials/utils/VersionUtil.java
+++ b/Essentials/src/com/earth2me/essentials/utils/VersionUtil.java
@@ -14,7 +14,9 @@ public class VersionUtil {
public static final BukkitVersion v1_8_8_R01 = BukkitVersion.fromString("1.8.8-R0.1-SNAPSHOT");
public static final BukkitVersion v1_9_R01 = BukkitVersion.fromString("1.9-R0.1-SNAPSHOT");
public static final BukkitVersion v1_9_4_R01 = BukkitVersion.fromString("1.9.4-R0.1-SNAPSHOT");
+ public static final BukkitVersion v1_10_R01 = BukkitVersion.fromString("1.10-R0.1-SNAPSHOT");
public static final BukkitVersion v1_10_2_R01 = BukkitVersion.fromString("1.10.2-R0.1-SNAPSHOT");
+ public static final BukkitVersion v1_11_R01 = BukkitVersion.fromString("1.11-R0.1-SNAPSHOT");
public static final BukkitVersion v1_11_2_R01 = BukkitVersion.fromString("1.11.2-R0.1-SNAPSHOT");
public static final BukkitVersion v1_12_0_R01 = BukkitVersion.fromString("1.12.0-R0.1-SNAPSHOT");
public static final BukkitVersion v1_12_2_R01 = BukkitVersion.fromString("1.12.2-R0.1-SNAPSHOT");
@@ -23,10 +25,10 @@ public class VersionUtil {
public static final BukkitVersion v1_14_R01 = BukkitVersion.fromString("1.14-R0.1-SNAPSHOT");
public static final BukkitVersion v1_14_4_R01 = BukkitVersion.fromString("1.14.4-R0.1-SNAPSHOT");
public static final BukkitVersion v1_15_R01 = BukkitVersion.fromString("1.15-R0.1-SNAPSHOT");
- public static final BukkitVersion v1_15_1_R01 = BukkitVersion.fromString("1.15.1-R0.1-SNAPSHOT");
public static final BukkitVersion v1_15_2_R01 = BukkitVersion.fromString("1.15.2-R0.1-SNAPSHOT");
+ public static final BukkitVersion v1_16_1_R01 = BukkitVersion.fromString("1.16.1-R0.1-SNAPSHOT");
- private static final Set 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);
+ private static final Set 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_1_R01);
private static BukkitVersion serverVersion = null;
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index d1681dcfd..7f8e194c4 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -23,6 +23,7 @@
############################################################
# A color code between 0-9 or a-f. Set to 'none' to disable.
+# In 1.16+ you can use hex color codes here as well. (For example, #613e1d is brown).
ops-name-color: '4'
# The character(s) to prefix all nicknames, so that you know they are not true usernames.
diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java
index 893500bfd..bad8bb224 100644
--- a/Essentials/test/com/earth2me/essentials/FakeServer.java
+++ b/Essentials/test/com/earth2me/essentials/FakeServer.java
@@ -741,6 +741,11 @@ public class FakeServer implements Server {
throw new UnsupportedOperationException("Not supported yet.");
}
+ @Override
+ public Spigot spigot() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
@Override
public boolean isPermissionSet(String name) {
throw new UnsupportedOperationException("Not supported yet.");
@@ -893,6 +898,11 @@ public class FakeServer implements Server {
throw new UnsupportedOperationException("Not supported yet.");
}
+ @Override
+ public int getTicksPerWaterAmbientSpawns() {
+ return 0;
+ }
+
@Override
public int getTicksPerAmbientSpawns() {
throw new UnsupportedOperationException("Not supported yet.");
@@ -978,6 +988,11 @@ public class FakeServer implements Server {
throw new UnsupportedOperationException("Not supported yet.");
}
+ @Override
+ public int getWaterAmbientSpawnLimit() {
+ return 0;
+ }
+
@Override
public boolean isPrimaryThread() {
return true; // Can be set to true or false, just needs to return for AFK status test to pass.
@@ -1074,6 +1089,11 @@ public class FakeServer implements Server {
throw new UnsupportedOperationException("Not supported yet.");
}
+ @Override
+ public Spigot spigot() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
@Override
public BanList getBanList(BanList.Type arg0) {
throw new UnsupportedOperationException("Not supported yet.");
diff --git a/EssentialsSpawn/pom.xml b/EssentialsSpawn/pom.xml
index 93e35d861..b7c3ddad8 100644
--- a/EssentialsSpawn/pom.xml
+++ b/EssentialsSpawn/pom.xml
@@ -31,12 +31,6 @@
net.ess3:EssentialsXSpawn
false
-
-
- io.papermc.lib
- com.earth2me.essentials.paperlib
-
-
@@ -48,10 +42,5 @@
EssentialsX
${project.version}
-
- io.papermc
- paperlib
- 1.0.2
-
\ No newline at end of file
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
index 306875ab6..469f7cc7b 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
@@ -44,7 +44,7 @@ class EssentialsSpawnPlayerListener implements Listener {
if (ess.getSettings().getRespawnAtHome()) {
Location home;
- final Location bed = user.getBase().getBedSpawnLocation();
+ final Location bed = user.getBase().getBedSpawnLocation(); // cannot nuke this sync load due to the event being sync so it would hand either way.
if (bed != null) {
home = bed;
} else {
diff --git a/README.md b/README.md
index a296bbd0c..206cce815 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ EssentialsX is almost a completely drop-in replacement for Essentials. However,
* **EssentialsX requires Java 8 or higher.** On older versions, the plugin may not work properly.
-* **EssentialsX supports Minecraft versions 1.8.8, 1.9.4, 1.10.2, 1.11.2, 1.12.2, 1.13.2, 1.14.4, and 1.15.2.**
+* **EssentialsX 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, and 1.16.1.**
Support
diff --git a/pom.xml b/pom.xml
index 00dd9ad72..5ff8fbac3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,13 +52,14 @@
providers/BaseProviders
providers/NMSReflectionProvider
providers/PaperProvider
+ providers/1_8Provider
- org.bukkit
- bukkit
- 1.15.2-R0.1-SNAPSHOT
+ org.spigotmc
+ spigot-api
+ 1.16.1-R0.1-SNAPSHOT
provided
diff --git a/providers/1_8Provider/pom.xml b/providers/1_8Provider/pom.xml
new file mode 100644
index 000000000..3532474aa
--- /dev/null
+++ b/providers/1_8Provider/pom.xml
@@ -0,0 +1,22 @@
+
+
+
+ EssentialsXParent
+ net.ess3
+ 2.17.2
+ ../../pom.xml
+
+ 4.0.0
+
+ 1_8Provider
+
+
+
+ net.ess3
+ NMSReflectionProvider
+ 2.17.2
+
+
+
\ No newline at end of file
diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/providers/1_8Provider/src/com/earth2me/essentials/OfflinePlayer.java
similarity index 81%
rename from Essentials/src/com/earth2me/essentials/OfflinePlayer.java
rename to providers/1_8Provider/src/com/earth2me/essentials/OfflinePlayer.java
index 0774daf09..0abba4f7f 100644
--- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
+++ b/providers/1_8Provider/src/com/earth2me/essentials/OfflinePlayer.java
@@ -1,8 +1,22 @@
package com.earth2me.essentials;
import net.ess3.nms.refl.ReflUtil;
-
-import org.bukkit.*;
+import org.bukkit.Achievement;
+import org.bukkit.BanList;
+import org.bukkit.Effect;
+import org.bukkit.EntityEffect;
+import org.bukkit.GameMode;
+import org.bukkit.Instrument;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Note;
+import org.bukkit.Particle;
+import org.bukkit.Server;
+import org.bukkit.Sound;
+import org.bukkit.SoundCategory;
+import org.bukkit.Statistic;
+import org.bukkit.WeatherType;
+import org.bukkit.World;
import org.bukkit.advancement.Advancement;
import org.bukkit.advancement.AdvancementProgress;
import org.bukkit.attribute.Attribute;
@@ -10,33 +24,44 @@ import org.bukkit.attribute.AttributeInstance;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.PistonMoveReaction;
-import org.bukkit.block.data.BlockData;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
-import org.bukkit.entity.*;
-import org.bukkit.entity.memory.MemoryKey;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Projectile;
+import org.bukkit.entity.Vehicle;
+import org.bukkit.entity.Villager;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
-import org.bukkit.inventory.*;
+import org.bukkit.inventory.EntityEquipment;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.InventoryView.Property;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.MainHand;
+import org.bukkit.inventory.Merchant;
+import org.bukkit.inventory.PlayerInventory;
import org.bukkit.map.MapView;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
-import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.plugin.Plugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scoreboard.Scoreboard;
-import org.bukkit.util.BoundingBox;
-import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
public class OfflinePlayer implements Player {
private final transient Server server;
@@ -45,7 +70,7 @@ public class OfflinePlayer implements Player {
private final transient org.bukkit.OfflinePlayer base;
private boolean allowFlight = false;
private boolean isFlying = false;
- private String name = null;
+ private String name;
public OfflinePlayer(final UUID uuid, final Server server) {
this.server = server;
@@ -110,15 +135,6 @@ public class OfflinePlayer implements Player {
public void setHealth(double d) {
}
- @Override
- public double getAbsorptionAmount() {
- return 0;
- }
-
- @Override
- public void setAbsorptionAmount(double v) {
- }
-
@Override
public boolean isInsideVehicle() {
return false;
@@ -144,12 +160,6 @@ public class OfflinePlayer implements Player {
return world;
}
- @Override
- public void setRotation(float yaw, float pitch) {
- location.setYaw(yaw);
- location.setPitch(pitch);
- }
-
public void setLocation(Location loc) {
location = loc;
world = loc.getWorld();
@@ -173,11 +183,6 @@ public class OfflinePlayer implements Player {
return null;
}
- @Override
- public Pose getPose() {
- return null;
- }
-
@Override
public boolean performCommand(String string) {
return false;
@@ -214,6 +219,21 @@ public class OfflinePlayer implements Player {
public void updateInventory() {
}
+ @Override
+ public void awardAchievement(Achievement achievement) {
+
+ }
+
+ @Override
+ public void removeAchievement(Achievement achievement) {
+
+ }
+
+ @Override
+ public boolean hasAchievement(Achievement achievement) {
+ return false;
+ }
+
@Override
public void chat(String string) {
}
@@ -243,26 +263,6 @@ public class OfflinePlayer implements Player {
return Collections.emptyList();
}
- @Override
- public Block getTargetBlockExact(int maxDistance) {
- return null;
- }
-
- @Override
- public Block getTargetBlockExact(int maxDistance, FluidCollisionMode fluidCollisionMode) {
- return null;
- }
-
- @Override
- public RayTraceResult rayTraceBlocks(double maxDistance) {
- return null;
- }
-
- @Override
- public RayTraceResult rayTraceBlocks(double maxDistance, FluidCollisionMode fluidCollisionMode) {
- return null;
- }
-
@Override
public int getFireTicks() {
return 0;
@@ -286,15 +286,6 @@ public class OfflinePlayer implements Player {
return server;
}
- @Override
- public boolean isPersistent() {
- return false;
- }
-
- @Override
- public void setPersistent(boolean persistent) {
- }
-
public Vector getMomentum() {
return getVelocity();
}
@@ -311,6 +302,16 @@ public class OfflinePlayer implements Player {
return new Vector(0, 0, 0);
}
+ @Override
+ public double getHeight() {
+ return 0;
+ }
+
+ @Override
+ public double getWidth() {
+ return 0;
+ }
+
@Override
public void damage(double d) {
}
@@ -380,6 +381,21 @@ public class OfflinePlayer implements Player {
return false;
}
+ @Override
+ public List getPassengers() {
+ return null;
+ }
+
+ @Override
+ public boolean addPassenger(Entity passenger) {
+ return false;
+ }
+
+ @Override
+ public boolean removePassenger(Entity passenger) {
+ return false;
+ }
+
@Override
public boolean isEmpty() {
return true;
@@ -519,11 +535,6 @@ public class OfflinePlayer implements Player {
public void sendBlockChange(Location lctn, Material mtrl, byte b) {
}
- @Override
- public void sendBlockChange(Location loc, BlockData block) {
-
- }
-
@Override
public void setLastDamageCause(EntityDamageEvent ede) {
}
@@ -542,6 +553,11 @@ public class OfflinePlayer implements Player {
return true;
}
+ @Override
+ public void sendBlockChange(Location location, int i, byte b) {
+
+ }
+
@Override
public void playNote(Location lctn, Instrument i, Note note) {
}
@@ -653,14 +669,6 @@ public class OfflinePlayer implements Player {
public void setTotalExperience(int i) {
}
- @Override
- public void sendExperienceChange(float v) {
- }
-
- @Override
- public void sendExperienceChange(float v, int i) {
- }
-
@Override
public float getExhaustion() {
return 0F;
@@ -701,31 +709,6 @@ public class OfflinePlayer implements Player {
public void setPlayerListName(String name) {
}
- @Override
- public String getPlayerListHeader() {
- return null;
- }
-
- @Override
- public String getPlayerListFooter() {
- return null;
- }
-
- @Override
- public void setPlayerListHeader(String header) {
-
- }
-
- @Override
- public void setPlayerListFooter(String footer) {
-
- }
-
- @Override
- public void setPlayerListHeaderFooter(String header, String footer) {
-
- }
-
@Override
public String getPlayerListName() {
return name;
@@ -807,21 +790,6 @@ public class OfflinePlayer implements Player {
public void setBedSpawnLocation(Location lctn, boolean force) {
}
- @Override
- public boolean sleep(Location location, boolean force) {
- return false;
- }
-
- @Override
- public void wakeup(boolean setSpawnLocation) {
-
- }
-
- @Override
- public Location getBedLocation() {
- return null;
- }
-
@Override
public void playEffect(EntityEffect ee) {
}
@@ -870,7 +838,7 @@ public class OfflinePlayer implements Player {
}
@Override
- public PotionEffect getPotionEffect(PotionEffectType potionEffectType) {
+ public PotionEffect getPotionEffect(PotionEffectType type) {
return null;
}
@@ -927,12 +895,12 @@ public class OfflinePlayer implements Player {
}
@Override
- public InventoryView openMerchant(Villager villager, boolean b) {
+ public InventoryView openMerchant(Villager trader, boolean force) {
return null;
}
@Override
- public InventoryView openMerchant(Merchant merchant, boolean b) {
+ public InventoryView openMerchant(Merchant merchant, boolean force) {
return null;
}
@@ -949,6 +917,21 @@ public class OfflinePlayer implements Player {
public void setItemOnCursor(ItemStack is) {
}
+ @Override
+ public boolean hasCooldown(Material material) {
+ return false;
+ }
+
+ @Override
+ public int getCooldown(Material material) {
+ return 0;
+ }
+
+ @Override
+ public void setCooldown(Material material, int ticks) {
+
+ }
+
@Override
public void setMetadata(String string, MetadataValue mv) {
}
@@ -1019,28 +1002,23 @@ public class OfflinePlayer implements Player {
}
@Override
- public float getAttackCooldown() {
- return 0f;
+ public Entity getShoulderEntityLeft() {
+ return null;
}
@Override
- public boolean discoverRecipe(NamespacedKey recipe) {
- return false;
+ public void setShoulderEntityLeft(Entity entity) {
+
}
@Override
- public int discoverRecipes(Collection recipes) {
- return 0;
+ public Entity getShoulderEntityRight() {
+ return null;
}
@Override
- public boolean undiscoverRecipe(NamespacedKey recipe) {
- return false;
- }
+ public void setShoulderEntityRight(Entity entity) {
- @Override
- public int undiscoverRecipes(Collection recipes) {
- return 0;
}
@Override
@@ -1078,7 +1056,7 @@ public class OfflinePlayer implements Player {
@Override
public MainHand getMainHand() {
- return MainHand.RIGHT;
+ return null;
}
@Override
@@ -1125,6 +1103,11 @@ public class OfflinePlayer implements Player {
public void setResourcePack(String s) {
}
+ @Override
+ public void setResourcePack(String url, byte[] hash) {
+
+ }
+
@Override
public void setMaxHealth(double i) {
}
@@ -1152,7 +1135,8 @@ public class OfflinePlayer implements Player {
}
@Override
- public void setGlowing(boolean b) {
+ public void setGlowing(boolean flag) {
+
}
@Override
@@ -1161,7 +1145,8 @@ public class OfflinePlayer implements Player {
}
@Override
- public void setInvulnerable(boolean b) {
+ public void setInvulnerable(boolean flag) {
+
}
@Override
@@ -1175,7 +1160,8 @@ public class OfflinePlayer implements Player {
}
@Override
- public void setSilent(boolean b) {
+ public void setSilent(boolean flag) {
+
}
@Override
@@ -1184,7 +1170,8 @@ public class OfflinePlayer implements Player {
}
@Override
- public void setGravity(boolean b) {
+ public void setGravity(boolean gravity) {
+
}
@Override
@@ -1193,7 +1180,7 @@ public class OfflinePlayer implements Player {
}
@Override
- public void setPortalCooldown(int i) {
+ public void setPortalCooldown(int cooldown) {
}
@@ -1203,15 +1190,20 @@ public class OfflinePlayer implements Player {
}
@Override
- public boolean addScoreboardTag(String s) {
+ public boolean addScoreboardTag(String tag) {
return false;
}
@Override
- public boolean removeScoreboardTag(String s) {
+ public boolean removeScoreboardTag(String tag) {
return false;
}
+ @Override
+ public PistonMoveReaction getPistonMoveReaction() {
+ return null;
+ }
+
@Override
public void setPlayerWeather(WeatherType arg0) {
}
@@ -1244,30 +1236,32 @@ public class OfflinePlayer implements Player {
}
@Override
- public void playSound(Location location, Sound sound, SoundCategory soundCategory, float v, float v1) {
-
+ public void playSound(Location location, Sound sound, SoundCategory category, float volume, float pitch) {
+
}
@Override
- public void playSound(Location location, String s, SoundCategory soundCategory, float v, float v1) {
+ public void playSound(Location location, String sound, SoundCategory category, float volume, float pitch) {
}
@Override
public void stopSound(Sound sound) {
- }
-
- @Override
- public void stopSound(String s) {
- }
-
- @Override
- public void stopSound(Sound sound, SoundCategory soundCategory) {
}
@Override
- public void stopSound(String s, SoundCategory soundCategory) {
+ public void stopSound(String sound) {
+
+ }
+
+ @Override
+ public void stopSound(Sound sound, SoundCategory category) {
+
+ }
+
+ @Override
+ public void stopSound(String sound, SoundCategory category) {
}
@@ -1282,7 +1276,7 @@ public class OfflinePlayer implements Player {
@Override
public void setHealthScale(double arg0) throws IllegalArgumentException {
-
+
}
@Override
@@ -1315,26 +1309,13 @@ public class OfflinePlayer implements Player {
}
@Override
- public void setGliding(boolean b) {
- }
-
- @Override
- public boolean isSwimming() {
- return false;
- }
-
- @Override
- public void setSwimming(boolean swimming) {
+ public void setGliding(boolean gliding) {
}
@Override
- public boolean isRiptiding() {
- return false;
- }
+ public void setAI(boolean ai) {
- @Override
- public void setAI(boolean b) {
}
@Override
@@ -1343,39 +1324,15 @@ public class OfflinePlayer implements Player {
}
@Override
- public void attack(Entity entity) {
+ public void setCollidable(boolean collidable) {
}
- @Override
- public void swingMainHand() {
-
- }
-
- @Override
- public void swingOffHand() {
-
- }
-
- @Override
- public void setCollidable(boolean b) {
- }
-
@Override
public boolean isCollidable() {
return false;
}
- @Override
- public T getMemory(MemoryKey memoryKey) {
- return null;
- }
-
- @Override
- public void setMemory(MemoryKey memoryKey, T t) {
-
- }
-
@Override
public T launchProjectile(Class extends T> type, Vector vector) {
return null;
@@ -1385,11 +1342,6 @@ public class OfflinePlayer implements Player {
public void sendSignChange(Location arg0, String[] arg1) throws IllegalArgumentException {
}
- @Override
- public void sendSignChange(Location loc, String[] lines, DyeColor dyeColor) throws IllegalArgumentException {
-
- }
-
@Override
public Location getBedSpawnLocation() {
return null;
@@ -1443,7 +1395,7 @@ public class OfflinePlayer implements Player {
}
try {
Method method = base.getClass().getDeclaredMethod("setBanned", boolean.class);
- method.invoke(banned);
+ method.invoke(base, banned);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
// This will never happen in a normal CraftBukkit pre-1.12 instance
e.printStackTrace();
@@ -1495,178 +1447,87 @@ public class OfflinePlayer implements Player {
}
@Override
- public void spawnParticle(Particle particle, Location location, int i) {
+ public void spawnParticle(Particle particle, Location location, int count) {
}
@Override
- public void spawnParticle(Particle particle, double v, double v1, double v2, int i) {
+ public void spawnParticle(Particle particle, double x, double y, double z, int count) {
}
@Override
- public void spawnParticle(Particle particle, Location location, int i, T t) {
+ public void spawnParticle(Particle particle, Location location, int count, T data) {
}
@Override
- public void spawnParticle(Particle particle, double v, double v1, double v2, int i, T t) {
+ public void spawnParticle(Particle particle, double x, double y, double z, int count, T data) {
}
@Override
- public void spawnParticle(Particle particle, Location location, int i, double v, double v1, double v2) {
+ public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ) {
}
@Override
- public void spawnParticle(Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5) {
+ public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ) {
}
@Override
- public void spawnParticle(Particle particle, Location location, int i, double v, double v1, double v2, T t) {
+ public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, T data) {
}
@Override
- public void spawnParticle(Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5, T t) {
+ public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, T data) {
}
@Override
- public void spawnParticle(Particle particle, Location location, int i, double v, double v1, double v2, double v3) {
+ public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra) {
}
@Override
- public void spawnParticle(Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5, double v6) {
+ public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra) {
}
@Override
- public void spawnParticle(Particle particle, Location location, int i, double v, double v1, double v2, double v3, T t) {
+ public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) {
}
@Override
- public void spawnParticle(Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5, double v6, T t) {
+ public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) {
}
- @Override
- public void sendTitle(String title, String subtitle) {
-
- }
-
- @Override
- public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
-
- }
-
- @Override
- public AttributeInstance getAttribute(Attribute attribute) {
- // GetAttribute is nullable as per CraftAttributeMap. This might need to be
- // improved to support cases where dummy null instances should be returned.
- return null;
- }
-
- @Override
- public void setResourcePack(String s, byte[] bytes) {
- }
-
@Override
public AdvancementProgress getAdvancementProgress(Advancement advancement) {
return null;
}
- @Override
- public int getClientViewDistance() {
- return 0;
- }
-
@Override
public String getLocale() {
return null;
}
@Override
- public boolean hasCooldown(Material material) {
- return false;
+ public void sendTitle(String title, String subtitle) {
+
}
@Override
- public int getCooldown(Material material) {
- return 0;
+ public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
+
}
@Override
- public void setCooldown(Material material, int i) {
- }
-
- @Override
- public Entity getShoulderEntityLeft() {
- return null;
- }
-
- @Override
- public void setShoulderEntityLeft(Entity entity) {
- }
-
- @Override
- public Entity getShoulderEntityRight() {
- return null;
- }
-
- @Override
- public void setShoulderEntityRight(Entity entity) {
- }
-
- @Override
- public double getHeight() {
- return 0;
- }
-
- @Override
- public double getWidth() {
- return 0;
- }
-
- @Override
- public BoundingBox getBoundingBox() {
- return null;
- }
-
- @Override
- public List getPassengers() {
- return null;
- }
-
- @Override
- public boolean addPassenger(Entity entity) {
- return false;
- }
-
- @Override
- public boolean removePassenger(Entity entity) {
- return false;
- }
-
- @Override
- public PistonMoveReaction getPistonMoveReaction() {
- return null;
- }
-
- @Override
- public void updateCommands() {
- }
-
- @Override
- public void openBook(ItemStack book) {
- }
-
- @Override
- public PersistentDataContainer getPersistentDataContainer() {
+ public AttributeInstance getAttribute(Attribute attribute) {
return null;
}
}