Invites are now fully functional, can be accepted and ignored

This commit is contained in:
luisc committed 2024-01-22 10:53:20 -06:00
1 parent 4abbb62e69
commit b712d5390b
5 files changed
+124 -18

No files matched your search

@@ -80,6 +80,9 @@ public class Party {
}
}
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
playerData.partyUUID = null;
return true;
}
@@ -106,9 +109,12 @@ public class Party {
return NoppesUtilServer.getPlayer(this.partyLeader);
}
@SideOnly(Side.CLIENT)
public String getPartyLeaderName() {
return this.partyLeaderName;
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
return this.partyLeaderName;
} else {
return this.getPartyLeader().getCommandSenderName();
}
}
public boolean setLeader(EntityPlayer player){
@@ -8,12 +8,14 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;
import noppes.npcs.LogWriter;
import noppes.npcs.PacketHandlerServer;
import noppes.npcs.Server;
import noppes.npcs.api.entity.ICustomNpc;
import noppes.npcs.api.handler.*;
import noppes.npcs.config.ConfigMain;
import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.constants.EnumRoleType;
import noppes.npcs.controllers.PartyController;
import noppes.npcs.controllers.PlayerDataController;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPCInterface;
@@ -203,6 +205,26 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
}
}
public void ignoreInvite(UUID uuid) {
if (uuid != null) {
this.partyInvites.remove(uuid);
PacketHandlerServer.sendInviteData((EntityPlayerMP) player);
}
}
public void acceptInvite(UUID uuid) {
if (uuid != null) {
this.partyInvites.remove(uuid);
Party party = PartyController.Instance().getParty(uuid);
party.addPlayer(player);
PacketHandlerServer.sendPartyData((EntityPlayerMP) player);
}
}
public HashSet<UUID> getPartyInvites() {
return (HashSet<UUID>) this.partyInvites.clone();
}
public void setCompanion(ICustomNpc npc) {
this.setCompanion((EntityNPCInterface) npc.getMCEntity());
}