mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 03:39:09 +00:00
Fix use of GameProfile.equals()
This commit is contained in:
1 parent
8b37aa86ff
commit
be0a62b831
5 files changed
+37
-41
No files matched your search
@@ -10,14 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.gadgets;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.arboriculture.genetics.Tree;
|
||||
import forestry.core.interfaces.IOwnable;
|
||||
@@ -27,6 +20,12 @@ import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketTileNBT;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumAccess;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* This is the base TE class for any block that needs to contain tree genome information.
|
||||
@@ -156,10 +155,7 @@ public abstract class TileTreeContainer extends TileEntity implements INetworked
|
||||
|
||||
@Override
|
||||
public boolean isOwner(EntityPlayer player) {
|
||||
if (owner != null)
|
||||
return owner.equals(player.getGameProfile());
|
||||
else
|
||||
return false;
|
||||
return PlayerUtil.isSameGameProfile(owner, player.getGameProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.gadgets;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.core.interfaces.IHintSource;
|
||||
import forestry.core.network.ClassMap;
|
||||
import forestry.core.network.IndexInPayload;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.core.utils.EnumAccess;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public abstract class TileBase extends TileForestry implements IHintSource {
|
||||
|
||||
@@ -94,7 +94,7 @@ public abstract class TileBase extends TileForestry implements IHintSource {
|
||||
if (!Utils.isUseableByPlayer(player, this, worldObj, xCoord, yCoord, zCoord))
|
||||
return false;
|
||||
if (getAccess() == EnumAccess.PRIVATE)
|
||||
return owner.equals(player.getGameProfile());
|
||||
return PlayerUtil.isSameGameProfile(owner, player.getGameProfile());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import forestry.api.core.INBTTagable;
|
||||
import forestry.api.mail.EnumAddressee;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
|
||||
@@ -77,7 +78,7 @@ public class MailAddress implements INBTTagable, IMailAddress {
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return !gameProfile.equals(invalidGameProfile);
|
||||
return !PlayerUtil.isSameGameProfile(gameProfile, invalidGameProfile);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,7 +109,7 @@ public class MailAddress implements INBTTagable, IMailAddress {
|
||||
return false;
|
||||
|
||||
MailAddress address = (MailAddress) o;
|
||||
return address.gameProfile.equals(gameProfile);
|
||||
return PlayerUtil.isSameGameProfile(address.gameProfile, gameProfile);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,8 +10,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.mail.EnumPostage;
|
||||
import forestry.api.mail.ILetter;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.api.mail.IPostalState;
|
||||
import forestry.api.mail.IStamps;
|
||||
import forestry.api.mail.ITradeStation;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.api.mail.TradeStationInfo;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.mail.items.ItemLetter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@@ -21,20 +33,7 @@ import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSavedData;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.mail.EnumPostage;
|
||||
import forestry.api.mail.ILetter;
|
||||
import forestry.api.mail.IPostalState;
|
||||
import forestry.api.mail.IStamps;
|
||||
import forestry.api.mail.ITradeStation;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.api.mail.TradeStationInfo;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.mail.items.ItemLetter;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TradeStation extends WorldSavedData implements ITradeStation, ISidedInventory {
|
||||
|
||||
@@ -529,8 +528,8 @@ public class TradeStation extends WorldSavedData implements ITradeStation, ISide
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer var1) {
|
||||
return var1.getGameProfile().equals(owner);
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return PlayerUtil.isSameGameProfile(owner, player.getGameProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,18 +11,18 @@
|
||||
package forestry.mail.proxy;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.core.network.ForestryPacket;
|
||||
import forestry.core.network.PacketIds;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.mail.POBox;
|
||||
import forestry.mail.POBoxInfo;
|
||||
import forestry.mail.PostRegistry;
|
||||
import forestry.mail.gui.GuiMailboxInfo;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.api.mail.PostManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ClientProxyMail extends ProxyMail {
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ClientProxyMail extends ProxyMail {
|
||||
@Override
|
||||
public void setPOBoxInfo(World world, IMailAddress address, POBoxInfo info) {
|
||||
EntityPlayer clientPlayer = Proxies.common.getPlayer();
|
||||
if (clientPlayer != null && clientPlayer.getGameProfile().equals(address.getPlayerProfile()))
|
||||
if (PlayerUtil.isSameGameProfile(clientPlayer.getGameProfile(), address.getPlayerProfile()))
|
||||
GuiMailboxInfo.instance.setPOBoxInfo(info);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user