Skip to content
Permalink
Browse files

[EXPERIMENTAL] Update to 1.14-pre5

  • Loading branch information...
Morphan1 committed Apr 25, 2019
1 parent eb74654 commit 3255c273088a5d33edfab48d7d03f93ebb42c057
Showing with 516 additions and 368 deletions.
  1. +3 −0 nmshandler/src/main/java/net/aufdemrand/denizen/nms/NMSHandler.java
  2. +2 −1 nmshandler/src/main/java/net/aufdemrand/denizen/nms/NMSVersion.java
  3. +14 −0 nmshandler/src/main/java/net/aufdemrand/denizen/nms/util/TradeOffer.java
  4. +6 −0 plugin/pom.xml
  5. +2 −10 plugin/src/main/java/net/aufdemrand/denizen/objects/dChunk.java
  6. +10 −9 plugin/src/main/java/net/aufdemrand/denizen/objects/dInventory.java
  7. +8 −3 plugin/src/main/java/net/aufdemrand/denizen/objects/properties/entity/EntityPotionEffects.java
  8. +11 −34 plugin/src/main/java/net/aufdemrand/denizen/objects/properties/entity/EntitySitting.java
  9. +2 −1 plugin/src/main/java/net/aufdemrand/denizen/objects/properties/inventory/InventoryTitle.java
  10. +4 −8 plugin/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/SitCommand.java
  11. +6 −8 plugin/src/main/java/net/aufdemrand/denizen/scripts/commands/npc/StandCommand.java
  12. +9 −7 plugin/src/main/java/net/aufdemrand/denizen/scripts/commands/world/SignCommand.java
  13. +3 −3 plugin/src/main/java/net/aufdemrand/denizen/utilities/BStatsMetricsLite.java
  14. +51 −2 plugin/src/main/java/net/aufdemrand/denizen/utilities/MaterialCompat.java
  15. +2 −4 plugin/src/main/java/net/aufdemrand/denizen/utilities/Utilities.java
  16. +2 −1 plugin/src/main/java/net/aufdemrand/denizen/utilities/inventory/InventoryMenu.java
  17. +2 −1 pom.xml
  18. +6 −0 v1_10_R1/src/main/java/net/aufdemrand/denizen/nms/Handler_v1_10_R1.java
  19. +6 −0 v1_11_R1/src/main/java/net/aufdemrand/denizen/nms/Handler_v1_11_R1.java
  20. +6 −0 v1_12_R1/src/main/java/net/aufdemrand/denizen/nms/Handler_v1_12_R1.java
  21. +6 −0 v1_13_R2/src/main/java/net/aufdemrand/denizen/nms/Handler_v1_13_R2.java
  22. +54 −3 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/Handler_v1_14_R1.java
  23. +2 −1 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/helpers/AdvancementHelper_v1_14_R1.java
  24. +12 −26 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/helpers/AnimationHelper_v1_14_R1.java
  25. +5 −4 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/helpers/BlockHelper_v1_14_R1.java
  26. +8 −9 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/helpers/ChunkHelper_v1_14_R1.java
  27. +2 −1 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/helpers/CustomEntityHelper_v1_14_R1.java
  28. +35 −27 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/helpers/EntityHelper_v1_14_R1.java
  29. +17 −7 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/helpers/FishingHelper_v1_14_R1.java
  30. +5 −4 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/helpers/ItemHelper_v1_14_R1.java
  31. +9 −5 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/helpers/PacketHelper_v1_14_R1.java
  32. +9 −5 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/helpers/PlayerHelper_v1_14_R1.java
  33. +1 −0 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/helpers/SoundHelper_v1_14_R1.java
  34. +10 −5 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/helpers/WorldHelper_v1_14_R1.java
  35. +4 −4 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/BiomeNMS_v1_14_R1.java
  36. +12 −11 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/ImprovedOfflinePlayer_v1_14_R1.java
  37. +1 −0 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/Sidebar_v1_14_R1.java
  38. +22 −1 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/blocks/BlockLight_v1_14_R1.java
  39. +2 −2 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/entities/CraftItemProjectile_v1_14_R1.java
  40. +3 −1 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/entities/EntityFakeArrow_v1_14_R1.java
  41. +2 −1 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/entities/EntityFakePlayer_v1_14_R1.java
  42. +71 −82 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/entities/EntityItemProjectile_v1_14_R1.java
  43. +7 −5 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/jnbt/CompoundTag_v1_14_R1.java
  44. +2 −0 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/network/FakeChannel_v1_14_R1.java
  45. +2 −1 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/network/FakeNetworkManager_v1_14_R1.java
  46. +1 −1 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/packets/PacketOutChat_v1_14_R1.java
  47. +2 −3 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/packets/PacketOutSpawnEntity_v1_14_R1.java
  48. +33 −37 v1_14_R1/src/main/java/net/aufdemrand/denizen/nms/impl/packets/PacketOutTradeList_v1_14_R1.java
  49. +16 −0 ...c/main/java/net/aufdemrand/denizen/nms/impl/packets/handlers/AbstractListenerPlayIn_v1_14_R1.java
  50. +6 −30 ...rc/main/java/net/aufdemrand/denizen/nms/impl/packets/handlers/DenizenNetworkManager_v1_14_R1.java
