aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0029-Configurable-end-credits.patch
blob: ee66e7704e20440824dcda96ae881db29f05cb6b (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
54
55
56
From c5e40e9bfa3083bdbf6c1eb91991e96b585320f5 Mon Sep 17 00:00:00 2001
From: DoctorDark <doctordark11@gmail.com>
Date: Wed, 16 Mar 2016 02:21:39 -0500
Subject: [PATCH] Configurable end credits


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index fd606ee14..c00fa83d5 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -149,4 +149,10 @@ public class PaperWorldConfig {
         queueLightUpdates = getBoolean("queue-light-updates", false);
         log("Lighting Queue enabled: " + queueLightUpdates);
     }
+
+    public boolean disableEndCredits;
+    private void disableEndCredits() {
+        disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false);
+        log("End credits disabled: " + disableEndCredits);
+    }
 }
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index f7edd9aa1..dbc5cf632 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -516,6 +516,15 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
         return this.world.pvpMode;
     }
 
+
+    // Paper start - Give "theEnd2" achievement if the player doesn't already have it
+    private void giveTheEnd2() {
+        if (!this.a(AchievementList.D)) {
+            this.b(AchievementList.D);
+        }
+    }
+    // Paper end
+
     @Nullable
     public Entity c(int i) {
         if (this.isSleeping()) return this; // CraftBukkit - SPIGOT-3154
@@ -525,7 +534,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
             this.world.kill(this);
             if (!this.viewingCredits) {
                 this.viewingCredits = true;
-                if (this.a(AchievementList.D)) {
+                // Paper start - Allow configurable end portal credits
+                if (world.paperConfig.disableEndCredits || this.a(AchievementList.D)) {
+                    this.giveTheEnd2();
+                    // Paper end
                     this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F));
                 } else {
                     this.b((Statistic) AchievementList.D);
-- 
2.12.2.windows.2