This commit is contained in:
KAMKEEL committed 2023-03-21 19:34:33 -04:00
commit 5d6da34717
12 files changed
+439 -49

No files matched your search

@@ -2,6 +2,7 @@ package noppes.npcs;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import noppes.npcs.constants.EnumJobType;
import noppes.npcs.constants.EnumRoleType;
import noppes.npcs.controllers.GlobalDataController;
@@ -13,6 +14,8 @@ import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.roles.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.UUID;
public class DataAdvanced {
@@ -32,6 +35,7 @@ public class DataAdvanced {
private EntityNPCInterface npc;
public FactionOptions factions = new FactionOptions();
public HashSet<UUID> tagUUIDs = new HashSet<>();
public EnumRoleType role = EnumRoleType.None;
public EnumJobType job = EnumJobType.None;
@@ -78,6 +82,12 @@ public class DataAdvanced {
compound.setBoolean("RefuseSoulStone", refuseSoulStone);
compound.setString("SoulStonePlayerName", soulStonePlayerName);
compound.setInteger("MinFactionPointsToSoulStone", minFactionPointsToSoulStone);
NBTTagList nbtTagList = new NBTTagList();
for (UUID uuid : tagUUIDs) {
nbtTagList.appendTag(new NBTTagString(uuid.toString()));
}
compound.setTag("TagUUIDs", nbtTagList);
return compound;
}
@@ -113,6 +123,11 @@ public class DataAdvanced {
refuseSoulStone = compound.getBoolean("RefuseSoulStone");
soulStonePlayerName = compound.getString("SoulStonePlayerName");
minFactionPointsToSoulStone = compound.getInteger("MinFactionPointsToSoulStone");
NBTTagList nbtTagList = compound.getTagList("TagUUIDs",8);
for (int i = 0; i < nbtTagList.tagCount(); i++) {
tagUUIDs.add(UUID.fromString(nbtTagList.getStringTagAt(i)));
}
}
private HashMap<Integer, DialogOption> getDialogs(NBTTagList tagList) {
@@ -6,6 +6,7 @@ import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
import cpw.mods.fml.relauncher.Side;
import foxz.utils.Market;
import io.netty.buffer.ByteBuf;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.passive.EntityVillager;
@@ -95,6 +96,19 @@ public class PacketHandlerServer{
map.put(provider.getDimensionName(), id);
}
NoppesUtilServer.sendScrollData(player, map);
} else if(type == EnumPacketServer.TagsGet){
NoppesUtilServer.sendTagDataAll(player);
} else if (type == EnumPacketServer.NpcTagsGet) {
NBTTagCompound compound = new NBTTagCompound();
NBTTagList tagList = new NBTTagList();
for (UUID uuid : npc.advanced.tagUUIDs) {
Tag tag = TagController.getInstance().getTagFromUUID(uuid);
if (tag != null) {
tagList.appendTag(new NBTTagString(tag.name));
}
}
compound.setTag("TagNames",tagList);
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
}
if(type.needsNpc && npc == null){
@@ -404,9 +418,6 @@ public class PacketHandlerServer{
else if(type == EnumPacketServer.FactionsGet){
NoppesUtilServer.sendFactionDataAll(player);
}
else if(type == EnumPacketServer.TagsGet){
NoppesUtilServer.sendTagDataAll(player);
}
else if(type == EnumPacketServer.DialogGet){
Dialog dialog = DialogController.instance.dialogs.get(buffer.readInt());
if(dialog != null){
@@ -751,7 +762,13 @@ public class PacketHandlerServer{
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
}
else if(type == EnumPacketServer.TagSet){
// npc.setFaction(buffer.readInt());
npc.advanced.tagUUIDs.removeIf(uuid -> TagController.getInstance().getTagFromUUID(uuid) != null);
NBTTagCompound compound = Server.readNBT(buffer);
NBTTagList list = compound.getTagList("TagNames",8);
for (int i = 0; i < list.tagCount(); i++) {
String tagName = list.getStringTagAt(i);
npc.advanced.tagUUIDs.add(((Tag)TagController.getInstance().getTagFromName(tagName)).uuid);
}
}
else if(type == EnumPacketServer.TagSave){
Tag tag = new Tag();
@@ -1058,6 +1075,33 @@ public class PacketHandlerServer{
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
}
else if (type == EnumPacketServer.CloneTagList) {
int tab = buffer.readInt();
List<String> cloneNames = ServerCloneController.Instance.getClones(tab);
NBTTagList cloneTags = new NBTTagList();
for (String name : cloneNames) {
NBTTagCompound compound = ServerCloneController.Instance.getCloneData(null, name, tab);
if (compound.hasKey("TagUUIDs")) {
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setString("Name",name);
NBTTagList uuidList = compound.getTagList("TagUUIDs",8);
NBTTagList tags = new NBTTagList();
for (int i = 0; i < uuidList.tagCount(); i++) {
String uuidString = uuidList.getStringTagAt(i);
NBTTagCompound tagNBT = new NBTTagCompound();
TagController.getInstance().getTagFromUUID(UUID.fromString(uuidString)).writeNBT(tagNBT);
tags.appendTag(tagNBT);
}
tagCompound.setTag("Tags",tags);
cloneTags.appendTag(tagCompound);
}
}
NBTTagCompound compound = new NBTTagCompound();
compound.setTag("CloneTags", cloneTags);
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
}
else
warn(player,"tried todo something with the wrong tool, probably a hacker");
}
@@ -12,15 +12,19 @@ import noppes.npcs.client.Client;
import noppes.npcs.client.controllers.ClientCloneController;
import noppes.npcs.client.gui.util.*;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.data.Tag;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
public class GuiNpcMobSpawner extends GuiNPCInterface implements IScrollData,IGuiData,ISubGuiListener {
public static HashSet<String> allTags = new HashSet<>();
public static HashSet<String> filter = new HashSet<>();
public static boolean showNoTags = true;
public HashMap<String,HashSet<Tag>> tags = new HashMap<>();
private GuiCustomScroll scroll;
private final GuiCustomScrollCloner scroll = new GuiCustomScrollCloner(this,0);
private int posX,posY,posZ;
private List<String> list;
@@ -41,6 +45,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
this.closeOnEsc = true;
setBackground("menubg.png");
Client.sendData(EnumPacketServer.TagsGet);
}
public void initGui()
{
@@ -48,12 +53,8 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
guiTop += 10;
guiLeft += 30;
if(scroll == null){
scroll = new GuiCustomScroll(this,0);
scroll.setSize(293, 188);
}
else
scroll.clear();
scroll.clear();
scroll.setSize(293, 188);
scroll.guiLeft = guiLeft + 4;
scroll.guiTop = guiTop + 26;
addScroll(scroll);
@@ -68,8 +69,10 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
addTopButton(button = new GuiMenuTopButton(4, button, "spawner.entities"));
button.active = showingClones == 1;
addButton(new GuiNpcButton(1, guiLeft + 298, guiTop + 6, 52, 20, "item.monsterPlacer.name"));
addButton(new GuiNpcButton(7, guiLeft + 298, guiTop + 78, 52, 20, "gui.filters"));
addButton(new GuiNpcButton(2, guiLeft + 298, guiTop + 100, 52, 20, "spawner.mobspawner"));
if(showingClones == 0 || showingClones == 2){
@@ -120,6 +123,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
scroll.setList(getSearchList());
}
private void showClones() {
Client.sendData(EnumPacketServer.CloneTagList, activeTab);
if(showingClones == 2){
Client.sendData(EnumPacketServer.CloneList, activeTab);
return;
@@ -227,12 +231,26 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
initGui();
}
}
if (id == 7) {
setSubGui(new SubGuiNpcFilterTags());
}
if(id > 20){
activeTab = id - 20;
initGui();
}
}
@Override
public void setData(Vector<String> list, HashMap<String, Integer> data)
{
allTags.addAll(list);
filter.addAll(allTags);
}
@Override
public void setSelected(String selected) {
}
@Override
public void save() {
// TODO Auto-generated method stub
@@ -240,13 +258,39 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
}
@Override
public void setGuiData(NBTTagCompound compound) {
NBTTagList nbtlist = compound.getTagList("List", 8);
List<String> list = new ArrayList<String>();
for(int i = 0; i < nbtlist.tagCount(); i++){
list.add(nbtlist.getStringTagAt(i));
if (compound.hasKey("CloneTags")) {
this.tags.clear();
NBTTagList cloneTags = compound.getTagList("CloneTags", 10);
for (int i = 0; i < cloneTags.tagCount(); i++) {
NBTTagCompound tagCompound = cloneTags.getCompoundTagAt(i);
String name = tagCompound.getString("Name");
HashSet<Tag> tagNames = new HashSet<>();
NBTTagList tagList = tagCompound.getTagList("Tags", 10);
for (int j = 0; j < tagList.tagCount(); j++) {
Tag tag = new Tag();
tag.readNBT(tagList.getCompoundTagAt(j));
tagNames.add(tag);
}
this.tags.put(name, tagNames);
}
} else {
NBTTagList nbtlist = compound.getTagList("List", 8);
List<String> list = new ArrayList<String>();
for(int i = 0; i < nbtlist.tagCount(); i++){
list.add(nbtlist.getStringTagAt(i));
}
this.list = list;
scroll.setList(getSearchList());
}
this.list = list;
scroll.setList(getSearchList());
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
SubGuiNpcFilterTags filterGui = (SubGuiNpcFilterTags) subgui;
filter = filterGui.filterScroll.getSelectedList();
showNoTags = filterGui.showNoTags;
initGui();
}
}
@@ -0,0 +1,67 @@
package noppes.npcs.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.StatCollector;
import noppes.npcs.client.gui.util.GuiCustomScroll;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.*;
public class SubGuiNpcFilterTags extends SubGuiInterface
{
ArrayList<String> allTags = new ArrayList<>();
HashSet<String> filter;
public GuiCustomScroll filterScroll;
public boolean showNoTags;
public SubGuiNpcFilterTags(){
setBackground("menubg.png");
xSize = 305;
ySize = 200;
closeOnEsc = true;
this.allTags.addAll(GuiNpcMobSpawner.allTags);
this.filter = GuiNpcMobSpawner.filter;
this.showNoTags = GuiNpcMobSpawner.showNoTags;
}
public void initGui(){
super.initGui();
if(filterScroll == null){
filterScroll = new GuiCustomScroll(this,0);
filterScroll.setSize(140, 180);
}
filterScroll.guiLeft = guiLeft + 4;
filterScroll.guiTop = guiTop + 14;
filterScroll.setList(this.allTags);
filterScroll.multipleSelection = true;
filterScroll.setSelectedList(this.filter);
this.addScroll(filterScroll);
addButton(new GuiNpcButton(10, guiLeft + 150, guiTop + 20, 120, 20, "gui.selectAll"));
addButton(new GuiNpcButton(11, guiLeft + 150, guiTop + 43, 120, 20, "gui.deselectAll"));
addLabel(new GuiNpcLabel(1, StatCollector.translateToLocal("tags.taglessEntries") + ":", guiLeft + 150, guiTop + 72));
addButton(new GuiNpcButton(12, guiLeft + 240, guiTop + 65, new String[]{"display.show", "display.hide"}, showNoTags ? 0 : 1));
getButton(12).width = 60;
getButton(12).height = 20;
addButton(new GuiNpcButton(66, guiLeft + 240, guiTop + 175, 60, 20, "gui.done"));
}
protected void actionPerformed(GuiButton guibutton){
if (guibutton.id == 10) {
HashSet<String> hashSet = new HashSet<>(this.allTags);
filterScroll.setSelectedList(hashSet);
}
if (guibutton.id == 11) {
filterScroll.setSelectedList(new HashSet<>());
}
if (guibutton.id == 12) {
showNoTags = !showNoTags;
}
if (guibutton.id == 66) {
close();
}
}
}
@@ -0,0 +1,117 @@
package noppes.npcs.client.gui.advanced;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import noppes.npcs.client.Client;
import noppes.npcs.client.gui.SubGuiNpcFactionOptions;
import noppes.npcs.client.gui.util.*;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.entity.EntityNPCInterface;
import java.util.*;
public class GuiNPCTagSetup extends GuiNPCInterface2 implements IScrollData,ICustomScrollListener,IGuiData
{
private GuiCustomScroll scrollTags;
private GuiCustomScroll npcTags;
private HashMap<String,Integer> data = new HashMap<>();
private final ArrayList<String> tagNames = new ArrayList<>();
public GuiNPCTagSetup(EntityNPCInterface npc)
{
super(npc);
Client.sendData(EnumPacketServer.TagsGet);
Client.sendData(EnumPacketServer.NpcTagsGet);
}
public void initGui()
{
super.initGui();
if(scrollTags == null){
scrollTags = new GuiCustomScroll(this,0);
scrollTags.setSize(120, 180);
}
scrollTags.guiLeft = guiLeft + 50;
scrollTags.guiTop = guiTop + 24;
this.addScroll(scrollTags);
if(npcTags == null){
npcTags = new GuiCustomScroll(this,1);
npcTags.setSize(120, 180);
}
npcTags.guiLeft = guiLeft + 250;
npcTags.guiTop = guiTop + 24;
npcTags.setList(tagNames);
this.addScroll(npcTags);
addButton(new GuiNpcButton(10, guiLeft + 180, guiTop + 90, 55, 20, ">"));
addButton(new GuiNpcButton(11, guiLeft + 180, guiTop + 112, 55, 20, "<"));
addButton(new GuiNpcButton(12, guiLeft + 180, guiTop + 140, 55, 20, ">>"));
addButton(new GuiNpcButton(13, guiLeft + 180, guiTop + 162, 55, 20, "<<"));
}
@Override
public void buttonEvent(GuiButton guibutton) {
if (guibutton.id == 10 && scrollTags.hasSelected() && !tagNames.contains(scrollTags.getSelected())) {
tagNames.add(scrollTags.getSelected());
}
if (guibutton.id == 12) {
tagNames.clear();
tagNames.addAll(data.keySet());
}
if (guibutton.id == 11 && npcTags.hasSelected()) {
tagNames.remove(npcTags.getSelected());
}
if (guibutton.id == 13) {
tagNames.clear();
}
initGui();
}
@Override
public void setData(Vector<String> list, HashMap<String, Integer> data)
{
this.data = data;
scrollTags.setList(list);
initGui();
}
@Override
public void setGuiData(NBTTagCompound compound) {
NBTTagList tagList = compound.getTagList("TagNames",8);
tagNames.clear();
for (int i = 0; i < tagList.tagCount(); i++) {
tagNames.add(tagList.getStringTagAt(i));
}
}
public void mouseClicked(int i, int j, int k)
{
super.mouseClicked(i, j, k);
if(k == 0 && scrollTags != null)
scrollTags.mouseClicked(i, j, k);
}
@Override
public void setSelected(String selected) {
scrollTags.setSelected(selected);
}
@Override
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
}
public void save() {
NBTTagCompound tagCompound = new NBTTagCompound();
NBTTagList tagList = new NBTTagList();
for (String string : this.tagNames) {
tagList.appendTag(new NBTTagString(string));
}
tagCompound.setTag("TagNames",tagList);
Client.sendData(EnumPacketServer.TagSet, tagCompound);
}
}
@@ -27,21 +27,24 @@ public class GuiNpcAdvanced extends GuiNPCInterface2 implements IGuiData
@Override
public void initGui(){
super.initGui();
this.addButton(new GuiNpcButton(3, guiLeft + 85 + 160, guiTop + 20, 52, 20, "selectServer.edit"));
this.addButton(new GuiNpcButton(8, guiLeft + 85, guiTop + 20,155,20, new String[]{"role.none","role.trader","role.follower","role.bank","role.transporter", "role.mailman", NoppesStringUtils.translate("role.companion", "(WIP)")},npc.advanced.role.ordinal()));
int y = guiTop + 10;
int gap = 21;
this.addButton(new GuiNpcButton(3, guiLeft + 85 + 160, y, 52, 20, "selectServer.edit"));
this.addButton(new GuiNpcButton(8, guiLeft + 85, y,155,20, new String[]{"role.none","role.trader","role.follower","role.bank","role.transporter", "role.mailman", NoppesStringUtils.translate("role.companion", "(WIP)")},npc.advanced.role.ordinal()));
getButton(3).setEnabled(npc.advanced.role != EnumRoleType.None && npc.advanced.role != EnumRoleType.Postman);
this.addButton(new GuiNpcButton(4, guiLeft + 85 + 160, guiTop + 43, 52, 20, "selectServer.edit"));
this.addButton(new GuiNpcButton(5, guiLeft + 85, guiTop + 43,155,20, new String[]{"job.none","job.bard","job.healer","job.guard","job.itemgiver","role.follower", "job.spawner", "job.conversation", "job.chunkloader"},npc.advanced.job.ordinal()));
this.addButton(new GuiNpcButton(4, guiLeft + 85 + 160, y += gap, 52, 20, "selectServer.edit"));
this.addButton(new GuiNpcButton(5, guiLeft + 85, y,155,20, new String[]{"job.none","job.bard","job.healer","job.guard","job.itemgiver","role.follower", "job.spawner", "job.conversation", "job.chunkloader"},npc.advanced.job.ordinal()));
getButton(4).setEnabled(npc.advanced.job != EnumJobType.None && npc.advanced.job != EnumJobType.ChunkLoader);
this.addButton(new GuiNpcButton(7, guiLeft + 85, guiTop + 66, 214, 20, "advanced.lines"));
this.addButton(new GuiNpcButton(9, guiLeft + 85, guiTop + 89, 214, 20, "menu.factions"));
this.addButton(new GuiNpcButton(10, guiLeft + 85, guiTop + 112, 214, 20, "dialog.dialogs"));
this.addButton(new GuiNpcButton(11, guiLeft + 85, guiTop + 135, 214, 20, "advanced.sounds"));
this.addButton(new GuiNpcButton(12, guiLeft + 85, guiTop + 158, 214, 20, "advanced.night"));
this.addButton(new GuiNpcButton(13, guiLeft + 85, guiTop + 181, 214, 20, "global.linked"));
this.addButton(new GuiNpcButton(7, guiLeft + 85, y += gap, 214, 20, "advanced.lines"));
this.addButton(new GuiNpcButton(9, guiLeft + 85, y += gap, 214, 20, "menu.factions"));
this.addButton(new GuiNpcButton(10, guiLeft + 85, y += gap, 214, 20, "dialog.dialogs"));
this.addButton(new GuiNpcButton(11, guiLeft + 85, y += gap, 214, 20, "advanced.sounds"));
this.addButton(new GuiNpcButton(12, guiLeft + 85, y += gap, 214, 20, "advanced.night"));
this.addButton(new GuiNpcButton(13, guiLeft + 85, y += gap, 214, 20, "global.linked"));
this.addButton(new GuiNpcButton(14, guiLeft + 85, y += gap, 214, 20, "menu.tags"));
}
@@ -92,6 +95,10 @@ public class GuiNpcAdvanced extends GuiNPCInterface2 implements IGuiData
save();
NoppesUtil.openGUI(player, new GuiNPCAdvancedLinkedNpc(npc));
}
if(button.id == 14){
save();
NoppesUtil.openGUI(player, new GuiNPCTagSetup(npc));
}
}
@Override
@@ -6,29 +6,27 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.*;
public class GuiCustomScroll extends GuiScreen
{
public static final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/misc.png");
private List<String> list;
protected List<String> list;
public final HashMap<String,Integer> colors = new HashMap<>();
public int id;
public int guiLeft = 0;
public int guiTop = 0;
public int xSize, ySize;
public int selected;
private HashSet<String> selectedList;
private int hover;
protected HashSet<String> selectedList;
protected int hover;
private int listHeight;
private int scrollY;
private int maxScrollY;
private int scrollHeight;
protected int scrollY;
protected int maxScrollY;
protected int scrollHeight;
private boolean isScrolling;
private boolean multipleSelection = false;
public boolean multipleSelection = false;
private ICustomScrollListener listener;
private boolean isSorted = true;
public boolean visible = true;
@@ -0,0 +1,85 @@
package noppes.npcs.client.gui.util;
import net.minecraft.util.StatCollector;
import noppes.npcs.client.gui.GuiNpcMobSpawner;
import noppes.npcs.controllers.data.Tag;
import java.util.HashSet;
public class GuiCustomScrollCloner extends GuiCustomScroll {
private final GuiNpcMobSpawner parent;
public GuiCustomScrollCloner(GuiNpcMobSpawner parent, int id) {
super(parent, id);
this.parent = parent;
}
protected void drawItems()
{
int l = 0;
for(int i = 0; i < list.size(); i++)
{
if (this.parent.tags.containsKey(list.get(i))) {
HashSet<Tag> tags = this.parent.tags.get(list.get(i));
boolean inFilter = false;
for (Tag tag : tags) {
if (GuiNpcMobSpawner.filter.contains(tag.name)) {
inFilter = true;
break;
}
}
if (!inFilter) {
continue;
}
} else if (!GuiNpcMobSpawner.showNoTags) {
continue;
}
int j = 4;
int k = (14 * l + 4) - scrollY;
l++;
if(k >= 4 && k + 12 < ySize)
{
int xOffset = scrollHeight < ySize - 8?0:10;
String displayString = StatCollector.translateToLocal(list.get(i));
String text = "";
float maxWidth = (xSize + xOffset - 8) * 0.8f;
if(fontRendererObj.getStringWidth(displayString) > maxWidth){
for(int h = 0; h < displayString.length(); h++){
char c = displayString.charAt(h);
text += c;
if(fontRendererObj.getStringWidth(text) > maxWidth)
break;
}
if(displayString.length() > text.length())
text += "...";
}
else
text = displayString;
if((multipleSelection && selectedList.contains(text)) || (!multipleSelection && selected == i)) {
drawVerticalLine(j-2, k-4, k + 10, 0xffffffff);
drawVerticalLine(j + xSize - 18 + xOffset, k - 4, k + 10, 0xffffffff);
drawHorizontalLine(j - 2, j + xSize - 18 + xOffset, k - 3 , 0xffffffff);
drawHorizontalLine(j - 2, j + xSize - 18 + xOffset, k + 10 , 0xffffffff);
fontRendererObj.drawString(text, j , k, this.colors.getOrDefault(text, 0xffffff));
} else if(i == hover) {
fontRendererObj.drawString(text, j, k, 0x00ff00);
} else {
fontRendererObj.drawString(text, j, k, this.colors.getOrDefault(text, 0xffffff));
}
int tagStartX = j + fontRendererObj.getStringWidth(displayString) + 5;
if (this.parent.tags.containsKey(list.get(i))) {
for (Tag tag : this.parent.tags.get(list.get(i))) {
if (!tag.getIsHidden()) {
fontRendererObj.drawString("[" + tag.name + "]", tagStartX, k, tag.color);
tagStartX += fontRendererObj.getStringWidth("[" + tag.name + "]") + 2;
}
}
}
}
}
}
}
@@ -33,7 +33,7 @@ public enum EnumPacketServer {
RoleCompanionUpdate(CustomNpcsPermissions.NPC_ADVANCED, true),
LinkedSet(CustomNpcsPermissions.NPC_ADVANCED, true),
ClonePreSave(CustomNpcsPermissions.NPC_CLONE), CloneSave(CustomNpcsPermissions.NPC_CLONE), CloneRemove(CustomNpcsPermissions.NPC_CLONE), CloneList,
ClonePreSave(CustomNpcsPermissions.NPC_CLONE), CloneSave(CustomNpcsPermissions.NPC_CLONE), CloneRemove(CustomNpcsPermissions.NPC_CLONE), CloneList, CloneTagList,
ScriptGlobalGuiDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
ScriptGlobalGuiDataGet(false),
@@ -66,7 +66,7 @@ public enum EnumPacketServer {
FactionRemove(CustomNpcsPermissions.GLOBAL_FACTION),
FactionSave(CustomNpcsPermissions.GLOBAL_FACTION), FactionsGet, FactionGet,
TagRemove(CustomNpcsPermissions.GLOBAL_TAG),
TagSave(CustomNpcsPermissions.GLOBAL_TAG), TagsGet, TagGet,
TagSave(CustomNpcsPermissions.GLOBAL_TAG), TagsGet, TagGet, NpcTagsGet,
QuestCategorySave(CustomNpcsPermissions.GLOBAL_QUEST), QuestCategoriesGet,
QuestRemove(CustomNpcsPermissions.GLOBAL_QUEST),
QuestCategoryRemove(CustomNpcsPermissions.GLOBAL_QUEST),
@@ -10,10 +10,7 @@ import noppes.npcs.api.handler.data.ITag;
import noppes.npcs.controllers.data.Tag;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.zip.GZIPInputStream;
public class TagController implements ITagHandler {
@@ -206,6 +203,7 @@ public class TagController implements ITagHandler {
return true;
return false;
}
public Tag getTagFromName(String tagname){
for (Map.Entry<Integer,Tag> entryTag: TagController.getInstance().tags.entrySet()){
if (entryTag.getValue().name.equalsIgnoreCase(tagname)){
@@ -224,4 +222,13 @@ public class TagController implements ITagHandler {
}
return names;
}
public Tag getTagFromUUID(UUID uuid){
for (Map.Entry<Integer,Tag> entryTag: TagController.getInstance().tags.entrySet()){
if (entryTag.getValue().uuid.equals(uuid)) {
return entryTag.getValue();
}
}
return null;
}
}