Skip to content
Permalink
Browse files

step 2: remove v1_10 and v1_11 refs

  • Loading branch information...
mcmonkey4eva committed May 9, 2019
1 parent 467ca96 commit 2abb37b1fa9342092c7669c9629b9971f465ed4a
Showing with 72 additions and 245 deletions.
  1. +0 −2 nmshandler/src/main/java/net/aufdemrand/denizen/nms/NMSVersion.java
  2. +0 −12 plugin/pom.xml
  3. +3 −9 plugin/src/main/java/net/aufdemrand/denizen/Denizen.java
  4. +1 −8 plugin/src/main/java/net/aufdemrand/denizen/events/core/CuboidEnterExitSmartEvent.java
  5. +1 −21 plugin/src/main/java/net/aufdemrand/denizen/events/entity/ProjectileHitsScriptEvent.java
  6. +3 −3 plugin/src/main/java/net/aufdemrand/denizen/objects/dEntity.java
  7. +1 −1 plugin/src/main/java/net/aufdemrand/denizen/objects/dLocation.java
  8. +2 −3 plugin/src/main/java/net/aufdemrand/denizen/objects/dPlayer.java
  9. +5 −12 plugin/src/main/java/net/aufdemrand/denizen/objects/properties/entity/EntityColor.java
  10. +16 −65 plugin/src/main/java/net/aufdemrand/denizen/objects/properties/entity/EntityInfected.java
  11. +5 −21 plugin/src/main/java/net/aufdemrand/denizen/objects/properties/entity/EntityProfession.java
  12. +20 −45 plugin/src/main/java/net/aufdemrand/denizen/objects/properties/entity/EntitySkeleton.java
  13. +8 −12 plugin/src/main/java/net/aufdemrand/denizen/objects/properties/item/ItemColor.java
  14. +2 −7 plugin/src/main/java/net/aufdemrand/denizen/objects/properties/item/ItemPotion.java
  15. +0 −3 plugin/src/main/java/net/aufdemrand/denizen/objects/properties/item/ItemSpawnEgg.java
  16. +2 −10 plugin/src/main/java/net/aufdemrand/denizen/objects/properties/item/ItemUnbreakable.java
  17. +2 −4 plugin/src/main/java/net/aufdemrand/denizen/scripts/commands/BukkitCommandRegistry.java
  18. +1 −5 plugin/src/main/java/net/aufdemrand/denizen/utilities/entity/DenizenEntityType.java
  19. +0 −2 pom.xml
