aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0003-Allow-undead-horse-types-to-be-leashed.patch
blob: 9c68af016370cd14eebc3e260cd050717fae54b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From e97b935204b2a83b7d89c497f50e21a578d73fd7 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Sat, 12 Jul 2014 19:36:18 -0500
Subject: [PATCH] Allow undead horse types to be leashed


diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java
index e9f6236..5b17bcb 100644
--- a/src/main/java/net/minecraft/server/EntityHorse.java
+++ b/src/main/java/net/minecraft/server/EntityHorse.java
@@ -5,6 +5,8 @@ import java.util.List;
 
 import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; // CraftBukkit
 
+import org.github.paperspigot.PaperSpigotWorldConfig; // PaperSpigot
+
 public class EntityHorse extends EntityAnimal implements IInventoryListener {
 
     private static final IEntitySelector bu = new EntitySelectorHorse();
@@ -169,7 +171,13 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
     }
 
     public boolean bM() {
-        return !this.cE() && super.bM();
+        // PaperSpigot start - configurable undead horse leashing
+        if (PaperSpigotWorldConfig.allowUndeadHorseLeashing) {
+            return super.bM();
+        } else {
+            return !this.cE() && super.bM();
+        }
+        // PaperSpigot end
     }
 
     protected void o(float f) {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index f3bc3aa..1eb5e47 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -74,4 +74,11 @@ public class PaperSpigotWorldConfig
         config.addDefault( "world-settings.default." + path, def );
         return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) );
     }
+
+    public static boolean allowUndeadHorseLeashing;
+    private void allowUndeadHorseLeashing()
+    {
+        allowUndeadHorseLeashing = getBoolean( "allow-undead-horse-leashing", true );
+        log( "Allow undead horse types to be leashed: " + allowUndeadHorseLeashing );
+    }
 }
-- 
1.9.1