From c387bcbf559991cd9044bb8d1d23619c3ed733db Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Mon, 1 Dec 2014 22:18:54 +0100 Subject: [PATCH] Spigot 1.8 compatibility * 1.8 Spigot API * 6.0 WorldGuard --- pom.xml | 4 ++-- .../limitedcreative/blockstate/BlockStateCommand.java | 2 +- .../minecraft/limitedcreative/limits/PlayerListener.java | 8 ++++++-- .../minecraft/limitedcreative/regions/RegionsCommand.java | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index e361688..b195c45 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ UTF-8 1.4-SNAPSHOT - 1.7.2-R0.1-SNAPSHOT + 1.8-R0.1-SNAPSHOT @@ -84,7 +84,7 @@ com.sk89q worldguard - 5.8-SNAPSHOT + 6.0.0-SNAPSHOT diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/blockstate/BlockStateCommand.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/blockstate/BlockStateCommand.java index 6a28282..7d5bd9a 100644 --- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/blockstate/BlockStateCommand.java +++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/blockstate/BlockStateCommand.java @@ -223,7 +223,7 @@ public class BlockStateCommand extends BukkitCommand implements IHelpDescribed { return false; } - if (Bukkit.getServer().getOnlinePlayers().length > (context.isPlayer() ? 1 : 0)) { + if (Bukkit.getServer().getOnlinePlayers().size() > (context.isPlayer() ? 1 : 0)) { context.responseFormatted(ChatFormattings.ERROR, L("command.blockstate.migrate_useronline_error")); return true; } diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/limits/PlayerListener.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/limits/PlayerListener.java index 5f4628f..7c17065 100644 --- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/limits/PlayerListener.java +++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/limits/PlayerListener.java @@ -45,6 +45,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.InventoryHolder; import org.bukkit.material.DirectionalContainer; import org.bukkit.potion.PotionEffect; +import org.bukkit.projectiles.ProjectileSource; import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission; import de.jaschastarke.minecraft.lib.permissions.IDynamicPermission; @@ -224,8 +225,11 @@ public class PlayerListener implements Listener { EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) rawevent; Entity source = event.getDamager(); - if (source instanceof Projectile) - source = ((Projectile) source).getShooter(); + if (source instanceof Projectile) { + ProjectileSource shooter = ((Projectile) source).getShooter(); + if (shooter instanceof Entity) + source = (Entity) shooter; + } if (source instanceof Player) { Player player = (Player) source; diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/RegionsCommand.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/RegionsCommand.java index b4e517f..5c99f56 100644 --- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/RegionsCommand.java +++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/RegionsCommand.java @@ -243,7 +243,7 @@ public class RegionsCommand extends BukkitCommand implements IHelpDescribed { if (set.size() > 0) { region = set.iterator().next(); } else { - region = getWorldGuard().getGlobalRegionManager().get(w).getRegionExact(GLOBAL_REGION); + region = getWorldGuard().getGlobalRegionManager().get(w).getRegion(GLOBAL_REGION); } } else { int rpc = params.getArgumentCount() > 1 ? 1 : 0;