mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Totally refactor frequencies to use UUIDs instead of player usernames
This commit is contained in:
1 parent
b72740cffd
commit
6f2b84e547
31 files changed
+328
-221
No files matched your search
@@ -6,12 +6,14 @@ import ic2.api.item.ISpecialElectricItem;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Range4D;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.client.MekKeyHandler;
|
||||
import mekanism.client.MekanismClient;
|
||||
import mekanism.client.MekanismKeyHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Tier.BaseTier;
|
||||
@@ -216,7 +218,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
{
|
||||
if(hasSecurity(itemstack))
|
||||
{
|
||||
list.add(SecurityUtils.getOwnerDisplay(entityplayer.getName(), getOwner(itemstack)));
|
||||
list.add(SecurityUtils.getOwnerDisplay(entityplayer, MekanismClient.clientUUIDMap.get(getOwnerUUID(itemstack))));
|
||||
list.add(EnumColor.GREY + LangUtils.localize("gui.security") + ": " + SecurityUtils.getSecurityDisplay(itemstack, Side.CLIENT));
|
||||
|
||||
if(SecurityUtils.isOverridden(itemstack, Side.CLIENT))
|
||||
@@ -332,16 +334,16 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
if(tileEntity instanceof ISecurityTile)
|
||||
{
|
||||
ISecurityTile security = (ISecurityTile)tileEntity;
|
||||
security.getSecurity().setOwner(getOwner(stack));
|
||||
security.getSecurity().setOwnerUUID(getOwnerUUID(stack));
|
||||
|
||||
if(hasSecurity(stack))
|
||||
{
|
||||
security.getSecurity().setMode(getSecurity(stack));
|
||||
}
|
||||
|
||||
if(getOwner(stack) == null)
|
||||
if(getOwnerUUID(stack) == null)
|
||||
{
|
||||
security.getSecurity().setOwner(player.getName());
|
||||
security.getSecurity().setOwnerUUID(player.getUniqueID());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,9 +466,9 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
if(getOwner(itemstack) == null)
|
||||
if(getOwnerUUID(itemstack) == null)
|
||||
{
|
||||
setOwner(itemstack, entityplayer.getName());
|
||||
setOwnerUUID(itemstack, entityplayer.getUniqueID());
|
||||
}
|
||||
|
||||
if(SecurityUtils.canAccess(entityplayer, itemstack))
|
||||
@@ -867,26 +869,26 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwner(ItemStack stack)
|
||||
public UUID getOwnerUUID(ItemStack stack)
|
||||
{
|
||||
if(ItemDataUtils.hasData(stack, "owner"))
|
||||
{
|
||||
return ItemDataUtils.getString(stack, "owner");
|
||||
return UUID.fromString(ItemDataUtils.getString(stack, "owner"));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(ItemStack stack, String owner)
|
||||
public void setOwnerUUID(ItemStack stack, UUID owner)
|
||||
{
|
||||
if(owner == null || owner.isEmpty())
|
||||
if(owner == null)
|
||||
{
|
||||
ItemDataUtils.removeData(stack, "owner");
|
||||
return;
|
||||
}
|
||||
|
||||
ItemDataUtils.setString(stack, "owner", owner);
|
||||
ItemDataUtils.setString(stack, "owner", owner.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user