Scripting for Effects and Profiles

This commit is contained in:
Kam committed 2025-02-21 17:30:57 -05:00
1 parent ce1f652d53
commit d7d968bf86
13 files changed
+18 -126

No files matched your search

+1 -1
Submodule src/api updated: 30ba1bafac...dd3d8c552c.
@@ -2,7 +2,7 @@ package kamkeel.npcs.command.profile;
import kamkeel.npcs.controllers.ProfileController;
import kamkeel.npcs.controllers.data.EnumProfileOperation;
import kamkeel.npcs.controllers.data.ISlot;
import noppes.npcs.api.handler.data.ISlot;
import kamkeel.npcs.controllers.data.Profile;
import kamkeel.npcs.controllers.data.ProfileOperation;
import net.minecraft.command.CommandException;
@@ -1,7 +1,7 @@
package kamkeel.npcs.command.profile;
import kamkeel.npcs.controllers.ProfileController;
import kamkeel.npcs.controllers.data.ISlot;
import noppes.npcs.api.handler.data.ISlot;
import kamkeel.npcs.controllers.data.Profile;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
@@ -2,23 +2,21 @@ package kamkeel.npcs.controllers;
import kamkeel.npcs.controllers.data.*;
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.server.MinecraftServer;
import noppes.npcs.CustomNpcs;
import noppes.npcs.CustomNpcsPermissions;
import noppes.npcs.LogWriter;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.handler.IPlayerData;
import noppes.npcs.api.handler.data.IQuest;
import noppes.npcs.api.handler.data.IProfile;
import noppes.npcs.api.handler.IProfileHandler;
import noppes.npcs.api.handler.data.ISlot;
import noppes.npcs.config.ConfigMain;
import noppes.npcs.constants.EnumProfileSync;
import noppes.npcs.controllers.QuestController;
import noppes.npcs.controllers.data.PlayerData;
import noppes.npcs.controllers.data.PlayerQuestData;
import noppes.npcs.controllers.data.Quest;
import noppes.npcs.util.CustomNPCsThreader;
import noppes.npcs.util.NBTJsonUtil;
@@ -31,7 +29,7 @@ import java.util.*;
import static noppes.npcs.CustomNpcsPermissions.PROFILE_REGION_BYPASS;
import static noppes.npcs.CustomNpcsPermissions.hasPermission;
public class ProfileController implements IProfileController {
public class ProfileController implements IProfileHandler {
// Message constants
private static final String MSG_PLAYER_NOT_FOUND = "Player not found.";
@@ -1,33 +0,0 @@
package kamkeel.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.api.entity.IPlayer;
import java.util.Map;
public interface IProfile {
/**
* @return the IPlayer attached to the Profile
*/
IPlayer getPlayer();
/**
* @return The profiles current Slot ID
*/
int getCurrentSlotId();
/**
* @return Map of all Slot IDs
*/
Map<Integer, ISlot> getSlots();
/**
* @return FULL NBT of the Profile
*/
NBTTagCompound writeToNBT();
}
@@ -1,19 +0,0 @@
package kamkeel.npcs.controllers.data;
import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.handler.IPlayerData;
public interface IProfileController {
IProfile getProfile(IPlayer player);
boolean changeSlot(IPlayer player, int slotID);
boolean hasSlot(IPlayer player, int slotID);
boolean removeSlot(IPlayer player, int slotID);
IPlayerData getSlotPlayerData(IPlayer player, int slotID);
void saveSlotData(IPlayer player);
}
@@ -1,61 +0,0 @@
package kamkeel.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Map;
public interface ISlot {
/**
* @return id of slot
*/
int getId();
/**
* @return Name of Slot
*/
String getName();
/**
* @param name - New name of slot
*/
void setName(String name);
/**
* @return Last time Slot was Saved
*/
long getLastLoaded();
/**
* @param time - Long time for when it was last saved
*/
void setLastLoaded(long time);
/**
* @return if the slot is temporary
*/
boolean isTemporary();
/**
* @param temporary - Setting a slot to temporary won't save it to Profile
*/
void setTemporary(boolean temporary);
/**
* @return A map of all the NBTs within a slot
*/
Map<String, NBTTagCompound> getComponents();
void setComponentData(String key, NBTTagCompound data);
/**
* @param key - The KEY of the NBT for the Slot: [CNPC+, DBC... etc]
* @return NBT for that that key
*/
NBTTagCompound getComponentData(String key);
/**
* @return The full NBT of the Slot
*/
NBTTagCompound toNBT();
}
@@ -4,6 +4,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.handler.data.IProfile;
import noppes.npcs.api.handler.data.ISlot;
import java.util.HashMap;
import java.util.Map;
@@ -1,6 +1,7 @@
package kamkeel.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.api.handler.data.ISlot;
import java.util.HashMap;
import java.util.Map;
@@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import kamkeel.npcs.controllers.ProfileController;
import kamkeel.npcs.controllers.data.ISlot;
import noppes.npcs.api.handler.data.ISlot;
import kamkeel.npcs.controllers.data.InfoEntry;
import kamkeel.npcs.controllers.data.Profile;
import kamkeel.npcs.network.AbstractPacket;
@@ -1,6 +1,6 @@
package noppes.npcs.client.gui.player.inventory;
import kamkeel.npcs.controllers.data.ISlot;
import noppes.npcs.api.handler.data.ISlot;
import kamkeel.npcs.controllers.data.InfoEntry;
import kamkeel.npcs.controllers.data.Profile;
import kamkeel.npcs.controllers.data.Slot;
@@ -1,9 +1,8 @@
package noppes.npcs.controllers.data;
import kamkeel.npcs.controllers.ProfileController;
import kamkeel.npcs.controllers.data.ISlot;
import noppes.npcs.api.handler.data.ISlot;
import kamkeel.npcs.controllers.data.Profile;
import kamkeel.npcs.controllers.data.Slot;
import kamkeel.npcs.network.packets.data.QuestCompletionPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -2,6 +2,7 @@ package noppes.npcs.scripted;
import cpw.mods.fml.common.eventhandler.EventBus;
import foxz.command.ScriptedCommand;
import kamkeel.npcs.controllers.ProfileController;
import net.minecraft.block.Block;
import net.minecraft.command.CommandHandler;
import net.minecraft.entity.Entity;
@@ -241,6 +242,10 @@ public class NpcAPI extends AbstractNpcAPI {
public INaturalSpawnsHandler getNaturalSpawns() { return SpawnController.Instance; }
public IProfileHandler getProfileHandler() { return ProfileController.Instance; }
public ICustomEffectHandler getCustomEffectHandler() { return CustomEffectController.Instance; }
public ITransportHandler getLocations() {
return TransportController.getInstance();
}