mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 15:27:29 +00:00
Remove Sync Configs [Now Dependant]
This commit is contained in:
1 parent
aa1db389da
commit
c2fa601955
2 files changed
+117
-154
No files matched your search
@@ -111,19 +111,6 @@ public class ConfigMain
|
||||
public static Property TrackedQuestUpdateFrequencyProperty;
|
||||
public static int TrackedQuestUpdateFrequency = 5;
|
||||
|
||||
/**
|
||||
* Sync Properties
|
||||
**/
|
||||
|
||||
public static Property SyncQuestAutoProperty;
|
||||
public static boolean SyncQuestAuto = true;
|
||||
|
||||
public static Property SyncDialogAutoProperty;
|
||||
public static boolean SyncDialogAuto = true;
|
||||
|
||||
public static Property SyncFactionAutoProperty;
|
||||
public static boolean SyncFactionAuto = true;
|
||||
|
||||
public static void init(File configFile)
|
||||
{
|
||||
config = new Configuration(configFile);
|
||||
@@ -216,16 +203,6 @@ public class ConfigMain
|
||||
TrackedQuestUpdateFrequencyProperty = config.get(UPDATE, "Tracked Quest Update Frequency", 5, "How often in seconds to update a players tracked quest. [Only applies to Item Quest currently]");
|
||||
TrackedQuestUpdateFrequency = TrackedQuestUpdateFrequencyProperty.getInt(5);
|
||||
|
||||
// Sync
|
||||
SyncQuestAutoProperty = config.get(SYNC, "Auto Sync Quest Data", true, "If enabled client will all Quest Data upon joining the world");
|
||||
SyncQuestAuto = SyncQuestAutoProperty.getBoolean(true);
|
||||
|
||||
SyncDialogAutoProperty = config.get(SYNC, "Auto Sync Dialog Data", true, "If enabled client will all Dialog Data upon joining the world");
|
||||
SyncDialogAuto = SyncDialogAutoProperty.getBoolean(true);
|
||||
|
||||
SyncFactionAutoProperty = config.get(SYNC, "Auto Sync Faction Data", true, "If enabled client will all Faction Data upon joining the world");
|
||||
SyncFactionAuto = SyncFactionAutoProperty.getBoolean(true);
|
||||
|
||||
// Convert to Legacy
|
||||
if(CustomNpcs.legacyExist){
|
||||
EnableUpdateChecker = LegacyConfig.EnableUpdateChecker;
|
||||
|
||||
@@ -20,74 +20,68 @@ public class SyncController {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Faction Sync
|
||||
if(ConfigMain.SyncFactionAuto){
|
||||
for(Faction faction : FactionController.getInstance().factions.values()){
|
||||
NBTTagCompound factioNBT = new NBTTagCompound();
|
||||
faction.writeNBT(factioNBT);
|
||||
list.appendTag(factioNBT);
|
||||
if(list.tagCount() > 20){
|
||||
compound = new NBTTagCompound();
|
||||
compound.setTag("Data", list);
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.FACTION, compound);
|
||||
list = new NBTTagList();
|
||||
}
|
||||
for(Faction faction : FactionController.getInstance().factions.values()){
|
||||
NBTTagCompound factioNBT = new NBTTagCompound();
|
||||
faction.writeNBT(factioNBT);
|
||||
list.appendTag(factioNBT);
|
||||
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);
|
||||
}
|
||||
compound = new NBTTagCompound();
|
||||
compound.setTag("Data", list);
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.FACTION, compound);
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Quest Sync
|
||||
if(ConfigMain.SyncQuestAuto){
|
||||
for(QuestCategory category : QuestController.Instance.categories.values()){
|
||||
NBTTagCompound questCompound;
|
||||
NBTTagList questList = new NBTTagList();
|
||||
for(int questID : category.quests.keySet()){
|
||||
Quest quest = category.quests.get(questID);
|
||||
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
|
||||
if(questList.tagCount() > 50){
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
questList = new NBTTagList();
|
||||
}
|
||||
for(QuestCategory category : QuestController.Instance.categories.values()){
|
||||
NBTTagCompound questCompound;
|
||||
NBTTagList questList = new NBTTagList();
|
||||
for(int questID : category.quests.keySet()){
|
||||
Quest quest = category.quests.get(questID);
|
||||
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
|
||||
if(questList.tagCount() > 50){
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
questList = new NBTTagList();
|
||||
}
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
}
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.QUEST_CATEGORY, new NBTTagCompound());
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
}
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.QUEST_CATEGORY, new NBTTagCompound());
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Dialog Sync
|
||||
if(ConfigMain.SyncDialogAuto){
|
||||
for(DialogCategory category : DialogController.Instance.categories.values()){
|
||||
NBTTagCompound dialogCompound;
|
||||
NBTTagList dialogList = new NBTTagList();
|
||||
for(int dialogID : category.dialogs.keySet()){
|
||||
Dialog dialog = category.dialogs.get(dialogID);
|
||||
dialogList.appendTag(dialog.writeToNBT(new NBTTagCompound()));
|
||||
if(dialogList.tagCount() > 50){
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogList = new NBTTagList();
|
||||
}
|
||||
for(DialogCategory category : DialogController.Instance.categories.values()){
|
||||
NBTTagCompound dialogCompound;
|
||||
NBTTagList dialogList = new NBTTagList();
|
||||
for(int dialogID : category.dialogs.keySet()){
|
||||
Dialog dialog = category.dialogs.get(dialogID);
|
||||
dialogList.appendTag(dialog.writeToNBT(new NBTTagCompound()));
|
||||
if(dialogList.tagCount() > 50){
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogList = new NBTTagList();
|
||||
}
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
}
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.DIALOG_CATEGORY, new NBTTagCompound());
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
}
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.DIALOG_CATEGORY, new NBTTagCompound());
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PlayerData data = PlayerData.get(player);
|
||||
@@ -96,97 +90,89 @@ public class SyncController {
|
||||
}
|
||||
|
||||
public static void syncAllDialogs() {
|
||||
if(ConfigMain.SyncDialogAuto){
|
||||
for(DialogCategory category : DialogController.Instance.categories.values()){
|
||||
NBTTagCompound dialogCompound;
|
||||
NBTTagList dialogList = new NBTTagList();
|
||||
for(int dialogID : category.dialogs.keySet()){
|
||||
Dialog dialog = category.dialogs.get(dialogID);
|
||||
dialogList.appendTag(dialog.writeToNBT(new NBTTagCompound()));
|
||||
if(dialogList.tagCount() > 50){
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
}
|
||||
Server.sendToAll(EnumPacketClient.SYNC_END, SyncType.DIALOG_CATEGORY, new NBTTagCompound());
|
||||
}
|
||||
}
|
||||
|
||||
public static void syncAllQuests() {
|
||||
if(ConfigMain.SyncQuestAuto){
|
||||
for(QuestCategory category : QuestController.Instance.categories.values()){
|
||||
NBTTagCompound questCompound;
|
||||
NBTTagList questList = new NBTTagList();
|
||||
for(int questID : category.quests.keySet()){
|
||||
Quest quest = category.quests.get(questID);
|
||||
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
|
||||
if(questList.tagCount() > 50){
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
questList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
}
|
||||
Server.sendToAll(EnumPacketClient.SYNC_END, SyncType.QUEST_CATEGORY, new NBTTagCompound());
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateQuestCat(QuestCategory questCategory) {
|
||||
if(ConfigMain.SyncQuestAuto){
|
||||
NBTTagCompound questCompound;
|
||||
NBTTagList questList = new NBTTagList();
|
||||
for(int questID : questCategory.quests.keySet()){
|
||||
Quest quest = questCategory.quests.get(questID);
|
||||
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
|
||||
if(questList.tagCount() > 50){
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", questCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.QUEST_CATEGORY, questCompound);
|
||||
questList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", questCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.QUEST_CATEGORY, questCompound);
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateDialogCat(DialogCategory dialogCategory) {
|
||||
if(ConfigMain.SyncDialogAuto){
|
||||
for(DialogCategory category : DialogController.Instance.categories.values()){
|
||||
NBTTagCompound dialogCompound;
|
||||
NBTTagList dialogList = new NBTTagList();
|
||||
for(int questID : dialogCategory.dialogs.keySet()){
|
||||
Dialog dialog = dialogCategory.dialogs.get(questID);
|
||||
for(int dialogID : category.dialogs.keySet()){
|
||||
Dialog dialog = category.dialogs.get(dialogID);
|
||||
dialogList.appendTag(dialog.writeToNBT(new NBTTagCompound()));
|
||||
if(dialogList.tagCount() > 50){
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", dialogCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", dialogCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
}
|
||||
Server.sendToAll(EnumPacketClient.SYNC_END, SyncType.DIALOG_CATEGORY, new NBTTagCompound());
|
||||
}
|
||||
|
||||
public static void syncAllQuests() {
|
||||
for(QuestCategory category : QuestController.Instance.categories.values()){
|
||||
NBTTagCompound questCompound;
|
||||
NBTTagList questList = new NBTTagList();
|
||||
for(int questID : category.quests.keySet()){
|
||||
Quest quest = category.quests.get(questID);
|
||||
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
|
||||
if(questList.tagCount() > 50){
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
questList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
}
|
||||
Server.sendToAll(EnumPacketClient.SYNC_END, SyncType.QUEST_CATEGORY, new NBTTagCompound());
|
||||
}
|
||||
|
||||
public static void updateQuestCat(QuestCategory questCategory) {
|
||||
NBTTagCompound questCompound;
|
||||
NBTTagList questList = new NBTTagList();
|
||||
for(int questID : questCategory.quests.keySet()){
|
||||
Quest quest = questCategory.quests.get(questID);
|
||||
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
|
||||
if(questList.tagCount() > 50){
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", questCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.QUEST_CATEGORY, questCompound);
|
||||
questList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", questCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.QUEST_CATEGORY, questCompound);
|
||||
}
|
||||
|
||||
public static void updateDialogCat(DialogCategory dialogCategory) {
|
||||
NBTTagCompound dialogCompound;
|
||||
NBTTagList dialogList = new NBTTagList();
|
||||
for(int questID : dialogCategory.dialogs.keySet()){
|
||||
Dialog dialog = dialogCategory.dialogs.get(questID);
|
||||
dialogList.appendTag(dialog.writeToNBT(new NBTTagCompound()));
|
||||
if(dialogList.tagCount() > 50){
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", dialogCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", dialogCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
}
|
||||
|
||||
public static void clientSync(int synctype, NBTTagCompound compound, boolean syncEnd) {
|
||||
|
||||
Reference in new issue
Block a user