From 2a6b5b76de447fa7e8f397ae9c243611388e80d3 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Wed, 16 Mar 2016 02:21:39 -0500 Subject: [PATCH] Fix the end credits toggle I think its pretty clear that no one uses this given that it didn't work at all before --- ...ble-end-credits-when-leaving-the-end.patch | 73 ------------------- .../Configurable-end-credits.patch | 53 ++++++++++++++ 2 files changed, 53 insertions(+), 73 deletions(-) delete mode 100644 Spigot-Server-Patches/Configurable-end-credits-when-leaving-the-end.patch create mode 100644 Spigot-Server-Patches/Configurable-end-credits.patch diff --git a/Spigot-Server-Patches/Configurable-end-credits-when-leaving-the-end.patch b/Spigot-Server-Patches/Configurable-end-credits-when-leaving-the-end.patch deleted file mode 100644 index ef466724ef..0000000000 --- a/Spigot-Server-Patches/Configurable-end-credits-when-leaving-the-end.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: DoctorDark -Date: Wed, 2 Mar 2016 01:17:06 -0600 -Subject: [PATCH] Configurable end credits when leaving the end - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - useAsyncLighting = false; //getBoolean( "use-async-lighting", false ); - log("World async lighting: " + useAsyncLighting); - } -+ -+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - - public Entity c(int i) { - this.cj = true; -+ // Paper start - Allow configurable end portal credits - if (this.dimension == 1 && i == 1) { -- this.world.kill(this); -- if (!this.viewingCredits) { -+ if (!this.viewingCredits && !world.paperConfig.disableEndCredits) { -+ this.world.kill(this); -+ // Paper end - this.viewingCredits = true; - if (this.a(AchievementList.D)) { - this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F)); -@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } else { - this.b((Statistic) AchievementList.y); - } -+ } - -+ if (!(this.dimension == 1 && i == 1) || world.paperConfig.disableEndCredits) { // Paper - Allow configurable end portal credits - // CraftBukkit start - TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL; - this.server.getPlayerList().changeDimension(this, i, cause); // PAIL: check all this -@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - this.cb = -1; - return this; - } -+ -+ return null; // Paper - Theoretically it should never make it here - } - - public boolean a(EntityPlayer entityplayer) { -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -0,0 +0,0 @@ public abstract class PlayerList { - return; - } - -- exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo(); -+ // Paper - Configurable end credits, if a plugin sets to use a travel agent even if the cause is an end portal, ignore it -+ exit = cause != TeleportCause.END_PORTAL && event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo(); - if (exit == null) { - return; - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-end-credits.patch b/Spigot-Server-Patches/Configurable-end-credits.patch new file mode 100644 index 0000000000..a8e4744f40 --- /dev/null +++ b/Spigot-Server-Patches/Configurable-end-credits.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: DoctorDark +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + useAsyncLighting = false; //getBoolean( "use-async-lighting", false ); + log("World async lighting: " + useAsyncLighting); + } ++ ++ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + return this.world.pvpMode; + } + ++ /** ++ * Paper - Give "theEnd2" achievement if the player doesn't already have it ++ */ ++ private void giveTheEnd2() { ++ if (!this.a(AchievementList.D)) { ++ this.b(AchievementList.D); ++ } ++ } ++ + public Entity c(int i) { + this.cj = true; + if (this.dimension == 1 && i == 1) { + 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); +-- \ No newline at end of file