mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 15:24:46 +00:00
Capital "I" for Instance
This commit is contained in:
1 parent
772f5a999d
commit
16d02f93e1
12 files changed
+39
-45
No files matched your search
@@ -43,7 +43,7 @@ public class FactionCommand extends CommandKamkeelBase {
|
||||
String playername = args[0];
|
||||
String factionname = args[1];
|
||||
|
||||
data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||
data = PlayerDataController.Instance.getPlayersData(sender, playername);
|
||||
if (data.isEmpty()) {
|
||||
sendError(sender, "Unknown player: " + playername);
|
||||
return;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
return;
|
||||
}
|
||||
|
||||
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||
List<PlayerData> data = PlayerDataController.Instance.getPlayersData(sender, playername);
|
||||
|
||||
if (data.isEmpty()) {
|
||||
sendError(sender, "Unknown player: " + playername);
|
||||
@@ -80,7 +80,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
return;
|
||||
}
|
||||
|
||||
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||
List<PlayerData> data = PlayerDataController.Instance.getPlayersData(sender, playername);
|
||||
if (data.isEmpty()) {
|
||||
sendError(sender, String.format("Unknown player '%s'", playername));
|
||||
return;
|
||||
@@ -123,7 +123,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
sendError(sender, "QuestID must be an integer: " + args[1]);
|
||||
return;
|
||||
}
|
||||
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||
List<PlayerData> data = PlayerDataController.Instance.getPlayersData(sender, playername);
|
||||
if (data.isEmpty()) {
|
||||
sendError(sender, String.format("Unknown player '%s'", playername));
|
||||
return;
|
||||
@@ -154,7 +154,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
return;
|
||||
}
|
||||
|
||||
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||
List<PlayerData> data = PlayerDataController.Instance.getPlayersData(sender, playername);
|
||||
if (data.isEmpty()) {
|
||||
sendError(sender, String.format("Unknown player '%s'", playername));
|
||||
return;
|
||||
|
||||
@@ -216,17 +216,17 @@ public class DataAdvanced {
|
||||
npc.jobInterface = new JobGuard(npc);
|
||||
else if (job == EnumJobType.ItemGiver && !(npc.jobInterface instanceof JobItemGiver)) {
|
||||
if (!npc.isRemote()) {
|
||||
if (npc.itemGiverId > 0 && GlobalDataController.instance.itemGivers.containsKey(npc.itemGiverId)) {
|
||||
GlobalDataController.instance.itemGivers.get(npc.itemGiverId).npc = npc;
|
||||
npc.jobInterface = GlobalDataController.instance.itemGivers.get(npc.itemGiverId);
|
||||
if (npc.itemGiverId > 0 && GlobalDataController.Instance.itemGivers.containsKey(npc.itemGiverId)) {
|
||||
GlobalDataController.Instance.itemGivers.get(npc.itemGiverId).npc = npc;
|
||||
npc.jobInterface = GlobalDataController.Instance.itemGivers.get(npc.itemGiverId);
|
||||
} else {
|
||||
npc.jobInterface = new JobItemGiver(npc);
|
||||
if (npc.itemGiverId == -1) {
|
||||
((JobItemGiver) npc.jobInterface).itemGiverId = GlobalDataController.instance.incrementItemGiverId();
|
||||
((JobItemGiver) npc.jobInterface).itemGiverId = GlobalDataController.Instance.incrementItemGiverId();
|
||||
} else {
|
||||
((JobItemGiver) npc.jobInterface).itemGiverId = npc.itemGiverId;
|
||||
}
|
||||
GlobalDataController.instance.itemGivers.put(((JobItemGiver) npc.jobInterface).itemGiverId, (JobItemGiver) npc.jobInterface);
|
||||
GlobalDataController.Instance.itemGivers.put(((JobItemGiver) npc.jobInterface).itemGiverId, (JobItemGiver) npc.jobInterface);
|
||||
npc.itemGiverId = ((JobItemGiver) npc.jobInterface).itemGiverId;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -173,7 +173,7 @@ public class PacketHandlerPlayer{
|
||||
return;
|
||||
int slot = buffer.readInt();
|
||||
int bankId = buffer.readInt();
|
||||
BankData data = PlayerDataController.instance.getBankData(player,bankId).getBankOrDefault(bankId);
|
||||
BankData data = PlayerDataController.Instance.getBankData(player,bankId).getBankOrDefault(bankId);
|
||||
data.openBankGui(player, npc, bankId, slot);
|
||||
}
|
||||
else if(type == EnumPlayerPacket.Dialog){
|
||||
@@ -183,25 +183,25 @@ public class PacketHandlerPlayer{
|
||||
NoppesUtilPlayer.dialogSelected(buffer.readInt(), buffer.readInt(), player, npc);
|
||||
}
|
||||
else if(type == EnumPlayerPacket.CheckQuestCompletion){
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerQuestData questData = PlayerDataController.instance.getPlayerData(player).questData;
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
PlayerQuestData questData = PlayerDataController.Instance.getPlayerData(player).questData;
|
||||
questData.checkQuestCompletion(playerData, null);
|
||||
}
|
||||
else if(type == EnumPlayerPacket.QuestLog){
|
||||
NoppesUtilPlayer.sendQuestLogData(player);
|
||||
}
|
||||
else if(type == EnumPlayerPacket.FactionsGet){
|
||||
PlayerFactionData data = PlayerDataController.instance.getPlayerData(player).factionData;
|
||||
PlayerFactionData data = PlayerDataController.Instance.getPlayerData(player).factionData;
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, data.getPlayerGuiData());
|
||||
}
|
||||
else if(type == EnumPlayerPacket.MailGet){
|
||||
PlayerMailData data = PlayerDataController.instance.getPlayerData(player).mailData;
|
||||
PlayerMailData data = PlayerDataController.Instance.getPlayerData(player).mailData;
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, data.saveNBTData(new NBTTagCompound()));
|
||||
}
|
||||
else if(type == EnumPlayerPacket.MailDelete){
|
||||
long time = buffer.readLong();
|
||||
String username = Server.readString(buffer);
|
||||
PlayerMailData data = PlayerDataController.instance.getPlayerData(player).mailData;
|
||||
PlayerMailData data = PlayerDataController.Instance.getPlayerData(player).mailData;
|
||||
|
||||
Iterator<PlayerMail> it = data.playermail.iterator();
|
||||
while(it.hasNext()){
|
||||
@@ -215,7 +215,7 @@ public class PacketHandlerPlayer{
|
||||
else if(type == EnumPlayerPacket.MailSend){
|
||||
if(!(player.openContainer instanceof ContainerMail))
|
||||
return;
|
||||
String username = PlayerDataController.instance.hasPlayer(Server.readString(buffer));
|
||||
String username = PlayerDataController.Instance.hasPlayer(Server.readString(buffer));
|
||||
if(username.isEmpty()){
|
||||
NoppesUtilServer.sendGuiError(player, 0);
|
||||
return;
|
||||
@@ -234,7 +234,7 @@ public class PacketHandlerPlayer{
|
||||
NoppesUtilServer.sendGuiError(player, 1);
|
||||
return;
|
||||
}
|
||||
PlayerDataController.instance.addPlayerMessage(username, mail);
|
||||
PlayerDataController.Instance.addPlayerMessage(username, mail);
|
||||
|
||||
NBTTagCompound comp = new NBTTagCompound();
|
||||
comp.setString("username", username);
|
||||
@@ -244,7 +244,7 @@ public class PacketHandlerPlayer{
|
||||
long time = buffer.readLong();
|
||||
String username = Server.readString(buffer);
|
||||
player.closeContainer();
|
||||
PlayerMailData data = PlayerDataController.instance.getPlayerData(player).mailData;
|
||||
PlayerMailData data = PlayerDataController.Instance.getPlayerData(player).mailData;
|
||||
|
||||
Iterator<PlayerMail> it = data.playermail.iterator();
|
||||
while(it.hasNext()){
|
||||
@@ -259,7 +259,7 @@ public class PacketHandlerPlayer{
|
||||
else if(type == EnumPlayerPacket.MailRead){
|
||||
long time = buffer.readLong();
|
||||
String username = Server.readString(buffer);
|
||||
PlayerMailData data = PlayerDataController.instance.getPlayerData(player).mailData;
|
||||
PlayerMailData data = PlayerDataController.Instance.getPlayerData(player).mailData;
|
||||
|
||||
Iterator<PlayerMail> it = data.playermail.iterator();
|
||||
while(it.hasNext()){
|
||||
|
||||
@@ -6,7 +6,6 @@ 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;
|
||||
@@ -28,7 +27,6 @@ import net.minecraft.world.WorldProvider;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.ITag;
|
||||
import noppes.npcs.config.ConfigDebug;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.config.ConfigScript;
|
||||
@@ -1006,7 +1004,7 @@ public class PacketHandlerServer{
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else if(type == EnumPacketServer.CloneSave){
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerData data = PlayerDataController.Instance.getPlayerData(player);
|
||||
if(data.cloned == null)
|
||||
return;
|
||||
String name = Server.readString(buffer);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class QuestLogData {
|
||||
trackedQuestKey = compound.getString("TrackedQuestID");
|
||||
}
|
||||
public void setData(EntityPlayer player){
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
|
||||
for(Quest quest : PlayerQuestController.getActiveQuests(player))
|
||||
{
|
||||
|
||||
@@ -25,7 +25,6 @@ import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.entity.player.*;
|
||||
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.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
@@ -64,19 +63,19 @@ public class ScriptPlayerEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayerDataController.instance != null) {
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
if (PlayerDataController.Instance != null) {
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
|
||||
if (playerData.timers.size() > 0) {
|
||||
playerData.timers.update();
|
||||
}
|
||||
|
||||
if (playerData.questData.getTrackedQuest() != null && !playerData.questData.activeQuests.containsKey(playerData.questData.getTrackedQuest().getId())) {
|
||||
PlayerDataController.instance.getPlayerData(player).questData.untrackQuest();
|
||||
PlayerDataController.Instance.getPlayerData(player).questData.untrackQuest();
|
||||
}
|
||||
|
||||
if (player.ticksExisted % 20 == 0 && !PlayerDataController.instance.getPlayerData(player).skinOverlays.overlayList.isEmpty()) {
|
||||
PlayerDataController.instance.getPlayerData(player).skinOverlays.updateClient();
|
||||
if (player.ticksExisted % 20 == 0 && !PlayerDataController.Instance.getPlayerData(player).skinOverlays.overlayList.isEmpty()) {
|
||||
PlayerDataController.Instance.getPlayerData(player).skinOverlays.updateClient();
|
||||
}
|
||||
|
||||
if (player.ticksExisted % (TrackedQuestUpdateFrequency * 20) == 0) {
|
||||
@@ -476,12 +475,12 @@ public class ScriptPlayerEventHandler {
|
||||
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(event.player);
|
||||
EventHooks.onPlayerLogin(handler, scriptPlayer);
|
||||
|
||||
Quest quest = (Quest) PlayerDataController.instance.getPlayerData(event.player).questData.getTrackedQuest();
|
||||
Quest quest = (Quest) PlayerDataController.Instance.getPlayerData(event.player).questData.getTrackedQuest();
|
||||
if (quest != null) {
|
||||
NoppesUtilPlayer.sendTrackedQuestData((EntityPlayerMP) event.player);
|
||||
}
|
||||
|
||||
PlayerDataController.instance.getPlayerData(event.player).skinOverlays.updateClient();
|
||||
PlayerDataController.Instance.getPlayerData(event.player).skinOverlays.updateClient();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ContainerMail extends ContainerNpcInterface{
|
||||
public void onContainerClosed(EntityPlayer player){
|
||||
super.onContainerClosed(player);
|
||||
if(!canEdit && !player.worldObj.isRemote){
|
||||
PlayerMailData data = PlayerDataController.instance.getPlayerData(player).mailData;
|
||||
PlayerMailData data = PlayerDataController.Instance.getPlayerData(player).mailData;
|
||||
Iterator<PlayerMail> it = data.playermail.iterator();
|
||||
while(it.hasNext()){
|
||||
PlayerMail mail = it.next();
|
||||
|
||||
@@ -12,13 +12,13 @@ import java.io.FileOutputStream;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class GlobalDataController {
|
||||
public static GlobalDataController instance;
|
||||
public static GlobalDataController Instance;
|
||||
|
||||
private int itemGiverId = 0;
|
||||
public HashMap<Integer, JobItemGiver> itemGivers = new HashMap<>();
|
||||
|
||||
public GlobalDataController(){
|
||||
instance = this;
|
||||
Instance = this;
|
||||
load();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IExtendedEntityProperties;
|
||||
import noppes.npcs.AnimationData;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.api.handler.*;
|
||||
import noppes.npcs.client.renderer.ImageData;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
@@ -21,7 +19,6 @@ import noppes.npcs.entity.data.DataSkinOverlays;
|
||||
import noppes.npcs.entity.data.DataTimers;
|
||||
import noppes.npcs.roles.RoleCompanion;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.util.CacheHashMap;
|
||||
import noppes.npcs.util.CustomNPCsThreader;
|
||||
import noppes.npcs.util.NBTJsonUtil;
|
||||
|
||||
@@ -219,11 +216,11 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
} else {
|
||||
filename = uuid + ".json";
|
||||
}
|
||||
PlayerDataController.instance.putPlayerMap(playername, uuid);
|
||||
PlayerDataController.instance.putPlayerDataCache(uuid, this);
|
||||
PlayerDataController.Instance.putPlayerMap(playername, uuid);
|
||||
PlayerDataController.Instance.putPlayerDataCache(uuid, this);
|
||||
CustomNPCsThreader.playerDataThread.execute(() -> {
|
||||
try {
|
||||
File saveDir = PlayerDataController.instance.getSaveDir();
|
||||
File saveDir = PlayerDataController.Instance.getSaveDir();
|
||||
File file = new File(saveDir, filename + "_new");
|
||||
File file1 = new File(saveDir, filename);
|
||||
if(ConfigMain.DatFormat){
|
||||
@@ -242,9 +239,9 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
}
|
||||
|
||||
public void load() {
|
||||
NBTTagCompound data = PlayerDataController.instance.loadPlayerData(player.getPersistentID().toString());
|
||||
NBTTagCompound data = PlayerDataController.Instance.loadPlayerData(player.getPersistentID().toString());
|
||||
if(data.hasNoTags()){
|
||||
data = PlayerDataController.instance.loadPlayerDataOld(player.getCommandSenderName());
|
||||
data = PlayerDataController.Instance.loadPlayerDataOld(player.getCommandSenderName());
|
||||
}
|
||||
setNBT(data);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class ItemSoulstoneFilled extends Item {
|
||||
npc.advanced.soulStonePlayerName = player.getDisplayName();
|
||||
npc.advanced.soulStoneInit = true;
|
||||
if(npc.advanced.role == EnumRoleType.Companion && player != null){
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerData data = PlayerDataController.Instance.getPlayerData(player);
|
||||
if(data.hasCompanion())
|
||||
return false;
|
||||
((RoleCompanion)npc.roleInterface).setOwner(player);
|
||||
|
||||
@@ -79,7 +79,7 @@ public class RoleTransporter extends RoleInterface{
|
||||
}
|
||||
|
||||
public void unlock(EntityPlayer player, ITransportLocation loc){
|
||||
PlayerTransportData data = PlayerDataController.instance.getPlayerData(player).transportData;
|
||||
PlayerTransportData data = PlayerDataController.Instance.getPlayerData(player).transportData;
|
||||
if(data.transports.contains(transportId))
|
||||
return;
|
||||
data.transports.add(transportId);
|
||||
|
||||
Reference in new issue
Block a user