@@ -3,8 +3,6 @@
public enum NMSVersion {

NOT_SUPPORTED,
v1_10_R1,
v1_11_R1,
v1_12_R1,
v1_13_R2,
v1_14_R1;
@@ -36,18 +36,6 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.aufdemrand</groupId>
<artifactId>denizen-v1_10_R1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.aufdemrand</groupId>
<artifactId>denizen-v1_11_R1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.aufdemrand</groupId>
<artifactId>denizen-v1_12_R1</artifactId>
@@ -645,9 +645,7 @@ public void onEnable() {
ScriptEvent.registerScriptEvent(new EntityHealsScriptEvent());
ScriptEvent.registerScriptEvent(new EntityInteractScriptEvent());
ScriptEvent.registerScriptEvent(new EntityKilledScriptEvent());
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1)) {
ScriptEvent.registerScriptEvent(new EntityResurrectScriptEvent());
}
ScriptEvent.registerScriptEvent(new EntityResurrectScriptEvent());
ScriptEvent.registerScriptEvent(new EntityShootsBowEvent());
ScriptEvent.registerScriptEvent(new EntitySpawnerSpawnScriptEvent());
ScriptEvent.registerScriptEvent(new EntitySpawnScriptEvent());
@@ -721,9 +719,7 @@ public void onEnable() {
ScriptEvent.registerScriptEvent(new PlayerPicksUpScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerPlacesBlockScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerPlacesHangingScriptEvent());
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1)) {
ScriptEvent.registerScriptEvent(new PlayerPreparesAnvilCraftScriptEvent());
}
ScriptEvent.registerScriptEvent(new PlayerPreparesAnvilCraftScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerQuitsScriptEvent());
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_13_R2)) {
ScriptEvent.registerScriptEvent(new PlayerReceivesCommandsScriptEvent());
@@ -854,9 +850,7 @@ public void onEnable() {
PropertyParser.registerProperty(EntityMarker.class, dEntity.class);
PropertyParser.registerProperty(EntityMaxFuseTicks.class, dEntity.class);
PropertyParser.registerProperty(EntityPainting.class, dEntity.class);
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1)) {
PropertyParser.registerProperty(EntityPickupStatus.class, dEntity.class);
}
PropertyParser.registerProperty(EntityPickupStatus.class, dEntity.class);
PropertyParser.registerProperty(EntityPotion.class, dEntity.class);
PropertyParser.registerProperty(EntityPowered.class, dEntity.class);
PropertyParser.registerProperty(EntityProfession.class, dEntity.class);
@@ -165,14 +165,7 @@ public void onWorldChange(PlayerChangedWorldEvent event) {

@EventHandler
public void vehicleMoveEvent(VehicleMoveEvent event) {
List<Entity> passengers = new ArrayList<Entity>();
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1)) {
passengers.addAll(event.getVehicle().getPassengers());
}
else {
passengers.add(event.getVehicle().getPassenger());
}
for (Entity entity : passengers) {
for (Entity entity : event.getVehicle().getPassengers()) {
if (dEntity.isPlayer(entity)) {
PlayerMoveEvent evt = new PlayerMoveEvent((Player) entity, event.getFrom(), event.getTo());
internalRun(evt, "vehicle");
@@ -143,27 +143,7 @@ public void onProjectileHits(ProjectileHitEvent event) {
return; // I can't explain this one either. It also chooses to happen whenever it pleases.
}

Block block = null;
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1)) {
block = event.getHitBlock();
}
else {
try {
BlockIterator bi = new BlockIterator(projectile.getLocation().getWorld(),
projectile.getLocation().toVector(), projectile.getLocation().getDirection().normalize(), 0, 4);
while (bi.hasNext()) {
block = bi.next();
if (block.getType() == Material.AIR) {
break;
}
}
}
catch (IllegalStateException ex) {
// This happens because it can. Also not explainable whatsoever.
// As this error happens on no fault of the user, display no error message... just cancel the event.
return;
}
}
Block block = event.getHitBlock();

if (block == null) {
return;
@@ -1943,8 +1943,8 @@ else if (mtr.angle == BlockFace.EAST) {
// @description
// Returns a list of the entity's passengers, if any.
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1) && (attribute.startsWith("passengers") || attribute.startsWith("get_passengers"))) {
ArrayList<dEntity> passengers = new ArrayList<dEntity>();
if (attribute.startsWith("passengers") || attribute.startsWith("get_passengers")) {
ArrayList<dEntity> passengers = new ArrayList<>();
for (Entity ent : entity.getPassengers()) {
passengers.add(new dEntity(ent));
}
@@ -2767,7 +2767,7 @@ public void adjust(Mechanism mechanism) {
// <e@entity.passengers>
// <e@entity.empty>
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1) && mechanism.matches("passengers")) {
if (mechanism.matches("passengers")) {
entity.eject();
for (dEntity ent : mechanism.valueAsType(dList.class).filter(dEntity.class, mechanism.context)) {
if (ent.isSpawned() && comparesTo(ent) != 1) {
@@ -2139,7 +2139,7 @@ else if (this.getWorldName().equalsIgnoreCase(toLocation.getWorldName())) {
// @description
// Returns whether the location is within the world border.
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1) && attribute.startsWith("is_within_border")) {
if (attribute.startsWith("is_within_border")) {
return new Element(getWorld().getWorldBorder().isInside(this))
.getAttribute(attribute.fulfill(1));
}
@@ -1137,7 +1137,7 @@ else if (attribute.startsWith("uuid") && !isOnline())
// @description
// Returns the cooldown duration remaining on player's material.
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1) && attribute.startsWith("item_cooldown")) {
if (attribute.startsWith("item_cooldown")) {
dMaterial mat = new Element(attribute.getContext(1)).asType(dMaterial.class, attribute.context);
if (mat != null) {
return new Duration((long) getPlayerEntity().getCooldown(mat.getMaterial()))
@@ -3309,8 +3309,7 @@ else if (split.length > 1) {
// NEUTRAL, PLAYERS, RECORDS, VOICE, and WEATHER
// If no sound type is specified, all types will be stopped.
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1)
&& mechanism.matches("stop_sound")) {
if (mechanism.matches("stop_sound")) {
if (!mechanism.hasValue()) {
getPlayerEntity().stopSound("");
}
@@ -31,7 +31,7 @@ public static boolean describes(dObject entity) {
type == EntityType.WOLF ||
type == EntityType.OCELOT ||
type == EntityType.RABBIT ||
(NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1) && type == EntityType.LLAMA) ||
type == EntityType.LLAMA ||
(NMSHandler.getVersion().isAtLeast(NMSVersion.v1_12_R1)
&& (type == EntityType.PARROT || type == EntityType.SHULKER));
}
@@ -69,8 +69,7 @@ private String getColor() {

if (type == EntityType.HORSE) {
Horse horse = (Horse) colored.getBukkitEntity();
return horse.getColor().name() + "|" + horse.getStyle().name() +
(NMSHandler.getVersion().isAtMost(NMSVersion.v1_10_R1) ? "|" + horse.getVariant().name() : "");
return horse.getColor().name() + "|" + horse.getStyle().name();
}
else if (type == EntityType.SHEEP) {
return ((Sheep) colored.getBukkitEntity()).getColor().name();
@@ -84,7 +83,7 @@ else if (type == EntityType.OCELOT) {
else if (type == EntityType.RABBIT) {
return ((Rabbit) colored.getBukkitEntity()).getRabbitType().name();
}
else if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1) && type == EntityType.LLAMA) {
else if (type == EntityType.LLAMA) {
return LlamaHelper.llamaColorName(colored);
}
else if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_12_R1) && type == EntityType.PARROT) {
@@ -191,8 +190,7 @@ public void adjust(Mechanism mechanism) {
// @description
// Changes the entity's color.
// Currently, only Horse, Wolf, Ocelot, Sheep, Rabbit, Llama, Parrot, and Shulker type entities can have a color.
// For horses, the input is COLOR|STYLE(|VARIANT), see <@link language horse types>
// NOTE: HORSE VARIANTS DEPRECATED SINCE 1.11, use spawn instead
// For horses, the input is COLOR|STYLE, see <@link language horse types>
// For ocelots, the types are BLACK_CAT, RED_CAT, SIAMESE_CAT, or WILD_OCELOT.
// For rabbit types, see <@link language rabbit types>.
// For parrots, the types are BLUE, CYAN, GRAY, GREEN, or RED.
@@ -216,11 +214,6 @@ public void adjust(Mechanism mechanism) {
((Horse) colored.getBukkitEntity())
.setStyle(Horse.Style.valueOf(horse_info.get(1).toUpperCase()));
}
if (NMSHandler.getVersion().isAtMost(NMSVersion.v1_10_R1)
&& horse_info.size() > 2 && new Element(horse_info.get(2)).matchesEnum(Horse.Variant.values())) {
((Horse) colored.getBukkitEntity())
.setVariant(Horse.Variant.valueOf(horse_info.get(2).toUpperCase()));
}
}
else if (type == EntityType.SHEEP
&& mechanism.getValue().matchesEnum(DyeColor.values())) {
@@ -245,7 +238,7 @@ else if (type == EntityType.RABBIT
&& mechanism.getValue().matchesEnum(Rabbit.Type.values())) {
((Rabbit) colored.getBukkitEntity()).setRabbitType(Rabbit.Type.valueOf(mechanism.getValue().asString().toUpperCase()));
}
else if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1) && type == EntityType.LLAMA) {
else if (type == EntityType.LLAMA) {
LlamaHelper.setLlamaColor(colored, mechanism.getValue().asString());
}
else if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_12_R1) && type == EntityType.PARROT) {
@@ -1,8 +1,7 @@
package net.aufdemrand.denizen.objects.properties.entity;

import net.aufdemrand.denizen.nms.NMSHandler;
import net.aufdemrand.denizen.nms.NMSVersion;
import net.aufdemrand.denizen.objects.dEntity;
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.aufdemrand.denizencore.objects.Element;
import net.aufdemrand.denizencore.objects.Mechanism;
import net.aufdemrand.denizencore.objects.dObject;
@@ -11,7 +10,6 @@
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Zombie;
import org.bukkit.entity.ZombieVillager;

@@ -56,9 +54,7 @@ private EntityInfected(dEntity item) {

public boolean isInfected() {
return infected.getBukkitEntity() instanceof Zombie
&& (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1)
? infected.getBukkitEntityType() == EntityType.ZOMBIE_VILLAGER
: ((Zombie) infected.getBukkitEntity()).isVillager());
&& infected.getBukkitEntityType() == EntityType.ZOMBIE_VILLAGER;
}

public void setInfected(boolean bool) {
@@ -68,49 +64,18 @@ public void setInfected(boolean bool) {
NPC infected_npc = infected.getDenizenNPC().getCitizen();
infected_npc.setBukkitEntityType(EntityType.ZOMBIE_VILLAGER);
}

// TODO: Improve upon.
else if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1)) {
LivingEntity entity = infected.getLivingEntity();
// Make a new entity
ZombieVillager infect = (ZombieVillager) entity.getLocation().getWorld().spawnEntity(infected.getLocation(), EntityType.ZOMBIE_VILLAGER);
// Set health
infect.setHealth(entity.getHealth());
// Set equipment
infect.getEquipment().setArmorContents(entity.getEquipment().getArmorContents());
// Remove the Villager
entity.remove();
// Set the dEntity to the new entity
infected.setEntity(infect);
}

// TODO: Should be bother allowing villager input at all?

// If it's a Villager, we need to spawn a Zombie instead.
// This is kind of messy, and can be improved upon.
// TODO: Improve upon.
else if (infected.getBukkitEntity() instanceof Villager) {
Villager villager = (Villager) infected.getBukkitEntity();
// Make a new entity
Zombie infect = (Zombie) villager.getLocation().getWorld().spawnEntity(infected.getLocation(), EntityType.ZOMBIE);
infect.setVillager(true);
// Set health
infect.setHealth(villager.getHealth());
// Set equipment
infect.getEquipment().setArmorContents(villager.getEquipment().getArmorContents());
// Remove the Villager
villager.remove();
// Set the dEntity to the new entity
infected.setEntity(infect);
}

// Much much easier
else if (infected.getBukkitEntity() instanceof Zombie) {
((Zombie) infected).setVillager(true);
}
LivingEntity entity = infected.getLivingEntity();
// Make a new entity
ZombieVillager infect = (ZombieVillager) entity.getLocation().getWorld().spawnEntity(infected.getLocation(), EntityType.ZOMBIE_VILLAGER);
// Set health
infect.setHealth(entity.getHealth());
// Set equipment
infect.getEquipment().setArmorContents(entity.getEquipment().getArmorContents());
// Remove the Villager
entity.remove();
// Set the dEntity to the new entity
infected.setEntity(infect);
}


}


@@ -145,15 +110,8 @@ public String getAttribute(Attribute attribute) {
return null;
}

// <--[tag]
// @attribute <e@entity.is_infected>
// @returns Element(Boolean)
// @group properties
// @description
// If the entity is infectable, returns whether the entity is infected.
// Currently only Zombie or Villager entities can be infected.
// -->
if (attribute.startsWith("is_infected")) {
dB.echoError("Different infection types are represented by different entity types. Please remove usage of the 'is_infected' tag.");
return new Element(isInfected())
.getAttribute(attribute.fulfill(1));
}
@@ -163,16 +121,9 @@ public String getAttribute(Attribute attribute) {

@Override
public void adjust(Mechanism mechanism) {
// <--[mechanism]
// @object dEntity
// @name is_infected
// @input Element(Boolean)
// @description
// Sets whether the entity is infected.
// @tags
// <e@entity.is_infected>
// -->

if (mechanism.matches("is_infected") && mechanism.requireBoolean()) {
dB.echoError("Different infection types are represented by different entity types. Please remove usage of the 'is_infected' mechanism.");
setInfected(mechanism.getValue().asBoolean());
}
}

0 comments on commit 2abb37b

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