mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 21:54:08 +00:00
Experimental SyncController with UpdateClient
This commit is contained in:
1 parent
92cf6bcad6
commit
3e67bf0336
31 files changed
+348
-74
No files matched your search
+1
-1
Submodule src/api updated: 5685f9a0f8...deac612185.
@@ -50,7 +50,7 @@ public class CmdDialog extends ChMcLogger {
|
||||
}
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.dialogData.dialogsRead.add(diagid);
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public class CmdDialog extends ChMcLogger {
|
||||
}
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.dialogData.dialogsRead.remove(diagid);
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class CmdNoppes extends ChMcLogger {
|
||||
cmdfaction.processCommand(this.pcParam, args);
|
||||
|
||||
for (PlayerData playerdata : cmdfaction.data) {
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class CmdQuest extends ChMcLogger{
|
||||
continue;
|
||||
QuestData questdata = new QuestData(quest);
|
||||
playerdata.questData.activeQuests.put(questid, questdata);
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
if(playerdata.player != null){
|
||||
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title);
|
||||
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title);
|
||||
@@ -93,7 +93,7 @@ public class CmdQuest extends ChMcLogger{
|
||||
}
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.questData.finishedQuests.put(questid, System.currentTimeMillis());
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public class CmdQuest extends ChMcLogger{
|
||||
}
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.questData.activeQuests.remove(questid);
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ public class CmdQuest extends ChMcLogger{
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.questData.activeQuests.remove(questid);
|
||||
playerdata.questData.finishedQuests.remove(questid);
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import noppes.npcs.client.EntityUtil;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.SyncController;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
@@ -48,7 +49,7 @@ public class DialogCommand extends CommandKamkeelBase {
|
||||
}
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.dialogData.dialogsRead.add(diagid);
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
sendResult(sender, String.format("Forced Read for Dialog \u00A7e%d\u00A77 for Player '\u00A7b%s\u00A77'", diagid, playerdata.playername));
|
||||
}
|
||||
}
|
||||
@@ -73,7 +74,7 @@ public class DialogCommand extends CommandKamkeelBase {
|
||||
}
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.dialogData.dialogsRead.remove(diagid);
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
sendResult(sender, String.format("Forced Unread for Dialog \u00A7e%d\u00A77 for Player '\u00A7b%s\u00A77'", diagid, playerdata.playername));
|
||||
}
|
||||
}
|
||||
@@ -83,6 +84,7 @@ public class DialogCommand extends CommandKamkeelBase {
|
||||
)
|
||||
public void reload(ICommandSender sender, String args[]){
|
||||
new DialogController();
|
||||
SyncController.syncAllDialogs();
|
||||
sendResult(sender, "Dialogs Reloaded");
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class FactionCommand extends CommandKamkeelBase {
|
||||
processSubCommand(sender, args[2], Arrays.copyOfRange(args, 3, args.length));
|
||||
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumQuestRepeat;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.QuestController;
|
||||
import noppes.npcs.controllers.SyncController;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.controllers.data.QuestData;
|
||||
@@ -56,7 +57,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
for(PlayerData playerdata : data){
|
||||
QuestData questdata = new QuestData(quest);
|
||||
playerdata.questData.activeQuests.put(questid, questdata);
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
if(playerdata.player != null && questdata.sendAlerts){
|
||||
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title);
|
||||
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title);
|
||||
@@ -101,7 +102,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
else
|
||||
playerdata.questData.finishedQuests.put(quest.id, sender.getEntityWorld().getTotalWorldTime());
|
||||
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
if(playerdata.player != null){
|
||||
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.MESSAGE, "quest.completed", quest.title);
|
||||
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.CHAT, "quest.completed", ": ", quest.title);
|
||||
@@ -135,7 +136,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
}
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.questData.activeQuests.remove(questid);
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
sendResult(sender, String.format("Stopped Quest \u00A7e%d\u00A77 for Player '\u00A7b%s\u00A77'", questid, playerdata.playername));
|
||||
}
|
||||
}
|
||||
@@ -169,7 +170,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.questData.activeQuests.remove(questid);
|
||||
playerdata.questData.finishedQuests.remove(questid);
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
sendResult(sender, String.format("Removed Quest \u00A7e%d\u00A77 for Player '\u00A7b%s\u00A77'", questid, playerdata.playername));
|
||||
}
|
||||
}
|
||||
@@ -181,6 +182,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
public void reload(ICommandSender sender, String args[]){
|
||||
new QuestController();
|
||||
QuestController.instance.load();
|
||||
SyncController.syncAllQuests();
|
||||
sendResult(sender, "Quests Reloaded");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,7 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumPlayerData;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.constants.*;
|
||||
import noppes.npcs.containers.ContainerManageBanks;
|
||||
import noppes.npcs.containers.ContainerManageRecipes;
|
||||
import noppes.npcs.controllers.*;
|
||||
@@ -39,7 +36,6 @@ import noppes.npcs.roles.RoleTransporter;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.ScriptSound;
|
||||
import noppes.npcs.scripted.event.DialogEvent;
|
||||
import noppes.npcs.util.CustomNPCsScheduler;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -163,6 +159,7 @@ public class NoppesUtilServer {
|
||||
|
||||
public static void openDialog(EntityPlayer player, EntityNPCInterface npc, Dialog dia, int optionId){
|
||||
Dialog dialog = dia.copy(player);
|
||||
PlayerData playerdata = PlayerDataController.instance.getPlayerData(player);
|
||||
|
||||
if (!npc.isRemote()) {
|
||||
if (EventHooks.onNPCDialog(npc, player, dialog.id, optionId, dialog)) {
|
||||
@@ -188,8 +185,10 @@ public class NoppesUtilServer {
|
||||
if(dialog.mail.isValid())
|
||||
PlayerDataController.instance.addPlayerMessage(player.getCommandSenderName(), dialog.mail);
|
||||
PlayerDialogData data = PlayerDataController.instance.getPlayerData(player).dialogData;
|
||||
if(!data.dialogsRead.contains(dialog.id))
|
||||
data.dialogsRead.add(dialog.id);
|
||||
if(!data.dialogsRead.contains(dialog.id)){
|
||||
data.dialogsRead.add(dialog.id);
|
||||
playerdata.updateClient = true;
|
||||
}
|
||||
setEditingNpc(player, npc);
|
||||
}
|
||||
public static void runCommand(EntityPlayer player, String name, String command){
|
||||
@@ -256,20 +255,18 @@ public class NoppesUtilServer {
|
||||
setEditingNpc(player, npc);
|
||||
sendExtraData(player, npc,gui, i, j, k);
|
||||
|
||||
CustomNPCsScheduler.runTack(() -> {
|
||||
if(CustomNpcs.proxy.getServerGuiElement(gui.ordinal(), player, player.worldObj, i, j, k) != null){
|
||||
player.openGui(CustomNpcs.instance, gui.ordinal(), player.worldObj, i, j, k);
|
||||
return;
|
||||
}
|
||||
else{
|
||||
Server.sendDataChecked((EntityPlayerMP)player, EnumPacketClient.GUI, gui.ordinal(), i, j, k);
|
||||
}
|
||||
ArrayList<String> list = getScrollData(player, gui, npc);
|
||||
if(list == null || list.isEmpty())
|
||||
return;
|
||||
if(CustomNpcs.proxy.getServerGuiElement(gui.ordinal(), player, player.worldObj, i, j, k) != null){
|
||||
player.openGui(CustomNpcs.instance, gui.ordinal(), player.worldObj, i, j, k);
|
||||
return;
|
||||
}
|
||||
else{
|
||||
Server.sendDataChecked((EntityPlayerMP)player, EnumPacketClient.GUI, gui.ordinal(), i, j, k);
|
||||
}
|
||||
ArrayList<String> list = getScrollData(player, gui, npc);
|
||||
if(list == null || list.isEmpty())
|
||||
return;
|
||||
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SCROLL_LIST, list);
|
||||
}, 100);
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SCROLL_LIST, list);
|
||||
}
|
||||
|
||||
public static void sendOpenGuiNoDelay(final EntityPlayer player,
|
||||
@@ -488,7 +485,7 @@ public class NoppesUtilServer {
|
||||
return;
|
||||
String name = Server.readString(buffer);
|
||||
EnumPlayerData type = EnumPlayerData.values()[id];
|
||||
EntityPlayer pl = MinecraftServer.getServer().getConfigurationManager().func_152612_a(name);
|
||||
EntityPlayerMP pl = MinecraftServer.getServer().getConfigurationManager().func_152612_a(name);
|
||||
PlayerData playerdata = null;
|
||||
if(pl == null)
|
||||
playerdata = PlayerDataController.instance.getDataFromUsername(name);
|
||||
@@ -502,7 +499,7 @@ public class NoppesUtilServer {
|
||||
if(pl != null){
|
||||
playerdata.setNBT(new NBTTagCompound());
|
||||
sendPlayerData(type, player, name);
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -515,28 +512,31 @@ public class NoppesUtilServer {
|
||||
int questId = buffer.readInt();
|
||||
data.activeQuests.remove(questId);
|
||||
data.finishedQuests.remove(questId);
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
}
|
||||
if(type == EnumPlayerData.Dialog){
|
||||
PlayerDialogData data = playerdata.dialogData;
|
||||
data.dialogsRead.remove(buffer.readInt());
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
}
|
||||
if(type == EnumPlayerData.Transport){
|
||||
PlayerTransportData data = playerdata.transportData;
|
||||
data.transports.remove(buffer.readInt());
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
}
|
||||
if(type == EnumPlayerData.Bank){
|
||||
PlayerBankData data = playerdata.bankData;
|
||||
data.banks.remove(buffer.readInt());
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
}
|
||||
if(type == EnumPlayerData.Factions){
|
||||
PlayerFactionData data = playerdata.factionData;
|
||||
data.factionData.remove(buffer.readInt());
|
||||
playerdata.save();
|
||||
playerdata.save(true);
|
||||
}
|
||||
if(pl != null) {
|
||||
SyncController.syncPlayer(pl);
|
||||
}
|
||||
sendPlayerData(type, player, name);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.minecraftforge.event.world.BlockEvent;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumQuestType;
|
||||
import noppes.npcs.constants.SyncType;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
@@ -67,6 +68,11 @@ public class ScriptPlayerEventHandler {
|
||||
if (PlayerDataController.instance != null) {
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
|
||||
if(playerData.updateClient) {
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNC_END, SyncType.PLAYER_DATA, playerData.getSyncNBT());
|
||||
playerData.updateClient = false;
|
||||
}
|
||||
|
||||
if (playerData.timers.size() > 0) {
|
||||
playerData.timers.update();
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ public class ServerEventsHandler {
|
||||
}
|
||||
if(event.entityLiving instanceof EntityPlayer){
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData((EntityPlayer)event.entityLiving);
|
||||
data.save();
|
||||
data.save(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,6 +341,7 @@ public class ServerEventsHandler {
|
||||
killed.put(name, amount + 1);
|
||||
}
|
||||
quest.setKilled(data, killed);
|
||||
playerData.updateClient = true;
|
||||
}
|
||||
if(!checkCompletion)
|
||||
return;
|
||||
@@ -369,7 +370,7 @@ public class ServerEventsHandler {
|
||||
@SubscribeEvent
|
||||
public void world(PlayerEvent.SaveToFile event){
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData((EntityPlayer) event.entity);
|
||||
data.save();
|
||||
data.save(false);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -4,9 +4,11 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.client.AnalyticsTracking;
|
||||
import noppes.npcs.controllers.SyncController;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
@@ -40,5 +42,9 @@ public class ServerTickHandler {
|
||||
serverName = e;
|
||||
}
|
||||
AnalyticsTracking.sendData(event.player, "join", serverName);
|
||||
if(event.player instanceof EntityPlayerMP){
|
||||
EntityPlayerMP player = (EntityPlayerMP) event.player;
|
||||
SyncController.syncPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,7 @@ public class TileWaypoint extends TileEntity {
|
||||
player.addChatMessage(new ChatComponentTranslation(name + " " + StatCollector.translateToLocal("quest.found")));
|
||||
|
||||
questData.checkQuestCompletion(playerData, EnumQuestType.Location);
|
||||
playerData.updateClient = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,12 @@ import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import noppes.npcs.AnimationData;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.gui.OverlayQuestTracking;
|
||||
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||
import noppes.npcs.client.renderer.customitem.ImageData;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.util.CustomNPCsScheduler;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
@@ -27,16 +25,14 @@ public class Client {
|
||||
private static HashMap<String, ImageData> imageDataCache = new HashMap<>();
|
||||
|
||||
public static void sendData(final EnumPacketServer enu, final Object... obs) {
|
||||
CustomNPCsScheduler.runTack(() -> {
|
||||
ByteBuf buffer = Unpooled.buffer();
|
||||
try {
|
||||
if(!Server.fillBuffer(buffer, enu, obs))
|
||||
return;
|
||||
CustomNpcs.Channel.sendToServer(new FMLProxyPacket(buffer, "CustomNPCs"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
ByteBuf buffer = Unpooled.buffer();
|
||||
try {
|
||||
if(!Server.fillBuffer(buffer, enu, obs))
|
||||
return;
|
||||
CustomNpcs.Channel.sendToServer(new FMLProxyPacket(buffer, "CustomNPCs"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static ImageData getImageData(String directory) {
|
||||
|
||||
@@ -30,14 +30,18 @@ import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.SyncType;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import noppes.npcs.controllers.SyncController;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
import noppes.npcs.controllers.data.RecipeCarpentry;
|
||||
import noppes.npcs.entity.EntityDialogNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.items.ItemScripted;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class PacketHandlerClient extends PacketHandlerServer{
|
||||
|
||||
@@ -100,6 +104,27 @@ public class PacketHandlerClient extends PacketHandlerServer{
|
||||
RecipeController.instance.anvilRecipes = RecipeController.syncRecipes;
|
||||
RecipeController.syncRecipes = new HashMap<Integer, RecipeCarpentry>();
|
||||
}
|
||||
else if(type == EnumPacketClient.SYNC_ADD || type == EnumPacketClient.SYNC_END){
|
||||
int synctype = buffer.readInt();
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
|
||||
SyncController.clientSync(synctype, compound, type == EnumPacketClient.SYNC_END);
|
||||
|
||||
if(synctype == SyncType.PLAYER_DATA){
|
||||
ClientProxy.playerData.setNBT(compound);
|
||||
}
|
||||
}
|
||||
else if(type == EnumPacketClient.SYNC_UPDATE){
|
||||
int synctype = buffer.readInt();
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
SyncController.clientSyncUpdate(synctype, compound, buffer);
|
||||
}
|
||||
else if(type == EnumPacketClient.SYNC_REMOVE){
|
||||
int synctype = buffer.readInt();
|
||||
int id = buffer.readInt();
|
||||
|
||||
SyncController.clientSyncRemove(synctype, id);
|
||||
}
|
||||
else if(type == EnumPacketClient.DIALOG){
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt());
|
||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||
|
||||
@@ -47,5 +47,6 @@ public enum EnumPacketClient {
|
||||
STOP_SOUND_FOR,
|
||||
PAUSE_SOUNDS,
|
||||
CONTINUE_SOUNDS,
|
||||
STOP_SOUNDS
|
||||
STOP_SOUNDS,
|
||||
SYNC_ADD, SYNC_END, SYNC_UPDATE, SYNC_REMOVE,
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package noppes.npcs.constants;
|
||||
|
||||
public class SyncType {
|
||||
|
||||
public static final int FACTION = 1;
|
||||
public static final int QUEST = 2;
|
||||
public static final int QUEST_CATEGORY = 3;
|
||||
public static final int DIALOG = 4;
|
||||
public static final int DIALOG_CATEGORY = 5;
|
||||
public static final int PLAYER_DATA = 8;
|
||||
}
|
||||
@@ -6,10 +6,13 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.api.handler.IDialogHandler;
|
||||
import noppes.npcs.api.handler.data.IDialog;
|
||||
import noppes.npcs.api.handler.data.IDialogCategory;
|
||||
import noppes.npcs.constants.EnumOptionType;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.SyncType;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogCategory;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
@@ -21,6 +24,7 @@ import java.util.*;
|
||||
|
||||
public class DialogController implements IDialogHandler {
|
||||
public HashMap<Integer,DialogCategory> categories = new HashMap<Integer, DialogCategory>();
|
||||
public HashMap<Integer,DialogCategory> categoriesSync = new HashMap<Integer, DialogCategory>();
|
||||
public HashMap<Integer,Dialog> dialogs = new HashMap<Integer, Dialog>();
|
||||
public static DialogController instance;
|
||||
|
||||
@@ -227,6 +231,7 @@ public class DialogController implements IDialogHandler {
|
||||
dir.mkdirs();
|
||||
}
|
||||
categories.put(category.id, category);
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.DIALOG_CATEGORY, category.writeNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
public void removeCategory(int category){
|
||||
@@ -239,6 +244,7 @@ public class DialogController implements IDialogHandler {
|
||||
for(int dia : cat.dialogs.keySet())
|
||||
dialogs.remove(dia);
|
||||
categories.remove(category);
|
||||
Server.sendToAll(EnumPacketClient.SYNC_REMOVE, SyncType.DIALOG_CATEGORY, category);
|
||||
}
|
||||
|
||||
private boolean containsCategoryName(String name) {
|
||||
@@ -281,10 +287,12 @@ public class DialogController implements IDialogHandler {
|
||||
File file2 = new File(dir, dialog.id + ".json");
|
||||
|
||||
try {
|
||||
NBTJsonUtil.SaveFile(file, dialog.writeToNBTPartial(new NBTTagCompound()));
|
||||
NBTTagCompound compound = dialog.writeToNBT(new NBTTagCompound());
|
||||
NBTJsonUtil.SaveFile(file, compound);
|
||||
if(file2.exists())
|
||||
file2.delete();
|
||||
file.renameTo(file2);
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.DIALOG, compound, category.id);
|
||||
} catch (Exception e) {
|
||||
LogWriter.except(e);
|
||||
}
|
||||
@@ -298,7 +306,7 @@ public class DialogController implements IDialogHandler {
|
||||
return;
|
||||
category.dialogs.remove(dialog.id);
|
||||
dialogs.remove(dialog.id);
|
||||
|
||||
Server.sendToAll(EnumPacketClient.SYNC_REMOVE, SyncType.DIALOG, dialog.id);
|
||||
}
|
||||
|
||||
private File getDir(){
|
||||
|
||||
@@ -5,8 +5,11 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.api.handler.IFactionHandler;
|
||||
import noppes.npcs.api.handler.data.IFaction;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.SyncType;
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
|
||||
import java.io.*;
|
||||
@@ -18,7 +21,7 @@ import java.util.zip.GZIPInputStream;
|
||||
|
||||
public class FactionController implements IFactionHandler {
|
||||
public HashMap<Integer,Faction> factions;
|
||||
|
||||
public HashMap<Integer,Faction> factionsSync = new HashMap<Integer,Faction>();
|
||||
private static FactionController instance;
|
||||
|
||||
private int lastUsedID = 0;
|
||||
@@ -151,6 +154,9 @@ public class FactionController implements IFactionHandler {
|
||||
}
|
||||
factions.remove(faction.id);
|
||||
factions.put(faction.id, faction);
|
||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||
faction.writeNBT(nbtTagCompound);
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.FACTION, nbtTagCompound);
|
||||
saveFactions();
|
||||
}
|
||||
|
||||
@@ -185,6 +191,7 @@ public class FactionController implements IFactionHandler {
|
||||
} else {
|
||||
this.saveFactions();
|
||||
faction.id = -1;
|
||||
Server.sendToAll(EnumPacketClient.SYNC_REMOVE, SyncType.FACTION, id);
|
||||
return faction;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -311,7 +311,7 @@ public class PlayerDataController {
|
||||
EntityPlayer player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(username);
|
||||
PlayerData data = getDataFromUsername(username);
|
||||
data.mailData.playermail.add(mail.copy());
|
||||
data.save();
|
||||
data.save(false);
|
||||
}
|
||||
|
||||
public List<PlayerData> getPlayersData(ICommandSender sender, String username){
|
||||
|
||||
@@ -6,9 +6,12 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.api.handler.IQuestHandler;
|
||||
import noppes.npcs.api.handler.data.IQuest;
|
||||
import noppes.npcs.api.handler.data.IQuestCategory;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.SyncType;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.controllers.data.QuestCategory;
|
||||
import noppes.npcs.util.NBTJsonUtil;
|
||||
@@ -19,6 +22,7 @@ import java.util.*;
|
||||
|
||||
public class QuestController implements IQuestHandler {
|
||||
public HashMap<Integer,QuestCategory> categories = new HashMap<Integer, QuestCategory>();
|
||||
public HashMap<Integer,QuestCategory> categoriesSync = new HashMap<Integer, QuestCategory>();
|
||||
public HashMap<Integer,Quest> quests = new HashMap<Integer, Quest>();
|
||||
|
||||
public static QuestController instance;
|
||||
@@ -142,6 +146,7 @@ public class QuestController implements IQuestHandler {
|
||||
for(int dia : cat.quests.keySet())
|
||||
quests.remove(dia);
|
||||
categories.remove(category);
|
||||
Server.sendToAll(EnumPacketClient.SYNC_REMOVE, SyncType.QUEST_CATEGORY, category);
|
||||
}
|
||||
|
||||
public void saveCategory(QuestCategory category){
|
||||
@@ -172,6 +177,7 @@ public class QuestController implements IQuestHandler {
|
||||
dir.mkdirs();
|
||||
}
|
||||
categories.put(category.id, category);
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.QUEST_CATEGORY, category.writeNBT(new NBTTagCompound()));
|
||||
}
|
||||
private boolean containsCategoryName(String name) {
|
||||
name = name.toLowerCase();
|
||||
@@ -219,6 +225,7 @@ public class QuestController implements IQuestHandler {
|
||||
if(file2.exists())
|
||||
file2.delete();
|
||||
file.renameTo(file2);
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.QUEST, quest.writeToNBT(new NBTTagCompound()), category.id);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -230,6 +237,7 @@ public class QuestController implements IQuestHandler {
|
||||
return;
|
||||
quests.remove(quest.id);
|
||||
quest.category.quests.remove(quest.id);
|
||||
Server.sendToAll(EnumPacketClient.SYNC_REMOVE, SyncType.QUEST, quest.id);
|
||||
}
|
||||
|
||||
private File getDir(){
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
package noppes.npcs.controllers;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.SyncType;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class SyncController {
|
||||
|
||||
public static void syncPlayer(EntityPlayerMP player){
|
||||
NBTTagList list = new NBTTagList();
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
|
||||
for(Faction faction : FactionController.getInstance().factions.values()){
|
||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||
faction.writeNBT(nbtTagCompound);
|
||||
list.appendTag(nbtTagCompound);
|
||||
if(list.tagCount() > 20){
|
||||
compound = new NBTTagCompound();
|
||||
compound.setTag("Data", list);
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.FACTION, compound);
|
||||
list = new NBTTagList();
|
||||
}
|
||||
}
|
||||
compound = new NBTTagCompound();
|
||||
compound.setTag("Data", list);
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.FACTION, compound);
|
||||
|
||||
for(QuestCategory category : QuestController.instance.categories.values()){
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, category.writeNBT(new NBTTagCompound()));
|
||||
}
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.QUEST_CATEGORY, new NBTTagCompound());
|
||||
|
||||
for(DialogCategory category : DialogController.instance.categories.values()){
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, category.writeNBT(new NBTTagCompound()));
|
||||
}
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.DIALOG_CATEGORY, new NBTTagCompound());
|
||||
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.PLAYER_DATA, data.getNBT());
|
||||
}
|
||||
|
||||
public static void syncAllDialogs() {
|
||||
for(DialogCategory category : DialogController.instance.categories.values()){
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, category.writeNBT(new NBTTagCompound()));
|
||||
}
|
||||
Server.sendToAll(EnumPacketClient.SYNC_END, SyncType.DIALOG_CATEGORY, new NBTTagCompound());
|
||||
}
|
||||
|
||||
public static void syncAllQuests() {
|
||||
for(QuestCategory category : QuestController.instance.categories.values()){
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, category.writeNBT(new NBTTagCompound()));
|
||||
}
|
||||
Server.sendToAll(EnumPacketClient.SYNC_END, SyncType.QUEST_CATEGORY, new NBTTagCompound());
|
||||
}
|
||||
|
||||
public static void clientSync(int synctype, NBTTagCompound compound, boolean syncEnd) {
|
||||
if(synctype == SyncType.FACTION){
|
||||
NBTTagList list = compound.getTagList("Data", 10);
|
||||
for(int i = 0; i < list.tagCount(); i++)
|
||||
{
|
||||
Faction faction = new Faction();
|
||||
faction.readNBT(list.getCompoundTagAt(i));
|
||||
FactionController.getInstance().factionsSync.put(faction.id, faction);
|
||||
}
|
||||
if(syncEnd){
|
||||
FactionController.getInstance().factions = FactionController.getInstance().factionsSync;
|
||||
FactionController.getInstance().factionsSync = new HashMap<Integer, Faction>();
|
||||
}
|
||||
}
|
||||
else if(synctype == SyncType.QUEST_CATEGORY){
|
||||
if(!compound.hasNoTags()){
|
||||
QuestCategory category = new QuestCategory();
|
||||
category.readNBT(compound);
|
||||
QuestController.instance.categoriesSync.put(category.id, category);
|
||||
}
|
||||
if(syncEnd){
|
||||
HashMap<Integer,Quest> quests = new HashMap<Integer, Quest>();
|
||||
for(QuestCategory category : QuestController.instance.categoriesSync.values()){
|
||||
for(Quest quest : category.quests.values()){
|
||||
quests.put(quest.id, quest);
|
||||
}
|
||||
}
|
||||
QuestController.instance.categories = QuestController.instance.categoriesSync;
|
||||
QuestController.instance.quests = quests;
|
||||
QuestController.instance.categoriesSync = new HashMap<Integer, QuestCategory>();
|
||||
}
|
||||
}
|
||||
else if(synctype == SyncType.DIALOG_CATEGORY){
|
||||
if(!compound.hasNoTags()){
|
||||
DialogCategory category = new DialogCategory();
|
||||
category.readNBT(compound);
|
||||
DialogController.instance.categoriesSync.put(category.id, category);
|
||||
}
|
||||
if(syncEnd){
|
||||
HashMap<Integer,Dialog> dialogs = new HashMap<Integer, Dialog>();
|
||||
for(DialogCategory category : DialogController.instance.categoriesSync.values()){
|
||||
for(Dialog dialog : category.dialogs.values()){
|
||||
dialogs.put(dialog.id, dialog);
|
||||
}
|
||||
}
|
||||
DialogController.instance.categories = DialogController.instance.categoriesSync;
|
||||
DialogController.instance.dialogs = dialogs;
|
||||
DialogController.instance.categoriesSync = new HashMap<Integer, DialogCategory>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void clientSyncUpdate(int synctype, NBTTagCompound compound, ByteBuf buffer) {
|
||||
if(synctype == SyncType.FACTION){
|
||||
Faction faction = new Faction();
|
||||
faction.readNBT(compound);
|
||||
FactionController.getInstance().factions.put(faction.id, faction);
|
||||
}
|
||||
else if(synctype == SyncType.DIALOG){
|
||||
DialogCategory category = DialogController.instance.categories.get(buffer.readInt());
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.category = category;
|
||||
dialog.readNBT(compound);
|
||||
DialogController.instance.dialogs.put(dialog.id, dialog);
|
||||
category.dialogs.put(dialog.id, dialog);
|
||||
}
|
||||
else if(synctype == SyncType.DIALOG_CATEGORY){
|
||||
DialogCategory category = new DialogCategory();
|
||||
category.readNBT(compound);
|
||||
DialogController.instance.categories.put(category.id, category);
|
||||
}
|
||||
else if(synctype == SyncType.QUEST){
|
||||
QuestCategory category = QuestController.instance.categories.get(buffer.readInt());
|
||||
Quest quest = new Quest();
|
||||
quest.category = category;
|
||||
quest.readNBT(compound);
|
||||
QuestController.instance.quests.put(quest.id, quest);
|
||||
category.quests.put(quest.id, quest);
|
||||
}
|
||||
else if(synctype == SyncType.QUEST_CATEGORY){
|
||||
QuestCategory category = new QuestCategory();
|
||||
category.readNBT(compound);
|
||||
QuestController.instance.categories.put(category.id, category);
|
||||
}
|
||||
}
|
||||
|
||||
public static void clientSyncRemove(int synctype, int id) {
|
||||
if(synctype == SyncType.FACTION){
|
||||
FactionController.getInstance().factions.remove(id);
|
||||
}
|
||||
else if(synctype == SyncType.DIALOG){
|
||||
Dialog dialog = DialogController.instance.dialogs.remove(id);
|
||||
if(dialog != null) {
|
||||
dialog.category.dialogs.remove(id);
|
||||
}
|
||||
}
|
||||
else if(synctype == SyncType.DIALOG_CATEGORY){
|
||||
DialogCategory category = DialogController.instance.categories.remove(id);
|
||||
if(category != null) {
|
||||
DialogController.instance.dialogs.keySet().removeAll(category.dialogs.keySet());
|
||||
}
|
||||
}
|
||||
else if(synctype == SyncType.QUEST){
|
||||
Quest quest = QuestController.instance.quests.remove(id);
|
||||
if(quest != null) {
|
||||
quest.category.quests.remove(id);
|
||||
}
|
||||
}
|
||||
else if(synctype == SyncType.QUEST_CATEGORY){
|
||||
QuestCategory category = QuestController.instance.categories.remove(id);
|
||||
if(category != null) {
|
||||
QuestController.instance.quests.keySet().removeAll(category.quests.keySet());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public class Faction implements IFaction {
|
||||
}
|
||||
|
||||
public int playerStatus(IPlayer player) {
|
||||
PlayerFactionData data = PlayerData.get((EntityPlayer) player.getMCEntity()).factionData;
|
||||
PlayerFactionData data = PlayerDataController.instance.getPlayerData((EntityPlayer) player.getMCEntity()).factionData;
|
||||
int points = data.getFactionPoints(this.id);
|
||||
if (points >= this.friendlyPoints) {
|
||||
return 1;
|
||||
|
||||
@@ -50,6 +50,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
public int companionID = 0;
|
||||
|
||||
public boolean isGUIOpen = false;
|
||||
public boolean updateClient = false;
|
||||
|
||||
@Override
|
||||
public void saveNBTData(NBTTagCompound nbtTagCompound) {
|
||||
@@ -69,6 +70,15 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
setNBT(data);
|
||||
}
|
||||
|
||||
public NBTTagCompound getSyncNBT(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
dialogData.saveNBTData(compound);
|
||||
questData.saveNBTData(compound);
|
||||
factionData.saveNBTData(compound);
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void setNBT(NBTTagCompound data){
|
||||
dialogData.loadNBTData(data);
|
||||
bankData.loadNBTData(data);
|
||||
@@ -158,7 +168,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
activeCompanion = npc;
|
||||
if(npc != null)
|
||||
((RoleCompanion)npc.roleInterface).companionID = companionID;
|
||||
save();
|
||||
save(false);
|
||||
}
|
||||
|
||||
public void updateCompanion(World world) {
|
||||
@@ -299,7 +309,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
return mailData;
|
||||
}
|
||||
|
||||
public synchronized void save() {
|
||||
public synchronized void save(boolean update) {
|
||||
final NBTTagCompound compound = getNBT();
|
||||
final String filename = uuid + ".json";
|
||||
|
||||
@@ -319,5 +329,8 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
|
||||
PlayerDataController.instance.putPlayerMap(playername, uuid);
|
||||
});
|
||||
|
||||
if(update)
|
||||
updateClient = true;
|
||||
}
|
||||
}
|
||||
@@ -48,9 +48,11 @@ public class PlayerDialogData implements IPlayerDialogData {
|
||||
|
||||
public void readDialog(int id) {
|
||||
dialogsRead.add(id);
|
||||
parent.updateClient = true;
|
||||
}
|
||||
|
||||
public void unreadDialog(int id) {
|
||||
dialogsRead.remove(id);
|
||||
parent.updateClient = true;
|
||||
}
|
||||
}
|
||||
@@ -175,6 +175,7 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
activeQuests.put(id, questdata);
|
||||
Server.sendData((EntityPlayerMP)parent.player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title);
|
||||
Server.sendData((EntityPlayerMP)parent.player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title);
|
||||
parent.updateClient = true;
|
||||
}
|
||||
|
||||
public void finishQuest(int id) {
|
||||
@@ -186,6 +187,8 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
finishedQuests.put(quest.id, System.currentTimeMillis());
|
||||
else
|
||||
finishedQuests.put(quest.id, parent.player.worldObj.getTotalWorldTime());
|
||||
|
||||
parent.updateClient = true;
|
||||
}
|
||||
|
||||
public void stopQuest(int id) {
|
||||
@@ -193,6 +196,7 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
if (quest == null)
|
||||
return;
|
||||
activeQuests.remove(id);
|
||||
parent.updateClient = true;
|
||||
}
|
||||
|
||||
public void removeQuest(int id) {
|
||||
@@ -201,6 +205,7 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
return;
|
||||
activeQuests.remove(id);
|
||||
finishedQuests.remove(id);
|
||||
parent.updateClient = true;
|
||||
}
|
||||
|
||||
public boolean hasFinishedQuest(int id){
|
||||
|
||||
@@ -18,7 +18,6 @@ import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.util.CustomNPCsScheduler;
|
||||
|
||||
public class ItemNpcWand extends Item{
|
||||
|
||||
|
||||
@@ -99,13 +99,15 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
if (progress == 0 && completed) {
|
||||
data.dialogData.dialogsRead.remove(this.dialog.id);
|
||||
data.questData.checkQuestCompletion(data, EnumQuestType.values()[1]);
|
||||
data.save();
|
||||
data.updateClient = true;
|
||||
data.save(true);
|
||||
}
|
||||
|
||||
if (progress == 1 && !completed) {
|
||||
data.dialogData.dialogsRead.add(this.dialog.id);
|
||||
data.questData.checkQuestCompletion(data, EnumQuestType.values()[1]);
|
||||
data.save();
|
||||
data.updateClient = true;
|
||||
data.save(true);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -161,7 +161,7 @@ public class QuestKill extends QuestInterface implements IQuestKill {
|
||||
this.parent.setKilled(questdata, killed);
|
||||
data.questData.checkQuestCompletion(data, EnumQuestType.values()[2]);
|
||||
data.questData.checkQuestCompletion(data, EnumQuestType.values()[4]);
|
||||
data.save();
|
||||
data.save(true);
|
||||
}
|
||||
} else {
|
||||
throw new CustomNPCsException("Progress has to be between 0 and " + this.amount, new Object[0]);
|
||||
|
||||
@@ -166,7 +166,7 @@ public class QuestLocation extends QuestInterface implements IQuestLocation {
|
||||
if ((!completed || progress != 1) && (completed || progress != 0)) {
|
||||
questData.extraData.setBoolean(this.nbtName, progress == 1);
|
||||
data.questData.checkQuestCompletion(data, EnumQuestType.values()[3]);
|
||||
data.save();
|
||||
data.save(true);
|
||||
}
|
||||
} else {
|
||||
throw new CustomNPCsException("Progress has to be 0 or 1", new Object[0]);
|
||||
|
||||
@@ -5,8 +5,6 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.client.gui.player.GuiFaction;
|
||||
import noppes.npcs.client.gui.player.GuiQuestLog;
|
||||
import noppes.npcs.util.CustomNPCsScheduler;
|
||||
|
||||
public class InventoryTabFactions extends AbstractTab {
|
||||
public InventoryTabFactions() {
|
||||
|
||||
@@ -3,11 +3,8 @@ package tconstruct.client.tabs;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.play.client.C0DPacketCloseWindow;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.client.gui.player.GuiFaction;
|
||||
import noppes.npcs.client.gui.player.GuiQuestLog;
|
||||
import noppes.npcs.util.CustomNPCsScheduler;
|
||||
|
||||
public class InventoryTabQuests extends AbstractTab {
|
||||
public InventoryTabQuests() {
|
||||
|
||||
Reference in new issue
Block a user