aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0521-Toggle-for-removing-existing-dragon.patch
blob: 3b83fc6f469128a519d123cf3148132b9a5bed39 (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
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mariell Hoversholm <proximyst@proximyst.com>
Date: Wed, 30 Sep 2020 22:49:14 +0200
Subject: [PATCH] Toggle for removing existing dragon


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 5c6c590a859e6a96b392a1146c4cc41dc6004c4c..86cddde870f3ec45e3708aadc1f3e4b19cbaebcc 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -73,6 +73,14 @@ public class PaperWorldConfig {
         }
     }
 
+    public boolean shouldRemoveDragon = false;
+    private void shouldRemoveDragon() {
+        shouldRemoveDragon = getBoolean("should-remove-dragon", shouldRemoveDragon);
+        if (shouldRemoveDragon) {
+            log("The Ender Dragon will be removed if she already exists without a portal.");
+        }
+    }
+
     public short keepLoadedRange;
     private void keepLoadedRange() {
         keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16);
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index b1a0654ba01c265385db877d528c1aa2103b2eb0..f59de70c4854b10ac39874838db33cdf784a45a1 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -216,7 +216,7 @@ public class EndDragonFight {
             this.dragonUUID = enderDragon.getUUID();
             LOGGER.info("Found that there's a dragon still alive ({})", (Object)enderDragon);
             this.dragonKilled = false;
-            if (!bl) {
+            if (!bl && this.level.paperConfig.shouldRemoveDragon) {
                 LOGGER.info("But we didn't have a portal, let's remove it.");
                 enderDragon.discard();
                 this.dragonUUID = null;