From 08613dcac4098d8aaf34f919f0a984d067f41e04 Mon Sep 17 00:00:00 2001 From: gamerforEA Date: Mon, 5 Jun 2017 17:55:39 +0400 Subject: [PATCH] Release 1.8. 1) Add check for FakePlayer in RealPlayer code. 2) Add "WG not installed" error description. --- build.gradle | 2 +- .../com/gamerforea/eventhelper/fake/FakePlayerContainer.java | 3 ++- src/main/java/com/gamerforea/eventhelper/wg/WGReflection.java | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 81d2af1..c31de64 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'forge' [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' -version = "1.7" +version = "1.8" group= "com.gamerforea" archivesBaseName = "EventHelper" diff --git a/src/main/java/com/gamerforea/eventhelper/fake/FakePlayerContainer.java b/src/main/java/com/gamerforea/eventhelper/fake/FakePlayerContainer.java index 45cc0b4..6e5a821 100644 --- a/src/main/java/com/gamerforea/eventhelper/fake/FakePlayerContainer.java +++ b/src/main/java/com/gamerforea/eventhelper/fake/FakePlayerContainer.java @@ -69,7 +69,8 @@ public final void setRealPlayer(EntityPlayer player) if (player != null) { this.profile = player.getGameProfile(); - this.realPlayer = new WeakReference(player); + if (!(player instanceof FakePlayer)) + this.realPlayer = new WeakReference(player); } } diff --git a/src/main/java/com/gamerforea/eventhelper/wg/WGReflection.java b/src/main/java/com/gamerforea/eventhelper/wg/WGReflection.java index 92edb41..e7b84c7 100644 --- a/src/main/java/com/gamerforea/eventhelper/wg/WGReflection.java +++ b/src/main/java/com/gamerforea/eventhelper/wg/WGReflection.java @@ -4,6 +4,7 @@ import org.bukkit.plugin.Plugin; +import com.google.common.base.Preconditions; import com.google.common.io.ByteStreams; public final class WGReflection @@ -13,6 +14,7 @@ public final class WGReflection public static final void setWG(Plugin plugin) { + Preconditions.checkNotNull(plugin, "WorldGuard not installed!"); wgPlugin = plugin; wgClassLoader = plugin.getClass().getClassLoader(); }