mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 12:19:56 +01:00
76 lines
3.5 KiB
Diff
76 lines
3.5 KiB
Diff
|
From b65a790b6121f108f31a54f98e6cee3368e00807 Mon Sep 17 00:00:00 2001
|
||
|
From: DoctorDark <doctordark11@gmail.com>
|
||
|
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 3506b1b..e68595b 100644
|
||
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||
|
@@ -163,4 +163,10 @@ public class PaperWorldConfig {
|
||
|
useAsyncLighting = 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 2f1d95b..b32617b 100644
|
||
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||
|
@@ -526,9 +526,11 @@ 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));
|
||
|
@@ -546,7 +548,9 @@ 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
|
||
|
@@ -557,6 +561,8 @@ 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 50add77..38d20b7 100644
|
||
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||
|
@@ -730,7 +730,8 @@ 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;
|
||
|
}
|
||
|
--
|
||
|
2.7.2
|
||
|
|