From fa103f2468b6685ca97195a5570c3f77b79548ec Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Tue, 17 Jul 2018 16:12:13 +0200 Subject: [PATCH] Update to MC 1.13 / Caliburn 0.4.5 / DRECommons 4.3 --- README.md | 4 ++-- pom.xml | 4 ++-- .../dungeonsxl/command/PortalCommand.java | 2 +- .../de/erethon/dungeonsxl/global/DPortal.java | 21 ++++++++++--------- .../global/GlobalProtectionCache.java | 4 ++-- .../erethon/dungeonsxl/sign/ScriptSign.java | 1 - src/main/resources/plugin.yml | 1 + 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 091328df..7bee3378 100644 --- a/README.md +++ b/README.md @@ -55,10 +55,10 @@ Building DungeonsXL from source requires [Apache Maven](https://maven.apache.org Maven automatically fetches all dependencies and builds DungeonsXL; just run _build.bat_ or enter the command _mvn clean install_. #### DRECommons -[DRECommons](https://github.com/DRE2N/DRECommons) is a util library for common tasks. DungeonsXL contains DRECommons 4.2.1. +[DRECommons](https://github.com/DRE2N/DRECommons) is a util library for common tasks. DungeonsXL contains DRECommons 4.3. #### Caliburn API -[Caliburn](https://github.com/DRE2N/CaliburnAPI) is an API to read custom items and mobs from config files. DungeonsXL contains Caliburn Beta 0.4.2. +[Caliburn](https://github.com/DRE2N/CaliburnAPI) is an API to read custom items and mobs from config files. DungeonsXL contains Caliburn Beta 0.4.5. ### Java Make sure that your server uses Java 8 or higher. diff --git a/pom.xml b/pom.xml index 6a697479..3382899a 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ org.spigotmc spigot-api - 1.12.2-R0.1-SNAPSHOT + 1.13-pre7-R0.1-SNAPSHOT provided @@ -77,7 +77,7 @@ de.erethon caliburn - 0.4.4 + 0.4.5 compile diff --git a/src/main/java/de/erethon/dungeonsxl/command/PortalCommand.java b/src/main/java/de/erethon/dungeonsxl/command/PortalCommand.java index e2cd1a5b..5c73e79d 100644 --- a/src/main/java/de/erethon/dungeonsxl/command/PortalCommand.java +++ b/src/main/java/de/erethon/dungeonsxl/command/PortalCommand.java @@ -70,7 +70,7 @@ public class PortalCommand extends DRECommand { DPortal dPortal = dGlobalPlayer.getPortal(); if (dPortal == null) { - dPortal = new DPortal(plugin.getGlobalProtections().generateId(DPortal.class, player.getWorld()), player.getWorld(), material.getMaterial(), false); + dPortal = new DPortal(plugin.getGlobalProtections().generateId(DPortal.class, player.getWorld()), player.getWorld(), material, false); dGlobalPlayer.setCreatingPortal(dPortal); dPortal.setWorld(player.getWorld()); dGlobalPlayer.setCachedItem(player.getItemInHand()); diff --git a/src/main/java/de/erethon/dungeonsxl/global/DPortal.java b/src/main/java/de/erethon/dungeonsxl/global/DPortal.java index b5ae2ca6..6b15a679 100644 --- a/src/main/java/de/erethon/dungeonsxl/global/DPortal.java +++ b/src/main/java/de/erethon/dungeonsxl/global/DPortal.java @@ -16,6 +16,7 @@ */ package de.erethon.dungeonsxl.global; +import de.erethon.caliburn.item.ExItem; import de.erethon.caliburn.item.VanillaItem; import de.erethon.commons.chat.MessageUtil; import de.erethon.commons.misc.BlockUtil; @@ -45,23 +46,23 @@ public class DPortal extends GlobalProtection { private Block block1; private Block block2; - private Material material = Material.PORTAL; + private ExItem material = VanillaItem.NETHER_PORTAL; private byte axis; private boolean active; private Set blocks; public DPortal(int id, World world, boolean active) { - this(id, world, Material.PORTAL, active); + this(id, world, VanillaItem.NETHER_PORTAL, active); } - public DPortal(int id, World world, Material material, boolean active) { + public DPortal(int id, World world, ExItem material, boolean active) { super(world, id); this.material = material; this.active = active; } - public DPortal(int id, Block block1, Block block2, Material material, byte axis, boolean active) { + public DPortal(int id, Block block1, Block block2, ExItem material, byte axis, boolean active) { super(block1.getWorld(), id); this.block1 = block1; @@ -125,7 +126,7 @@ public class DPortal extends GlobalProtection { return; } - if (player != null && material == Material.PORTAL) { + if (player != null && material == VanillaItem.NETHER_PORTAL) { float yaw = player.getPlayer().getLocation().getYaw(); if (yaw >= 45 & yaw < 135 || yaw >= 225 & yaw < 315) { axis = 2;//z; @@ -165,8 +166,8 @@ public class DPortal extends GlobalProtection { Material type = getWorld().getBlockAt(xx, yy, zz).getType(); if (!type.isSolid()) { Block block = getWorld().getBlockAt(xx, yy, zz); - block.setType(material, false); - if (material == Material.PORTAL) { + block.setType(material.getMaterial(), false); + if (material == VanillaItem.NETHER_PORTAL) { block.setData(axis); } } @@ -268,8 +269,8 @@ public class DPortal extends GlobalProtection { configFile.set(preString + ".loc2.y", block2.getY()); configFile.set(preString + ".loc2.z", block2.getZ()); - configFile.set(preString + ".material", VanillaItem.get(material).getId()); - if (material == Material.PORTAL) { + configFile.set(preString + ".material", material.getId()); + if (material == VanillaItem.NETHER_PORTAL) { configFile.set(preString + ".axis", axis == 2 ? "z" : "x"); } } @@ -312,7 +313,7 @@ public class DPortal extends GlobalProtection { do { Material type = getWorld().getBlockAt(xx, yy, zz).getType(); - if (type == material) { + if (material.getMaterial() == type) { getWorld().getBlockAt(xx, yy, zz).setType(Material.AIR); } diff --git a/src/main/java/de/erethon/dungeonsxl/global/GlobalProtectionCache.java b/src/main/java/de/erethon/dungeonsxl/global/GlobalProtectionCache.java index f94e1ad4..33599821 100644 --- a/src/main/java/de/erethon/dungeonsxl/global/GlobalProtectionCache.java +++ b/src/main/java/de/erethon/dungeonsxl/global/GlobalProtectionCache.java @@ -17,6 +17,7 @@ package de.erethon.dungeonsxl.global; import de.erethon.caliburn.item.ExItem; +import de.erethon.caliburn.item.VanillaItem; import de.erethon.dungeonsxl.DungeonsXL; import de.erethon.dungeonsxl.player.DGroup; import java.io.File; @@ -24,7 +25,6 @@ import java.util.HashSet; import java.util.Set; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.Sign; @@ -249,7 +249,7 @@ public class GlobalProtectionCache { Block block2 = world.getBlockAt(data.getInt(preString + "loc2.x"), data.getInt(preString + "loc2.y"), data.getInt(preString + "loc2.z")); ExItem material = plugin.getCaliburn().getExItem(data.getString(preString + "material")); String axis = data.getString(preString + "axis"); - DPortal dPortal = new DPortal(id, block1, block2, material != null ? material.getMaterial() : Material.PORTAL, (byte) (axis != null && axis.equals("z") ? 2 : 1), true); + DPortal dPortal = new DPortal(id, block1, block2, material != null ? material : VanillaItem.NETHER_PORTAL, (byte) (axis != null && axis.equals("z") ? 2 : 1), true); dPortal.create(null); } diff --git a/src/main/java/de/erethon/dungeonsxl/sign/ScriptSign.java b/src/main/java/de/erethon/dungeonsxl/sign/ScriptSign.java index 4ae1ddf7..ce99744e 100644 --- a/src/main/java/de/erethon/dungeonsxl/sign/ScriptSign.java +++ b/src/main/java/de/erethon/dungeonsxl/sign/ScriptSign.java @@ -16,7 +16,6 @@ */ package de.erethon.dungeonsxl.sign; -import de.erethon.caliburn.item.VanillaItem; import de.erethon.dungeonsxl.world.DGameWorld; import org.bukkit.block.Sign; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 7edc3566..ee7de885 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -9,3 +9,4 @@ commands: dungeonsxl: description: Reference command for DungeonsXL. aliases: [dxl,dungeon] +api-version: 1.13