summaryrefslogtreecommitdiffstats
path: root/nms-patches/AdvancementRewards.patch
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2017-08-06 09:07:24 +1000
committermd_5 <git@md-5.net>2017-08-06 09:07:24 +1000
commitb5878783ad27ea17421faee92bb9a43b3ef8ef37 (patch)
treecb60f6c7889311b8b569378fd2419ff8f7460222 /nms-patches/AdvancementRewards.patch
parent571760182fb8c5326de812259ddef80564953a1d (diff)
downloadcraftbukkit-b5878783ad27ea17421faee92bb9a43b3ef8ef37.tar
craftbukkit-b5878783ad27ea17421faee92bb9a43b3ef8ef37.tar.gz
craftbukkit-b5878783ad27ea17421faee92bb9a43b3ef8ef37.tar.lz
craftbukkit-b5878783ad27ea17421faee92bb9a43b3ef8ef37.tar.xz
craftbukkit-b5878783ad27ea17421faee92bb9a43b3ef8ef37.zip
SPIGOT-3491: Add option to bypass permissions in advancements
Diffstat (limited to 'nms-patches/AdvancementRewards.patch')
-rw-r--r--nms-patches/AdvancementRewards.patch46
1 files changed, 39 insertions, 7 deletions
diff --git a/nms-patches/AdvancementRewards.patch b/nms-patches/AdvancementRewards.patch
index 50852ea2..8f0ea2c3 100644
--- a/nms-patches/AdvancementRewards.patch
+++ b/nms-patches/AdvancementRewards.patch
@@ -1,15 +1,47 @@
--- a/net/minecraft/server/AdvancementRewards.java
+++ b/net/minecraft/server/AdvancementRewards.java
-@@ -98,7 +98,7 @@
- }
+@@ -66,7 +66,24 @@
+ CustomFunction customfunction = this.e.a(minecraftserver.aL());
- public boolean getSendCommandFeedback() {
-- return minecraftserver.worldServer[0].getGameRules().getBoolean("commandBlockOutput");
-+ return minecraftserver.worlds.get(0).getGameRules().getBoolean("commandBlockOutput"); // CraftBukkit
+ if (customfunction != null) {
+- ICommandListener icommandlistener = new ICommandListener() {
++ // CraftBukkit start
++ ICommandListener icommandlistener = new AdvancementCommandListener(entityplayer, minecraftserver);
++
++ minecraftserver.aL().a(customfunction, icommandlistener);
++ }
++
++ }
++
++ public static class AdvancementCommandListener implements ICommandListener {
++
++ private final EntityPlayer entityplayer;
++ private final MinecraftServer minecraftserver;
++
++ public AdvancementCommandListener(EntityPlayer entityplayer, MinecraftServer minecraftserver) {
++ this.entityplayer = entityplayer;
++ this.minecraftserver = minecraftserver;
++ }
++
+ public String getName() {
+ return entityplayer.getName();
+ }
+@@ -108,12 +125,8 @@
+ public MinecraftServer C_() {
+ return entityplayer.C_();
}
+- };
+-
+- minecraftserver.aL().a(customfunction, icommandlistener);
+- }
+-
+- }
++ }
++ // CraftBukkit end
- public void a(CommandObjectiveExecutor.EnumCommandResult commandobjectiveexecutor_enumcommandresult, int i) {
-@@ -156,7 +156,7 @@
+ public String toString() {
+ return "AdvancementRewards{experience=" + this.b + ", loot=" + Arrays.toString(this.c) + ", recipes=" + Arrays.toString(this.d) + ", function=" + this.e + '}';
+@@ -156,7 +169,7 @@
return new AdvancementRewards(i, aminecraftkey, aminecraftkey1, customfunction_a);
}