SPIGOT-2056: Fix killedByTeam scoreboard criteria

This commit is contained in:
md_5 2016-03-27 11:11:15 +11:00
parent ea49b2eee9
commit 1ea1adc10f

View File

@ -66,7 +66,7 @@
if (f > 0.1F) { if (f > 0.1F) {
f = 0.1F; f = 0.1F;
@@ -416,28 +441,35 @@ @@ -416,29 +441,35 @@
public void b(Entity entity, int i) { public void b(Entity entity, int i) {
if (entity != this) { if (entity != this) {
this.addScore(i); this.addScore(i);
@ -85,9 +85,8 @@
this.b(StatisticList.B); this.b(StatisticList.B);
} }
- collection.addAll(this.d(entity)); collection.addAll(this.d(entity));
- Iterator iterator = collection.iterator(); - Iterator iterator = collection.iterator();
+ // collection.addAll(this.d(entity)); // PAIL
+ Iterator<ScoreboardScore> iterator = collection.iterator(); + Iterator<ScoreboardScore> iterator = collection.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -105,11 +104,24 @@
} }
} }
+ // PAIL - TODO: Check me? - private Collection<ScoreboardObjective> d(Entity entity) {
private Collection<ScoreboardObjective> d(Entity entity) { + private Collection<ScoreboardScore> d(Entity entity) { // CraftBukkit
String s = entity instanceof EntityHuman ? entity.getName() : entity.getUniqueID().toString(); String s = entity instanceof EntityHuman ? entity.getName() : entity.getUniqueID().toString();
ScoreboardTeam scoreboardteam = this.getScoreboard().getPlayerTeam(this.getName()); 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<ScoreboardScore>());
+ // return this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.m[j]);
+ // CraftBukkit end
}
}
@@ -471,6 +505,7 @@
} }
public EntityItem a(boolean flag) { 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); 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; entityitem.motZ += Math.sin((double) f1) * (double) f;
} }
@ -148,7 +160,7 @@
ItemStack itemstack1 = this.a(entityitem); ItemStack itemstack1 = this.a(entityitem);
if (flag1) { if (flag1) {
@@ -612,6 +669,13 @@ @@ -612,6 +671,13 @@
this.a(true, true, false); this.a(true, true, false);
} }
@ -162,7 +174,7 @@
if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) { 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.e = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
this.f = nbttagcompound.getBoolean("SpawnForced"); this.f = nbttagcompound.getBoolean("SpawnForced");
@@ -649,6 +713,12 @@ @@ -649,6 +715,12 @@
this.foodData.b(nbttagcompound); this.foodData.b(nbttagcompound);
this.abilities.a(nbttagcompound); this.abilities.a(nbttagcompound);
nbttagcompound.set("EnderItems", this.enderChest.h()); nbttagcompound.set("EnderItems", this.enderChest.h());
@ -175,7 +187,7 @@
} }
public boolean damageEntity(DamageSource damagesource, float f) { public boolean damageEntity(DamageSource damagesource, float f) {
@@ -667,7 +737,7 @@ @@ -667,7 +739,7 @@
if (damagesource.r()) { if (damagesource.r()) {
if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL) { if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL) {
@ -184,7 +196,7 @@
} }
if (this.world.getDifficulty() == EnumDifficulty.EASY) { if (this.world.getDifficulty() == EnumDifficulty.EASY) {
@@ -679,7 +749,7 @@ @@ -679,7 +751,7 @@
} }
} }
@ -193,7 +205,7 @@
return false; return false;
} else { } else {
Entity entity = damagesource.getEntity(); Entity entity = damagesource.getEntity();
@@ -695,10 +765,29 @@ @@ -695,10 +767,29 @@
} }
public boolean a(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
@ -226,7 +238,7 @@
} }
protected void damageArmor(float f) { protected void damageArmor(float f) {
@@ -742,7 +831,12 @@ @@ -742,7 +833,12 @@
return (float) i / (float) this.inventory.armor.length; return (float) i / (float) this.inventory.armor.length;
} }
@ -240,7 +252,7 @@
if (!this.isInvulnerable(damagesource)) { if (!this.isInvulnerable(damagesource)) {
f = this.applyArmorModifier(damagesource, f); f = this.applyArmorModifier(damagesource, f);
f = this.applyMagicModifier(damagesource, f); f = this.applyMagicModifier(damagesource, f);
@@ -762,6 +856,7 @@ @@ -762,6 +858,7 @@
} }
} }
@ -248,7 +260,7 @@
} }
public void openSign(TileEntitySign tileentitysign) {} public void openSign(TileEntitySign tileentitysign) {}
@@ -884,8 +979,15 @@ @@ -884,8 +981,15 @@
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth(); f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isBurning()) { if (j > 0 && !entity.isBurning()) {
@ -266,7 +278,7 @@
} }
} }
@@ -925,11 +1027,28 @@ @@ -925,11 +1029,28 @@
} }
if (entity instanceof EntityPlayer && entity.velocityChanged) { if (entity instanceof EntityPlayer && entity.velocityChanged) {
@ -295,7 +307,7 @@
} }
if (flag2) { if (flag2) {
@@ -991,7 +1110,8 @@ @@ -991,7 +1112,8 @@
if (itemstack3 != null && object instanceof EntityLiving) { if (itemstack3 != null && object instanceof EntityLiving) {
itemstack3.a((EntityLiving) object, this); itemstack3.a((EntityLiving) object, this);
@ -305,7 +317,7 @@
this.a(EnumHand.MAIN_HAND, (ItemStack) null); this.a(EnumHand.MAIN_HAND, (ItemStack) null);
} }
} }
@@ -1001,7 +1121,14 @@ @@ -1001,7 +1123,14 @@
this.a(StatisticList.y, Math.round(f5 * 10.0F)); this.a(StatisticList.y, Math.round(f5 * 10.0F));
if (j > 0) { if (j > 0) {
@ -321,7 +333,7 @@
} }
if (this.world instanceof WorldServer && f5 > 2.0F) { if (this.world instanceof WorldServer && f5 > 2.0F) {
@@ -1090,6 +1217,20 @@ @@ -1090,6 +1219,20 @@
this.stopRiding(); this.stopRiding();
} }
@ -342,7 +354,7 @@
this.setSize(0.2F, 0.2F); this.setSize(0.2F, 0.2F);
if (this.world.isLoaded(blockposition)) { if (this.world.isLoaded(blockposition)) {
EnumDirection enumdirection = (EnumDirection) this.world.getType(blockposition).get(BlockFacingHorizontal.FACING); EnumDirection enumdirection = (EnumDirection) this.world.getType(blockposition).get(BlockFacingHorizontal.FACING);
@@ -1172,6 +1313,23 @@ @@ -1172,6 +1315,23 @@
this.world.everyoneSleeping(); this.world.everyoneSleeping();
} }
@ -366,7 +378,7 @@
this.sleepTicks = flag ? 0 : 100; this.sleepTicks = flag ? 0 : 100;
if (flag2) { if (flag2) {
this.setRespawnPosition(this.bedPosition, false); this.setRespawnPosition(this.bedPosition, false);
@@ -1222,9 +1380,11 @@ @@ -1222,9 +1382,11 @@
if (blockposition != null) { if (blockposition != null) {
this.e = blockposition; this.e = blockposition;
this.f = flag; this.f = flag;