mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 19:55:06 +00:00
CAPITAL I cause it looks cool
This commit is contained in:
1 parent
2d0d34bd6e
commit
491e377a3e
40 files changed
+150
-158
No files matched your search
@@ -3,7 +3,6 @@ package foxz.command;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.nashorn.internal.runtime.regexp.joni.Config;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockIce;
|
||||
import net.minecraft.block.BlockLeavesBase;
|
||||
@@ -161,7 +160,7 @@ public class CmdConfig extends ChMcLogger {
|
||||
)
|
||||
public boolean chunkloaders(String[] args){
|
||||
if(args.length == 0){
|
||||
sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + ConfigMain.ChunkLoaders);
|
||||
sendmessage("ChunkLoaders: " + ChunkController.Instance.size() + "/" + ConfigMain.ChunkLoaders);
|
||||
}
|
||||
else{
|
||||
try{
|
||||
@@ -176,12 +175,12 @@ public class CmdConfig extends ChMcLogger {
|
||||
if(ConfigMain.config.hasChanged()){
|
||||
ConfigMain.config.save();
|
||||
}
|
||||
int size = ChunkController.instance.size();
|
||||
int size = ChunkController.Instance.size();
|
||||
if(size > ConfigMain.ChunkLoaders){
|
||||
ChunkController.instance.unload(size - ConfigMain.ChunkLoaders);
|
||||
ChunkController.Instance.unload(size - ConfigMain.ChunkLoaders);
|
||||
sendmessage(size - ConfigMain.ChunkLoaders + " chunksloaders unloaded");
|
||||
}
|
||||
sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + ConfigMain.ChunkLoaders);
|
||||
sendmessage("ChunkLoaders: " + ChunkController.Instance.size() + "/" + ConfigMain.ChunkLoaders);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class CmdDialog extends ChMcLogger {
|
||||
sendmessage("DialogID must be an integer: " + args[1]);
|
||||
return;
|
||||
}
|
||||
Dialog dialog = DialogController.instance.dialogs.get(diagid);
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(diagid);
|
||||
if(dialog == null){
|
||||
sendmessage("Unknown dialog id: " + args[1]);
|
||||
return;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class CmdQuest extends ChMcLogger{
|
||||
sendmessage(String.format("Unknow player '%s'", playername));
|
||||
return false;
|
||||
}
|
||||
Quest quest = QuestController.instance.quests.get(questid);
|
||||
Quest quest = QuestController.Instance.quests.get(questid);
|
||||
if (quest == null){
|
||||
sendmessage("Unknown QuestID");
|
||||
return false;
|
||||
@@ -86,7 +86,7 @@ public class CmdQuest extends ChMcLogger{
|
||||
return false;
|
||||
}
|
||||
|
||||
Quest quest = QuestController.instance.quests.get(questid);
|
||||
Quest quest = QuestController.Instance.quests.get(questid);
|
||||
if (quest == null){
|
||||
sendmessage("Unknown QuestID");
|
||||
return false;
|
||||
@@ -117,7 +117,7 @@ public class CmdQuest extends ChMcLogger{
|
||||
sendmessage(String.format("Unknow player '%s'", playername));
|
||||
return false;
|
||||
}
|
||||
Quest quest = QuestController.instance.quests.get(questid);
|
||||
Quest quest = QuestController.Instance.quests.get(questid);
|
||||
if (quest == null){
|
||||
sendmessage("Unknown QuestID");
|
||||
return false;
|
||||
@@ -148,7 +148,7 @@ public class CmdQuest extends ChMcLogger{
|
||||
sendmessage(String.format("Unknow player '%s'", playername));
|
||||
return false;
|
||||
}
|
||||
Quest quest = QuestController.instance.quests.get(questid);
|
||||
Quest quest = QuestController.Instance.quests.get(questid);
|
||||
if (quest == null){
|
||||
sendmessage("Unknown QuestID");
|
||||
return false;
|
||||
|
||||
@@ -150,7 +150,7 @@ public class ConfigCommand extends CommandKamkeelBase {
|
||||
)
|
||||
public void chunkloaders(ICommandSender sender, String[] args) throws CommandException{
|
||||
if(args.length == 0){
|
||||
sendResult(sender, "ChunkLoaders: \u00A7c" + ChunkController.instance.size() + "\u00A77/\u00A7c" + ConfigMain.ChunkLoaders);
|
||||
sendResult(sender, "ChunkLoaders: \u00A7c" + ChunkController.Instance.size() + "\u00A77/\u00A7c" + ConfigMain.ChunkLoaders);
|
||||
}
|
||||
else{
|
||||
try{
|
||||
@@ -165,12 +165,12 @@ public class ConfigCommand extends CommandKamkeelBase {
|
||||
ConfigMain.config.save();
|
||||
}
|
||||
|
||||
int size = ChunkController.instance.size();
|
||||
int size = ChunkController.Instance.size();
|
||||
if(size > ConfigMain.ChunkLoaders){
|
||||
ChunkController.instance.unload(size - ConfigMain.ChunkLoaders);
|
||||
ChunkController.Instance.unload(size - ConfigMain.ChunkLoaders);
|
||||
sendResult(sender, size - ConfigMain.ChunkLoaders + " chunksloaders unloaded");
|
||||
}
|
||||
sendResult(sender, "ChunkLoaders: \u00A7c" + ChunkController.instance.size() + "\u00A77/\u00A7c" + ConfigMain.ChunkLoaders);
|
||||
sendResult(sender, "ChunkLoaders: \u00A7c" + ChunkController.Instance.size() + "\u00A77/\u00A7c" + ConfigMain.ChunkLoaders);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class DialogCategoryCommand extends CommandKamkeelBase {
|
||||
}
|
||||
|
||||
String catName = String.join(" ", args).toLowerCase();
|
||||
final Collection<DialogCategory> dialogCats = DialogController.instance.categories.values();
|
||||
final Collection<DialogCategory> dialogCats = DialogController.Instance.categories.values();
|
||||
int count = 0;
|
||||
for(DialogCategory cat : dialogCats){
|
||||
if(cat.getName().toLowerCase().contains(catName)){
|
||||
@@ -67,7 +67,7 @@ public class DialogCategoryCommand extends CommandKamkeelBase {
|
||||
return;
|
||||
}
|
||||
|
||||
DialogCategory dialogCategory = DialogController.instance.categories.get(dialogCatId);
|
||||
DialogCategory dialogCategory = DialogController.Instance.categories.get(dialogCatId);
|
||||
if (dialogCategory == null){
|
||||
sendError(sender, "Unknown DialogCatID: " + dialogCatId);
|
||||
return;
|
||||
@@ -108,7 +108,7 @@ public class DialogCategoryCommand extends CommandKamkeelBase {
|
||||
return;
|
||||
}
|
||||
|
||||
DialogCategory dialogCategory = DialogController.instance.categories.get(dialogCatId);
|
||||
DialogCategory dialogCategory = DialogController.Instance.categories.get(dialogCatId);
|
||||
if (dialogCategory == null){
|
||||
sendError(sender, "Unknown DialogCatID: " + dialogCatId);
|
||||
return;
|
||||
|
||||
@@ -104,7 +104,7 @@ public class DialogCommand extends CommandKamkeelBase {
|
||||
sendError(sender, "DialogID must be an integer: " + args[1]);
|
||||
return;
|
||||
}
|
||||
Dialog dialog = DialogController.instance.dialogs.get(diagid);
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(diagid);
|
||||
if(dialog == null){
|
||||
sendError(sender, "Unknown dialog id: " + args[1]);
|
||||
return;
|
||||
|
||||
@@ -11,10 +11,8 @@ import noppes.npcs.controllers.QuestController;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.controllers.data.QuestCategory;
|
||||
import noppes.npcs.controllers.data.QuestData;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class QuestCategoryCommand extends CommandKamkeelBase {
|
||||
@@ -40,7 +38,7 @@ public class QuestCategoryCommand extends CommandKamkeelBase {
|
||||
}
|
||||
|
||||
String catName = String.join(" ", args).toLowerCase();
|
||||
final Collection<QuestCategory> questCats = QuestController.instance.categories.values();
|
||||
final Collection<QuestCategory> questCats = QuestController.Instance.categories.values();
|
||||
int count = 0;
|
||||
for(QuestCategory cat : questCats){
|
||||
if(cat.getName().toLowerCase().contains(catName)){
|
||||
@@ -75,7 +73,7 @@ public class QuestCategoryCommand extends CommandKamkeelBase {
|
||||
return;
|
||||
}
|
||||
|
||||
QuestCategory questCategory = QuestController.instance.categories.get(questcatid);
|
||||
QuestCategory questCategory = QuestController.Instance.categories.get(questcatid);
|
||||
if (questCategory == null){
|
||||
sendError(sender, "Unknown QuestCatID: " + questcatid);
|
||||
return;
|
||||
@@ -128,7 +126,7 @@ public class QuestCategoryCommand extends CommandKamkeelBase {
|
||||
return;
|
||||
}
|
||||
|
||||
QuestCategory questCategory = QuestController.instance.categories.get(questcatid);
|
||||
QuestCategory questCategory = QuestController.Instance.categories.get(questcatid);
|
||||
if (questCategory == null){
|
||||
sendError(sender, "Unknown QuestCatID: " + questcatid);
|
||||
return;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
return;
|
||||
}
|
||||
|
||||
Quest quest = QuestController.instance.quests.get(questid);
|
||||
Quest quest = QuestController.Instance.quests.get(questid);
|
||||
if (quest == null){
|
||||
sendError(sender, "Unknown QuestID: " + questid);
|
||||
return;
|
||||
@@ -86,7 +86,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
return;
|
||||
}
|
||||
|
||||
Quest quest = QuestController.instance.quests.get(questid);
|
||||
Quest quest = QuestController.Instance.quests.get(questid);
|
||||
if (quest == null){
|
||||
sendError(sender, "Unknown QuestID: " + questid);
|
||||
return;
|
||||
@@ -128,7 +128,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
sendError(sender, String.format("Unknown player '%s'", playername));
|
||||
return;
|
||||
}
|
||||
Quest quest = QuestController.instance.quests.get(questid);
|
||||
Quest quest = QuestController.Instance.quests.get(questid);
|
||||
if (quest == null){
|
||||
sendError(sender, "Unknown QuestID: " + questid);
|
||||
return;
|
||||
@@ -160,7 +160,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
return;
|
||||
}
|
||||
|
||||
Quest quest = QuestController.instance.quests.get(questid);
|
||||
Quest quest = QuestController.Instance.quests.get(questid);
|
||||
if (quest == null){
|
||||
sendError(sender, String.format("Unknown QuestID"));
|
||||
return;
|
||||
@@ -180,7 +180,7 @@ public class QuestCommand extends CommandKamkeelBase {
|
||||
)
|
||||
public void reload(ICommandSender sender, String args[]){
|
||||
new QuestController();
|
||||
QuestController.instance.load();
|
||||
QuestController.Instance.load();
|
||||
sendResult(sender, "Quests Reloaded");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package kamkeel.developer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Developer {
|
||||
@@ -11,10 +9,10 @@ public class Developer {
|
||||
public static HashSet<UUID> ScriptUser = new HashSet<>();
|
||||
public static HashSet<UUID> WandUser = new HashSet<>();
|
||||
public static HashSet<UUID> QuestMaker = new HashSet<>();
|
||||
public static Developer instance;
|
||||
public static Developer Instance;
|
||||
|
||||
public Developer(){
|
||||
instance = this;
|
||||
Instance = this;
|
||||
// Temp for testing
|
||||
Universal.add(UUID.fromString("29cc52dd-2c50-4e8f-a388-be6c497cf0b4"));
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ public class CustomNpcs {
|
||||
|
||||
@EventHandler
|
||||
public void setAboutToStart(FMLServerAboutToStartEvent event) {
|
||||
ChunkController.instance.clear();
|
||||
ChunkController.Instance.clear();
|
||||
new QuestController();
|
||||
new PlayerDataController();
|
||||
new FactionController();
|
||||
@@ -224,10 +224,10 @@ public class CustomNpcs {
|
||||
//Loading items in the about to start event was corrupting items with a damage value
|
||||
@EventHandler
|
||||
public void started(FMLServerStartedEvent event) {
|
||||
RecipeController.instance.load();
|
||||
RecipeController.Instance.load();
|
||||
new DialogController();
|
||||
new BankController();
|
||||
QuestController.instance.load();
|
||||
QuestController.Instance.load();
|
||||
ScriptController.HasStart = true;
|
||||
ServerCloneController.Instance = new ServerCloneController();
|
||||
ServerTagMapController.Instance = new ServerTagMapController();
|
||||
|
||||
@@ -76,7 +76,7 @@ public class CustomNpcsPermissions{
|
||||
|
||||
public static boolean hasPermission(EntityPlayer player, Permission permission){
|
||||
if(player != null){
|
||||
if(Developer.instance.hasUniversal(player.getUniqueID())){
|
||||
if(Developer.Instance.hasUniversal(player.getUniqueID())){
|
||||
return true;
|
||||
}
|
||||
if(permission != null){
|
||||
@@ -89,7 +89,7 @@ public class CustomNpcsPermissions{
|
||||
}
|
||||
|
||||
public static boolean hasCustomPermission(EntityPlayer player, String permission){
|
||||
if(Developer.instance.hasUniversal(player.getUniqueID())){
|
||||
if(Developer.Instance.hasUniversal(player.getUniqueID())){
|
||||
return true;
|
||||
}
|
||||
if(Instance.bukkit != null){
|
||||
|
||||
@@ -3,7 +3,6 @@ package noppes.npcs;
|
||||
import com.google.common.collect.Sets;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
@@ -38,7 +37,7 @@ public class NPCSpawning {
|
||||
private static boolean liquidSpawn;
|
||||
|
||||
public static void findChunksForSpawning(WorldServer world){
|
||||
if(SpawnController.instance.data.isEmpty() || world.getWorldInfo().getWorldTotalTime() % 400L != 0L)
|
||||
if(SpawnController.Instance.data.isEmpty() || world.getWorldInfo().getWorldTotalTime() % 400L != 0L)
|
||||
return;
|
||||
eligibleChunksForSpawning.clear();
|
||||
for (int i = 0; i < world.playerEntities.size(); ++i){
|
||||
@@ -80,7 +79,7 @@ public class NPCSpawning {
|
||||
z += world.rand.nextInt(b1) - world.rand.nextInt(b1);
|
||||
|
||||
String name = world.getBiomeGenForCoords(x, z).biomeName;
|
||||
SpawnData data = SpawnController.instance.getRandomSpawnData(name, world.provider.dimensionId);
|
||||
SpawnData data = SpawnController.Instance.getRandomSpawnData(name, world.provider.dimensionId);
|
||||
if (data == null || !canCreatureTypeSpawnAtLocation(data, world, x, y, z) || world.getClosestPlayer(x, y, z, 24.0D) != null)
|
||||
continue;
|
||||
|
||||
@@ -111,7 +110,7 @@ public class NPCSpawning {
|
||||
public static void performWorldGenSpawning(World world, int x, int z, Random rand){
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(x + 8, z + 8);
|
||||
while (rand.nextFloat() < biome.getSpawningChance()){
|
||||
SpawnData data = SpawnController.instance.getRandomSpawnData(biome.biomeName, world.provider.dimensionId);
|
||||
SpawnData data = SpawnController.Instance.getRandomSpawnData(biome.biomeName, world.provider.dimensionId);
|
||||
if(data == null)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ public class NoppesUtilPlayer {
|
||||
}
|
||||
|
||||
public static void dialogSelected(int dialogId, int optionId, EntityPlayerMP player, EntityNPCInterface npc) {
|
||||
Dialog dialog = DialogController.instance.dialogs.get(dialogId);
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(dialogId);
|
||||
if(dialog == null)
|
||||
return;
|
||||
DialogOption option = dialog.options.get(optionId);
|
||||
@@ -328,7 +328,7 @@ public class NoppesUtilPlayer {
|
||||
String categoryName = splitString[0];
|
||||
String questName = splitString[1];
|
||||
|
||||
for (QuestCategory category : QuestController.instance.categories.values()) {
|
||||
for (QuestCategory category : QuestController.Instance.categories.values()) {
|
||||
if (category.title.equals(categoryName)) {
|
||||
for (Quest quest : category.quests.values()) {
|
||||
if (quest.title.equals(questName)) {
|
||||
|
||||
@@ -400,7 +400,7 @@ public class NoppesUtilServer {
|
||||
|
||||
public static void sendQuestCategoryData(EntityPlayerMP player) {
|
||||
Map<String,Integer> map = new HashMap<String,Integer>();
|
||||
for(QuestCategory category : QuestController.instance.categories.values()){
|
||||
for(QuestCategory category : QuestController.Instance.categories.values()){
|
||||
map.put(category.title, category.id);
|
||||
}
|
||||
sendScrollData(player, map);
|
||||
@@ -423,7 +423,7 @@ public class NoppesUtilServer {
|
||||
PlayerDialogData data = playerdata.dialogData;
|
||||
|
||||
for(int questId : data.dialogsRead){
|
||||
Dialog dialog = DialogController.instance.dialogs.get(questId);
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(questId);
|
||||
if(dialog == null)
|
||||
continue;
|
||||
map.put(dialog.category.title + ": " + dialog.title,questId);
|
||||
@@ -433,13 +433,13 @@ public class NoppesUtilServer {
|
||||
PlayerQuestData data = playerdata.questData;
|
||||
|
||||
for(int questId : data.activeQuests.keySet()){
|
||||
Quest quest = QuestController.instance.quests.get(questId);
|
||||
Quest quest = QuestController.Instance.quests.get(questId);
|
||||
if(quest == null)
|
||||
continue;
|
||||
map.put(quest.category.title + ": " + quest.title + "(Active quest)",questId);
|
||||
}
|
||||
for(int questId : data.finishedQuests.keySet()){
|
||||
Quest quest = QuestController.instance.quests.get(questId);
|
||||
Quest quest = QuestController.Instance.quests.get(questId);
|
||||
if(quest == null)
|
||||
continue;
|
||||
map.put(quest.category.title + ": " + quest.title + "(Finished quest)",questId);
|
||||
@@ -548,12 +548,12 @@ public class NoppesUtilServer {
|
||||
public static void sendRecipeData(EntityPlayerMP player, int size) {
|
||||
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
||||
if(size == 3){
|
||||
for(RecipeCarpentry recipe : RecipeController.instance.globalRecipes.values()){
|
||||
for(RecipeCarpentry recipe : RecipeController.Instance.globalRecipes.values()){
|
||||
map.put(recipe.name, recipe.id);
|
||||
}
|
||||
}
|
||||
else{
|
||||
for(RecipeCarpentry recipe : RecipeController.instance.anvilRecipes.values()){
|
||||
for(RecipeCarpentry recipe : RecipeController.Instance.anvilRecipes.values()){
|
||||
map.put(recipe.name, recipe.id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,19 +348,19 @@ public class PacketHandlerServer{
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else if(type == EnumPacketServer.DialogCategoriesGet){
|
||||
NoppesUtilServer.sendScrollData(player, DialogController.instance.getScroll());
|
||||
NoppesUtilServer.sendScrollData(player, DialogController.Instance.getScroll());
|
||||
}
|
||||
else if(type == EnumPacketServer.DialogsGetFromDialog){
|
||||
Dialog dialog = DialogController.instance.dialogs.get(buffer.readInt());
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(buffer.readInt());
|
||||
if(dialog == null)
|
||||
return;
|
||||
NoppesUtilServer.sendDialogData(player,dialog.category);
|
||||
}
|
||||
else if(type == EnumPacketServer.DialogsGet){
|
||||
NoppesUtilServer.sendDialogData(player,DialogController.instance.categories.get(buffer.readInt()));
|
||||
NoppesUtilServer.sendDialogData(player,DialogController.Instance.categories.get(buffer.readInt()));
|
||||
}
|
||||
else if(type == EnumPacketServer.QuestsGetFromQuest){
|
||||
Quest quest = QuestController.instance.quests.get(buffer.readInt());
|
||||
Quest quest = QuestController.Instance.quests.get(buffer.readInt());
|
||||
if(quest == null)
|
||||
return;
|
||||
NoppesUtilServer.sendQuestData(player,quest.category);
|
||||
@@ -369,24 +369,24 @@ public class PacketHandlerServer{
|
||||
NoppesUtilServer.sendQuestCategoryData(player);
|
||||
}
|
||||
else if(type == EnumPacketServer.QuestsGet){
|
||||
QuestCategory category = QuestController.instance.categories.get(buffer.readInt());
|
||||
QuestCategory category = QuestController.Instance.categories.get(buffer.readInt());
|
||||
NoppesUtilServer.sendQuestData(player,category);
|
||||
}
|
||||
else if(type == EnumPacketServer.FactionsGet){
|
||||
NoppesUtilServer.sendFactionDataAll(player);
|
||||
}
|
||||
else if(type == EnumPacketServer.DialogGet){
|
||||
Dialog dialog = DialogController.instance.dialogs.get(buffer.readInt());
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(buffer.readInt());
|
||||
if(dialog != null){
|
||||
NBTTagCompound compound = dialog.writeToNBT(new NBTTagCompound());
|
||||
Quest quest = QuestController.instance.quests.get(dialog.quest);
|
||||
Quest quest = QuestController.Instance.quests.get(dialog.quest);
|
||||
if(quest != null)
|
||||
compound.setString("DialogQuestName", quest.title);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
}
|
||||
else if(type == EnumPacketServer.QuestGet){
|
||||
Quest quest = QuestController.instance.quests.get(buffer.readInt());
|
||||
Quest quest = QuestController.Instance.quests.get(buffer.readInt());
|
||||
if(quest != null){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
if(quest.hasNewQuest())
|
||||
@@ -526,24 +526,24 @@ public class PacketHandlerServer{
|
||||
NoppesUtilServer.sendRecipeData(player,buffer.readInt());
|
||||
}
|
||||
else if(type == EnumPacketServer.RecipeGet){
|
||||
RecipeCarpentry recipe = RecipeController.instance.getRecipe(buffer.readInt());
|
||||
RecipeCarpentry recipe = RecipeController.Instance.getRecipe(buffer.readInt());
|
||||
NoppesUtilServer.setRecipeGui(player,recipe);
|
||||
}
|
||||
else if(type == EnumPacketServer.RecipeRemove){
|
||||
RecipeCarpentry recipe = RecipeController.instance.delete(buffer.readInt());
|
||||
RecipeCarpentry recipe = RecipeController.Instance.delete(buffer.readInt());
|
||||
NoppesUtilServer.sendRecipeData(player, recipe.isGlobal?3:4);
|
||||
NoppesUtilServer.setRecipeGui(player,new RecipeCarpentry(""));
|
||||
}
|
||||
else if(type == EnumPacketServer.RecipeSave){
|
||||
RecipeCarpentry recipe = RecipeController.instance.saveRecipe(Server.readNBT(buffer));
|
||||
RecipeCarpentry recipe = RecipeController.Instance.saveRecipe(Server.readNBT(buffer));
|
||||
NoppesUtilServer.sendRecipeData(player, recipe.isGlobal?3:4);
|
||||
NoppesUtilServer.setRecipeGui(player,recipe);
|
||||
}
|
||||
else if(type == EnumPacketServer.NaturalSpawnGetAll){
|
||||
NoppesUtilServer.sendScrollData(player, SpawnController.instance.getScroll());
|
||||
NoppesUtilServer.sendScrollData(player, SpawnController.Instance.getScroll());
|
||||
}
|
||||
else if(type == EnumPacketServer.NaturalSpawnGet){
|
||||
SpawnData spawn = SpawnController.instance.getSpawnData(buffer.readInt());
|
||||
SpawnData spawn = SpawnController.Instance.getSpawnData(buffer.readInt());
|
||||
if(spawn != null){
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, spawn.writeNBT(new NBTTagCompound()));
|
||||
}
|
||||
@@ -551,26 +551,26 @@ public class PacketHandlerServer{
|
||||
else if(type == EnumPacketServer.NaturalSpawnSave){
|
||||
SpawnData data = new SpawnData();
|
||||
data.readNBT(Server.readNBT(buffer));
|
||||
SpawnController.instance.saveSpawnData(data);
|
||||
SpawnController.Instance.saveSpawnData(data);
|
||||
|
||||
NoppesUtilServer.sendScrollData(player, SpawnController.instance.getScroll());
|
||||
NoppesUtilServer.sendScrollData(player, SpawnController.Instance.getScroll());
|
||||
}
|
||||
else if(type == EnumPacketServer.NaturalSpawnRemove){
|
||||
SpawnController.instance.removeSpawnData(buffer.readInt());
|
||||
NoppesUtilServer.sendScrollData(player, SpawnController.instance.getScroll());
|
||||
SpawnController.Instance.removeSpawnData(buffer.readInt());
|
||||
NoppesUtilServer.sendScrollData(player, SpawnController.Instance.getScroll());
|
||||
}
|
||||
else if(type == EnumPacketServer.DialogCategorySave){
|
||||
DialogCategory category = new DialogCategory();
|
||||
category.readNBT(Server.readNBT(buffer));
|
||||
DialogController.instance.saveCategory(category);
|
||||
NoppesUtilServer.sendScrollData(player, DialogController.instance.getScroll());
|
||||
DialogController.Instance.saveCategory(category);
|
||||
NoppesUtilServer.sendScrollData(player, DialogController.Instance.getScroll());
|
||||
}
|
||||
else if(type == EnumPacketServer.DialogCategoryRemove){
|
||||
DialogController.instance.removeCategory(buffer.readInt());
|
||||
NoppesUtilServer.sendScrollData(player, DialogController.instance.getScroll());
|
||||
DialogController.Instance.removeCategory(buffer.readInt());
|
||||
NoppesUtilServer.sendScrollData(player, DialogController.Instance.getScroll());
|
||||
}
|
||||
else if(type == EnumPacketServer.DialogCategoryGet){
|
||||
DialogCategory category = DialogController.instance.categories.get(buffer.readInt());
|
||||
DialogCategory category = DialogController.Instance.categories.get(buffer.readInt());
|
||||
if(category != null){
|
||||
NBTTagCompound comp = category.writeNBT(new NBTTagCompound());
|
||||
comp.removeTag("Dialogs");
|
||||
@@ -581,7 +581,7 @@ public class PacketHandlerServer{
|
||||
int category = buffer.readInt();
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.readNBT(Server.readNBT(buffer));
|
||||
DialogController.instance.saveDialog(category,dialog);
|
||||
DialogController.Instance.saveDialog(category,dialog);
|
||||
if(dialog.category != null)
|
||||
NoppesUtilServer.sendDialogData(player,dialog.category);
|
||||
}
|
||||
@@ -593,9 +593,9 @@ public class PacketHandlerServer{
|
||||
player.openGui(CustomNpcs.instance, gui , player.worldObj, 0, 0, 0);
|
||||
}
|
||||
else if(type == EnumPacketServer.DialogRemove){
|
||||
Dialog dialog = DialogController.instance.dialogs.get(buffer.readInt());
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(buffer.readInt());
|
||||
if(dialog != null && dialog.category != null){
|
||||
DialogController.instance.removeDialog(dialog);
|
||||
DialogController.Instance.removeDialog(dialog);
|
||||
NoppesUtilServer.sendDialogData(player,dialog.category);
|
||||
}
|
||||
}
|
||||
@@ -616,7 +616,7 @@ public class PacketHandlerServer{
|
||||
npc.dialogs.remove(buffer.readInt());
|
||||
}
|
||||
else if(type == EnumPacketServer.QuestCategoryGet){
|
||||
QuestCategory category = QuestController.instance.categories.get(buffer.readInt());
|
||||
QuestCategory category = QuestController.Instance.categories.get(buffer.readInt());
|
||||
if(category != null){
|
||||
NBTTagCompound comp = category.writeNBT(new NBTTagCompound());
|
||||
comp.removeTag("Dialogs");
|
||||
@@ -626,25 +626,25 @@ public class PacketHandlerServer{
|
||||
else if(type == EnumPacketServer.QuestCategorySave){
|
||||
QuestCategory category = new QuestCategory();
|
||||
category.readNBT(Server.readNBT(buffer));
|
||||
QuestController.instance.saveCategory(category);
|
||||
QuestController.Instance.saveCategory(category);
|
||||
NoppesUtilServer.sendQuestCategoryData(player);
|
||||
}
|
||||
else if(type == EnumPacketServer.QuestCategoryRemove){
|
||||
QuestController.instance.removeCategory(buffer.readInt());
|
||||
QuestController.Instance.removeCategory(buffer.readInt());
|
||||
NoppesUtilServer.sendQuestCategoryData(player);
|
||||
}
|
||||
else if(type == EnumPacketServer.QuestSave){
|
||||
int category = buffer.readInt();
|
||||
Quest quest = new Quest();
|
||||
quest.readNBT(Server.readNBT(buffer));
|
||||
QuestController.instance.saveQuest(category, quest);
|
||||
QuestController.Instance.saveQuest(category, quest);
|
||||
if(quest.category != null)
|
||||
NoppesUtilServer.sendQuestData(player,quest.category);
|
||||
}
|
||||
else if(type == EnumPacketServer.QuestDialogGetTitle){
|
||||
Dialog quest = DialogController.instance.dialogs.get(buffer.readInt());
|
||||
Dialog quest2 = DialogController.instance.dialogs.get(buffer.readInt());
|
||||
Dialog quest3 = DialogController.instance.dialogs.get(buffer.readInt());
|
||||
Dialog quest = DialogController.Instance.dialogs.get(buffer.readInt());
|
||||
Dialog quest2 = DialogController.Instance.dialogs.get(buffer.readInt());
|
||||
Dialog quest3 = DialogController.Instance.dialogs.get(buffer.readInt());
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
if(quest != null)
|
||||
compound.setString("1", quest.title);
|
||||
@@ -655,9 +655,9 @@ public class PacketHandlerServer{
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else if(type == EnumPacketServer.QuestRemove){
|
||||
Quest quest = QuestController.instance.quests.get(buffer.readInt());
|
||||
Quest quest = QuestController.Instance.quests.get(buffer.readInt());
|
||||
if(quest != null){
|
||||
QuestController.instance.removeQuest(quest);
|
||||
QuestController.Instance.removeQuest(quest);
|
||||
NoppesUtilServer.sendQuestData(player,quest.category);
|
||||
}
|
||||
}
|
||||
@@ -893,41 +893,41 @@ public class PacketHandlerServer{
|
||||
}
|
||||
}
|
||||
else if(type == EnumPacketServer.AnimationListGet) {
|
||||
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.instance.animations.keySet()));
|
||||
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.Instance.animations.keySet()));
|
||||
}
|
||||
else if(type == EnumPacketServer.AnimationGet) {
|
||||
String animationName = Server.readString(buffer);
|
||||
Animation animation = (Animation) AnimationController.instance.get(animationName);
|
||||
Animation animation = (Animation) AnimationController.Instance.get(animationName);
|
||||
if (animation != null) {
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, animation.writeToNBT());
|
||||
}
|
||||
}
|
||||
else if (type == EnumPacketServer.AnimationAdd) {
|
||||
String name = "Animation";
|
||||
if (AnimationController.instance.has(name)) {
|
||||
if (AnimationController.Instance.has(name)) {
|
||||
name += "_";
|
||||
int i = 1;
|
||||
while (AnimationController.instance.has(name + i)) {
|
||||
while (AnimationController.Instance.has(name + i)) {
|
||||
i++;
|
||||
}
|
||||
name += i;
|
||||
}
|
||||
Animation animation = new Animation(name);
|
||||
animation.save();
|
||||
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.instance.animations.keySet()));
|
||||
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.Instance.animations.keySet()));
|
||||
}
|
||||
else if (type == EnumPacketServer.AnimationDelete) {
|
||||
String animationName = Server.readString(buffer);
|
||||
AnimationController.instance.delete(animationName);
|
||||
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.instance.animations.keySet()));
|
||||
AnimationController.Instance.delete(animationName);
|
||||
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.Instance.animations.keySet()));
|
||||
}
|
||||
else if (type == EnumPacketServer.AnimationSave) {
|
||||
String prevName = Server.readString(buffer);
|
||||
AnimationController.instance.delete(prevName);
|
||||
AnimationController.Instance.delete(prevName);
|
||||
Animation animation = new Animation();
|
||||
animation.readFromNBT(Server.readNBT(buffer));
|
||||
animation.save();
|
||||
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.instance.animations.keySet()));
|
||||
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.Instance.animations.keySet()));
|
||||
}
|
||||
else
|
||||
blockPackets(type, buffer, player);
|
||||
|
||||
@@ -174,7 +174,7 @@ public class ServerEventsHandler {
|
||||
}
|
||||
|
||||
if(block == Blocks.crafting_table && event.action == Action.RIGHT_CLICK_BLOCK && !player.worldObj.isRemote){
|
||||
RecipeController controller = RecipeController.instance;
|
||||
RecipeController controller = RecipeController.Instance;
|
||||
NBTTagList list = new NBTTagList();
|
||||
int i = 0;
|
||||
for(RecipeCarpentry recipe : controller.globalRecipes.values()){
|
||||
@@ -196,7 +196,7 @@ public class ServerEventsHandler {
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_WORKBENCH);
|
||||
}
|
||||
if(block == CustomItems.carpentyBench && event.action == Action.RIGHT_CLICK_BLOCK && !player.worldObj.isRemote){
|
||||
RecipeController controller = RecipeController.instance;
|
||||
RecipeController controller = RecipeController.Instance;
|
||||
NBTTagList list = new NBTTagList();
|
||||
int i = 0;
|
||||
for(RecipeCarpentry recipe : controller.anvilRecipes.values()){
|
||||
|
||||
@@ -254,8 +254,8 @@ public class NoppesUtil {
|
||||
}
|
||||
|
||||
public static void openDialog(NBTTagCompound compound, EntityNPCInterface npc, EntityPlayer player){
|
||||
if(DialogController.instance == null)
|
||||
DialogController.instance = new DialogController();
|
||||
if(DialogController.Instance == null)
|
||||
DialogController.Instance = new DialogController();
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.readNBT(compound);
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
|
||||
@@ -97,7 +97,7 @@ public class PacketHandlerClient extends PacketHandlerServer{
|
||||
RecipeController.syncRecipes = new HashMap<Integer, RecipeCarpentry>();
|
||||
}
|
||||
else if(type == EnumPacketClient.SYNCRECIPES_CARPENTRYBENCH){
|
||||
RecipeController.instance.anvilRecipes = RecipeController.syncRecipes;
|
||||
RecipeController.Instance.anvilRecipes = RecipeController.syncRecipes;
|
||||
RecipeController.syncRecipes = new HashMap<Integer, RecipeCarpentry>();
|
||||
}
|
||||
else if(type == EnumPacketClient.DIALOG){
|
||||
|
||||
@@ -38,7 +38,7 @@ public class GuiNpcCarpentryBench extends GuiContainerNPCInterface
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
button.enabled = RecipeController.instance != null && !RecipeController.instance.anvilRecipes.isEmpty();
|
||||
button.enabled = RecipeController.Instance != null && !RecipeController.Instance.anvilRecipes.isEmpty();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
int l = (width - xSize) / 2;
|
||||
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPlayerData;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import noppes.npcs.controllers.data.RecipeCarpentry;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -34,7 +33,7 @@ public class GuiRecipes extends GuiNPCInterface
|
||||
this.xSize = 256;
|
||||
setBackground("recipes.png");
|
||||
this.closeOnEsc = true;
|
||||
recipes.addAll(RecipeController.instance.anvilRecipes.values());
|
||||
recipes.addAll(RecipeController.Instance.anvilRecipes.values());
|
||||
}
|
||||
@Override
|
||||
public void initGui(){
|
||||
@@ -68,10 +67,10 @@ public class GuiRecipes extends GuiNPCInterface
|
||||
|
||||
private List<IRecipe> getSearchList(){
|
||||
if(search.isEmpty()){
|
||||
return new ArrayList<IRecipe>(RecipeController.instance.anvilRecipes.values());
|
||||
return new ArrayList<IRecipe>(RecipeController.Instance.anvilRecipes.values());
|
||||
}
|
||||
List<IRecipe> list = new ArrayList<IRecipe>();
|
||||
for(IRecipe recipe : RecipeController.instance.anvilRecipes.values()){
|
||||
for(IRecipe recipe : RecipeController.Instance.anvilRecipes.values()){
|
||||
if(recipe.getRecipeOutput() == null)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ContainerCarpentryBench extends Container
|
||||
public void onCraftMatrixChanged(IInventory par1IInventory)
|
||||
{
|
||||
if(!this.worldObj.isRemote){
|
||||
RecipeCarpentry recipe = RecipeController.instance.findMatchingRecipe(this.craftMatrix);
|
||||
RecipeCarpentry recipe = RecipeController.Instance.findMatchingRecipe(this.craftMatrix);
|
||||
|
||||
ItemStack item = null;
|
||||
if(recipe != null && recipe.availability.isAvailable(player)){
|
||||
|
||||
@@ -5,7 +5,6 @@ import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.api.handler.IAnimationHandler;
|
||||
import noppes.npcs.api.handler.data.IAnimation;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
import noppes.npcs.util.NBTJsonUtil;
|
||||
|
||||
import java.io.File;
|
||||
@@ -13,16 +12,16 @@ import java.util.*;
|
||||
|
||||
public class AnimationController implements IAnimationHandler {
|
||||
public HashMap<String, Animation> animations;
|
||||
public static AnimationController instance;
|
||||
public static AnimationController Instance;
|
||||
|
||||
public AnimationController() {
|
||||
instance = this;
|
||||
Instance = this;
|
||||
animations = new HashMap<>();
|
||||
load();
|
||||
}
|
||||
|
||||
public static AnimationController getInstance(){
|
||||
return instance;
|
||||
return Instance;
|
||||
}
|
||||
|
||||
public void load(){
|
||||
|
||||
@@ -18,12 +18,12 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class ChunkController implements LoadingCallback{
|
||||
public static ChunkController instance;
|
||||
public static ChunkController Instance;
|
||||
|
||||
public HashMap<Entity,Ticket> tickets = new HashMap<Entity,Ticket>();
|
||||
|
||||
public ChunkController(){
|
||||
instance = this;
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
|
||||
@@ -22,13 +22,13 @@ import java.util.*;
|
||||
public class DialogController implements IDialogHandler {
|
||||
public HashMap<Integer,DialogCategory> categories = new HashMap<Integer, DialogCategory>();
|
||||
public HashMap<Integer,Dialog> dialogs = new HashMap<Integer, Dialog>();
|
||||
public static DialogController instance;
|
||||
public static DialogController Instance;
|
||||
|
||||
private int lastUsedDialogID = 0;
|
||||
private int lastUsedCatID = 0;
|
||||
|
||||
public DialogController(){
|
||||
instance = this;
|
||||
Instance = this;
|
||||
load();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@ public class QuestController implements IQuestHandler {
|
||||
public HashMap<Integer,QuestCategory> categories = new HashMap<Integer, QuestCategory>();
|
||||
public HashMap<Integer,Quest> quests = new HashMap<Integer, Quest>();
|
||||
|
||||
public static QuestController instance;
|
||||
public static QuestController Instance;
|
||||
|
||||
private int lastUsedCatID = 0;
|
||||
private int lastUsedQuestID = 0;
|
||||
|
||||
public QuestController(){
|
||||
instance = this;
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public void load(){
|
||||
|
||||
@@ -22,7 +22,7 @@ public class RecipeController implements IRecipeHandler {
|
||||
private static Collection<RecipeCarpentry> prevRecipes;
|
||||
public HashMap<Integer,RecipeCarpentry> globalRecipes = new HashMap<Integer, RecipeCarpentry>();
|
||||
public HashMap<Integer,RecipeCarpentry> anvilRecipes = new HashMap<Integer, RecipeCarpentry>();
|
||||
public static RecipeController instance;
|
||||
public static RecipeController Instance;
|
||||
|
||||
public static final int version = 1;
|
||||
public int nextId = 1;
|
||||
@@ -30,7 +30,7 @@ public class RecipeController implements IRecipeHandler {
|
||||
public static HashMap<Integer,RecipeCarpentry> syncRecipes = new HashMap<Integer, RecipeCarpentry>();
|
||||
|
||||
public RecipeController(){
|
||||
instance = this;
|
||||
Instance = this;
|
||||
}
|
||||
public void load(){
|
||||
loadCategories();
|
||||
@@ -210,9 +210,9 @@ public class RecipeController implements IRecipeHandler {
|
||||
public void addRecipe(RecipeCarpentry recipeAnvil) {
|
||||
recipeAnvil.id = getUniqueId();
|
||||
if(!recipeAnvil.isGlobal)
|
||||
RecipeController.instance.anvilRecipes.put(recipeAnvil.id, recipeAnvil);
|
||||
RecipeController.Instance.anvilRecipes.put(recipeAnvil.id, recipeAnvil);
|
||||
else{
|
||||
RecipeController.instance.globalRecipes.put(recipeAnvil.id, recipeAnvil);
|
||||
RecipeController.Instance.globalRecipes.put(recipeAnvil.id, recipeAnvil);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,12 @@ public class SpawnController implements INaturalSpawnsHandler {
|
||||
public ArrayList<SpawnData> data = new ArrayList<SpawnData>();
|
||||
public Random random = new Random();
|
||||
|
||||
public static SpawnController instance;
|
||||
public static SpawnController Instance;
|
||||
|
||||
private int lastUsedID = 0;
|
||||
|
||||
public SpawnController(){
|
||||
instance = this;
|
||||
Instance = this;
|
||||
loadData();
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ public class Animation implements IAnimation {
|
||||
}
|
||||
|
||||
public IAnimation save() {
|
||||
return AnimationController.instance.saveAnimation(this);
|
||||
return AnimationController.Instance.saveAnimation(this);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
|
||||
@@ -325,7 +325,7 @@ public class Dialog implements ICompatibilty, IDialog {
|
||||
}
|
||||
|
||||
public void save() {
|
||||
DialogController.instance.saveDialog(this.category.id, this);
|
||||
DialogController.Instance.saveDialog(this.category.id, this);
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
@@ -354,7 +354,7 @@ public class Dialog implements ICompatibilty, IDialog {
|
||||
}
|
||||
|
||||
public Quest getQuest() {
|
||||
return QuestController.instance == null ? null : (Quest)QuestController.instance.quests.get(this.quest);
|
||||
return QuestController.Instance == null ? null : (Quest)QuestController.Instance.quests.get(this.quest);
|
||||
}
|
||||
|
||||
public String getCommand() {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class DialogOption {
|
||||
public boolean hasDialog(){
|
||||
if(dialogId <= 0)
|
||||
return false;
|
||||
if(!DialogController.instance.hasDialog(dialogId)){
|
||||
if(!DialogController.Instance.hasDialog(dialogId)){
|
||||
dialogId = -1;
|
||||
return false;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class DialogOption {
|
||||
public Dialog getDialog() {
|
||||
if(!hasDialog())
|
||||
return null;
|
||||
return DialogController.instance.dialogs.get(dialogId);
|
||||
return DialogController.Instance.dialogs.get(dialogId);
|
||||
}
|
||||
|
||||
public boolean isAvailable(EntityPlayer player) {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class PlayerMail implements IInventory, IPlayerMail {
|
||||
return getQuest() != null;
|
||||
}
|
||||
public Quest getQuest() {
|
||||
return QuestController.instance != null?QuestController.instance.quests.get(questId):null;
|
||||
return QuestController.Instance != null?QuestController.Instance.quests.get(questId):null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,7 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
{
|
||||
NBTTagCompound nbttagcompound = list2.getCompoundTagAt(i);
|
||||
int id = nbttagcompound.getInteger("Quest");
|
||||
Quest quest = QuestController.instance.quests.get(id);
|
||||
Quest quest = QuestController.Instance.quests.get(id);
|
||||
if(quest == null)
|
||||
continue;
|
||||
QuestData data = new QuestData(quest);
|
||||
@@ -67,7 +67,7 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
this.activeQuests = activeQuests;
|
||||
}
|
||||
|
||||
this.trackedQuest = QuestController.instance.get(mainCompound.getInteger("TrackedQuestID"));
|
||||
this.trackedQuest = QuestController.Instance.get(mainCompound.getInteger("TrackedQuestID"));
|
||||
}
|
||||
|
||||
public void saveNBTData(NBTTagCompound maincompound) {
|
||||
@@ -162,7 +162,7 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
}
|
||||
|
||||
public void startQuest(int id) {
|
||||
Quest quest = QuestController.instance.quests.get(id);
|
||||
Quest quest = QuestController.Instance.quests.get(id);
|
||||
if (quest == null)
|
||||
return;
|
||||
if(activeQuests.containsKey(id))
|
||||
@@ -174,7 +174,7 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
}
|
||||
|
||||
public void finishQuest(int id) {
|
||||
Quest quest = QuestController.instance.quests.get(id);
|
||||
Quest quest = QuestController.Instance.quests.get(id);
|
||||
if (quest == null)
|
||||
return;
|
||||
|
||||
@@ -185,14 +185,14 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
}
|
||||
|
||||
public void stopQuest(int id) {
|
||||
Quest quest = QuestController.instance.quests.get(id);
|
||||
Quest quest = QuestController.Instance.quests.get(id);
|
||||
if (quest == null)
|
||||
return;
|
||||
activeQuests.remove(id);
|
||||
}
|
||||
|
||||
public void removeQuest(int id) {
|
||||
Quest quest = QuestController.instance.quests.get(id);
|
||||
Quest quest = QuestController.Instance.quests.get(id);
|
||||
if (quest == null)
|
||||
return;
|
||||
activeQuests.remove(id);
|
||||
@@ -211,7 +211,7 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
List<IQuest> quests = new ArrayList<>();
|
||||
|
||||
for (int id : activeQuests.keySet()) {
|
||||
IQuest quest = (IQuest) QuestController.instance.quests.get(id);
|
||||
IQuest quest = (IQuest) QuestController.Instance.quests.get(id);
|
||||
if (quest != null) {
|
||||
quests.add(quest);
|
||||
}
|
||||
@@ -224,7 +224,7 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
List<IQuest> quests = new ArrayList<>();
|
||||
|
||||
for (int id : finishedQuests.keySet()) {
|
||||
IQuest quest = (IQuest) QuestController.instance.quests.get(id);
|
||||
IQuest quest = (IQuest) QuestController.Instance.quests.get(id);
|
||||
if (quest != null) {
|
||||
quests.add(quest);
|
||||
}
|
||||
@@ -241,7 +241,7 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
}
|
||||
|
||||
public void setLastCompletedTime(int id,long time) {
|
||||
Quest quest = QuestController.instance.quests.get(id);
|
||||
Quest quest = QuestController.Instance.quests.get(id);
|
||||
if (quest == null)
|
||||
return;
|
||||
this.finishedQuests.put(id,time);
|
||||
|
||||
@@ -127,7 +127,7 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
}
|
||||
public Quest getNextQuest()
|
||||
{
|
||||
return QuestController.instance == null?null:QuestController.instance.quests.get(nextQuestid);
|
||||
return QuestController.Instance == null?null:QuestController.Instance.quests.get(nextQuestid);
|
||||
}
|
||||
|
||||
public boolean instantComplete(EntityPlayer player, QuestData data) {
|
||||
@@ -193,7 +193,7 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
}
|
||||
|
||||
public void save() {
|
||||
QuestController.instance.saveQuest(this.category.id, this);
|
||||
QuestController.Instance.saveQuest(this.category.id, this);
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
|
||||
@@ -267,14 +267,14 @@ public class RecipeCarpentry extends ShapedRecipes implements IRecipe {
|
||||
|
||||
public void save() {
|
||||
try {
|
||||
RecipeController.instance.saveRecipe(this.writeNBT());
|
||||
RecipeController.Instance.saveRecipe(this.writeNBT());
|
||||
} catch (IOException var2) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
RecipeController.instance.delete(this.id);
|
||||
RecipeController.Instance.delete(this.id);
|
||||
}
|
||||
|
||||
public ItemStack[] getRecipe() {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class RecipesDefault {
|
||||
RecipeCarpentry recipeAnvil = new RecipeCarpentry(name);
|
||||
recipeAnvil.isGlobal = isGlobal;
|
||||
recipeAnvil = RecipeCarpentry.saveRecipe(recipeAnvil, item, recipe);
|
||||
RecipeController.instance.addRecipe(recipeAnvil);
|
||||
RecipeController.Instance.addRecipe(recipeAnvil);
|
||||
}
|
||||
public static void loadDefaultRecipes(int i) {
|
||||
if(i < 0){
|
||||
|
||||
@@ -48,7 +48,7 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
public Vector<String> getQuestLogStatus(EntityPlayer player) {
|
||||
Vector<String> vec = new Vector<String>();
|
||||
for(int dialogId : dialogs.values()){
|
||||
Dialog dialog = DialogController.instance.dialogs.get(dialogId);
|
||||
Dialog dialog = DialogController.Instance.dialogs.get(dialogId);
|
||||
if(dialog == null)
|
||||
continue;
|
||||
String title = dialog.title;
|
||||
@@ -67,7 +67,7 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
|
||||
for(int i = 0; i < 3; ++i) {
|
||||
if (this.dialogs.containsKey(i)) {
|
||||
Dialog dialog = (Dialog)DialogController.instance.dialogs.get(this.dialogs.get(i));
|
||||
Dialog dialog = (Dialog)DialogController.Instance.dialogs.get(this.dialogs.get(i));
|
||||
if (dialog != null) {
|
||||
list.add(new noppes.npcs.quests.QuestDialog.QuestDialogObjective(this, player, dialog));
|
||||
}
|
||||
|
||||
@@ -46,11 +46,11 @@ public class JobChunkLoader extends JobInterface{
|
||||
|
||||
//unload after 10 min
|
||||
if(System.currentTimeMillis() > playerLastSeen + 600000){
|
||||
ChunkController.instance.deleteNPC(npc);
|
||||
ChunkController.Instance.deleteNPC(npc);
|
||||
chunks.clear();
|
||||
return false;
|
||||
}
|
||||
Ticket ticket = ChunkController.instance.getTicket(npc);
|
||||
Ticket ticket = ChunkController.Instance.getTicket(npc);
|
||||
if(ticket == null) //Only null when too many active chunkloaders already
|
||||
return false;
|
||||
double x = npc.posX / 16;
|
||||
@@ -79,7 +79,7 @@ public class JobChunkLoader extends JobInterface{
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
ChunkController.instance.deleteNPC(npc);
|
||||
ChunkController.Instance.deleteNPC(npc);
|
||||
chunks.clear();
|
||||
playerLastSeen = 0;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class JobConversation extends JobInterface{
|
||||
public Quest getQuest() {
|
||||
if(npc.isRemote())
|
||||
return null;
|
||||
return QuestController.instance.quests.get(quest);
|
||||
return QuestController.Instance.quests.get(quest);
|
||||
}
|
||||
@Override
|
||||
public void aiUpdateTask() {
|
||||
|
||||
@@ -147,23 +147,23 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
|
||||
public IRecipeHandler getRecipes() {
|
||||
this.checkWorld();
|
||||
return RecipeController.instance;
|
||||
return RecipeController.Instance;
|
||||
}
|
||||
|
||||
public IQuestHandler getQuests() {
|
||||
this.checkWorld();
|
||||
return QuestController.instance;
|
||||
return QuestController.Instance;
|
||||
}
|
||||
|
||||
public IDialogHandler getDialogs() {
|
||||
return DialogController.instance;
|
||||
return DialogController.Instance;
|
||||
}
|
||||
|
||||
public ICloneHandler getClones() {
|
||||
return ServerCloneController.Instance;
|
||||
}
|
||||
|
||||
public INaturalSpawnsHandler getNaturalSpawns() { return SpawnController.instance; }
|
||||
public INaturalSpawnsHandler getNaturalSpawns() { return SpawnController.Instance; }
|
||||
|
||||
public ITransportHandler getLocations() {
|
||||
return TransportController.getInstance();
|
||||
@@ -171,7 +171,7 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
|
||||
public IAnimationHandler getAnimations() {
|
||||
this.checkWorld();
|
||||
return AnimationController.instance;
|
||||
return AnimationController.Instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -220,7 +220,7 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
|
||||
public INpc[] getChunkLoadingNPCs() {
|
||||
ArrayList<INpc> list = new ArrayList<>();
|
||||
Set<Entity> npcSet = ChunkController.instance.tickets.keySet();
|
||||
Set<Entity> npcSet = ChunkController.Instance.tickets.keySet();
|
||||
for (Entity entity : npcSet) {
|
||||
if (entity instanceof EntityNPCInterface) {
|
||||
list.add((INpc) NpcAPI.Instance().getIEntity(entity));
|
||||
|
||||
@@ -179,7 +179,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
}
|
||||
|
||||
public void showDialog(int id){
|
||||
Dialog dialog = (Dialog) DialogController.instance.get(id);
|
||||
Dialog dialog = (Dialog) DialogController.Instance.get(id);
|
||||
if(dialog == null)
|
||||
return;
|
||||
|
||||
@@ -250,7 +250,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
* @param id The Quest ID
|
||||
*/
|
||||
public void startQuest(int id){
|
||||
Quest quest = QuestController.instance.quests.get(id);
|
||||
Quest quest = QuestController.Instance.quests.get(id);
|
||||
if (quest == null)
|
||||
return;
|
||||
PlayerData data = PlayerDataController.Instance.getPlayerData(player);
|
||||
@@ -267,7 +267,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
* @param id The Quest ID
|
||||
*/
|
||||
public void finishQuest(int id){
|
||||
Quest quest = QuestController.instance.quests.get(id);
|
||||
Quest quest = QuestController.Instance.quests.get(id);
|
||||
if (quest == null)
|
||||
return;
|
||||
PlayerData data = PlayerDataController.Instance.getPlayerData(player);
|
||||
@@ -283,7 +283,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
* @param id The Quest ID
|
||||
*/
|
||||
public void stopQuest(int id){
|
||||
Quest quest = QuestController.instance.quests.get(id);
|
||||
Quest quest = QuestController.Instance.quests.get(id);
|
||||
if (quest == null)
|
||||
return;
|
||||
PlayerData data = PlayerDataController.Instance.getPlayerData(player);
|
||||
@@ -295,7 +295,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
* @param id The Quest ID
|
||||
*/
|
||||
public void removeQuest(int id){
|
||||
Quest quest = QuestController.instance.quests.get(id);
|
||||
Quest quest = QuestController.Instance.quests.get(id);
|
||||
if (quest == null)
|
||||
return;
|
||||
PlayerData data = PlayerDataController.Instance.getPlayerData(player);
|
||||
@@ -728,7 +728,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
|
||||
while(var3.hasNext()) {
|
||||
int id = (Integer)var3.next();
|
||||
IQuest quest = (IQuest)QuestController.instance.quests.get(id);
|
||||
IQuest quest = (IQuest)QuestController.Instance.quests.get(id);
|
||||
if (quest != null) {
|
||||
quests.add(quest);
|
||||
}
|
||||
@@ -777,7 +777,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
|
||||
while(var3.hasNext()) {
|
||||
int id = (Integer)var3.next();
|
||||
IQuest quest = (IQuest)QuestController.instance.quests.get(id);
|
||||
IQuest quest = (IQuest)QuestController.Instance.quests.get(id);
|
||||
if (quest != null) {
|
||||
quests.add(quest);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user