From ea1c3918fc37b8d68abf0504464891c51611d78c Mon Sep 17 00:00:00 2001 From: MusicScore <16635607+MusicScore@users.noreply.github.com> Date: Fri, 16 Aug 2019 16:49:55 -0400 Subject: [PATCH 1/2] Implement BlockData.Type interfaces, part 2 Covers everything from farmland moisture to redstone wire connections --- .../objects/properties/PropertyRegistry.java | 24 ++- .../material/MaterialFarmlandMoisture.java | 131 ++++++++++++ .../material/MaterialGateInStoneWall.java | 109 ++++++++++ .../material/MaterialHopperEnabled.java | 111 ++++++++++ .../material/MaterialJukeboxRecord.java | 91 ++++++++ .../material/MaterialLanternHanging.java | 108 ++++++++++ .../material/MaterialLeavesDistance.java | 110 ++++++++++ .../material/MaterialLeavesPersistence.java | 108 ++++++++++ .../material/MaterialLecternBook.java | 91 ++++++++ .../material/MaterialNoteblockInstrument.java | 111 ++++++++++ .../material/MaterialNoteblockNote.java | 199 ++++++++++++++++++ .../material/MaterialPistonExtended.java | 108 ++++++++++ .../MaterialPistonHeadRetracting.java | 108 ++++++++++ .../material/MaterialPistonType.java | 110 ++++++++++ .../material/MaterialRailShape.java | 141 +++++++++++++ .../material/MaterialRedstoneConnection.java | 186 ++++++++++++++++ 16 files changed, 1838 insertions(+), 8 deletions(-) create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialFarmlandMoisture.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialGateInStoneWall.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialHopperEnabled.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialJukeboxRecord.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLanternHanging.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesDistance.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesPersistence.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLecternBook.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockInstrument.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockNote.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonExtended.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonHeadRetracting.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonType.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRailShape.java create mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRedstoneConnection.java diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java index 9cdd68fd02..7a3727b07d 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java @@ -162,21 +162,29 @@ public static void registermainProperties() { PropertyParser.registerProperty(MaterialAge.class, MaterialTag.class); PropertyParser.registerProperty(MaterialAttached.class, MaterialTag.class); PropertyParser.registerProperty(MaterialDirectional.class, MaterialTag.class); + PropertyParser.registerProperty(MaterialFarmlandMoisture.class, MaterialTag.class); PropertyParser.registerProperty(MaterialHalf.class, MaterialTag.class); - PropertyParser.registerProperty(MaterialSlab.class, MaterialTag.class); - PropertyParser.registerProperty(MaterialLeaves.class, MaterialTag.class); + PropertyParser.registerProperty(MaterialGateInStoneWall.class, MaterialTag.class); + PropertyParser.registerProperty(MaterialHopperEnabled.class, MaterialTag.class); + PropertyParser.registerProperty(MaterialJukeboxRecord.class, MaterialTag.class); + PropertyParser.registerProperty(MaterialLeavesDistance.class, MaterialTag.class); + PropertyParser.registerProperty(MaterialLeavesPersistence.class, MaterialTag.class); PropertyParser.registerProperty(MaterialLevel.class, MaterialTag.class); PropertyParser.registerProperty(MaterialLightable.class, MaterialTag.class); - PropertyParser.registerProperty(MaterialMultipleFacing.class, MaterialTag.class); - PropertyParser.registerProperty(MaterialOpen.class, MaterialTag.class); - PropertyParser.registerProperty(MaterialOrientation.class, MaterialTag.class); + PropertyParser.registerProperty(MaterialNoteblockInstrument.class, MaterialTag.class); + PropertyParser.registerProperty(MaterialNoteblockNote.class, MaterialTag.class); + PropertyParser.registerProperty(MaterialPistonExtended.class, MaterialTag.class); + PropertyParser.registerProperty(MaterialPistonHeadRetracting.class, MaterialTag.class); + PropertyParser.registerProperty(MaterialPistonType.class, MaterialTag.class); PropertyParser.registerProperty(MaterialRailShape.class, MaterialTag.class); - PropertyParser.registerProperty(MaterialRedstonePower.class, MaterialTag.class); - PropertyParser.registerProperty(MaterialRotation.class, MaterialTag.class); - PropertyParser.registerProperty(MaterialSnowy.class, MaterialTag.class); + PropertyParser.registerProperty(MaterialRedstoneConnection.class, MaterialTag.class); PropertyParser.registerProperty(MaterialSwitchFace.class, MaterialTag.class); PropertyParser.registerProperty(MaterialWaterlogged.class, MaterialTag.class); } + if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_14_R1)) { + PropertyParser.registerProperty(MaterialLanternHanging.class, MaterialTag.class); + PropertyParser.registerProperty(MaterialLecternBook.class, MaterialTag.class); + } // register core TradeTag properties PropertyParser.registerProperty(TradeHasXp.class, TradeTag.class); diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialFarmlandMoisture.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialFarmlandMoisture.java new file mode 100644 index 0000000000..9cb4771ad5 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialFarmlandMoisture.java @@ -0,0 +1,131 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizen.utilities.debugging.Debug; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.block.data.type.Farmland; + +public class MaterialFarmlandMoisture implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof Farmland; + } + + public static MaterialFarmlandMoisture getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialFarmlandMoisture((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "moisture", "max_moisture" + }; + + public static final String[] handledMechs = new String[] { + "moisture" + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialFarmlandMoisture(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private Farmland getFarmland() { + return (Farmland) material.getModernData().data; + } + + private int getMoisture() { + return getFarmland().getMoisture(); + } + + private int getMaxMoisture() { + return getFarmland().getMoisture(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return getMoisture() != 0 ? String.valueOf(getMoisture()) : null; + } + + @Override + public String getPropertyId() { + return "moisture"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ElementTag(Number) + // @group properties + // @description + // Returns the maximum moisture level of the farmland material. + // --> + if (attribute.startsWith("max_moisture")) { + return new ElementTag(getMaxMoisture()).getAttribute(attribute.fulfill(1)); + } + + // <--[tag] + // @attribute + // @returns ElementTag(Number) + // @mechanism MaterialTag.moisture + // @group properties + // @description + // Returns the moisture level of the farmland material. + // --> + if (attribute.startsWith("moisture")) { + return new ElementTag(getMoisture()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + + // <--[mechanism] + // @object MaterialTag + // @name moisture + // @input ElementTag(Number) + // @description + // Sets the moisture level of the farmland material. + // Cannot be higher than the max moisture level. + // @tags + // + // + // --> + if (mechanism.matches("moisture") && mechanism.requireInteger()) { + int moisture = mechanism.getValue().asInt(); + if (moisture < 0 || moisture > getMaxMoisture()) { + Debug.echoError("The moisture level must be between '0' and '" + getMaxMoisture() + "'!"); + return; + } + getFarmland().setMoisture(moisture); + } + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialGateInStoneWall.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialGateInStoneWall.java new file mode 100644 index 0000000000..ba591802a2 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialGateInStoneWall.java @@ -0,0 +1,109 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.block.data.type.Gate; + +public class MaterialGateInStoneWall implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof Gate; + } + + public static MaterialGateInStoneWall getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialGateInStoneWall((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "in_stone_wall" + }; + + public static final String[] handledMechs = new String[] { + "in_stone_wall" + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialGateInStoneWall(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private Gate getGate() { + return (Gate) material.getModernData().data; + } + + private boolean isInWall() { + return getGate().isInWall(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return isInWall() ? "true" : null; + } + + @Override + public String getPropertyId() { + return "in_stone_wall"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ElementTag(Boolean) + // @mechanism MaterialTag.in_stone_wall + // @group properties + // @description + // Returns whether this fence gate material is attached to a stone wall. + // --> + if (attribute.startsWith("in_stone_wall")) { + return new ElementTag(isInWall()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + + // <--[mechanism] + // @object MaterialTag + // @name in_stone_wall + // @input ElementTag(Boolean) + // @description + // Sets whether this fence gate material is attached to a stone wall. + // If true, then the material's texture is lowered. + // @tags + // + // --> + if (mechanism.matches("in_stone_wall") && mechanism.requireBoolean()) { + getGate().setInWall(mechanism.getValue().asBoolean()); + } + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialHopperEnabled.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialHopperEnabled.java new file mode 100644 index 0000000000..d823d69ce7 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialHopperEnabled.java @@ -0,0 +1,111 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.block.data.type.Hopper; + +public class MaterialHopperEnabled implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof Hopper; + } + + public static MaterialHopperEnabled getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialHopperEnabled((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "enabled" + }; + + public static final String[] handledMechs = new String[] { + "enabled" + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialHopperEnabled(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private Hopper getHopper() { + return (Hopper) material.getModernData().data; + } + + private boolean isEnabled() { + return getHopper().isEnabled(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + // The default state of a hopper is being enabled. + return !isEnabled() ? "false" : null; + } + + @Override + public String getPropertyId() { + return "enabled"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ElementTag(Boolean) + // @mechanism MaterialTag.enabled + // @group properties + // @description + // Returns whether this hopper material is enabled. + // NOTE: A hopper is enabled when it is not receiving power! + // --> + if (attribute.startsWith("enabled")) { + return new ElementTag(isEnabled()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + + // <--[mechanism] + // @object MaterialTag + // @name enabled + // @input ElementTag(Boolean) + // @description + // Sets whether this hopper material is enabled. + // NOTE: A hopper is enabled when it is not receiving power! + // @tags + // + // --> + if (mechanism.matches("enabled") && mechanism.requireBoolean()) { + getHopper().setEnabled(mechanism.getValue().asBoolean()); + } + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialJukeboxRecord.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialJukeboxRecord.java new file mode 100644 index 0000000000..53ac4e4cf3 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialJukeboxRecord.java @@ -0,0 +1,91 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.block.data.type.Jukebox; + +public class MaterialJukeboxRecord implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof Jukebox; + } + + public static MaterialJukeboxRecord getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialJukeboxRecord((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "has_record" + }; + + public static final String[] handledMechs = new String[] { + // None + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialJukeboxRecord(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private boolean hasRecord() { + return ((Jukebox) material.getModernData().data).hasRecord(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return hasRecord() ? "true" : null; + } + + @Override + public String getPropertyId() { + return "has_record"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ElementTag(Boolean) + // @group properties + // @description + // Returns whether the jukebox material has a record inside of it. + // --> + if (attribute.startsWith("has_record")) { + return new ElementTag(hasRecord()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + // None + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLanternHanging.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLanternHanging.java new file mode 100644 index 0000000000..007428c5f4 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLanternHanging.java @@ -0,0 +1,108 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.block.data.type.Lantern; + +public class MaterialLanternHanging implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof Lantern; + } + + public static MaterialLanternHanging getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialLanternHanging((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "is_hanging" + }; + + public static final String[] handledMechs = new String[] { + "is_hanging" + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialLanternHanging(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private Lantern getLantern() { + return (Lantern) material.getModernData().data; + } + + private boolean isHanging() { + return getLantern().isHanging(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return isHanging() ? "true" : null; + } + + @Override + public String getPropertyId() { + return "is_hanging"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ElementTag(Boolean) + // @mechanism MaterialTag.is_hanging + // @group properties + // @description + // Returns whether the lantern material is hanging from a block. + // --> + if (attribute.startsWith("is_hanging")) { + return new ElementTag(isHanging()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + + // <--[mechanism] + // @object MaterialTag + // @name is_hanging + // @input ElementTag(Boolean) + // @description + // Sets whether the lantern material is hanging from a block. + // @tags + // + // --> + if (mechanism.matches("is_hanging") && mechanism.requireBoolean()) { + getLantern().setHanging(mechanism.getValue().asBoolean()); + } + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesDistance.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesDistance.java new file mode 100644 index 0000000000..636819b794 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesDistance.java @@ -0,0 +1,110 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.block.data.type.Leaves; + +public class MaterialLeavesDistance implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof Leaves; + } + + public static MaterialLeavesDistance getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialLeavesDistance((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "distance" + }; + + public static final String[] handledMechs = new String[] { + "distance" + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialLeavesDistance(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private Leaves getLeaves() { + return (Leaves) material.getModernData().data; + } + + private int getDistance() { + return getLeaves().getDistance(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return getDistance() != 0 ? String.valueOf(getDistance()) : null; + } + + @Override + public String getPropertyId() { + return "distance"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ElementTag(Number) + // @mechanism MaterialTag.distance + // @group properties + // @description + // Returns how far the leaves material is from a tree. + // Used together with <@link tag MaterialTag.persistent> to determine if the leaves will decay. + // --> + if (attribute.startsWith("distance")) { + return new ElementTag(getDistance()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + + // <--[mechanism] + // @object MaterialTag + // @name distance + // @input ElementTag(Number) + // @description + // Sets how far the leaves material is from a tree. + // Used together with <@link mechanism MaterialTag.persistent> to determine if the leaves will decay. + // @tags + // + // --> + if (mechanism.matches("distance") && mechanism.requireInteger()) { + getLeaves().setDistance(mechanism.getValue().asInt()); + } + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesPersistence.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesPersistence.java new file mode 100644 index 0000000000..3eaac1a284 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesPersistence.java @@ -0,0 +1,108 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.block.data.type.Leaves; + +public class MaterialLeavesPersistence implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof Leaves; + } + + public static MaterialLeavesPersistence getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialLeavesPersistence((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "persistent" + }; + + public static final String[] handledMechs = new String[] { + "persistent" + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialLeavesPersistence(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private Leaves getLeaves() { + return (Leaves) material.getModernData().data; + } + + private boolean isPersistent() { + return getLeaves().isPersistent(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return isPersistent() ? "true" : null; + } + + @Override + public String getPropertyId() { + return "persistent"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ElementTag(Boolean) + // @mechanism MaterialTag.persistent + // @group properties + // @description + // Returns whether the leaves material is persistent or not. + // --> + if (attribute.startsWith("persistent")) { + return new ElementTag(isPersistent()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + + // <--[mechanism] + // @object MaterialTag + // @name persistent + // @input ElementTag(Boolean) + // @description + // Sets whether the leaves material is persistent or not. + // @tags + // + // --> + if (mechanism.matches("persistent") && mechanism.requireBoolean()) { + getLeaves().setPersistent(mechanism.getValue().asBoolean()); + } + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLecternBook.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLecternBook.java new file mode 100644 index 0000000000..33f1197d9a --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLecternBook.java @@ -0,0 +1,91 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.block.data.type.Lectern; + +public class MaterialLecternBook implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof Lectern; + } + + public static MaterialLecternBook getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialLecternBook((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "has_book" + }; + + public static final String[] handledMechs = new String[] { + // None + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialLecternBook(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private boolean hasBook() { + return ((Lectern) material.getModernData().data).hasBook(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return hasBook() ? "true" : null; + } + + @Override + public String getPropertyId() { + return "has_book"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ElementTag(Boolean) + // @group properties + // @description + // Returns whether the lectern material has a book. + // --> + if (attribute.startsWith("has_book")) { + return new ElementTag(hasBook()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + // None + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockInstrument.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockInstrument.java new file mode 100644 index 0000000000..497490a677 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockInstrument.java @@ -0,0 +1,111 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.Instrument; +import org.bukkit.block.data.type.NoteBlock; + +public class MaterialNoteblockInstrument implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof NoteBlock; + } + + public static MaterialNoteblockInstrument getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialNoteblockInstrument((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "instrument" + }; + + public static final String[] handledMechs = new String[] { + "instrument" + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialNoteblockInstrument(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private NoteBlock getNoteBlock() { + return (NoteBlock) material.getModernData().data; + } + + private String getInstrument() { + return getNoteBlock().getInstrument().name(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return getNoteBlock().getInstrument() != Instrument.PIANO ? getInstrument() : null; + } + + @Override + public String getPropertyId() { + return "instrument"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ElementTag + // @mechanism MaterialTag.instrument + // @group properties + // @description + // Returns the instrument the noteblock material is using. + // The instrument can be any of: <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Instrument.html> + // --> + if (attribute.startsWith("instrument")) { + return new ElementTag(getInstrument()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + + // <--[mechanism] + // @object MaterialTag + // @name instrument + // @input ElementTag + // @description + // Sets the instrument the noteblock material is using. + // The instrument can be any of: <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Instrument.html> + // @tags + // + // --> + if (mechanism.matches("instrument") && mechanism.requireEnum(false, Instrument.values())) { + getNoteBlock().setInstrument(Instrument.valueOf(mechanism.getValue().asString().toUpperCase())); + } + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockNote.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockNote.java new file mode 100644 index 0000000000..f565771072 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockNote.java @@ -0,0 +1,199 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizen.utilities.debugging.Debug; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.core.ListTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.Note; +import org.bukkit.block.data.type.NoteBlock; + +public class MaterialNoteblockNote implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof NoteBlock; + } + + public static MaterialNoteblockNote getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialNoteblockNote((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "note" + }; + + public static final String[] handledMechs = new String[] { + "note" + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialNoteblockNote(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private NoteBlock getNoteBlock() { + return (NoteBlock) material.getModernData().data; + } + + private int getNoteOctave() { + return getNoteBlock().getNote().getOctave(); + } + + private String getNoteTone() { + return getNoteBlock().getNote().getTone().name(); + } + + private boolean isNoteSharped() { + return getNoteBlock().getNote().isSharped(); + } + + private String getNoteInfo() { + return getNoteOctave() + "|" + getNoteTone() + "|" + isNoteSharped(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return getNoteInfo(); + } + + @Override + public String getPropertyId() { + return "note"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ElementTag(Number)|ElementTag|ElementTag(Boolean) + // @mechanism MaterialTag.note + // @group properties + // @description + // Returns the note information of the noteblock material. + // Formatted as: OCTAVE|TONE|SHARP + // --> + if (attribute.startsWith("note")) { + attribute.fulfill(1); + + // <--[tag] + // @attribute + // @returns ElementTag(Number) + // @mechanism MaterialTag.note + // @group properties + // @description + // Returns the note octave of the noteblock material. + // --> + if (attribute.startsWith("octave")) { + return new ElementTag(getNoteOctave()).getAttribute(attribute.fulfill(1)); + } + + // <--[tag] + // @attribute + // @returns ElementTag + // @mechanism MaterialTag.note + // @group properties + // @description + // Returns the note tone of the noteblock material. + // --> + if (attribute.startsWith("tone")) { + return new ElementTag(getNoteTone()).getAttribute(attribute.fulfill(1)); + } + + // <--[tag] + // @attribute + // @returns ElementTag(Boolean) + // @mechanism MaterialTag.note + // @group properties + // @description + // Returns whether the note tone of the noteblock material is sharp. + // --> + if (attribute.startsWith("is_sharp")) { + return new ElementTag(isNoteSharped()).getAttribute(attribute.fulfill(1)); + } + + return new ElementTag(getNoteInfo()).getAttribute(attribute); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + + // <--[mechanism] + // @object MaterialTag + // @name note + // @input ElementTag(Number)|ElementTag(|ElementTag(Boolean)) + // @description + // Sets the note information of the noteblock material. + // The first ElementTag is a number noting the octave. + // The second ElementTag is the note tone, which can be any of: <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Note.Tone.html> + // Optionally, use the third ElementTag to specify if the note should be sharp. + // Omitting the third ElementTag or setting it to "false" makes the note's tone natural. + // @tags + // + // + // + // + // --> + if (mechanism.matches("note") && mechanism.requireObject(ListTag.class)) { + ListTag noteInfo = mechanism.valueAsType(ListTag.class); + if (noteInfo.size() < 2 || noteInfo.size() > 3) { + Debug.echoError("Invalid input! Valid input must be at least OCTAVE|NOTE, and at most OCTAVE|NOTE|SHARP!"); + return; + } + + ElementTag elOctave = new ElementTag(noteInfo.get(0)); + int octave = 0; + if (elOctave.isInt()) { + octave = elOctave.asInt(); + } + + String elTone = noteInfo.get(1); + Note.Tone tone; + try { + tone = Note.Tone.valueOf(elTone.toUpperCase()); + } + catch (IllegalArgumentException e) { + Debug.echoError(e); + return; + } + + boolean sharp = false; + if (noteInfo.size() == 3) { + ElementTag elSharp = new ElementTag(noteInfo.get(2)); + if (elSharp.isBoolean()) { + sharp = elSharp.asBoolean(); + } + } + + getNoteBlock().setNote(new Note(octave, tone, sharp)); + } + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonExtended.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonExtended.java new file mode 100644 index 0000000000..6b633f0534 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonExtended.java @@ -0,0 +1,108 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.block.data.type.Piston; + +public class MaterialPistonExtended implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof Piston; + } + + public static MaterialPistonExtended getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialPistonExtended((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "extended" + }; + + public static final String[] handledMechs = new String[] { + "extended" + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialPistonExtended(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private Piston getPiston() { + return (Piston) material.getModernData().data; + } + + private boolean isExtended() { + return getPiston().isExtended(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return isExtended() ? "true" : null; + } + + @Override + public String getPropertyId() { + return "extended"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ElementTag(Boolean) + // @mechanism MaterialTag.extended + // @group properties + // @description + // Returns whether the piston material's head is extended. + // --> + if (attribute.startsWith("extended")) { + return new ElementTag(isExtended()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + + // <--[mechanism] + // @object MaterialTag + // @name extended + // @input ElementTag(Boolean) + // @description + // Sets whether the piston material's head is extended. + // @tags + // + // --> + if (mechanism.matches("extended") && mechanism.requireBoolean()) { + getPiston().setExtended(mechanism.getValue().asBoolean()); + } + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonHeadRetracting.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonHeadRetracting.java new file mode 100644 index 0000000000..9d54aa3cc5 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonHeadRetracting.java @@ -0,0 +1,108 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.block.data.type.PistonHead; + +public class MaterialPistonHeadRetracting implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof PistonHead; + } + + public static MaterialPistonHeadRetracting getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialPistonHeadRetracting((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "retracting" + }; + + public static final String[] handledMechs = new String[] { + "retracting" + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialPistonHeadRetracting(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private PistonHead getPistonHead() { + return (PistonHead) material.getModernData().data; + } + + private boolean isShort() { + return getPistonHead().isShort(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return isShort() ? "true" : null; + } + + @Override + public String getPropertyId() { + return "retracting"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ElementTag(Boolean) + // @mechanism MaterialTag.retracting + // @group properties + // @description + // Returns whether this piston head is currently retracting. + // --> + if (attribute.startsWith("retracting")) { + return new ElementTag(isShort()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + + // <--[mechanism] + // @object MaterialTag + // @name retracting + // @input ElementTag(Boolean) + // @description + // Sets whether this piston head is currently retracting. + // @tags + // + // --> + if (mechanism.matches("retracting") && mechanism.requireBoolean()) { + getPistonHead().setShort(mechanism.getValue().asBoolean()); + } + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonType.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonType.java new file mode 100644 index 0000000000..800dd31939 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonType.java @@ -0,0 +1,110 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.block.data.type.TechnicalPiston; + +public class MaterialPistonType implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof TechnicalPiston; + } + + public static MaterialPistonType getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialPistonType((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "piston_type" + }; + + public static final String[] handledMechs = new String[] { + "piston_type" + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialPistonType(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private TechnicalPiston getPiston() { + return (TechnicalPiston) material.getModernData().data; + } + + private String getType() { + return getPiston().getType().name(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return getPiston().getType() != TechnicalPiston.Type.NORMAL ? getType() : null; + } + + @Override + public String getPropertyId() { + return "piston_type"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ElementTag + // @mechanism MaterialTag.piston_type + // @group properties + // @description + // Returns the kind of piston this piston block is. + // Can be either NORMAL or STICKY. + // --> + if (attribute.startsWith("piston_type")) { + return new ElementTag(getType()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + + // <--[mechanism] + // @object MaterialTag + // @name piston_type + // @input ElementTag + // @description + // Sets the kind of piston this piston block is. + // Can be either NORMAL or STICKY. + // @tags + // + // --> + if (mechanism.matches("piston_type") && mechanism.requireEnum(false, TechnicalPiston.Type.values())) { + getPiston().setType(TechnicalPiston.Type.valueOf(mechanism.getValue().asString().toUpperCase())); + } + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRailShape.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRailShape.java new file mode 100644 index 0000000000..82fc7270d5 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRailShape.java @@ -0,0 +1,141 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizen.utilities.debugging.Debug; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.core.ListTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import org.bukkit.block.data.Rail; + +import java.util.ArrayList; +import java.util.List; + +public class MaterialRailShape implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof Rail; + } + + public static MaterialRailShape getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialRailShape((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "valid_rail_shapes", "rail_shape" + }; + + public static final String[] handledMechs = new String[] { + "rail_shape" + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialRailShape(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private Rail getRail() { + return (Rail) material.getModernData().data; + } + + private List getValidRails() { + List railShapes = new ArrayList<>(); + for (Rail.Shape shape : getRail().getShapes()) { + railShapes.add(shape.name()); + } + return railShapes; + } + + private String getShape() { + return getRail().getShape().name(); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return getShape(); + } + + @Override + public String getPropertyId() { + return "rail_shape"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ListTag + // @group properties + // @description + // If the material is a rail, returns a list of all rail shapes that are applicable to this material. + // A list of valid rail shapes can be found here: <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/Rail.Shape.html> + // --> + if (attribute.startsWith("valid_rail_shapes")) { + return new ListTag(getValidRails()).getAttribute(attribute.fulfill(1)); + } + + // <--[tag] + // @attribute + // @returns ElementTag + // @mechanism MaterialTag.rail_shape + // @group properties + // @description + // If the material is a rail, returns the material's rail shape. + // A list of valid rail shapes can be found here: <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/Rail.Shape.html> + // --> + if (attribute.startsWith("rail_shape")) { + return new ElementTag(getRail().getShape().name()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + + // <--[mechanism] + // @object MaterialTag + // @name rail_shape + // @input ElementTag + // @description + // If the material is a rail, sets the material's rail shape. + // A list of valid rail shapes can be found here: <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/Rail.Shape.html> + // @tags + // + // + // --> + if (mechanism.matches("rail_shape") && mechanism.requireEnum(false, Rail.Shape.values())) { + String value = mechanism.getValue().asString().toUpperCase(); + if (!getValidRails().contains(value)) { + Debug.echoError("This shape is not applicable to this rail!"); + return; + } + getRail().setShape(Rail.Shape.valueOf(value)); + } + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRedstoneConnection.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRedstoneConnection.java new file mode 100644 index 0000000000..456c9d5b5b --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRedstoneConnection.java @@ -0,0 +1,186 @@ +package com.denizenscript.denizen.objects.properties.material; + +import com.denizenscript.denizen.objects.MaterialTag; +import com.denizenscript.denizen.utilities.debugging.Debug; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.core.ListTag; +import com.denizenscript.denizencore.objects.properties.Property; +import com.denizenscript.denizencore.tags.Attribute; +import com.denizenscript.denizencore.utilities.CoreUtilities; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.type.RedstoneWire; + +import java.util.*; + +public class MaterialRedstoneConnection implements Property { + + public static boolean describes(ObjectTag material) { + return material instanceof MaterialTag + && ((MaterialTag) material).hasModernData() + && ((MaterialTag) material).getModernData().data instanceof RedstoneWire; + } + + public static MaterialRedstoneConnection getFrom(ObjectTag material) { + if (!describes(material)) { + return null; + } + return new MaterialRedstoneConnection((MaterialTag) material); + } + + public static final String[] handledTags = new String[] { + "redstone_connections", "redstone_connection_to" + }; + + public static final String[] handledMechs = new String[] { + "redstone_connections" + }; + + + /////////////////// + // Instance Fields and Methods + ///////////// + + private MaterialRedstoneConnection(MaterialTag material) { + this.material = material; + } + + private MaterialTag material; + + private RedstoneWire getRedstoneWire() { + return (RedstoneWire) material.getModernData().data; + } + + private Set getAllowedFaces() { + return getRedstoneWire().getAllowedFaces(); + } + + private RedstoneWire.Connection getConnectionOnFace(BlockFace face) { + return getRedstoneWire().getFace(face); + } + + private Set getConnections() { + Set output = new HashSet<>(); + for (BlockFace face : getAllowedFaces()) { + if (getRedstoneWire().getFace(face) != RedstoneWire.Connection.NONE) { + output.add(face.name() + "/" + getConnectionOnFace(face).name()); + } + } + return output; + } + + private void debugValidDirection() { + Debug.echoError("Invalid direction! Must be \"NORTH\", \"EAST\", \"SOUTH\", or \"WEST\"!"); + } + + ///////// + // Property Methods + /////// + + @Override + public String getPropertyString() { + return !getConnections().isEmpty() ? new ListTag(getConnections()).identify() : null; + } + + @Override + public String getPropertyId() { + return "redstone_connections"; + } + + /////////// + // ObjectTag Attributes + //////// + + @Override + public String getAttribute(Attribute attribute) { + if (attribute == null) { + return null; + } + + // <--[tag] + // @attribute + // @returns ListTag(ElementTag/ElementTag) + // @mechanism MaterialTag.redstone_connections + // @group properties + // @description + // Returns a list of all connections that the redstone wire material has. + // --> + if (attribute.startsWith("redstone_connections")) { + return new ListTag(getConnections()).getAttribute(attribute.fulfill(1)); + } + + // <--[tag] + // @attribute ]> + // @returns ElementTag + // @mechanism MaterialTag.redstone_connections + // @group properties + // @description + // Returns the type of connection that the redstone wire material has in the specified direction. + // The direction can be NORTH, EAST, SOUTH, or WEST. The returned connection can be either SIDE or UP. + // NOTE: A connection of type SIDE also covers the case of the redstone wire going down the side of the block. + // --> + if (attribute.startsWith("redstone_connection_to") && attribute.hasContext(1)) { + String direction = attribute.getContext(1).toUpperCase(); + BlockFace face; + try { + face = BlockFace.valueOf(direction); + } + catch (IllegalArgumentException e) { + debugValidDirection(); + return null; + } + if (face != BlockFace.NORTH && face != BlockFace.EAST && face != BlockFace.SOUTH && face != BlockFace.WEST) { + debugValidDirection(); + return null; + } + return new ElementTag(getConnectionOnFace(face).name()).getAttribute(attribute.fulfill(1)); + } + + return null; + } + + @Override + public void adjust(Mechanism mechanism) { + + // <--[mechanism] + // @object MaterialTag + // @name redstone_connections + // @input ListTag(ElementTag/ElementTag) + // @description + // Sets the redstone wire material's connections. + // In the format DIRECTION/CONNECTION|... + // The direction can be NORTH, EAST, SOUTH, or WEST. + // The connection can be NONE, SIDE, or UP. + // NOTE: Setting a connection to NONE does nothing, as this disconnects the wire from that face. + // NOTE: A connection of type SIDE also covers the case of the redstone wire going down the side of the block. + // @tags + // + // ]> + // --> + if (mechanism.matches("redstone_connections") && mechanism.requireObject(ListTag.class)) { + for (BlockFace face : getAllowedFaces()) { + getRedstoneWire().setFace(face, RedstoneWire.Connection.NONE); + } + + for (String data : mechanism.valueAsType(ListTag.class)) { + List faceData = CoreUtilities.split(data, '/'); + + BlockFace face; + RedstoneWire.Connection connection; + if (faceData.size() != 2) { + continue; + } + try { + face = BlockFace.valueOf(faceData.get(0).toUpperCase()); + connection = RedstoneWire.Connection.valueOf(faceData.get(1).toUpperCase()); + } + catch (IllegalArgumentException e) { + continue; + } + + getRedstoneWire().setFace(face, connection); + } + } + } +} From 8a89cba2a37ed1b5dc6dabe1dee66063c02fbc00 Mon Sep 17 00:00:00 2001 From: MusicScore <16635607+MusicScore@users.noreply.github.com> Date: Tue, 15 Oct 2019 12:17:20 -0400 Subject: [PATCH 2/2] Move new files to new package, remove duplicate file --- .../objects/properties/PropertyRegistry.java | 3 +- .../material/MaterialRailShape.java | 141 ------------------ .../material/MaterialFarmlandMoisture.java | 2 +- .../material/MaterialGateInStoneWall.java | 2 +- .../properties/material/MaterialHalf.java | 2 +- .../material/MaterialHopperEnabled.java | 2 +- .../material/MaterialJukeboxRecord.java | 2 +- .../material/MaterialLanternHanging.java | 2 +- .../material/MaterialLeavesDistance.java | 2 +- .../material/MaterialLeavesPersistence.java | 2 +- .../material/MaterialLecternBook.java | 2 +- .../material/MaterialNoteblockInstrument.java | 2 +- .../material/MaterialNoteblockNote.java | 2 +- .../material/MaterialPistonExtended.java | 2 +- .../MaterialPistonHeadRetracting.java | 2 +- .../material/MaterialPistonType.java | 2 +- .../material/MaterialRedstoneConnection.java | 2 +- 17 files changed, 16 insertions(+), 158 deletions(-) delete mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRailShape.java rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialFarmlandMoisture.java (95%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialGateInStoneWall.java (94%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialHalf.java (94%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialHopperEnabled.java (94%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialJukeboxRecord.java (93%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialLanternHanging.java (94%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialLeavesDistance.java (94%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialLeavesPersistence.java (94%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialLecternBook.java (93%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialNoteblockInstrument.java (95%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialNoteblockNote.java (96%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialPistonExtended.java (94%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialPistonHeadRetracting.java (94%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialPistonType.java (94%) rename plugin/src/main/java/{com/denizenscript => dev/unizen}/denizen/objects/properties/material/MaterialRedstoneConnection.java (96%) diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java index 7a3727b07d..e723c790db 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java @@ -16,7 +16,6 @@ import com.denizenscript.denizencore.objects.core.ListTag; import com.denizenscript.denizencore.objects.core.QueueTag; import com.denizenscript.denizencore.objects.core.ScriptTag; -import com.denizenscript.denizencore.objects.properties.Property; import com.denizenscript.denizencore.objects.properties.PropertyParser; import dev.unizen.denizen.objects.properties.entity.*; import dev.unizen.denizen.objects.properties.material.*; @@ -181,7 +180,7 @@ public static void registermainProperties() { PropertyParser.registerProperty(MaterialSwitchFace.class, MaterialTag.class); PropertyParser.registerProperty(MaterialWaterlogged.class, MaterialTag.class); } - if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_14_R1)) { + if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_14)) { PropertyParser.registerProperty(MaterialLanternHanging.class, MaterialTag.class); PropertyParser.registerProperty(MaterialLecternBook.class, MaterialTag.class); } diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRailShape.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRailShape.java deleted file mode 100644 index 82fc7270d5..0000000000 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRailShape.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.denizenscript.denizen.objects.properties.material; - -import com.denizenscript.denizen.objects.MaterialTag; -import com.denizenscript.denizen.utilities.debugging.Debug; -import com.denizenscript.denizencore.objects.Mechanism; -import com.denizenscript.denizencore.objects.ObjectTag; -import com.denizenscript.denizencore.objects.core.ElementTag; -import com.denizenscript.denizencore.objects.core.ListTag; -import com.denizenscript.denizencore.objects.properties.Property; -import com.denizenscript.denizencore.tags.Attribute; -import org.bukkit.block.data.Rail; - -import java.util.ArrayList; -import java.util.List; - -public class MaterialRailShape implements Property { - - public static boolean describes(ObjectTag material) { - return material instanceof MaterialTag - && ((MaterialTag) material).hasModernData() - && ((MaterialTag) material).getModernData().data instanceof Rail; - } - - public static MaterialRailShape getFrom(ObjectTag material) { - if (!describes(material)) { - return null; - } - return new MaterialRailShape((MaterialTag) material); - } - - public static final String[] handledTags = new String[] { - "valid_rail_shapes", "rail_shape" - }; - - public static final String[] handledMechs = new String[] { - "rail_shape" - }; - - - /////////////////// - // Instance Fields and Methods - ///////////// - - private MaterialRailShape(MaterialTag material) { - this.material = material; - } - - private MaterialTag material; - - private Rail getRail() { - return (Rail) material.getModernData().data; - } - - private List getValidRails() { - List railShapes = new ArrayList<>(); - for (Rail.Shape shape : getRail().getShapes()) { - railShapes.add(shape.name()); - } - return railShapes; - } - - private String getShape() { - return getRail().getShape().name(); - } - - ///////// - // Property Methods - /////// - - @Override - public String getPropertyString() { - return getShape(); - } - - @Override - public String getPropertyId() { - return "rail_shape"; - } - - /////////// - // ObjectTag Attributes - //////// - - @Override - public String getAttribute(Attribute attribute) { - if (attribute == null) { - return null; - } - - // <--[tag] - // @attribute - // @returns ListTag - // @group properties - // @description - // If the material is a rail, returns a list of all rail shapes that are applicable to this material. - // A list of valid rail shapes can be found here: <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/Rail.Shape.html> - // --> - if (attribute.startsWith("valid_rail_shapes")) { - return new ListTag(getValidRails()).getAttribute(attribute.fulfill(1)); - } - - // <--[tag] - // @attribute - // @returns ElementTag - // @mechanism MaterialTag.rail_shape - // @group properties - // @description - // If the material is a rail, returns the material's rail shape. - // A list of valid rail shapes can be found here: <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/Rail.Shape.html> - // --> - if (attribute.startsWith("rail_shape")) { - return new ElementTag(getRail().getShape().name()).getAttribute(attribute.fulfill(1)); - } - - return null; - } - - @Override - public void adjust(Mechanism mechanism) { - - // <--[mechanism] - // @object MaterialTag - // @name rail_shape - // @input ElementTag - // @description - // If the material is a rail, sets the material's rail shape. - // A list of valid rail shapes can be found here: <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/Rail.Shape.html> - // @tags - // - // - // --> - if (mechanism.matches("rail_shape") && mechanism.requireEnum(false, Rail.Shape.values())) { - String value = mechanism.getValue().asString().toUpperCase(); - if (!getValidRails().contains(value)) { - Debug.echoError("This shape is not applicable to this rail!"); - return; - } - getRail().setShape(Rail.Shape.valueOf(value)); - } - } -} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialFarmlandMoisture.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialFarmlandMoisture.java similarity index 95% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialFarmlandMoisture.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialFarmlandMoisture.java index 9cb4771ad5..e0d13df41e 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialFarmlandMoisture.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialFarmlandMoisture.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizen.utilities.debugging.Debug; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialGateInStoneWall.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialGateInStoneWall.java similarity index 94% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialGateInStoneWall.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialGateInStoneWall.java index ba591802a2..c44ce0c356 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialGateInStoneWall.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialGateInStoneWall.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizencore.objects.Mechanism; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialHalf.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialHalf.java similarity index 94% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialHalf.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialHalf.java index ef6bac1aed..3cfdb5c469 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialHalf.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialHalf.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizencore.objects.core.ElementTag; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialHopperEnabled.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialHopperEnabled.java similarity index 94% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialHopperEnabled.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialHopperEnabled.java index d823d69ce7..aa1e39a481 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialHopperEnabled.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialHopperEnabled.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizencore.objects.Mechanism; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialJukeboxRecord.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialJukeboxRecord.java similarity index 93% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialJukeboxRecord.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialJukeboxRecord.java index 53ac4e4cf3..d4ddbb711b 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialJukeboxRecord.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialJukeboxRecord.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizencore.objects.Mechanism; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLanternHanging.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialLanternHanging.java similarity index 94% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLanternHanging.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialLanternHanging.java index 007428c5f4..d5119aff70 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLanternHanging.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialLanternHanging.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizencore.objects.Mechanism; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesDistance.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialLeavesDistance.java similarity index 94% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesDistance.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialLeavesDistance.java index 636819b794..af8109af02 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesDistance.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialLeavesDistance.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizencore.objects.Mechanism; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesPersistence.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialLeavesPersistence.java similarity index 94% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesPersistence.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialLeavesPersistence.java index 3eaac1a284..013053ad66 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLeavesPersistence.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialLeavesPersistence.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizencore.objects.Mechanism; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLecternBook.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialLecternBook.java similarity index 93% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLecternBook.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialLecternBook.java index 33f1197d9a..11ab7b75c5 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialLecternBook.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialLecternBook.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizencore.objects.Mechanism; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockInstrument.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialNoteblockInstrument.java similarity index 95% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockInstrument.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialNoteblockInstrument.java index 497490a677..e6253d7cd4 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockInstrument.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialNoteblockInstrument.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizencore.objects.Mechanism; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockNote.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialNoteblockNote.java similarity index 96% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockNote.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialNoteblockNote.java index f565771072..376a335865 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialNoteblockNote.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialNoteblockNote.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizen.utilities.debugging.Debug; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonExtended.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialPistonExtended.java similarity index 94% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonExtended.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialPistonExtended.java index 6b633f0534..82e369608f 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonExtended.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialPistonExtended.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizencore.objects.Mechanism; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonHeadRetracting.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialPistonHeadRetracting.java similarity index 94% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonHeadRetracting.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialPistonHeadRetracting.java index 9d54aa3cc5..db9ec365e8 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonHeadRetracting.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialPistonHeadRetracting.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizencore.objects.Mechanism; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonType.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialPistonType.java similarity index 94% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonType.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialPistonType.java index 800dd31939..ba533c00d2 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialPistonType.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialPistonType.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizencore.objects.Mechanism; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRedstoneConnection.java b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialRedstoneConnection.java similarity index 96% rename from plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRedstoneConnection.java rename to plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialRedstoneConnection.java index 456c9d5b5b..1353496054 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/material/MaterialRedstoneConnection.java +++ b/plugin/src/main/java/dev/unizen/denizen/objects/properties/material/MaterialRedstoneConnection.java @@ -1,4 +1,4 @@ -package com.denizenscript.denizen.objects.properties.material; +package dev.unizen.denizen.objects.properties.material; import com.denizenscript.denizen.objects.MaterialTag; import com.denizenscript.denizen.utilities.debugging.Debug;