3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00

Fixed insane fall damage (entities reset on death)

Dieser Commit ist enthalten in:
Dinnerbone 2010-12-30 20:34:26 +00:00
Ursprung a063036210
Commit a9191c24b3
6 geänderte Dateien mit 59 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -81,6 +81,7 @@ public class NetServerHandler extends NetHandler
// CraftBukkit start // CraftBukkit start
Location from = new Location(player.getWorld(), g, h, i, e.v, e.w); Location from = new Location(player.getWorld(), g, h, i, e.v, e.w);
Location to = player.getLocation(); Location to = player.getLocation();
if (!from.equals(to)) {
PlayerMoveEvent event = new PlayerMoveEvent(Type.PLAYER_MOVE, player, from, to); PlayerMoveEvent event = new PlayerMoveEvent(Type.PLAYER_MOVE, player, from, to);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
@ -92,6 +93,7 @@ public class NetServerHandler extends NetHandler
e.r = to.getZ(); e.r = to.getZ();
e.v = to.getYaw(); e.v = to.getYaw();
e.w = to.getPitch(); e.w = to.getPitch();
}
// CraftBukkit end // CraftBukkit end
if (j) { if (j) {
@ -481,6 +483,7 @@ public class NetServerHandler extends NetHandler
return; return;
} else { } else {
e = d.f.d(e); e = d.f.d(e);
player.setHandle(e); // CraftBukkit
return; return;
} }
} }

Datei anzeigen

@ -8,7 +8,7 @@ import org.bukkit.World;
public class CraftEntity implements org.bukkit.Entity { public class CraftEntity implements org.bukkit.Entity {
protected final CraftServer server; protected final CraftServer server;
private final Entity entity; private Entity entity;
public CraftEntity(final CraftServer server, final Entity entity) { public CraftEntity(final CraftServer server, final Entity entity) {
this.server = server; this.server = server;
@ -35,6 +35,10 @@ public class CraftEntity implements org.bukkit.Entity {
return entity; return entity;
} }
public void setHandle(final Entity entity) {
this.entity = entity;
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null) { if (obj == null) {

Datei anzeigen

@ -7,7 +7,7 @@ import org.bukkit.HumanEntity;
import org.bukkit.ItemStack; import org.bukkit.ItemStack;
public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
private final EntityPlayer entity; private EntityPlayer entity;
public CraftHumanEntity(final CraftServer server, final EntityPlayer entity) { public CraftHumanEntity(final CraftServer server, final EntityPlayer entity) {
super(server, entity); super(server, entity);
@ -29,6 +29,11 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
return entity; return entity;
} }
public void setHandle(final EntityPlayer entity) {
super.setHandle((EntityPlayer)entity);
this.entity = entity;
}
@Override @Override
public String toString() { public String toString() {
return "CraftHumanEntity{" + "id=" + getEntityID() + "name=" + getName() + '}'; return "CraftHumanEntity{" + "id=" + getEntityID() + "name=" + getName() + '}';

Datei anzeigen

@ -1,11 +1,12 @@
package org.bukkit.craftbukkit; package org.bukkit.craftbukkit;
import net.minecraft.server.Entity;
import net.minecraft.server.EntityLiving; import net.minecraft.server.EntityLiving;
import org.bukkit.LivingEntity; import org.bukkit.LivingEntity;
public class CraftLivingEntity extends CraftEntity implements LivingEntity { public class CraftLivingEntity extends CraftEntity implements LivingEntity {
private final EntityLiving entity; private EntityLiving entity;
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) { public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
super(server, entity); super(server, entity);
@ -29,6 +30,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return entity; return entity;
} }
public void setHandle(final EntityLiving entity) {
super.setHandle((Entity)entity);
this.entity = entity;
}
@Override @Override
public String toString() { public String toString() {
return "CraftLivingEntity{" + "id=" + getEntityID() + '}'; return "CraftLivingEntity{" + "id=" + getEntityID() + '}';

Datei anzeigen

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit; package org.bukkit.craftbukkit;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.EntityPlayerMP; import net.minecraft.server.EntityPlayerMP;
import net.minecraft.server.Packet3Chat; import net.minecraft.server.Packet3Chat;
import org.bukkit.Location; import org.bukkit.Location;
@ -24,6 +25,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void setHandle(final EntityPlayerMP entity) { public void setHandle(final EntityPlayerMP entity) {
super.setHandle((EntityPlayer)entity);
this.entity = entity; this.entity = entity;
} }
@ -40,4 +42,26 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public String toString() { public String toString() {
return "CraftPlayer{" + "name=" + getName() + '}'; return "CraftPlayer{" + "name=" + getName() + '}';
} }
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CraftPlayer other = (CraftPlayer) obj;
if ((this.getName() == null) ? (other.getName() != null) : !this.getName().equals(other.getName())) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 5;
hash = 97 * hash + (this.getName() != null ? this.getName().hashCode() : 0);
return hash;
}
} }

Datei anzeigen

@ -70,6 +70,11 @@ public class CraftWorld implements World {
return world; return world;
} }
@Override
public String toString() {
return "CraftWorld";
}
private final class ChunkCoordinate { private final class ChunkCoordinate {
public final int x; public final int x;
public final int z; public final int z;