mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-25 06:14:46 +00:00
Created Server-safe method to get EntityPlayer from GameProfile
This commit is contained in:
1 parent
c51e01987c
commit
fe8d55f38f
9 files changed
+34
-15
No files matched your search
@@ -143,18 +143,11 @@ public class MailAddress implements INBTTagable, IMailAddress {
|
||||
return address;
|
||||
}
|
||||
|
||||
public EntityPlayer getPlayer(World world) {
|
||||
if (!this.isPlayer())
|
||||
return null;
|
||||
|
||||
return world.getPlayerEntityByName(this.gameProfile.getName());
|
||||
}
|
||||
|
||||
public boolean isClientPlayer(World world) {
|
||||
if (!this.isPlayer())
|
||||
return false;
|
||||
|
||||
EntityPlayer addressPlayer = this.getPlayer(world);
|
||||
EntityPlayer addressPlayer = Proxies.common.getPlayer(world, gameProfile);
|
||||
EntityPlayer clientPlayer = Proxies.common.getPlayer();
|
||||
|
||||
return addressPlayer != null && clientPlayer != null && clientPlayer.equals(addressPlayer);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ProxyMail {
|
||||
}
|
||||
|
||||
public void setPOBoxInfo(World world, IMailAddress address, POBoxInfo info) {
|
||||
EntityPlayer player = address.getPlayer(world);
|
||||
EntityPlayer player = Proxies.common.getPlayer(world, address.getPlayerProfile());
|
||||
if (player != null)
|
||||
Proxies.net.sendToPlayer(new PacketPOBoxInfo(PacketIds.POBOX_INFO, info), player);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user