@@ -17,6 +17,7 @@
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;

@@ -127,6 +128,8 @@ public boolean isCorrectMappingsCode() {

public abstract int getPort();

public abstract String getTitle(Inventory inventory);

public static Vector fixOffset(Vector offset, double yaw, double pitch) {
yaw = Math.toRadians(yaw);
pitch = Math.toRadians(pitch);
@@ -6,7 +6,8 @@
v1_10_R1,
v1_11_R1,
v1_12_R1,
v1_13_R2;
v1_13_R2,
v1_14_R1;

public boolean isAtLeast(NMSVersion version) {
return ordinal() >= version.ordinal();
@@ -11,6 +11,11 @@
private int currentUses;
private int maxUses;

// 1.14
public boolean rewardExp;
public int xp;
public float priceMultiplier;

public TradeOffer(ItemStack product, ItemStack firstCost, ItemStack secondCost,
boolean usedMaxTimes, int currentUses, int maxUses) {
this.product = product;
@@ -21,6 +26,15 @@ public TradeOffer(ItemStack product, ItemStack firstCost, ItemStack secondCost,
this.maxUses = maxUses;
}

public TradeOffer(ItemStack product, ItemStack firstCost, ItemStack secondCost,
boolean usedMaxTimes, int currentUses, int maxUses,
boolean rewardExp, int xp, float priceMultiplier) {
this(product, firstCost, secondCost, usedMaxTimes, currentUses, maxUses);
this.rewardExp = rewardExp;
this.xp = xp;
this.priceMultiplier = priceMultiplier;
}

public ItemStack getProduct() {
return product;
}
@@ -60,6 +60,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.aufdemrand</groupId>
<artifactId>denizen-v1_14_R1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<!-- Basic dependencies -->
<dependency>
<groupId>net.citizensnpcs</groupId>
@@ -592,17 +592,9 @@ public void adjust(Mechanism mechanism) {
getChunk().unload(true);
}

// <--[mechanism]
// @object dChunk
// @name unload_safely
// @input None
// @description
// Removes a chunk from memory in a safe manner.
// @tags
// <chunk.is_loaded>
// -->
if (mechanism.matches("unload_safely")) {
getChunk().unload(true, true);
dB.echoError("Mechanism 'dChunk.unload_safely' is not valid: It is never safe to remove a chunk in use.");
getChunk().unload(true);
}

// <--[mechanism]
@@ -72,8 +72,9 @@ public static dInventory mirrorBukkitInventory(Inventory inventory) {
InventoryScriptHelper.tempInventoryScripts.get(inventory));
}
// Use the map to get notable inventories
if (InventoryScriptHelper.notableInventories.containsKey(inventory.getTitle())) {
return InventoryScriptHelper.notableInventories.get(inventory.getTitle());
String title = NMSHandler.getInstance().getTitle(inventory);
if (InventoryScriptHelper.notableInventories.containsKey(title)) {
return InventoryScriptHelper.notableInventories.get(title);
}
// Iterate through offline player inventories
for (Map.Entry<UUID, PlayerInventory> inv : ImprovedOfflinePlayer.offlineInventories.entrySet()) {
@@ -130,7 +131,7 @@ public String getSaveObject() {
public static int inventoryNameNotableMax = 32 - inventoryNameNotableRequired;

public void makeUnique(String id) {
String title = inventory.getTitle();
String title = NMSHandler.getInstance().getTitle(inventory);
if (title == null || title.startsWith("container.")) {
title = inventory.getType().getDefaultTitle();
}
@@ -283,7 +284,7 @@ else if (type.equals("player")) {
else if (type.equals("workbench")) {
if (dPlayer.matches(holder)) {
dInventory workbench = dPlayer.valueOf(holder).getWorkbench();
if (workbench != null) {
if (workbench == null) {
if (!silent) {
dB.echoError("Value of dInventory returning null (" + string + ")." +
" Specified player does not have an open workbench.");
@@ -459,7 +460,7 @@ public void setTitle(String title) {
if (!(getIdType().equals("generic") || getIdType().equals("script")) || title == null) {
return;
}
if (inventory != null && inventory.getTitle().equals(title)) {
if (inventory != null && NMSHandler.getInstance().getTitle(inventory).equals(title)) {
return;
}
if (inventory == null) {
@@ -469,7 +470,7 @@ public void setTitle(String title) {
}
else if (notableColors != null) {
title += notableColors;
InventoryScriptHelper.notableInventories.remove(inventory.getTitle());
InventoryScriptHelper.notableInventories.remove(NMSHandler.getInstance().getTitle(inventory));
InventoryScriptHelper.notableInventories.put(title, this);
}
ItemStack[] contents = inventory.getContents();
@@ -572,7 +573,7 @@ else if (inventory == null) {
else {
newContents = oldContents;
}
String title = inventory.getTitle();
String title = NMSHandler.getInstance().getTitle(inventory);
inventory = Bukkit.getServer().createInventory(null, size, (title != null ? title : inventory.getType().getDefaultTitle()));
inventory.setContents(newContents);
loadIdentifiers();
@@ -1388,7 +1389,7 @@ public String getAttribute(Attribute attribute) {
int attribs = 1;

InventoryType type = inventory.getType();
dInventory dummyInv = new dInventory(Bukkit.createInventory(null, type == InventoryType.PLAYER ? InventoryType.CHEST : type, inventory.getTitle()));
dInventory dummyInv = new dInventory(Bukkit.createInventory(null, type == InventoryType.PLAYER ? InventoryType.CHEST : type, NMSHandler.getInstance().getTitle(inventory)));
ItemStack[] contents = getStorageContents();
if (dummyInv.getInventoryType() == InventoryType.CHEST) {
dummyInv.setSize(contents.length);
@@ -1437,7 +1438,7 @@ public String getAttribute(Attribute attribute) {
int attribs = 1;
int qty = 1;

dInventory dummyInv = new dInventory(Bukkit.createInventory(null, inventory.getType(), inventory.getTitle()));
dInventory dummyInv = new dInventory(Bukkit.createInventory(null, inventory.getType(), NMSHandler.getInstance().getTitle(inventory)));
if (inventory.getType() == InventoryType.CHEST) {
dummyInv.setSize(inventory.getSize());
}
@@ -19,10 +19,15 @@
import java.util.List;

public class EntityPotionEffects implements Property {

public static boolean describes(dObject object) {
return object instanceof dEntity &&
(((dEntity) object).isLivingEntity()
|| ((dEntity) object).getBukkitEntityType() == EntityType.TIPPED_ARROW);
|| isTippedArrow(((dEntity) object).getBukkitEntityType()));
}

public static boolean isTippedArrow(EntityType entityType) {
return entityType.getEntityClass() == TippedArrow.class;
}

public static EntityPotionEffects getFrom(dObject object) {
@@ -57,7 +62,7 @@ private EntityPotionEffects(dEntity entity) {
if (entity.isLivingEntity()) {
return entity.getLivingEntity().getActivePotionEffects();
}
else if (entity.getBukkitEntityType() == EntityType.TIPPED_ARROW) {
else if (isTippedArrow(entity.getBukkitEntityType())) {
return ((TippedArrow) entity.getBukkitEntity()).getCustomEffects();
}
return new ArrayList<PotionEffect>();
@@ -165,7 +170,7 @@ public void adjust(Mechanism mechanism) {
entity.getLivingEntity().addPotionEffect(new PotionEffect(effectType, Integer.valueOf(split.get(2)),
Integer.valueOf(split.get(1))));
}
else if (entity.getBukkitEntityType() == EntityType.TIPPED_ARROW) {
else if (isTippedArrow(entity.getBukkitEntityType())) {
((TippedArrow) entity.getBukkitEntity()).addCustomEffect(new PotionEffect(effectType, Integer.valueOf(split.get(2)),
Integer.valueOf(split.get(1))), true);
}
@@ -8,14 +8,14 @@
import net.aufdemrand.denizencore.tags.Attribute;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Sittable;
import org.bukkit.entity.Wolf;

public class EntitySitting implements Property {

public static boolean describes(dObject entity) {
return entity instanceof dEntity && (
((dEntity) entity).getBukkitEntityType() == EntityType.WOLF
|| ((dEntity) entity).getBukkitEntityType() == EntityType.OCELOT);
return entity instanceof dEntity
&& ((dEntity) entity).getBukkitEntity() instanceof Sittable;
}

public static EntitySitting getFrom(dObject entity) {
@@ -52,22 +52,10 @@ private EntitySitting(dEntity entity) {

@Override
public String getPropertyString() {
if (entity.getBukkitEntityType() == EntityType.WOLF) {
if (!((Wolf) entity.getBukkitEntity()).isSitting()) {
return null;
}
else {
return "true";
}
}
else {
if (!((Ocelot) entity.getBukkitEntity()).isSitting()) {
return null;
}
else {
return "true";
}
if (((Sittable) entity.getBukkitEntity()).isSitting()) {
return "true";
}
return null;
}

@Override
@@ -92,17 +80,11 @@ public String getAttribute(Attribute attribute) {
// @mechanism dEntity.sitting
// @group properties
// @description
// If the entity is a wolf or ocelot, returns whether the animal is sitting.
// If the entity is a wolf, cat, or parrot, returns whether the animal is sitting.
// -->
if (attribute.startsWith("sitting")) {
if (entity.getBukkitEntityType() == EntityType.WOLF) {
return new Element(((Wolf) entity.getBukkitEntity()).isSitting())
.getAttribute(attribute.fulfill(1));
}
else {
return new Element(((Ocelot) entity.getBukkitEntity()).isSitting())
.getAttribute(attribute.fulfill(1));
}
return new Element(((Sittable) entity.getBukkitEntity()).isSitting())
.getAttribute(attribute.fulfill(1));
}

return null;
@@ -116,18 +98,13 @@ public void adjust(Mechanism mechanism) {
// @name sitting
// @input Element(Boolean)
// @description
// Changes the sitting state of a wolf or ocelot.
// Changes the sitting state of a wolf, cat, or parrot.
// @tags
// <e@entity.sitting>
// -->

if (mechanism.matches("sitting") && mechanism.requireBoolean()) {
if (entity.getBukkitEntityType() == EntityType.WOLF) {
((Wolf) entity.getBukkitEntity()).setSitting(mechanism.getValue().asBoolean());
}
else {
((Ocelot) entity.getBukkitEntity()).setSitting(mechanism.getValue().asBoolean());
}
((Sittable) entity.getBukkitEntity()).setSitting(mechanism.getValue().asBoolean());
}
}
}
@@ -1,5 +1,6 @@
package net.aufdemrand.denizen.objects.properties.inventory;

import net.aufdemrand.denizen.nms.NMSHandler;
import net.aufdemrand.denizen.objects.dInventory;
import net.aufdemrand.denizencore.objects.Element;
import net.aufdemrand.denizencore.objects.Mechanism;
@@ -41,7 +42,7 @@ public InventoryTitle(dInventory inventory) {

public String getTitle() {
if (inventory.getInventory() != null) {
String title = inventory.getInventory().getTitle();
String title = NMSHandler.getInstance().getTitle(inventory.getInventory());
if (title != null) {
if (inventory.isUnique()) {
return title.substring(0, title.length() - dInventory.inventoryNameNotableRequired);
@@ -8,9 +8,7 @@
import net.aufdemrand.denizencore.objects.aH;
import net.aufdemrand.denizencore.scripts.ScriptEntry;
import net.aufdemrand.denizencore.scripts.commands.AbstractCommand;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.*;

public class SitCommand extends AbstractCommand {

@@ -49,11 +47,9 @@ public void execute(ScriptEntry scriptEntry) {

}

if (((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getEntityType() == EntityType.OCELOT) {
((Ocelot) ((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getEntity()).setSitting(true);
}
else if (((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getEntityType() == EntityType.WOLF) {
((Wolf) ((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getEntity()).setSitting(true);
Entity entity = ((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getEntity();
if (entity instanceof Sittable) {
((Sittable) entity).setSitting(true);
}
else {
SittingTrait trait = ((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getCitizen().getTrait(SittingTrait.class);
@@ -1,16 +1,16 @@
package net.aufdemrand.denizen.scripts.commands.npc;

import net.aufdemrand.denizen.BukkitScriptEntryData;
import net.aufdemrand.denizen.nms.NMSHandler;
import net.aufdemrand.denizen.nms.NMSVersion;
import net.aufdemrand.denizen.npc.traits.SittingTrait;
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.aufdemrand.denizencore.exceptions.InvalidArgumentsException;
import net.aufdemrand.denizencore.objects.aH;
import net.aufdemrand.denizencore.scripts.ScriptEntry;
import net.aufdemrand.denizencore.scripts.commands.AbstractCommand;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.*;

public class StandCommand extends AbstractCommand {

@@ -43,11 +43,9 @@ public void execute(ScriptEntry scriptEntry) {

}

if (((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getEntityType() == EntityType.OCELOT) {
((Ocelot) ((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getEntity()).setSitting(false);
}
else if (((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getEntityType() == EntityType.WOLF) {
((Wolf) ((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getEntity()).setSitting(false);
Entity entity = ((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getEntity();
if (entity instanceof Sittable) {
((Sittable) entity).setSitting(false);
}
else {
NPC npc = ((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getCitizen();

0 comments on commit 3255c27

Please sign in to comment.
You can’t perform that action at this time.