From 1ea1adc10f3f068f3d67f472469443fd732d8d2c Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 27 Mar 2016 11:11:15 +1100 Subject: [PATCH] SPIGOT-2056: Fix killedByTeam scoreboard criteria --- nms-patches/EntityHuman.patch | 54 +++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/nms-patches/EntityHuman.patch b/nms-patches/EntityHuman.patch index e997a403ae..052ba4009b 100644 --- a/nms-patches/EntityHuman.patch +++ b/nms-patches/EntityHuman.patch @@ -66,7 +66,7 @@ if (f > 0.1F) { f = 0.1F; -@@ -416,28 +441,35 @@ +@@ -416,29 +441,35 @@ public void b(Entity entity, int i) { if (entity != this) { this.addScore(i); @@ -85,9 +85,8 @@ this.b(StatisticList.B); } -- collection.addAll(this.d(entity)); + collection.addAll(this.d(entity)); - Iterator iterator = collection.iterator(); -+ // collection.addAll(this.d(entity)); // PAIL + Iterator iterator = collection.iterator(); while (iterator.hasNext()) { @@ -105,11 +104,24 @@ } } -+ // PAIL - TODO: Check me? - private Collection d(Entity entity) { +- private Collection d(Entity entity) { ++ private Collection d(Entity entity) { // CraftBukkit String s = entity instanceof EntityHuman ? entity.getName() : entity.getUniqueID().toString(); ScoreboardTeam scoreboardteam = this.getScoreboard().getPlayerTeam(this.getName()); -@@ -471,6 +503,7 @@ + +@@ -463,7 +494,10 @@ + int j = scoreboardteam1.m().b(); + + if (j >= 0 && j < IScoreboardCriteria.m.length) { +- return this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.m[j]); ++ // CraftBukkit - Get our scores instead ++ return this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.m[j], this.getName(), new java.util.ArrayList()); ++ // return this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.m[j]); ++ // CraftBukkit end + } + } + +@@ -471,6 +505,7 @@ } public EntityItem a(boolean flag) { @@ -117,7 +129,7 @@ return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false, true); } -@@ -513,6 +546,30 @@ +@@ -513,6 +548,30 @@ entityitem.motZ += Math.sin((double) f1) * (double) f; } @@ -148,7 +160,7 @@ ItemStack itemstack1 = this.a(entityitem); if (flag1) { -@@ -612,6 +669,13 @@ +@@ -612,6 +671,13 @@ this.a(true, true, false); } @@ -162,7 +174,7 @@ if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) { this.e = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ")); this.f = nbttagcompound.getBoolean("SpawnForced"); -@@ -649,6 +713,12 @@ +@@ -649,6 +715,12 @@ this.foodData.b(nbttagcompound); this.abilities.a(nbttagcompound); nbttagcompound.set("EnderItems", this.enderChest.h()); @@ -175,7 +187,7 @@ } public boolean damageEntity(DamageSource damagesource, float f) { -@@ -667,7 +737,7 @@ +@@ -667,7 +739,7 @@ if (damagesource.r()) { if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL) { @@ -184,7 +196,7 @@ } if (this.world.getDifficulty() == EnumDifficulty.EASY) { -@@ -679,7 +749,7 @@ +@@ -679,7 +751,7 @@ } } @@ -193,7 +205,7 @@ return false; } else { Entity entity = damagesource.getEntity(); -@@ -695,10 +765,29 @@ +@@ -695,10 +767,29 @@ } public boolean a(EntityHuman entityhuman) { @@ -226,7 +238,7 @@ } protected void damageArmor(float f) { -@@ -742,7 +831,12 @@ +@@ -742,7 +833,12 @@ return (float) i / (float) this.inventory.armor.length; } @@ -240,7 +252,7 @@ if (!this.isInvulnerable(damagesource)) { f = this.applyArmorModifier(damagesource, f); f = this.applyMagicModifier(damagesource, f); -@@ -762,6 +856,7 @@ +@@ -762,6 +858,7 @@ } } @@ -248,7 +260,7 @@ } public void openSign(TileEntitySign tileentitysign) {} -@@ -884,8 +979,15 @@ +@@ -884,8 +981,15 @@ if (entity instanceof EntityLiving) { f3 = ((EntityLiving) entity).getHealth(); if (j > 0 && !entity.isBurning()) { @@ -266,7 +278,7 @@ } } -@@ -925,11 +1027,28 @@ +@@ -925,11 +1029,28 @@ } if (entity instanceof EntityPlayer && entity.velocityChanged) { @@ -295,7 +307,7 @@ } if (flag2) { -@@ -991,7 +1110,8 @@ +@@ -991,7 +1112,8 @@ if (itemstack3 != null && object instanceof EntityLiving) { itemstack3.a((EntityLiving) object, this); @@ -305,7 +317,7 @@ this.a(EnumHand.MAIN_HAND, (ItemStack) null); } } -@@ -1001,7 +1121,14 @@ +@@ -1001,7 +1123,14 @@ this.a(StatisticList.y, Math.round(f5 * 10.0F)); if (j > 0) { @@ -321,7 +333,7 @@ } if (this.world instanceof WorldServer && f5 > 2.0F) { -@@ -1090,6 +1217,20 @@ +@@ -1090,6 +1219,20 @@ this.stopRiding(); } @@ -342,7 +354,7 @@ this.setSize(0.2F, 0.2F); if (this.world.isLoaded(blockposition)) { EnumDirection enumdirection = (EnumDirection) this.world.getType(blockposition).get(BlockFacingHorizontal.FACING); -@@ -1172,6 +1313,23 @@ +@@ -1172,6 +1315,23 @@ this.world.everyoneSleeping(); } @@ -366,7 +378,7 @@ this.sleepTicks = flag ? 0 : 100; if (flag2) { this.setRespawnPosition(this.bedPosition, false); -@@ -1222,9 +1380,11 @@ +@@ -1222,9 +1382,11 @@ if (blockposition != null) { this.e = blockposition; this.f = flag;