2010-12-22 16:22:23 +01:00
|
|
|
|
|
|
|
package org.bukkit.craftbukkit;
|
|
|
|
|
2010-12-30 21:34:26 +01:00
|
|
|
import net.minecraft.server.EntityPlayer;
|
2010-12-26 03:20:29 +01:00
|
|
|
import net.minecraft.server.EntityPlayerMP;
|
2010-12-30 05:56:34 +01:00
|
|
|
import net.minecraft.server.Packet3Chat;
|
2010-12-30 06:35:30 +01:00
|
|
|
import org.bukkit.Location;
|
2010-12-22 16:22:23 +01:00
|
|
|
import org.bukkit.Player;
|
|
|
|
|
2010-12-30 05:30:12 +01:00
|
|
|
public class CraftPlayer extends CraftHumanEntity implements Player {
|
2010-12-30 06:35:30 +01:00
|
|
|
private EntityPlayerMP entity;
|
2010-12-22 16:22:23 +01:00
|
|
|
|
2010-12-30 05:30:12 +01:00
|
|
|
public CraftPlayer(CraftServer server, EntityPlayerMP entity) {
|
|
|
|
super(server, entity);
|
|
|
|
this.entity = entity;
|
2010-12-22 16:22:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isOnline() {
|
2010-12-30 05:39:28 +01:00
|
|
|
return server.getHandle().g(getName());
|
2010-12-22 16:22:23 +01:00
|
|
|
}
|
2010-12-27 03:13:03 +01:00
|
|
|
|
2010-12-30 05:30:12 +01:00
|
|
|
@Override
|
|
|
|
public EntityPlayerMP getHandle() {
|
|
|
|
return entity;
|
2010-12-28 22:52:39 +01:00
|
|
|
}
|
2010-12-29 01:29:18 +01:00
|
|
|
|
2010-12-30 06:35:30 +01:00
|
|
|
public void setHandle(final EntityPlayerMP entity) {
|
2010-12-30 21:34:26 +01:00
|
|
|
super.setHandle((EntityPlayer)entity);
|
2010-12-30 06:35:30 +01:00
|
|
|
this.entity = entity;
|
2010-12-29 01:29:18 +01:00
|
|
|
}
|
2010-12-30 05:56:34 +01:00
|
|
|
|
|
|
|
public void sendMessage(String message) {
|
|
|
|
entity.a.b(new Packet3Chat(message));
|
|
|
|
}
|
2010-12-30 06:35:30 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void teleportTo(Location location) {
|
|
|
|
entity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return "CraftPlayer{" + "name=" + getName() + '}';
|
|
|
|
}
|
2010-12-30 21:34:26 +01:00
|
|
|
|
|
|
|
@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;
|
|
|
|
}
|
2010-12-22 16:22:23 +01:00
|
|
|
}
|