mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 04:05:12 +00:00
-Parties: Kicking, inviting players, setting a leader, friendly fire toggle, and leaving a party are all functional over packets
-Created a new type of achievement that uses the bag icon, used for party messages
This commit is contained in:
1 parent
32d9869d43
commit
4abbb62e69
11 files changed
+224
-73
No files matched your search
@@ -2,14 +2,17 @@ package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IExtendedEntityProperties;
|
||||
import noppes.npcs.LogWriter;
|
||||
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.PlayerDataController;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
@@ -24,6 +27,7 @@ import noppes.npcs.util.NBTJsonUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
@@ -41,7 +45,9 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
|
||||
public EntityNPCInterface editingNpc;
|
||||
public NBTTagCompound cloned;
|
||||
|
||||
public UUID partyUUID = null;
|
||||
private final HashSet<UUID> partyInvites = new HashSet<>();
|
||||
|
||||
public EntityPlayer player;
|
||||
|
||||
@@ -55,6 +61,15 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
|
||||
public ScreenSize screenSize = new ScreenSize(-1,-1);
|
||||
|
||||
public void onLogin() {
|
||||
|
||||
}
|
||||
|
||||
public void onLogout() {
|
||||
this.partyUUID = null;
|
||||
this.partyInvites.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveNBTData(NBTTagCompound nbtTagCompound) {
|
||||
}
|
||||
@@ -128,7 +143,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
|
||||
@Override
|
||||
public void init(Entity entity, World world) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void setGUIOpen(boolean bool) {
|
||||
@@ -180,6 +195,14 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
world.spawnEntityInWorld(npc);
|
||||
}
|
||||
|
||||
public void inviteToParty(Party party) {
|
||||
if (party != null && this.partyUUID == null && !this.partyInvites.contains(party.getPartyUUID())) {
|
||||
this.partyInvites.add(party.getPartyUUID());
|
||||
Server.sendData((EntityPlayerMP)this.player, EnumPacketClient.PARTY_MESSAGE, "party.inviteAlert", party.getPartyLeader().getCommandSenderName());
|
||||
Server.sendData((EntityPlayerMP)this.player, EnumPacketClient.CHAT, "party.inviteChat", " ", party.getPartyLeader().getCommandSenderName(), "!");
|
||||
}
|
||||
}
|
||||
|
||||
public void setCompanion(ICustomNpc npc) {
|
||||
this.setCompanion((EntityNPCInterface) npc.getMCEntity());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user