mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 14:33:56 +01:00
SPIGOT-1583: Fix scoreboard crash.
Might not function 100%, but doesn't crash!
This commit is contained in:
parent
ffacb6cf79
commit
a5d4a933bc
@ -65,13 +65,13 @@
|
|||||||
|
|
||||||
if (f > 0.1F) {
|
if (f > 0.1F) {
|
||||||
f = 0.1F;
|
f = 0.1F;
|
||||||
@@ -416,16 +440,20 @@
|
@@ -416,28 +440,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);
|
||||||
- Collection collection = this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.f);
|
- Collection collection = this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.f);
|
||||||
+ // CraftBukkit - Get our scores instead
|
+ // CraftBukkit - Get our scores instead
|
||||||
+ Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.f, this.getName(), new java.util.ArrayList<ScoreboardScore>());
|
+ Collection<ScoreboardScore> collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.f, this.getName(), new java.util.ArrayList<ScoreboardScore>());
|
||||||
|
|
||||||
if (entity instanceof EntityHuman) {
|
if (entity instanceof EntityHuman) {
|
||||||
this.b(StatisticList.D);
|
this.b(StatisticList.D);
|
||||||
@ -85,11 +85,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- collection.addAll(this.d(entity));
|
- collection.addAll(this.d(entity));
|
||||||
|
- Iterator iterator = collection.iterator();
|
||||||
+ // collection.addAll(this.d(entity)); // PAIL
|
+ // collection.addAll(this.d(entity)); // PAIL
|
||||||
Iterator iterator = collection.iterator();
|
+ Iterator<ScoreboardScore> iterator = collection.iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@@ -438,6 +466,7 @@
|
- ScoreboardObjective scoreboardobjective = (ScoreboardObjective) iterator.next();
|
||||||
|
- ScoreboardScore scoreboardscore = this.getScoreboard().getPlayerScoreForObjective(this.getName(), scoreboardobjective);
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ // ScoreboardObjective scoreboardobjective = (ScoreboardObjective) iterator.next();
|
||||||
|
+ // ScoreboardScore scoreboardscore = this.getScoreboard().getPlayerScoreForObjective(this.getName(), scoreboardobjective);
|
||||||
|
|
||||||
|
- scoreboardscore.incrementScore();
|
||||||
|
+ iterator.next().incrementScore();
|
||||||
|
+ // CraftBukkit end
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +108,7 @@
|
|||||||
private Collection<ScoreboardObjective> d(Entity entity) {
|
private Collection<ScoreboardObjective> d(Entity entity) {
|
||||||
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 +500,7 @@
|
@@ -471,6 +502,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityItem a(boolean flag) {
|
public EntityItem a(boolean flag) {
|
||||||
@ -105,7 +116,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 +543,30 @@
|
@@ -513,6 +545,30 @@
|
||||||
entityitem.motZ += Math.sin((double) f1) * (double) f;
|
entityitem.motZ += Math.sin((double) f1) * (double) f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +147,7 @@
|
|||||||
ItemStack itemstack1 = this.a(entityitem);
|
ItemStack itemstack1 = this.a(entityitem);
|
||||||
|
|
||||||
if (flag1) {
|
if (flag1) {
|
||||||
@@ -612,6 +666,13 @@
|
@@ -612,6 +668,13 @@
|
||||||
this.a(true, true, false);
|
this.a(true, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +161,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 +710,12 @@
|
@@ -649,6 +712,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());
|
||||||
@ -163,7 +174,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||||
@@ -667,7 +734,7 @@
|
@@ -667,7 +736,7 @@
|
||||||
|
|
||||||
if (damagesource.r()) {
|
if (damagesource.r()) {
|
||||||
if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL) {
|
if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL) {
|
||||||
@ -172,7 +183,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.world.getDifficulty() == EnumDifficulty.EASY) {
|
if (this.world.getDifficulty() == EnumDifficulty.EASY) {
|
||||||
@@ -679,7 +746,7 @@
|
@@ -679,7 +748,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +192,7 @@
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
Entity entity = damagesource.getEntity();
|
Entity entity = damagesource.getEntity();
|
||||||
@@ -695,10 +762,29 @@
|
@@ -695,10 +764,29 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean a(EntityHuman entityhuman) {
|
public boolean a(EntityHuman entityhuman) {
|
||||||
@ -214,7 +225,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void damageArmor(float f) {
|
protected void damageArmor(float f) {
|
||||||
@@ -742,7 +828,12 @@
|
@@ -742,7 +830,12 @@
|
||||||
return (float) i / (float) this.inventory.armor.length;
|
return (float) i / (float) this.inventory.armor.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +239,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 +853,7 @@
|
@@ -762,6 +855,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,7 +247,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void openSign(TileEntitySign tileentitysign) {}
|
public void openSign(TileEntitySign tileentitysign) {}
|
||||||
@@ -884,7 +976,15 @@
|
@@ -884,7 +978,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()) {
|
||||||
@ -253,7 +264,7 @@
|
|||||||
entity.setOnFire(1);
|
entity.setOnFire(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -925,11 +1025,28 @@
|
@@ -925,11 +1027,28 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity instanceof EntityPlayer && entity.velocityChanged) {
|
if (entity instanceof EntityPlayer && entity.velocityChanged) {
|
||||||
@ -282,7 +293,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flag2) {
|
if (flag2) {
|
||||||
@@ -991,7 +1108,8 @@
|
@@ -991,7 +1110,8 @@
|
||||||
|
|
||||||
if (itemstack3 != null && object instanceof EntityLiving) {
|
if (itemstack3 != null && object instanceof EntityLiving) {
|
||||||
itemstack3.a((EntityLiving) object, this);
|
itemstack3.a((EntityLiving) object, this);
|
||||||
@ -292,7 +303,7 @@
|
|||||||
this.a(EnumHand.MAIN_HAND, (ItemStack) null);
|
this.a(EnumHand.MAIN_HAND, (ItemStack) null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1001,7 +1119,14 @@
|
@@ -1001,7 +1121,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) {
|
||||||
@ -308,7 +319,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.world instanceof WorldServer && f5 > 2.0F) {
|
if (this.world instanceof WorldServer && f5 > 2.0F) {
|
||||||
@@ -1090,6 +1215,20 @@
|
@@ -1090,6 +1217,20 @@
|
||||||
this.stopRiding();
|
this.stopRiding();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +340,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 +1311,23 @@
|
@@ -1172,6 +1313,23 @@
|
||||||
this.world.everyoneSleeping();
|
this.world.everyoneSleeping();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,7 +364,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 +1378,11 @@
|
@@ -1222,9 +1380,11 @@
|
||||||
if (blockposition != null) {
|
if (blockposition != null) {
|
||||||
this.e = blockposition;
|
this.e = blockposition;
|
||||||
this.f = flag;
|
this.f = flag;
|
||||||
|
Loading…
Reference in New Issue
Block a user