mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 21:48:43 +01:00
Compile against 1.13 final Bukkit build
This commit is contained in:
parent
d8f3734198
commit
ffe73d777c
4
pom.xml
4
pom.xml
@ -65,7 +65,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.13-pre7-R0.1-SNAPSHOT</version>
|
<version>1.13-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -89,7 +89,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens</artifactId>
|
<artifactId>citizens</artifactId>
|
||||||
<version>2.0.22-SNAPSHOT</version>
|
<version>2.0.23-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
package de.erethon.dungeonsxl.config;
|
package de.erethon.dungeonsxl.config;
|
||||||
|
|
||||||
import de.erethon.commons.chat.MessageUtil;
|
import de.erethon.commons.chat.MessageUtil;
|
||||||
import de.erethon.commons.compatibility.CompatibilityHandler;
|
|
||||||
import de.erethon.commons.compatibility.Internals;
|
import de.erethon.commons.compatibility.Internals;
|
||||||
import de.erethon.commons.config.DREConfig;
|
import de.erethon.commons.config.DREConfig;
|
||||||
import de.erethon.commons.misc.EnumUtil;
|
import de.erethon.commons.misc.EnumUtil;
|
||||||
@ -682,7 +681,7 @@ public class MainConfig extends DREConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (config.contains("tweaksEnabled")) {
|
if (config.contains("tweaksEnabled")) {
|
||||||
if (Internals.andHigher(Internals.v1_9_R1).contains(CompatibilityHandler.getInstance().getInternals())) {
|
if (Internals.isAtLeast(Internals.v1_9_R1)) {
|
||||||
tweaksEnabled = config.getBoolean("tweaksEnabled");
|
tweaksEnabled = config.getBoolean("tweaksEnabled");
|
||||||
} else {
|
} else {
|
||||||
tweaksEnabled = false;
|
tweaksEnabled = false;
|
||||||
|
@ -26,6 +26,7 @@ import de.erethon.dungeonsxl.game.Game;
|
|||||||
import de.erethon.dungeonsxl.player.DGamePlayer;
|
import de.erethon.dungeonsxl.player.DGamePlayer;
|
||||||
import de.erethon.dungeonsxl.player.DGlobalPlayer;
|
import de.erethon.dungeonsxl.player.DGlobalPlayer;
|
||||||
import de.erethon.dungeonsxl.player.DGroup;
|
import de.erethon.dungeonsxl.player.DGroup;
|
||||||
|
import de.erethon.dungeonsxl.util.MagicValueUtil;
|
||||||
import de.erethon.dungeonsxl.world.DGameWorld;
|
import de.erethon.dungeonsxl.world.DGameWorld;
|
||||||
import de.erethon.dungeonsxl.world.DResourceWorld;
|
import de.erethon.dungeonsxl.world.DResourceWorld;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -168,7 +169,7 @@ public class DPortal extends GlobalProtection {
|
|||||||
Block block = getWorld().getBlockAt(xx, yy, zz);
|
Block block = getWorld().getBlockAt(xx, yy, zz);
|
||||||
block.setType(material.getMaterial(), false);
|
block.setType(material.getMaterial(), false);
|
||||||
if (material == VanillaItem.NETHER_PORTAL) {
|
if (material == VanillaItem.NETHER_PORTAL) {
|
||||||
block.setData(axis);
|
MagicValueUtil.setBlockData(block, axis);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
package de.erethon.dungeonsxl.player;
|
package de.erethon.dungeonsxl.player;
|
||||||
|
|
||||||
import de.erethon.commons.chat.MessageUtil;
|
import de.erethon.commons.chat.MessageUtil;
|
||||||
import de.erethon.commons.compatibility.CompatibilityHandler;
|
|
||||||
import de.erethon.commons.compatibility.Internals;
|
import de.erethon.commons.compatibility.Internals;
|
||||||
import de.erethon.commons.player.PlayerUtil;
|
import de.erethon.commons.player.PlayerUtil;
|
||||||
import de.erethon.commons.player.PlayerWrapper;
|
import de.erethon.commons.player.PlayerWrapper;
|
||||||
@ -48,7 +47,7 @@ public class DGlobalPlayer implements PlayerWrapper {
|
|||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||||
|
|
||||||
boolean is1_9 = Internals.andHigher(Internals.v1_9_R1).contains(CompatibilityHandler.getInstance().getInternals());
|
boolean is1_9 = Internals.isAtLeast(Internals.v1_9_R1);
|
||||||
|
|
||||||
protected Player player;
|
protected Player player;
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
package de.erethon.dungeonsxl.player;
|
package de.erethon.dungeonsxl.player;
|
||||||
|
|
||||||
import de.erethon.commons.chat.MessageUtil;
|
import de.erethon.commons.chat.MessageUtil;
|
||||||
import de.erethon.commons.compatibility.CompatibilityHandler;
|
|
||||||
import de.erethon.commons.compatibility.Internals;
|
import de.erethon.commons.compatibility.Internals;
|
||||||
import de.erethon.commons.config.DREConfig;
|
import de.erethon.commons.config.DREConfig;
|
||||||
import de.erethon.commons.misc.EnumUtil;
|
import de.erethon.commons.misc.EnumUtil;
|
||||||
@ -46,7 +45,7 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
*/
|
*/
|
||||||
public class DPlayerData extends DREConfig {
|
public class DPlayerData extends DREConfig {
|
||||||
|
|
||||||
boolean is1_9 = Internals.andHigher(Internals.v1_9_R1).contains(CompatibilityHandler.getInstance().getInternals());
|
boolean is1_9 = Internals.isAtLeast(Internals.v1_9_R1);
|
||||||
|
|
||||||
public static final int CONFIG_VERSION = 4;
|
public static final int CONFIG_VERSION = 4;
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ package de.erethon.dungeonsxl.sign;
|
|||||||
import de.erethon.caliburn.item.ExItem;
|
import de.erethon.caliburn.item.ExItem;
|
||||||
import de.erethon.caliburn.item.VanillaItem;
|
import de.erethon.caliburn.item.VanillaItem;
|
||||||
import de.erethon.commons.misc.NumberUtil;
|
import de.erethon.commons.misc.NumberUtil;
|
||||||
|
import de.erethon.dungeonsxl.util.MagicValueUtil;
|
||||||
import de.erethon.dungeonsxl.world.DGameWorld;
|
import de.erethon.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
@ -80,7 +81,7 @@ public class BlockSign extends DSign {
|
|||||||
|
|
||||||
getSign().getBlock().setType(offBlock.getMaterial());
|
getSign().getBlock().setType(offBlock.getMaterial());
|
||||||
try {
|
try {
|
||||||
getSign().getBlock().setData(offBlockData);
|
MagicValueUtil.setBlockData(getSign().getBlock(), offBlockData);
|
||||||
} catch (IllegalArgumentException exception) {
|
} catch (IllegalArgumentException exception) {
|
||||||
markAsErroneous("offBlock data value " + offBlockData + " cannot be applied to given type " + offBlock.getId());
|
markAsErroneous("offBlock data value " + offBlockData + " cannot be applied to given type " + offBlock.getId());
|
||||||
return;
|
return;
|
||||||
@ -93,7 +94,7 @@ public class BlockSign extends DSign {
|
|||||||
if (initialized && !active) {
|
if (initialized && !active) {
|
||||||
getSign().getBlock().setType(onBlock.getMaterial());
|
getSign().getBlock().setType(onBlock.getMaterial());
|
||||||
try {
|
try {
|
||||||
getSign().getBlock().setData(onBlockData);
|
MagicValueUtil.setBlockData(getSign().getBlock(), onBlockData);
|
||||||
} catch (IllegalArgumentException exception) {
|
} catch (IllegalArgumentException exception) {
|
||||||
markAsErroneous("onBlock data value " + onBlockData + " cannot be applied to given type " + onBlock.getId());
|
markAsErroneous("onBlock data value " + onBlockData + " cannot be applied to given type " + onBlock.getId());
|
||||||
return;
|
return;
|
||||||
@ -106,7 +107,7 @@ public class BlockSign extends DSign {
|
|||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
if (initialized && active) {
|
if (initialized && active) {
|
||||||
getSign().getBlock().setType(offBlock.getMaterial());
|
getSign().getBlock().setType(offBlock.getMaterial());
|
||||||
getSign().getBlock().setData(offBlockData);
|
MagicValueUtil.setBlockData(getSign().getBlock(), offBlockData);
|
||||||
active = false;
|
active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
package de.erethon.dungeonsxl.sign.message;
|
package de.erethon.dungeonsxl.sign.message;
|
||||||
|
|
||||||
import de.erethon.caliburn.item.VanillaItem;
|
import de.erethon.caliburn.item.VanillaItem;
|
||||||
import de.erethon.commons.compatibility.CompatibilityHandler;
|
|
||||||
import de.erethon.commons.compatibility.Internals;
|
import de.erethon.commons.compatibility.Internals;
|
||||||
import de.erethon.commons.misc.EnumUtil;
|
import de.erethon.commons.misc.EnumUtil;
|
||||||
import de.erethon.commons.misc.NumberUtil;
|
import de.erethon.commons.misc.NumberUtil;
|
||||||
@ -64,7 +63,7 @@ public class SoundMessageSign extends DSign {
|
|||||||
sound = lines[1];
|
sound = lines[1];
|
||||||
if (!lines[2].isEmpty()) {
|
if (!lines[2].isEmpty()) {
|
||||||
String[] args = lines[2].split(",");
|
String[] args = lines[2].split(",");
|
||||||
if (args.length >= 1 && args.length != 2 && Internals.andHigher(Internals.v1_11_R1).contains(CompatibilityHandler.getInstance().getInternals())) {
|
if (args.length >= 1 && args.length != 2 && Internals.isAtLeast(Internals.v1_11_R1)) {
|
||||||
category = EnumUtil.getEnumIgnoreCase(SoundCategory.class, args[0]);
|
category = EnumUtil.getEnumIgnoreCase(SoundCategory.class, args[0]);
|
||||||
if (category == null) {
|
if (category == null) {
|
||||||
category = SoundCategory.MASTER;
|
category = SoundCategory.MASTER;
|
||||||
@ -100,7 +99,7 @@ public class SoundMessageSign extends DSign {
|
|||||||
if (initialized) {
|
if (initialized) {
|
||||||
if (!done.contains(player)) {
|
if (!done.contains(player)) {
|
||||||
done.add(player);
|
done.add(player);
|
||||||
if (Internals.andHigher(Internals.v1_11_R1).contains(CompatibilityHandler.getInstance().getInternals())) {
|
if (Internals.isAtLeast(Internals.v1_11_R1)) {
|
||||||
player.playSound(getSign().getLocation(), sound, category, volume, pitch);
|
player.playSound(getSign().getLocation(), sound, category, volume, pitch);
|
||||||
} else {
|
} else {
|
||||||
player.playSound(getSign().getLocation(), sound, volume, pitch);
|
player.playSound(getSign().getLocation(), sound, volume, pitch);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
package de.erethon.dungeonsxl.util;
|
package de.erethon.dungeonsxl.util;
|
||||||
|
|
||||||
import de.erethon.caliburn.item.VanillaItem;
|
import de.erethon.caliburn.item.VanillaItem;
|
||||||
|
import de.erethon.commons.compatibility.Internals;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ public enum DColor {
|
|||||||
|
|
||||||
BLACK(ChatColor.BLACK, DyeColor.BLACK, VanillaItem.BLACK_WOOL),
|
BLACK(ChatColor.BLACK, DyeColor.BLACK, VanillaItem.BLACK_WOOL),
|
||||||
DARK_GRAY(ChatColor.DARK_GRAY, DyeColor.GRAY, VanillaItem.GRAY_WOOL),
|
DARK_GRAY(ChatColor.DARK_GRAY, DyeColor.GRAY, VanillaItem.GRAY_WOOL),
|
||||||
LIGHT_GRAY(ChatColor.GRAY, DyeColor.SILVER, VanillaItem.LIGHT_GRAY_WOOL),
|
LIGHT_GRAY(ChatColor.GRAY, DyeColor.valueOf(Internals.isAtLeast(Internals.v1_13_R1) ? "LIGHT_GRAY" : "SILVER"), VanillaItem.LIGHT_GRAY_WOOL),
|
||||||
WHITE(ChatColor.WHITE, DyeColor.WHITE, VanillaItem.WHITE_WOOL),
|
WHITE(ChatColor.WHITE, DyeColor.WHITE, VanillaItem.WHITE_WOOL),
|
||||||
DARK_GREEN(ChatColor.DARK_GREEN, DyeColor.GREEN, VanillaItem.GREEN_WOOL),
|
DARK_GREEN(ChatColor.DARK_GREEN, DyeColor.GREEN, VanillaItem.GREEN_WOOL),
|
||||||
LIGHT_GREEN(ChatColor.GREEN, DyeColor.LIME, VanillaItem.LIME_WOOL),
|
LIGHT_GREEN(ChatColor.GREEN, DyeColor.LIME, VanillaItem.LIME_WOOL),
|
||||||
|
46
src/main/java/de/erethon/dungeonsxl/util/MagicValueUtil.java
Normal file
46
src/main/java/de/erethon/dungeonsxl/util/MagicValueUtil.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2012-2018 Frank Baumann
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.util;
|
||||||
|
|
||||||
|
import de.erethon.commons.misc.ReflectionUtil;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public class MagicValueUtil {
|
||||||
|
|
||||||
|
private static Method CRAFT_BLOCK_SET_DATA;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
CRAFT_BLOCK_SET_DATA = Class.forName(ReflectionUtil.ORG_BUKKIT_CRAFTBUKKIT + ".block.CraftBlock").getDeclaredMethod("setData", byte.class);
|
||||||
|
} catch (NoSuchMethodException | SecurityException | ClassNotFoundException exception) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setBlockData(Block block, byte data) {
|
||||||
|
try {
|
||||||
|
CRAFT_BLOCK_SET_DATA.invoke(block, data);
|
||||||
|
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -23,6 +23,7 @@ import de.erethon.dungeonsxl.config.DMessage;
|
|||||||
import de.erethon.dungeonsxl.player.DGamePlayer;
|
import de.erethon.dungeonsxl.player.DGamePlayer;
|
||||||
import de.erethon.dungeonsxl.player.DGroup;
|
import de.erethon.dungeonsxl.player.DGroup;
|
||||||
import de.erethon.dungeonsxl.util.DColor;
|
import de.erethon.dungeonsxl.util.DColor;
|
||||||
|
import de.erethon.dungeonsxl.util.MagicValueUtil;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
@ -67,7 +68,7 @@ public class TeamFlag extends TeamBlock {
|
|||||||
public static void setBlockWoolColor(Block block, DColor color) {
|
public static void setBlockWoolColor(Block block, DColor color) {
|
||||||
block.setType(color.getWoolMaterial().getMaterial());
|
block.setType(color.getWoolMaterial().getMaterial());
|
||||||
if (!CompatibilityHandler.getInstance().getVersion().useNewMaterials()) {
|
if (!CompatibilityHandler.getInstance().getVersion().useNewMaterials()) {
|
||||||
block.setData(color.getWoolData());
|
MagicValueUtil.setBlockData(block, color.getWoolData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user