Переглянути джерело

Fixing build issues caused by recent changes to CraftBukkit.

Glitchfinder 12 роки тому
батько
коміт
569079fed0
2 змінених файлів з 23 додано та 10 видалено
  1. 0 7
      pom.xml
  2. 23 3
      src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java

+ 0 - 7
pom.xml

@@ -121,13 +121,6 @@
             <type>jar</type>
             <scope>compile</scope>
         </dependency>
-        <dependency>
-            <groupId>org.bukkit</groupId>
-            <artifactId>craftbukkit</artifactId>
-            <version>LATEST</version>
-            <type>jar</type>
-            <scope>compile</scope>
-        </dependency>
         <dependency>
             <groupId>org.getspout</groupId>
             <artifactId>spoutpluginapi</artifactId>

+ 23 - 3
src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java

@@ -1,5 +1,6 @@
 package com.gmail.nossr50.skills.gathering;
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -17,8 +18,6 @@ import org.bukkit.event.player.PlayerFishEvent;
 import org.bukkit.inventory.ItemStack;
 import org.bukkit.material.Wool;
 
-import org.bukkit.craftbukkit.entity.CraftSkeleton;
-
 import com.gmail.nossr50.config.AdvancedConfig;
 import com.gmail.nossr50.config.Config;
 import com.gmail.nossr50.config.TreasuresConfig;
@@ -338,7 +337,28 @@ public class Fishing {
                 break;
 
             case SKELETON:
-                if (((CraftSkeleton) le).getHandle().getSkeletonType() == 1) {
+                Object o;
+                Class  c;
+                Method m;
+
+                o = le;
+                c = o.getClass();
+
+                boolean isWitherSkeleton = false;
+
+		try {
+                    m = c.getDeclaredMethod("getHandle");
+                    o = m.invoke(o);
+
+                    c = o.getClass();
+                    m = c.getDeclaredMethod("getSkeletonType");
+                    o = m.invoke(o);
+
+                    if(o instanceof Integer)
+                        isWitherSkeleton = (((Integer) o) == 1);
+                } catch(Exception e) {}
+
+                if (isWitherSkeleton) {
                     if (DROP_NUMBER > 95) {
                         Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1));
                     } else if (DROP_NUMBER > 50) {