diff --git a/src/main/java/foxz/command/CmdConfig.java b/src/main/java/foxz/command/CmdConfig.java index 3595286ec..6dc4acf7e 100644 --- a/src/main/java/foxz/command/CmdConfig.java +++ b/src/main/java/foxz/command/CmdConfig.java @@ -10,6 +10,7 @@ import net.minecraft.block.BlockVine; import net.minecraft.entity.player.EntityPlayerMP; import noppes.npcs.CustomNpcs; import noppes.npcs.Server; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumPacketClient; import noppes.npcs.controllers.ChunkController; import foxz.commandhelper.ChMcLogger; @@ -37,19 +38,19 @@ public class CmdConfig extends ChMcLogger { ) public boolean leavesdecay(String[] args){ if(args.length == 0){ - sendmessage("LeavesDecay: " + CustomNpcs.LeavesDecayEnabled); + sendmessage("LeavesDecay: " + ConfigMain.LeavesDecayEnabled); } else{ - CustomNpcs.LeavesDecayEnabled = Boolean.parseBoolean(args[0]); - CustomNpcs.Config.updateConfig(); + ConfigMain.LeavesDecayEnabled = Boolean.parseBoolean(args[0]); + // CustomNpcs.Config.updateConfig(); Set names = Block.blockRegistry.getKeys(); for(String name : names){ Block block = (Block) Block.blockRegistry.getObject(name); if(block instanceof BlockLeavesBase){ - block.setTickRandomly(CustomNpcs.LeavesDecayEnabled); + block.setTickRandomly(ConfigMain.LeavesDecayEnabled); } } - sendmessage("LeavesDecay is now " + CustomNpcs.LeavesDecayEnabled); + sendmessage("LeavesDecay is now " + ConfigMain.LeavesDecayEnabled); } return true; } @@ -62,19 +63,19 @@ public class CmdConfig extends ChMcLogger { ) public boolean vinegrowth(String[] args){ if(args.length == 0){ - sendmessage("VineGrowth: " + CustomNpcs.VineGrowthEnabled); + sendmessage("VineGrowth: " + ConfigMain.VineGrowthEnabled); } else{ - CustomNpcs.VineGrowthEnabled = Boolean.parseBoolean(args[0]); - CustomNpcs.Config.updateConfig(); + ConfigMain.VineGrowthEnabled = Boolean.parseBoolean(args[0]); + // CustomNpcs.Config.updateConfig(); Set names = Block.blockRegistry.getKeys(); for(String name : names){ Block block = (Block) Block.blockRegistry.getObject(name); if(block instanceof BlockVine){ - block.setTickRandomly(CustomNpcs.VineGrowthEnabled); + block.setTickRandomly(ConfigMain.VineGrowthEnabled); } } - sendmessage("VineGrowth is now " + CustomNpcs.VineGrowthEnabled); + sendmessage("VineGrowth is now " + ConfigMain.VineGrowthEnabled); } return true; } @@ -87,19 +88,19 @@ public class CmdConfig extends ChMcLogger { ) public boolean icemelts(String[] args){ if(args.length == 0){ - sendmessage("IceMelts: " + CustomNpcs.IceMeltsEnabled); + sendmessage("IceMelts: " + ConfigMain.IceMeltsEnabled); } else{ - CustomNpcs.IceMeltsEnabled = Boolean.parseBoolean(args[0]); - CustomNpcs.Config.updateConfig(); + ConfigMain.IceMeltsEnabled = Boolean.parseBoolean(args[0]); + // CustomNpcs.Config.updateConfig(); Set names = Block.blockRegistry.getKeys(); for(String name : names){ Block block = (Block) Block.blockRegistry.getObject(name); if(block instanceof BlockIce){ - block.setTickRandomly(CustomNpcs.IceMeltsEnabled); + block.setTickRandomly(ConfigMain.IceMeltsEnabled); } } - sendmessage("IceMelts is now " + CustomNpcs.IceMeltsEnabled); + sendmessage("IceMelts is now " + ConfigMain.IceMeltsEnabled); } return true; } @@ -112,12 +113,12 @@ public class CmdConfig extends ChMcLogger { ) public boolean guns(String[] args){ if(args.length == 0){ - sendmessage("GunsEnabled: " + CustomNpcs.GunsEnabled); + sendmessage("GunsEnabled: " + ConfigMain.GunsEnabled); } else{ - CustomNpcs.GunsEnabled = Boolean.parseBoolean(args[0]); - CustomNpcs.Config.updateConfig(); - sendmessage("GunsEnabled is now " + CustomNpcs.GunsEnabled); + ConfigMain.GunsEnabled = Boolean.parseBoolean(args[0]); + // CustomNpcs.Config.updateConfig(); + sendmessage("GunsEnabled is now " + ConfigMain.GunsEnabled); } return true; } @@ -147,24 +148,24 @@ public class CmdConfig extends ChMcLogger { ) public boolean chunkloaders(String[] args){ if(args.length == 0){ - sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + CustomNpcs.ChunkLoaders); + sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + ConfigMain.ChunkLoaders); } else{ try{ - CustomNpcs.ChunkLoaders = Integer.parseInt(args[0]); + ConfigMain.ChunkLoaders = Integer.parseInt(args[0]); } catch(NumberFormatException ex){ sendmessage("Didnt get a number"); return false; } - CustomNpcs.Config.updateConfig(); + // CustomNpcs.Config.updateConfig(); int size = ChunkController.instance.size(); - if(size > CustomNpcs.ChunkLoaders){ - ChunkController.instance.unload(size - CustomNpcs.ChunkLoaders); - sendmessage(size - CustomNpcs.ChunkLoaders + " chunksloaders unloaded"); + if(size > ConfigMain.ChunkLoaders){ + ChunkController.instance.unload(size - ConfigMain.ChunkLoaders); + sendmessage(size - ConfigMain.ChunkLoaders + " chunksloaders unloaded"); } - sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + CustomNpcs.ChunkLoaders); + sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + ConfigMain.ChunkLoaders); } return true; } diff --git a/src/main/java/noppes/npcs/CustomItems.java b/src/main/java/noppes/npcs/CustomItems.java index 13613d8a7..ebf237c6b 100644 --- a/src/main/java/noppes/npcs/CustomItems.java +++ b/src/main/java/noppes/npcs/CustomItems.java @@ -71,6 +71,7 @@ import noppes.npcs.blocks.tiles.TileTombstone; import noppes.npcs.blocks.tiles.TileWallBanner; import noppes.npcs.blocks.tiles.TileWaypoint; import noppes.npcs.blocks.tiles.TileWeaponRack; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumNpcToolMaterial; import noppes.npcs.items.*; import cpw.mods.fml.common.registry.GameRegistry; @@ -261,7 +262,7 @@ public class CustomItems { GameRegistry.registerTileEntity(TileWaypoint.class, "TileWaypoint"); GameRegistry.registerTileEntity(TileBanner.class, "TileNPCBanner"); - if(!CustomNpcs.DisableExtraBlock){ + if(!ConfigMain.DisableExtraBlock){ GameRegistry.registerTileEntity(TileWallBanner.class, "TileNPCWallBanner"); GameRegistry.registerTileEntity(TileTallLamp.class, "TileNPCTallLamp"); GameRegistry.registerTileEntity(TileChair.class, "TileNPCChair"); @@ -324,7 +325,7 @@ public class CustomItems { ((ItemNpcBlock)Item.getItemFromBlock(carpentyBench)).names = new String[]{"tile.npcCarpentyBench", "tile.anvil"}; - if(!CustomNpcs.DisableExtraBlock){ + if(!ConfigMain.DisableExtraBlock){ blood = new BlockBlood().setBlockName("npcBloodBlock").setBlockTextureName("customnpcs:npcBloodBlock").setCreativeTab(tabBlocks); banner = new BlockBanner().setBlockName("npcBanner").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(tabBlocks); wallBanner = new BlockWallBanner().setBlockName("npcWallBanner").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(tabBlocks); @@ -413,7 +414,7 @@ public class CustomItems { clarinet = new ItemMusicClarinet().setUnlocalizedName("npcClarinet").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcClarinet"); - if(!CustomNpcs.DisableExtraItems){ + if(!ConfigMain.DisableExtraItems){ tabArmor = new CreativeTabNpcs("cnpcsa"); tabWeapon = new CreativeTabNpcs("cnpcsw"); diff --git a/src/main/java/noppes/npcs/CustomNpcs.java b/src/main/java/noppes/npcs/CustomNpcs.java index 2ff7e76ee..fbbe732ab 100644 --- a/src/main/java/noppes/npcs/CustomNpcs.java +++ b/src/main/java/noppes/npcs/CustomNpcs.java @@ -16,14 +16,12 @@ import net.minecraft.block.BlockVine; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.MinecraftForge; import nikedemos.markovnames.generators.*; -import noppes.npcs.config.ConfigLoader; -import noppes.npcs.config.ConfigProp; -import noppes.npcs.constants.EnumScriptType; +import noppes.npcs.config.LoadConfiguration; +import noppes.npcs.config.ConfigMain; import noppes.npcs.controllers.*; import noppes.npcs.enchants.EnchantInterface; import noppes.npcs.entity.*; @@ -38,160 +36,20 @@ import java.util.UUID; @Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.7") public class CustomNpcs { - @ConfigProp(info = "Disable Chat Bubbles") - public static boolean EnableChatBubbles = true; - - private static int NewEntityStartId = 0; - - @ConfigProp(info = "Enables/Disables ALL scripting. You can still see and write code in the scripter, but these scripts won't run. True by default") - public static boolean ScriptingEnabled = true; - - @ConfigProp(info = "Enables/Disables the use of the the ECMA6 Javascript standard instead of ECMA5.1." + - "\nEnabling this adds many more features to JS in scripts. Only use if on Java 8 or higher." + - "\nNot all ECMA 6 language is supported through this functionality.") - public static boolean ScriptingECMA6 = false; - - @ConfigProp(info = "Enables global player event scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. True by default.") - public static boolean GlobalPlayerScripts = true; - - @ConfigProp(info = "Enables global forge event scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. True by default.") - public static boolean GlobalForgeScripts = true; - - @ConfigProp(info = "Enables global NPC scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. False by default, use with caution!") - public static boolean GlobalNPCScripts = false; - - @ConfigProp(info = "If scripts are too long (>65535 characters), they normally won't be saved in NBT data.\n" + - "This config adds additional compound tags to scripts that need it, so you can store much larger scripts!\n" + - "Every additional compound tag adds 65535 more characters to your script length limit. Use incrementally, with caution.") - public static int ExpandedScriptLimit = 2; - - @ConfigProp(info = "Enables if Player Information (WAND-USE) should be printed to CustomNPCs Logs. IF on Server \n" + - "Logs will only be present SERVER-SIDE only in CustomNPCs-latest, -1, -2, and -3") - public static boolean PlayerLogging = false; - - @ConfigProp(info = "Enables if Scripting Information should be printed to CustomNPCs Logs. IF on Server \n" + - "Logs will only be present SERVER-SIDE only in CustomNPCs-latest, -1, -2, and -3") - public static boolean ScriptLogging = false; - - @ConfigProp(info = "Amount of Messages marked as SPAM [5, 3000]. Lower Number means MORE accurate messages \n" + - "This frequency will determine if the log will print a line with [SPAM] to warn the console.") - public static int ScriptFrequency = 20; - - @ConfigProp(info = "IN Milliseconds 1s = 1000s. If a recent LOG of the same event is SENT within this threshold it will be ignored.") - public static int ScriptIgnoreTime = 2000; - - @ConfigProp(info = "Comma separated list of NPC Script Types that will omit these from the logs,\n" + - "INIT,TICK,INTERACT,DIALOG,DAMAGED,KILLED,ATTACK,TARGET,COLLIDE,KILLS,DIALOG_CLOSE,TIMER") - public static String ScriptLogIgnoreType = "TICK"; - - @ConfigProp(info = "Navigation search range for NPCs. Not recommended to increase if you have a slow pc or on a server. Minimum of 16, maximum of 96.") - public static int NpcNavRange = 32; - - @ConfigProp(info = "Size limit for NPCs. Default 100, larger sizes may cause lag on clients and servers that can't take it!") - public static int NpcSizeLimit = 100; - - @ConfigProp(info = "Set to true if you want the dialog command option to be able to use op commands like tp etc") - public static boolean NpcUseOpCommands = false; - - @ConfigProp(info = "Client sided! Determines where tracking quest info shows up on the screen based on a number from 0 to 8. Default: 3") - public static int TrackingInfoAlignment = 3; - - @ConfigProp(info = "Client sided! Offsets the tracking info GUI by this amount in the X direction.") - public static int TrackingInfoX = 0; - - @ConfigProp(info = "Client sided! Offsets the tracking info GUI by this amount in the Y direction.") - public static int TrackingInfoY = 0; - - @ConfigProp - public static boolean InventoryGuiEnabled = true; - - @ConfigProp - public static boolean DisableExtraItems = false; - @ConfigProp - public static boolean DisableExtraBlock = false; - - public static long ticks; - @SidedProxy(clientSide = "noppes.npcs.client.ClientProxy", serverSide = "noppes.npcs.CommonProxy") public static CommonProxy proxy; - @ConfigProp(info = "Enables CustomNpcs startup update message") - public static boolean EnableUpdateChecker = true; + public static File Dir; + private static int NewEntityStartId = 0; + public static long ticks; public static CustomNpcs instance; public static boolean FreezeNPCs = false; - @ConfigProp(info = "Only ops can create and edit npcs") - public static boolean OpsOnly = false; - - @ConfigProp(info = "Only ops can see and edit scripts") - public static boolean ScriptOpsOnly = false; - - @ConfigProp(info = "Comma separated list of player UUIDs that can see and edit scripts. If ScriptsOpsOnly is true,\n" + - "ops and players with these IDs can see and edit scripts. Example:\n" + - "b876ec32-e396-476b-a115-8438d83c67d4,069a79f4-44e9-4726-a5be-fca90e38aaf5,be951074-c7ea-4f02-a725-bf017bc88650\n" + - "Get a player's UUID from a site like NameMC or the API IPlayer.getUniqueID() function!\n" + - "If left empty and ScriptsOpsOnly is false, anyone can see and edit scripts with a scripter.") - public static String ScriptDevIDs = ""; - - @ConfigProp(info = "Default interact line. Leave empty to not have one") - public static String DefaultInteractLine = "Hello @p"; - - @ConfigProp - public static boolean DisableEnchants = false; - @ConfigProp(info = "Start Id for enchants. IDs can only range from 0-256") - public static int EnchantStartId = 100; - - @ConfigProp(info = "Number of chunk loading npcs that can be active at the same time") - public static int ChunkLoaders = 20; - - @ConfigProp(info = "The maximum number of images any dialog can hold.") - public static int DialogImageLimit = 10; - - @ConfigProp(info = "The maximum number of images any dialog can hold.") - public static int SkinOverlayLimit = 10; - - public static File Dir; - - @ConfigProp(info = "Set to false if you want to disable guns") - public static boolean GunsEnabled = true; - - @ConfigProp(info = "Enables leaves decay") - public static boolean LeavesDecayEnabled = true; - - @ConfigProp(info = "Enables Vine Growth") - public static boolean VineGrowthEnabled = true; - - @ConfigProp(info = "Enables Ice Melting") - public static boolean IceMeltsEnabled = true; - - @ConfigProp(info = "Normal players can use soulstone on animals") - public static boolean SoulStoneAnimals = true; - - @ConfigProp(info = "Normal players can use soulstone on villagers") - public static boolean SoulStoneVillagers = false; - - @ConfigProp(info = "Normal players can use soulstone on all npcs") - public static boolean SoulStoneNPCs = false; - - @ConfigProp(info = "Normal players can use soulstone on friendly npcs") - public static boolean SoulStoneFriendlyNPCs = false; - - @ConfigProp(info="When set to Minecraft it will use minecrafts font, when Default it will use OpenSans. Can only use fonts installed on your PC") - public static String FontType = "Default"; - - @ConfigProp(info="Font size for custom fonts (doesn't work with minecrafts font)") - public static int FontSize = 18; - - @ConfigProp(info = "Enables Overlay Mixins for Conflicts relating to Optifine or other Skin Renderers. If crashes occur, please disable.") - public static boolean EntityRendererMixin = true; - public static FMLEventChannel Channel; public static FMLEventChannel ChannelPlayer; - public static ConfigLoader Config; - public static ArrayList ScriptDevs = new ArrayList<>(); public static final MarkovGenerator[] MARKOV_GENERATOR = new MarkovGenerator[10]; @@ -209,6 +67,8 @@ public class CustomNpcs { public static boolean DialogCloseIgnore = false; public static boolean TimerIgnore = false; + public static String configPath; + public CustomNpcs() { instance = this; } @@ -228,99 +88,8 @@ public class CustomNpcs { Dir = new File(dir, "customnpcs"); Dir.mkdir(); - Config = new ConfigLoader(this.getClass(), new File(dir, "config"), "CustomNpcs"); - Config.loadConfig(); - - try { - ScriptDevs.clear(); - String[] uuidStrings = ScriptDevIDs.split(","); - for (String s : uuidStrings) { - ScriptDevs.add(UUID.fromString(s)); - } - } catch (Exception ignored) {} - - if (NpcNavRange < 16) { - NpcNavRange = 16; - } - if (NpcNavRange > 96) { - NpcNavRange = 96; - } - - if(NpcSizeLimit < 1) - NpcSizeLimit = 1; - - if (DialogImageLimit < 0) { - DialogImageLimit = 0; - } - - if (SkinOverlayLimit < 0) { - SkinOverlayLimit = 0; - } - - if (TrackingInfoAlignment < 0) - TrackingInfoAlignment = 0; - if (TrackingInfoAlignment > 8) - TrackingInfoAlignment = 8; - - if (ExpandedScriptLimit < 0) - ExpandedScriptLimit = 0; - - if (ScriptFrequency < 5) - ScriptFrequency = 5; - if (ScriptFrequency > 3000) - ScriptFrequency = 3000; - - if (ScriptIgnoreTime < 0) - ScriptIgnoreTime = 0; - - try { - String[] ignoreTypes = ScriptLogIgnoreType.split(","); - for (String s : ignoreTypes) { - EnumScriptType type = EnumScriptType.valueOfIgnoreCase(s); - if(type != null){ - switch (type){ - case INIT: - InitIgnore = true; - break; - case TICK: - TickIgnore = true; - break; - case INTERACT: - InteractIgnore = true; - break; - case DIALOG: - DialogIgnore = true; - break; - case DAMAGED: - DamagedIgnore = true; - break; - case KILLED: - KilledIgnore = true; - break; - case ATTACK: - AttackIgnore = true; - break; - case TARGET: - TargetIgnore = true; - break; - case COLLIDE: - CollideIgnore = true; - break; - case KILLS: - KillsIgnore = true; - break; - case DIALOG_CLOSE: - DialogCloseIgnore = true; - break; - case TIMER: - TimerIgnore = true; - break; - default: - break; - } - } - } - } catch (Exception ignored) {} + configPath = ev.getModConfigurationDirectory() + "/CustomNPCPlus/"; + LoadConfiguration.init(configPath); EnchantInterface.load(); CustomItems.load(); @@ -420,13 +189,13 @@ public class CustomNpcs { for(String name : names){ Block block = (Block) Block.blockRegistry.getObject(name); if(block instanceof BlockLeavesBase){ - block.setTickRandomly(LeavesDecayEnabled); + block.setTickRandomly(ConfigMain.LeavesDecayEnabled); } if(block instanceof BlockVine){ - block.setTickRandomly(VineGrowthEnabled); + block.setTickRandomly(ConfigMain.VineGrowthEnabled); } if(block instanceof BlockIce){ - block.setTickRandomly(IceMeltsEnabled); + block.setTickRandomly(ConfigMain.IceMeltsEnabled); } } } @@ -508,11 +277,4 @@ public class CustomNpcs { public static MinecraftServer getServer(){ return MinecraftServer.getServer(); } - - public static boolean isScriptDev(EntityPlayer player) { - if(CustomNpcs.ScriptOpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile()) || - ScriptDevs.contains(player.getUniqueID())){ - return true; - } else return ScriptDevIDs.isEmpty(); - } } \ No newline at end of file diff --git a/src/main/java/noppes/npcs/DataDisplay.java b/src/main/java/noppes/npcs/DataDisplay.java index c8899161c..48400d866 100644 --- a/src/main/java/noppes/npcs/DataDisplay.java +++ b/src/main/java/noppes/npcs/DataDisplay.java @@ -8,6 +8,7 @@ import net.minecraft.nbt.NBTTagString; import net.minecraft.nbt.NBTUtil; import net.minecraft.server.MinecraftServer; import net.minecraft.util.StringUtils; +import noppes.npcs.config.ConfigMain; import noppes.npcs.controllers.data.SkinOverlay; import noppes.npcs.entity.EntityNPCInterface; import noppes.npcs.entity.data.DataSkinOverlays; @@ -155,8 +156,8 @@ public class DataDisplay { skinOverlayData.readFromNBT(nbttagcompound); modelSize = ValueUtil.CorrectInt(nbttagcompound.getInteger("Size"), 1, Integer.MAX_VALUE); - if(modelSize > CustomNpcs.NpcSizeLimit) - modelSize = CustomNpcs.NpcSizeLimit; + if(modelSize > ConfigMain.NpcSizeLimit) + modelSize = ConfigMain.NpcSizeLimit; modelType = nbttagcompound.getInteger("modelType"); diff --git a/src/main/java/noppes/npcs/LogWriter.java b/src/main/java/noppes/npcs/LogWriter.java index 1e6d64f31..c373fe6f2 100644 --- a/src/main/java/noppes/npcs/LogWriter.java +++ b/src/main/java/noppes/npcs/LogWriter.java @@ -1,5 +1,7 @@ package noppes.npcs; +import noppes.npcs.config.ConfigDebug; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumScriptType; import java.io.File; @@ -170,7 +172,7 @@ public class LogWriter { long secondsSinceFirst = TimeUnit.MILLISECONDS.toSeconds(new Date().getTime() - stamp.makeDate.getTime()); long millisecSinceLast = TimeUnit.MILLISECONDS.toMillis(stamp.recentDate.getTime() - stamp.makeDate.getTime()); - double frequency = (float)CustomNpcs.ScriptFrequency / 60; + double frequency = (float) ConfigDebug.ScriptFrequency / 60; // Reset Log if 2 Minutes Pass if (secondsSinceFirst > 120) { LogWriter.script(message); @@ -184,7 +186,7 @@ public class LogWriter { stamp.recentDate = new Date(); } // IF event occurs to QUICKLY Ignore. - else if (millisecSinceLast < CustomNpcs.ScriptIgnoreTime){ + else if (millisecSinceLast < ConfigDebug.ScriptIgnoreTime){ stamp.recentDate = new Date(); } else if(secondsSinceFirst > 10 && (double)stamp.counter / secondsSinceFirst > frequency){ diff --git a/src/main/java/noppes/npcs/PacketHandlerServer.java b/src/main/java/noppes/npcs/PacketHandlerServer.java index 3cad65585..b3ffef2bf 100644 --- a/src/main/java/noppes/npcs/PacketHandlerServer.java +++ b/src/main/java/noppes/npcs/PacketHandlerServer.java @@ -31,6 +31,9 @@ import net.minecraft.village.MerchantRecipeList; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldServer; import net.minecraftforge.common.DimensionManager; +import noppes.npcs.config.ConfigDebug; +import noppes.npcs.config.ConfigMain; +import noppes.npcs.config.ConfigScript; import noppes.npcs.constants.EnumCompanionStage; import noppes.npcs.constants.EnumGuiType; import noppes.npcs.constants.EnumJobType; @@ -61,7 +64,7 @@ public class PacketHandlerServer{ @SubscribeEvent public void onServerPacket(ServerCustomPacketEvent event) { EntityPlayerMP player = ((NetHandlerPlayServer)event.handler).playerEntity; - if(CustomNpcs.OpsOnly && !NoppesUtilServer.isOp(player)){ + if(ConfigMain.OpsOnly && !NoppesUtilServer.isOp(player)){ warn(player, "tried to use custom npcs without being an op"); return; } @@ -123,7 +126,7 @@ public class PacketHandlerServer{ featherPackets(type, buffer, player); else if (item.getItem() == Item.getItemFromBlock(CustomItems.waypoint) || item.getItem() == Item.getItemFromBlock(CustomItems.border) || item.getItem() == Item.getItemFromBlock(CustomItems.redstoneBlock)) blockPackets(type, buffer, player); - else if (CustomNpcs.isScriptDev(player)) { + else if (ConfigScript.isScriptDev(player)) { if (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave) playerScriptPackets(type, buffer, player); else if (type == EnumPacketServer.ScriptNPCGet || type == EnumPacketServer.ScriptNPCSave) @@ -178,18 +181,18 @@ public class PacketHandlerServer{ private void getScriptsEnabled(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException { if (type == EnumPacketServer.ScriptGlobalGuiDataGet) { NBTTagCompound compound = new NBTTagCompound(); - compound.setBoolean("ScriptsEnabled", CustomNpcs.ScriptingEnabled); - compound.setBoolean("PlayerScriptsEnabled", CustomNpcs.GlobalPlayerScripts); - compound.setBoolean("GlobalNPCScriptsEnabled", CustomNpcs.GlobalNPCScripts); - compound.setBoolean("ForgeScriptsEnabled", CustomNpcs.GlobalForgeScripts); + compound.setBoolean("ScriptsEnabled", ConfigScript.ScriptingEnabled); + compound.setBoolean("PlayerScriptsEnabled", ConfigScript.GlobalPlayerScripts); + compound.setBoolean("GlobalNPCScriptsEnabled", ConfigScript.GlobalNPCScripts); + compound.setBoolean("ForgeScriptsEnabled", ConfigScript.GlobalForgeScripts); Server.sendData(player, EnumPacketClient.GUI_DATA, compound); } else if (type == EnumPacketServer.ScriptGlobalGuiDataSave) { NBTTagCompound compound = Server.readNBT(buffer); - CustomNpcs.ScriptingEnabled = compound.getBoolean("ScriptsEnabled"); - CustomNpcs.GlobalPlayerScripts = compound.getBoolean("PlayerScriptsEnabled"); - CustomNpcs.GlobalNPCScripts = compound.getBoolean("GlobalNPCScriptsEnabled"); - CustomNpcs.GlobalForgeScripts = compound.getBoolean("ForgeScriptsEnabled"); + ConfigScript.ScriptingEnabled = compound.getBoolean("ScriptsEnabled"); + ConfigScript.GlobalPlayerScripts = compound.getBoolean("PlayerScriptsEnabled"); + ConfigScript.GlobalNPCScripts = compound.getBoolean("GlobalNPCScriptsEnabled"); + ConfigScript.GlobalForgeScripts = compound.getBoolean("ForgeScriptsEnabled"); } } @@ -198,7 +201,7 @@ public class PacketHandlerServer{ npc.script.readFromNBT(Server.readNBT(buffer)); npc.updateAI = true; npc.script.hasInited = false; - if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ + if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ LogWriter.script(String.format("[%s] (Player) %s SAVED NPC %s (%s, %s, %s) [%s]", "SCRIPTER", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)(npc).posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName())); } } @@ -373,7 +376,7 @@ public class PacketHandlerServer{ private void wandPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws IOException{ if(type == EnumPacketServer.Delete){ - if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ + if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ LogWriter.script(String.format("[%s] (Player) %s DELETE NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)npc.posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName())); } npc.delete(); @@ -411,7 +414,7 @@ public class PacketHandlerServer{ npc.reset(); if(npc.linkedData != null) LinkedNpcController.Instance.saveNpcData(npc); - if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ + if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ LogWriter.script(String.format("[%s] (Player) %s CLOSE NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)npc.posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName())); } NoppesUtilServer.setEditingNpc(player, null); @@ -440,7 +443,7 @@ public class PacketHandlerServer{ if(entity == null || !(entity instanceof EntityNPCInterface)) return; NoppesUtilServer.sendOpenGui(player, EnumGuiType.MainMenuDisplay, (EntityNPCInterface) entity); - if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ + if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), ((EntityNPCInterface)entity).display.getName(), entity.posX, entity.posY, entity.posZ, entity.worldObj.getWorldInfo().getWorldName())); } } @@ -449,7 +452,7 @@ public class PacketHandlerServer{ if(entity == null || !(entity instanceof EntityNPCInterface)) return; npc = (EntityNPCInterface) entity; - if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ + if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ LogWriter.script(String.format("[%s] (Player) %s DELETE NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)npc.posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName())); } npc.delete(); @@ -879,7 +882,7 @@ public class PacketHandlerServer{ player.addChatMessage(new ChatComponentText("Failed to create an entity out of your clone")); return; } - if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ + if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ LogWriter.script(String.format("[%s] (Player) %s SPAWNED ENTITY %s", "CLONER", player.getCommandSenderName(), entity)); } } diff --git a/src/main/java/noppes/npcs/ServerEventsHandler.java b/src/main/java/noppes/npcs/ServerEventsHandler.java index be12b636a..1476752e3 100644 --- a/src/main/java/noppes/npcs/ServerEventsHandler.java +++ b/src/main/java/noppes/npcs/ServerEventsHandler.java @@ -34,6 +34,8 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; import net.minecraftforge.event.terraingen.PopulateChunkEvent; import noppes.npcs.blocks.tiles.TileBanner; +import noppes.npcs.config.ConfigDebug; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumGuiType; import noppes.npcs.constants.EnumPacketClient; import noppes.npcs.constants.EnumQuestType; @@ -61,13 +63,13 @@ public class ServerEventsHandler { boolean isRemote = event.entityPlayer.worldObj.isRemote; boolean npcInteracted = event.target instanceof EntityNPCInterface; - if(!isRemote && CustomNpcs.OpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(event.entityPlayer.getGameProfile())){ + if(!isRemote && ConfigMain.OpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(event.entityPlayer.getGameProfile())){ return; } if(!isRemote && item.getItem() == CustomItems.soulstoneEmpty && event.target instanceof EntityLivingBase) { ((ItemSoulstoneEmpty)item.getItem()).store((EntityLivingBase)event.target, item, event.entityPlayer); - if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ + if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ LogWriter.script(String.format("[%s] (Player) %s PICKED ENTITY %s", "SOULSTONE", event.entityPlayer.getCommandSenderName(), event.target)); } } @@ -78,7 +80,7 @@ public class ServerEventsHandler { } event.setCanceled(true); NoppesUtilServer.sendOpenGui(event.entityPlayer, EnumGuiType.MainMenuDisplay, (EntityNPCInterface) event.target); - if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ + if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "WAND", event.entityPlayer.getCommandSenderName(), ((EntityNPCInterface)(event.target)).display.getName(), (int)(event.target).posX, (int)(event.target).posY, (int)(event.target).posZ, (event.target).worldObj.getWorldInfo().getWorldName())); } } @@ -99,7 +101,7 @@ public class ServerEventsHandler { NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface)event.target); event.setCanceled(true); Server.sendData((EntityPlayerMP)event.entityPlayer, EnumPacketClient.GUI, EnumGuiType.Script.ordinal()); - if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ + if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "SCRIPTER", event.entityPlayer.getCommandSenderName(), ((EntityNPCInterface)(event.target)).display.getName(), (int)(event.target).posX, (int)(event.target).posY, (int)(event.target).posZ, (event.target).worldObj.getWorldInfo().getWorldName())); } } diff --git a/src/main/java/noppes/npcs/ai/EntityAIAttackTarget.java b/src/main/java/noppes/npcs/ai/EntityAIAttackTarget.java index 4cf345196..c4fda8969 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIAttackTarget.java +++ b/src/main/java/noppes/npcs/ai/EntityAIAttackTarget.java @@ -7,6 +7,7 @@ import net.minecraft.pathfinding.PathEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import noppes.npcs.CustomNpcs; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.AiMutex; import noppes.npcs.entity.EntityNPCInterface; @@ -59,7 +60,7 @@ public class EntityAIAttackTarget extends EntityAIBase this.entityTarget = entitylivingbase; this.attacker.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(((EntityNPCInterface) this.attacker).stats.aggroRange); this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); - this.attacker.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(CustomNpcs.NpcNavRange); + this.attacker.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(ConfigMain.NpcNavRange); return this.entityPathEntity != null; } } diff --git a/src/main/java/noppes/npcs/ai/EntityAIReturn.java b/src/main/java/noppes/npcs/ai/EntityAIReturn.java index 8920ac61a..a27b88be0 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIReturn.java +++ b/src/main/java/noppes/npcs/ai/EntityAIReturn.java @@ -3,6 +3,7 @@ package noppes.npcs.ai; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.util.Vec3; import noppes.npcs.CustomNpcs; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumMovingType; import noppes.npcs.entity.EntityNPCInterface; @@ -56,7 +57,7 @@ public class EntityAIReturn extends EntityAIBase return false; } - if(npc.ai.movingType == EnumMovingType.MovingPath && npc.ai.getDistanceSqToPathPoint() < CustomNpcs.NpcNavRange * CustomNpcs.NpcNavRange) + if(npc.ai.movingType == EnumMovingType.MovingPath && npc.ai.getDistanceSqToPathPoint() < ConfigMain.NpcNavRange * ConfigMain.NpcNavRange) return false; if (npc.getNavigator().noPath() || (!npc.isAttacking() && wasAttacked)) { @@ -129,10 +130,10 @@ public class EntityAIReturn extends EntityAIBase double posY = endPosY; double posZ = endPosZ; double range = npc.getDistance(posX, posY, posZ); - if(range > CustomNpcs.NpcNavRange || towards){ + if(range > ConfigMain.NpcNavRange || towards){ int distance = (int) range; - if(distance > CustomNpcs.NpcNavRange) - distance = CustomNpcs.NpcNavRange / 2; + if(distance > ConfigMain.NpcNavRange) + distance = ConfigMain.NpcNavRange / 2; else distance /= 2; if(distance > 2){ diff --git a/src/main/java/noppes/npcs/ai/EntityAIWander.java b/src/main/java/noppes/npcs/ai/EntityAIWander.java index 96ad68423..528b4c831 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIWander.java +++ b/src/main/java/noppes/npcs/ai/EntityAIWander.java @@ -9,6 +9,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import noppes.npcs.CustomNpcs; import noppes.npcs.ai.selector.NPCInteractSelector; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.AiMutex; import noppes.npcs.controllers.data.Line; import noppes.npcs.entity.EntityNPCInterface; @@ -84,12 +85,12 @@ public class EntityAIWander extends EntityAIBase if(entity.ai.walkingRange > 0){ double distance = this.entity.getDistanceSq(this.entity.getStartXPos(), this.entity.getStartYPos(), this.entity.getStartZPos()); int range = (int) MathHelper.sqrt_double(this.entity.ai.walkingRange * this.entity.ai.walkingRange - distance); - if(range > CustomNpcs.NpcNavRange) - range = CustomNpcs.NpcNavRange; + if(range > ConfigMain.NpcNavRange) + range = ConfigMain.NpcNavRange; if(range < 3){ range = this.entity.ai.walkingRange; - if(range > CustomNpcs.NpcNavRange) - range = CustomNpcs.NpcNavRange; + if(range > ConfigMain.NpcNavRange) + range = ConfigMain.NpcNavRange; Vec3 start = Vec3.createVectorHelper(this.entity.getStartXPos(), this.entity.getStartYPos(), this.entity.getStartZPos()); return RandomPositionGeneratorAlt.findRandomTargetBlockTowards(this.entity, range / 2, range / 2 > 7?7:range / 2, start); } @@ -97,7 +98,7 @@ public class EntityAIWander extends EntityAIBase return RandomPositionGeneratorAlt.findRandomTarget(this.entity, range, range / 2 > 7?7:range / 2); } } - return RandomPositionGeneratorAlt.findRandomTarget(this.entity, CustomNpcs.NpcNavRange, 7); + return RandomPositionGeneratorAlt.findRandomTarget(this.entity, ConfigMain.NpcNavRange, 7); } @Override diff --git a/src/main/java/noppes/npcs/ai/target/EntityAIClosestTarget.java b/src/main/java/noppes/npcs/ai/target/EntityAIClosestTarget.java index 454d1fb71..1aeee1fe2 100644 --- a/src/main/java/noppes/npcs/ai/target/EntityAIClosestTarget.java +++ b/src/main/java/noppes/npcs/ai/target/EntityAIClosestTarget.java @@ -12,6 +12,7 @@ import net.minecraft.entity.ai.EntityAITarget; import net.minecraft.entity.monster.EntityMob; import net.minecraft.util.MathHelper; import noppes.npcs.CustomNpcs; +import noppes.npcs.config.ConfigMain; import noppes.npcs.entity.EntityNPCInterface; public class EntityAIClosestTarget extends EntityAITarget @@ -59,7 +60,7 @@ public class EntityAIClosestTarget extends EntityAITarget double d0 = this.getTargetDistance(); List list = this.taskOwner.worldObj.selectEntitiesWithinAABB(this.targetClass, this.taskOwner.boundingBox.expand(d0, MathHelper.ceiling_double_int(d0 / 2.0D), d0), this.field_82643_g); Collections.sort(list, this.theNearestAttackableTargetSorter); - taskOwner.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(CustomNpcs.NpcNavRange); + taskOwner.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(ConfigMain.NpcNavRange); if (list.isEmpty()) { return false; diff --git a/src/main/java/noppes/npcs/client/ClientProxy.java b/src/main/java/noppes/npcs/client/ClientProxy.java index fbacdc510..8b69447ba 100644 --- a/src/main/java/noppes/npcs/client/ClientProxy.java +++ b/src/main/java/noppes/npcs/client/ClientProxy.java @@ -128,6 +128,9 @@ import noppes.npcs.client.renderer.blocks.BlockTallLampRenderer; import noppes.npcs.client.renderer.blocks.BlockTombstoneRenderer; import noppes.npcs.client.renderer.blocks.BlockWallBannerRenderer; import noppes.npcs.client.renderer.blocks.BlockWeaponRackRenderer; +import noppes.npcs.config.ConfigClient; +import noppes.npcs.config.ConfigMain; +import noppes.npcs.config.ConfigScript; import noppes.npcs.config.StringCache; import noppes.npcs.constants.EnumGuiType; import noppes.npcs.containers.*; @@ -154,7 +157,7 @@ public class ClientProxy extends CommonProxy { public static FontContainer Font; public void load() { - Font = new FontContainer(CustomNpcs.FontType, CustomNpcs.FontSize); + Font = new FontContainer(ConfigClient.FontType, ConfigClient.FontSize); createFolders(); CustomNpcs.Channel.register(new PacketHandlerClient()); CustomNpcs.ChannelPlayer.register(new PacketHandlerPlayer()); @@ -177,7 +180,7 @@ public class ClientProxy extends CommonProxy { ClientRegistry.bindTileEntitySpecialRenderer(TileMailbox.class, new BlockMailboxRenderer()); RenderingRegistry.registerBlockHandler(new BlockBorderRenderer()); - if(!CustomNpcs.DisableExtraBlock){ + if(!ConfigMain.DisableExtraBlock){ ClientRegistry.bindTileEntitySpecialRenderer(TileBanner.class, new BlockBannerRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileWallBanner.class, new BlockWallBannerRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileTallLamp.class, new BlockTallLampRenderer()); @@ -210,7 +213,7 @@ public class ClientProxy extends CommonProxy { new PresetController(CustomNpcs.Dir); - if(CustomNpcs.EnableUpdateChecker){ + if(ConfigMain.EnableUpdateChecker){ VersionChecker checker = new VersionChecker(); checker.start(); } @@ -219,7 +222,7 @@ public class ClientProxy extends CommonProxy { MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); - if(CustomNpcs.InventoryGuiEnabled){ + if(ConfigClient.InventoryGuiEnabled){ MinecraftForge.EVENT_BUS.register(new TabRegistry()); if (TabRegistry.getTabList().size() < 2){ @@ -358,7 +361,7 @@ public class ClientProxy extends CommonProxy { else if(gui == EnumGuiType.PlayerTransporter) return new GuiTransportSelection(npc); - else if(gui == EnumGuiType.Script && CustomNpcs.ScriptingEnabled) + else if(gui == EnumGuiType.Script && ConfigScript.ScriptingEnabled) return new GuiScript(npc); else if (gui == EnumGuiType.ScriptItem) diff --git a/src/main/java/noppes/npcs/client/PacketHandlerClient.java b/src/main/java/noppes/npcs/client/PacketHandlerClient.java index b3c1d2627..bba5a503a 100644 --- a/src/main/java/noppes/npcs/client/PacketHandlerClient.java +++ b/src/main/java/noppes/npcs/client/PacketHandlerClient.java @@ -37,6 +37,7 @@ import noppes.npcs.client.gui.util.IGuiClose; import noppes.npcs.client.gui.util.IGuiData; import noppes.npcs.client.gui.util.IGuiError; import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.config.ConfigClient; import noppes.npcs.constants.EnumGuiType; import noppes.npcs.constants.EnumPacketClient; import noppes.npcs.controllers.data.RecipeCarpentry; @@ -248,10 +249,10 @@ public class PacketHandlerClient extends PacketHandlerServer{ String font = Server.readString(buffer); int size = buffer.readInt(); if(!font.isEmpty()){ - CustomNpcs.FontType = font; - CustomNpcs.FontSize = size; - ClientProxy.Font = new FontContainer(CustomNpcs.FontType, CustomNpcs.FontSize); - CustomNpcs.Config.updateConfig(); + ConfigClient.FontType = font; + ConfigClient.FontSize = size; + ClientProxy.Font = new FontContainer(ConfigClient.FontType, ConfigClient.FontSize); + // CustomNpcs.Config.updateConfig(); player.addChatMessage(new ChatComponentTranslation("Font set to %s", ClientProxy.Font.getName())); } else diff --git a/src/main/java/noppes/npcs/client/RenderChatMessages.java b/src/main/java/noppes/npcs/client/RenderChatMessages.java index 4c5dfabd0..c612a01a6 100644 --- a/src/main/java/noppes/npcs/client/RenderChatMessages.java +++ b/src/main/java/noppes/npcs/client/RenderChatMessages.java @@ -1,10 +1,7 @@ package noppes.npcs.client; -import java.util.Hashtable; import java.util.Map; import java.util.TreeMap; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -13,9 +10,8 @@ import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.util.IChatComponent; -import net.minecraft.util.MathHelper; import noppes.npcs.IChatMessages; -import noppes.npcs.CustomNpcs; +import noppes.npcs.config.ConfigClient; import noppes.npcs.entity.EntityNPCInterface; import org.lwjgl.opengl.GL11; @@ -31,7 +27,7 @@ public class RenderChatMessages implements IChatMessages{ @Override public void addMessage(String message, EntityNPCInterface npc){ - if(!CustomNpcs.EnableChatBubbles) + if(!ConfigClient.EnableChatBubbles) return; long time = System.currentTimeMillis(); if(message.equals(lastMessage) && lastMessageTime + 5000 > time){ diff --git a/src/main/java/noppes/npcs/client/gui/OverlayQuestTracking.java b/src/main/java/noppes/npcs/client/gui/OverlayQuestTracking.java index dc7cbdbc7..270b76b87 100644 --- a/src/main/java/noppes/npcs/client/gui/OverlayQuestTracking.java +++ b/src/main/java/noppes/npcs/client/gui/OverlayQuestTracking.java @@ -13,6 +13,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.ResourceLocation; import noppes.npcs.CustomNpcs; +import noppes.npcs.config.ConfigClient; +import noppes.npcs.config.ConfigScript; import noppes.npcs.controllers.data.Quest; import org.lwjgl.opengl.GL11; @@ -179,17 +181,17 @@ public class OverlayQuestTracking extends Gui { GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glPushMatrix(); - GL11.glTranslatef(CustomNpcs.TrackingInfoAlignment%3*((float)(scaledWidth)/2), (float) (Math.floor((float)(CustomNpcs.TrackingInfoAlignment/3))*((float)(scaledHeight)/2)),0.0F); + GL11.glTranslatef(ConfigClient.TrackingInfoAlignment%3*((float)(scaledWidth)/2), (float) (Math.floor((float)(ConfigClient.TrackingInfoAlignment/3))*((float)(scaledHeight)/2)),0.0F); - float offsetX = CustomNpcs.TrackingInfoAlignment%3 == 0 ? 5 : -5; - GL11.glTranslatef(CustomNpcs.TrackingInfoX + offsetX, CustomNpcs.TrackingInfoY, 0.0F); + float offsetX = ConfigClient.TrackingInfoAlignment%3 == 0 ? 5 : -5; + GL11.glTranslatef(ConfigClient.TrackingInfoX + offsetX, ConfigClient.TrackingInfoY, 0.0F); red = (color >> 16 & 255) / 255f; green = (color >> 8 & 255) / 255f; blue = (color & 255) / 255f; float centerX = -60; - centerX *= CustomNpcs.TrackingInfoAlignment%3 == 0 ? -1 : 1; + centerX *= ConfigClient.TrackingInfoAlignment%3 == 0 ? -1 : 1; float questTitleTop; this.renderOffsetY = -40; @@ -206,12 +208,12 @@ public class OverlayQuestTracking extends Gui { this.renderOffsetY = -10; GL11.glPushMatrix(); - this.renderStringLines(objectiveLines,1F, true, false, CustomNpcs.TrackingInfoAlignment%3 == 0 ? 1 : 2); + this.renderStringLines(objectiveLines,1F, true, false, ConfigClient.TrackingInfoAlignment%3 == 0 ? 1 : 2); GL11.glPopMatrix(); this.renderOffsetY += 10; GL11.glPushMatrix(); - this.renderStringLines(turnInText,1F, false, false, CustomNpcs.TrackingInfoAlignment%3 == 0 ? 1 : 2); + this.renderStringLines(turnInText,1F, false, false, ConfigClient.TrackingInfoAlignment%3 == 0 ? 1 : 2); GL11.glPopMatrix(); this.renderOffsetY = -20; diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcDialogVisual.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcDialogVisual.java index 64d1cc35b..4aab1870a 100644 --- a/src/main/java/noppes/npcs/client/gui/SubGuiNpcDialogVisual.java +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcDialogVisual.java @@ -8,6 +8,8 @@ import noppes.npcs.client.Client; import noppes.npcs.client.NoppesUtil; import noppes.npcs.client.gui.global.GuiNPCManageDialogs; import noppes.npcs.client.gui.util.*; +import noppes.npcs.config.ConfigMain; +import noppes.npcs.config.ConfigScript; import noppes.npcs.constants.EnumPacketServer; import noppes.npcs.controllers.data.Dialog; import noppes.npcs.controllers.data.DialogImage; @@ -324,7 +326,7 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis if (activeMenu == 3) { if (button.id == 1) { - if (dialog.dialogImages.size() >= CustomNpcs.DialogImageLimit) { + if (dialog.dialogImages.size() >= ConfigMain.DialogImageLimit) { return; } diff --git a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcDisplay.java b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcDisplay.java index 29173463e..0f94863fa 100644 --- a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcDisplay.java +++ b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcDisplay.java @@ -14,6 +14,7 @@ import noppes.npcs.client.gui.GuiNpcTextureOverlays; import noppes.npcs.client.gui.SubGuiNpcName; import noppes.npcs.client.gui.model.GuiCreationScreen; import noppes.npcs.client.gui.util.*; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumPacketServer; import noppes.npcs.controllers.data.SkinOverlay; import noppes.npcs.entity.EntityCustomNpc; @@ -53,7 +54,7 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene addLabel(new GuiNpcLabel(2,"display.size", guiLeft + 175, y + 5)); addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 203, y, 40, 20, display.modelSize + "")); getTextField(2).integersOnly = true; - getTextField(2).setMinMaxDefault(1, CustomNpcs.NpcSizeLimit, 5); + getTextField(2).setMinMaxDefault(1, ConfigMain.NpcSizeLimit, 5); //addLabel(new GuiNpcLabel(3,"(1-30)", guiLeft + 246 , y + 5)); y+=23; diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiTextArea.java b/src/main/java/noppes/npcs/client/gui/util/GuiTextArea.java index 5103da22e..792431708 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiTextArea.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiTextArea.java @@ -20,6 +20,7 @@ import net.minecraftforge.client.GuiIngameForge; import noppes.npcs.CustomNpcs; import noppes.npcs.NoppesStringUtils; import noppes.npcs.client.gui.util.TextContainer.LineData; +import noppes.npcs.config.ConfigClient; import noppes.npcs.config.TrueTypeFont; import org.lwjgl.input.Mouse; @@ -458,7 +459,7 @@ public class GuiTextArea extends Gui implements IGui, IKeyListener, IMouseListen } static { - font = new TrueTypeFont(new Font("Arial Unicode MS", 0, CustomNpcs.FontSize), 1.0F); + font = new TrueTypeFont(new Font("Arial Unicode MS", 0, ConfigClient.FontSize), 1.0F); } class UndoData { diff --git a/src/main/java/noppes/npcs/config/ConfigClient.java b/src/main/java/noppes/npcs/config/ConfigClient.java new file mode 100644 index 000000000..4801341d2 --- /dev/null +++ b/src/main/java/noppes/npcs/config/ConfigClient.java @@ -0,0 +1,62 @@ +package noppes.npcs.config; + +import cpw.mods.fml.common.FMLLog; +import net.minecraftforge.common.config.Configuration; +import org.apache.logging.log4j.Level; + +import java.io.File; + +public class ConfigClient +{ + public static Configuration config; + + public static boolean EnableChatBubbles = true; + public static boolean InventoryGuiEnabled = true; + public static String FontType = "Default"; + public static int FontSize = 18; + public static boolean EntityRendererMixin = true; + + public static int TrackingInfoAlignment = 3; + public static int TrackingInfoX = 0; + public static int TrackingInfoY = 0; + + public final static String VISUAL = "Visual"; + + public final static String QUESTING = "Questing"; + + public static void init(File configFile) + { + config = new Configuration(configFile); + + try + { + config.load(); + EnableChatBubbles = config.get(VISUAL, "Enable Chat Bubbles", true, "Enable/Disable Chat Bubbles").getBoolean(true); + InventoryGuiEnabled = config.get(VISUAL, "Enable Inventory Tabs", true, "Enable/Disable Inventory Tabs").getBoolean(true); + FontType = config.get(VISUAL, "Font Type", "Default", "When set to Minecraft it will use minecrafts font, when Default it will use OpenSans. Can only use fonts installed on your PC").getString(); + FontSize = config.get(VISUAL, "Font Size", 18, "Font size for custom fonts (doesn't work with minecrafts font)").getInt(18); + EntityRendererMixin = config.get(VISUAL, "Entity Render Mixin", true, "Enables Overlay Mixins for Conflicts relating to Optifine or other Skin Renderers. If crashes occur, please disable.").getBoolean(true); + + TrackingInfoAlignment = config.get(QUESTING, "Tracking Info Alignment", 3, "Client sided! Determines where tracking quest info shows up on the screen based on a number from 0 to 8. Default: 3").getInt(3); + if (TrackingInfoAlignment < 0) + TrackingInfoAlignment = 0; + if (TrackingInfoAlignment > 8) + TrackingInfoAlignment = 8; + + TrackingInfoX = config.get(QUESTING, "Tracking Info X", 0, "Client sided! Offsets the tracking info GUI by this amount in the X direction.").getInt(0); + TrackingInfoY = config.get(QUESTING, "Tracking Info Y", 0, "Client sided! Offsets the tracking info GUI by this amount in the Y direction.").getInt(0); + + + } + catch (Exception e) + { + FMLLog.log(Level.ERROR, e, "CNPC+ has had a problem loading its client configuration"); + } + finally + { + if (config.hasChanged()) { + config.save(); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/config/ConfigDebug.java b/src/main/java/noppes/npcs/config/ConfigDebug.java new file mode 100644 index 000000000..fa346c48e --- /dev/null +++ b/src/main/java/noppes/npcs/config/ConfigDebug.java @@ -0,0 +1,109 @@ +package noppes.npcs.config; + +import cpw.mods.fml.common.FMLLog; +import net.minecraftforge.common.config.Configuration; +import noppes.npcs.CustomNpcs; +import noppes.npcs.constants.EnumScriptType; +import org.apache.logging.log4j.Level; + +import java.io.File; + +public class ConfigDebug +{ + public static Configuration config; + + public static boolean PlayerLogging = false; + + public static boolean ScriptLogging = false; + public static int ScriptFrequency = 20; + public static int ScriptIgnoreTime = 2000; + public static String ScriptLogIgnoreType = "TICK"; + + public final static String LOGGING = "Visual"; + + public static void init(File configFile) + { + config = new Configuration(configFile); + + try + { + config.load(); + PlayerLogging = config.get(LOGGING, "Enable Player Logging", false, "Enables if Player Information (WAND-USE) should be printed to CustomNPCs Logs. IF on Server \n" + + "Logs will only be present SERVER-SIDE only in CustomNPCs-latest, -1, -2, and -3").getBoolean(false); + + ScriptLogging = config.get(LOGGING, "Enable Script Logging", false, "Enables if Scripting Information should be printed to CustomNPCs Logs. IF on Server \n" + + "Logs will only be present SERVER-SIDE only in CustomNPCs-latest, -1, -2, and -3").getBoolean(false); + ScriptFrequency = config.get(LOGGING, "Script Log Frequency Limit", 20, "Amount of Messages marked as SPAM [5, 3000]. Lower Number means MORE accurate messages \n" + + "This frequency will determine if the log will print a line with [SPAM] to warn the console.").getInt(20); + if (ScriptFrequency < 5) + ScriptFrequency = 5; + if (ScriptFrequency > 3000) + ScriptFrequency = 3000; + + ScriptIgnoreTime = config.get(LOGGING, "Script Ignore Time Buffer", 2000, "IN Milliseconds 1s = 1000s. If a recent LOG of the same event is SENT within this threshold it will be ignored.").getInt(2000); + if (ScriptIgnoreTime < 0) + ScriptIgnoreTime = 0; + + ScriptLogIgnoreType = config.get(LOGGING, "Script Type Ignore", "TICK", "Comma separated list of NPC Script Types that will omit these from the logs,\n" + + "INIT,TICK,INTERACT,DIALOG,DAMAGED,KILLED,ATTACK,TARGET,COLLIDE,KILLS,DIALOG_CLOSE,TIMER").getString(); + try { + String[] ignoreTypes = ScriptLogIgnoreType.split(","); + for (String s : ignoreTypes) { + EnumScriptType type = EnumScriptType.valueOfIgnoreCase(s); + if(type != null){ + switch (type){ + case INIT: + CustomNpcs.InitIgnore = true; + break; + case TICK: + CustomNpcs.TickIgnore = true; + break; + case INTERACT: + CustomNpcs.InteractIgnore = true; + break; + case DIALOG: + CustomNpcs.DialogIgnore = true; + break; + case DAMAGED: + CustomNpcs.DamagedIgnore = true; + break; + case KILLED: + CustomNpcs.KilledIgnore = true; + break; + case ATTACK: + CustomNpcs.AttackIgnore = true; + break; + case TARGET: + CustomNpcs.TargetIgnore = true; + break; + case COLLIDE: + CustomNpcs.CollideIgnore = true; + break; + case KILLS: + CustomNpcs.KillsIgnore = true; + break; + case DIALOG_CLOSE: + CustomNpcs.DialogCloseIgnore = true; + break; + case TIMER: + CustomNpcs.TimerIgnore = true; + break; + default: + break; + } + } + } + } catch (Exception ignored) {} + } + catch (Exception e) + { + FMLLog.log(Level.ERROR, e, "CNPC+ has had a problem loading its debug configuration"); + } + finally + { + if (config.hasChanged()) { + config.save(); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/config/ConfigMain.java b/src/main/java/noppes/npcs/config/ConfigMain.java new file mode 100644 index 000000000..1d1ffd631 --- /dev/null +++ b/src/main/java/noppes/npcs/config/ConfigMain.java @@ -0,0 +1,102 @@ +package noppes.npcs.config; + +import cpw.mods.fml.common.FMLLog; +import net.minecraftforge.common.config.Configuration; +import org.apache.logging.log4j.Level; + +import java.io.File; + +public class ConfigMain +{ + public static Configuration config; + + public static boolean EnableUpdateChecker = true; + + public static boolean DisableExtraBlock = false; + public static boolean DisableExtraItems = false; + public static boolean DisableEnchants = false; + public static boolean GunsEnabled = true; + public static int EnchantStartId = 100; + + public static boolean LeavesDecayEnabled = true; + public static boolean VineGrowthEnabled = true; + public static boolean IceMeltsEnabled = true; + public static boolean SoulStoneAnimals = true; + public static boolean SoulStoneVillagers = false; + public static boolean SoulStoneNPCs = false; + public static boolean SoulStoneFriendlyNPCs = false; + + public static boolean OpsOnly = false; + public static int NpcNavRange = 32; + public static int NpcSizeLimit = 100; + public static String DefaultInteractLine = "Hello @p"; + public static int ChunkLoaders = 20; + public static int DialogImageLimit = 10; + public static int SkinOverlayLimit = 10; + + public static boolean NpcUseOpCommands = false; + + public final static String GENERAL = "NPC"; + public final static String NPC = "NPC"; + + public static void init(File configFile) + { + config = new Configuration(configFile); + + try + { + config.load(); + EnableUpdateChecker = config.get(GENERAL, "Enables Update Checker", true).getBoolean(true); + + DisableExtraBlock = config.get(GENERAL, "Disable Extra Blocks", false).getBoolean(false); + DisableExtraItems = config.get(GENERAL, "Disable Extra Items", false).getBoolean(false); + GunsEnabled = config.get(GENERAL, "Guns Enabled", true, "Set to false if you want to disable guns").getBoolean(true); + DisableEnchants = config.get(GENERAL, "Disable Enchants", false).getBoolean(false); + EnchantStartId = config.get(GENERAL, "Enchant Start ID", 100, "Start ID for enchants. IDs can only range from 0-256").getInt(100); + LeavesDecayEnabled = config.get(GENERAL, "Leaves Decay Enabled", true).getBoolean(true); + VineGrowthEnabled = config.get(GENERAL, "Vine Growth Enabled", true).getBoolean(true); + IceMeltsEnabled = config.get(GENERAL, "Ice Melt Enabled", true).getBoolean(true); + SoulStoneAnimals = config.get(GENERAL, "Normal playes can use soulstone on Animals", true).getBoolean(true); + SoulStoneVillagers = config.get(GENERAL, "Normal playes can use soulstone on Villagers", true).getBoolean(true); + SoulStoneNPCs = config.get(GENERAL, "Normal playes can use soulstone on NPCs", false).getBoolean(false); + SoulStoneFriendlyNPCs = config.get(GENERAL, "Normal playes can use soulstone on Friendly NPCs", false).getBoolean(false); + + NpcNavRange = config.get(NPC, "NPC Navigation Range", 32, "Navigation search range for NPCs. Not recommended to increase if you have a slow pc or on a server. Minimum of 16, maximum of 96.").getInt(32); + if (NpcNavRange < 16) { + NpcNavRange = 16; + } + if (NpcNavRange > 96) { + NpcNavRange = 96; + } + + NpcSizeLimit = config.get(NPC, "NPC Size Limit", 100, "Size limit for NPCs. Default 100, larger sizes may cause lag on clients and servers that can't take it!").getInt(100); + if(NpcSizeLimit < 1) + NpcSizeLimit = 1; + + OpsOnly = config.get(NPC, "Only Ops Edit NPCs", false, "Only ops can create and edit npcs").getBoolean(false); + NpcUseOpCommands = config.get(NPC, "NPC Use Op Commands", false, "Set to true if you want the dialog command option to be able to use op commands like tp etc").getBoolean(false); + DefaultInteractLine = config.get(NPC, "Default Interaction Line", "Hello @p", "Default interact line. Leave empty to not have one").getString(); + ChunkLoaders = config.get(NPC, "Chunk Loader Limit", 20, "Number of chunk loading npcs that can be active at the same time").getInt(20); + + DialogImageLimit = config.get(NPC, "Dialog Image Limit", 10, "The maximum number of images any dialog can hold.").getInt(10); + if (DialogImageLimit < 0) { + DialogImageLimit = 0; + } + + SkinOverlayLimit = config.get(NPC, "Skin Overlay Limit", 10, "The maximum number of overlays any npc/player can hold.").getInt(10); + if (SkinOverlayLimit < 0) { + SkinOverlayLimit = 0; + } + } + catch (Exception e) + { + FMLLog.log(Level.ERROR, e, "CNPC+ has had a problem loading its main configuration"); + } + finally + { + if (config.hasChanged()) { + config.save(); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/config/ConfigScript.java b/src/main/java/noppes/npcs/config/ConfigScript.java new file mode 100644 index 000000000..304711726 --- /dev/null +++ b/src/main/java/noppes/npcs/config/ConfigScript.java @@ -0,0 +1,86 @@ +package noppes.npcs.config; + +import cpw.mods.fml.common.FMLLog; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import net.minecraftforge.common.config.Configuration; +import noppes.npcs.CustomNpcs; +import org.apache.logging.log4j.Level; + +import java.io.File; +import java.util.UUID; + +public class ConfigScript +{ + public static Configuration config; + + public static boolean ScriptingEnabled = true; + public static boolean ScriptingECMA6 = false; + public static boolean GlobalPlayerScripts = true; + public static boolean GlobalForgeScripts = true; + public static boolean GlobalNPCScripts = false; + public static int ExpandedScriptLimit = 2; + public static boolean ScriptOpsOnly = false; + public static String ScriptDevIDs = ""; + + public final static String GENERAL = "Scripting General"; + public final static String CUSTOMIZATION = "Scripting Customization"; + + public static void init(File configFile) + { + config = new Configuration(configFile); + + try + { + config.load(); + ScriptingEnabled = config.get(GENERAL, "Enable Scripting", true, "Enables/Disables ALL scripting. You can still see and write code in the scripter, but these scripts won't run. True by default").getBoolean(true); + ScriptOpsOnly = config.get(GENERAL, "OPs Only", false, "Only ops can see and edit scripts").getBoolean(false); + GlobalPlayerScripts = config.get(GENERAL, "Enable Global Player Scripts", true, "Enables global player event scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. True by default.").getBoolean(true); + GlobalForgeScripts = config.get(GENERAL, "Enable Global Forge Event Scripts", true, "Enables global forge event scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. True by default.").getBoolean(true); + GlobalNPCScripts = config.get(GENERAL, "Enable Global NPC Scripts", false, "Enables global NPC scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. False by default, use with caution!").getBoolean(false); + + ScriptingECMA6 = config.get(CUSTOMIZATION, "ECMA6 Scripting Language", false, + "Enables/Disables the use of the the ECMA6 Javascript standard instead of ECMA5.1." + + "\nEnabling this adds many more features to JS in scripts. Only use if on Java 8 or higher." + + "\nNot all ECMA 6 language is supported through this functionality.").getBoolean(false); + ExpandedScriptLimit = config.get(CUSTOMIZATION, "Script Tag Limit", 2, + "If scripts are too long (>65535 characters), they normally won't be saved in NBT data.\n" + + "This config adds additional compound tags to scripts that need it, so you can store much larger scripts!\n" + + "Every additional compound tag adds 65535 more characters to your script length limit. Use incrementally, with caution.").getInt(2); + if (ExpandedScriptLimit < 0) + ExpandedScriptLimit = 0; + + ScriptDevIDs = config.get(CUSTOMIZATION, "Script Dev UUIDs", "", + "Comma separated list of player UUIDs that can see and edit scripts. If ScriptsOpsOnly is true,\n" + + "ops and players with these IDs can see and edit scripts. Example:\n" + + "b876ec32-e396-476b-a115-8438d83c67d4,069a79f4-44e9-4726-a5be-fca90e38aaf5,be951074-c7ea-4f02-a725-bf017bc88650\n" + + "Get a player's UUID from a site like NameMC or the API IPlayer.getUniqueID() function!\n" + + "If left empty and ScriptsOpsOnly is false, anyone can see and edit scripts with a scripter.").getString(); + try { + CustomNpcs.ScriptDevs.clear(); + String[] uuidStrings = ScriptDevIDs.split(","); + for (String s : uuidStrings) { + CustomNpcs.ScriptDevs.add(UUID.fromString(s)); + } + } catch (Exception ignored) {} + + } + catch (Exception e) + { + FMLLog.log(Level.ERROR, e, "CNPC+ has had a problem loading its scripting configuration"); + } + finally + { + if (config.hasChanged()) { + config.save(); + } + } + } + + public static boolean isScriptDev(EntityPlayer player) { + if(ScriptOpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile()) || + CustomNpcs.ScriptDevs.contains(player.getUniqueID())){ + return true; + } else return ScriptDevIDs.isEmpty(); + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/config/LoadConfiguration.java b/src/main/java/noppes/npcs/config/LoadConfiguration.java new file mode 100644 index 000000000..5bde64099 --- /dev/null +++ b/src/main/java/noppes/npcs/config/LoadConfiguration.java @@ -0,0 +1,37 @@ +package noppes.npcs.config; + +import noppes.npcs.config.legacy.ConfigProp; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.LinkedList; + +public class LoadConfiguration { + public static File mainConfigFile; + public static File scriptConfigFile; + public static File debugConfigFile; + public static File clientConfigFile; + + public static void init(String configpath) + { + if(!dir.exists()) + dir.mkdir(); + this.dir = dir; + configClass = clss; + configFields = new LinkedList(); + this.fileName = fileName+".cfg"; + + mainConfigFile = new File(configpath + "main.cfg"); + clientConfigFile = new File(configpath + "client.cfg"); + scriptConfigFile = new File(configpath + "script.cfg"); + debugConfigFile = new File(configpath + "debug.cfg"); + + ConfigMain.init(mainConfigFile); + ConfigClient.init(clientConfigFile); + ConfigScript.init(scriptConfigFile); + ConfigDebug.init(debugConfigFile); + } +} diff --git a/src/main/java/noppes/npcs/config/ConfigProp.java b/src/main/java/noppes/npcs/config/legacy/ConfigProp.java similarity index 89% rename from src/main/java/noppes/npcs/config/ConfigProp.java rename to src/main/java/noppes/npcs/config/legacy/ConfigProp.java index 281d99ca9..adfac6e06 100644 --- a/src/main/java/noppes/npcs/config/ConfigProp.java +++ b/src/main/java/noppes/npcs/config/legacy/ConfigProp.java @@ -1,4 +1,4 @@ -package noppes.npcs.config; +package noppes.npcs.config.legacy; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/noppes/npcs/config/legacy/LegacyConfig.java b/src/main/java/noppes/npcs/config/legacy/LegacyConfig.java new file mode 100644 index 000000000..487e4cfd5 --- /dev/null +++ b/src/main/java/noppes/npcs/config/legacy/LegacyConfig.java @@ -0,0 +1,160 @@ +package noppes.npcs.config.legacy; + +import net.minecraft.client.Minecraft; +import net.minecraft.server.MinecraftServer; + +import java.io.File; + +public class LegacyConfig { + @ConfigProp(info = "Disable Chat Bubbles") + public static boolean EnableChatBubbles = true; + + @ConfigProp(info = "Enables/Disables ALL scripting. You can still see and write code in the scripter, but these scripts won't run. True by default") + public static boolean ScriptingEnabled = true; + + @ConfigProp(info = "Enables/Disables the use of the the ECMA6 Javascript standard instead of ECMA5.1." + + "\nEnabling this adds many more features to JS in scripts. Only use if on Java 8 or higher." + + "\nNot all ECMA 6 language is supported through this functionality.") + public static boolean ScriptingECMA6 = false; + + @ConfigProp(info = "Enables global player event scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. True by default.") + public static boolean GlobalPlayerScripts = true; + + @ConfigProp(info = "Enables global forge event scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. True by default.") + public static boolean GlobalForgeScripts = true; + + @ConfigProp(info = "Enables global NPC scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. False by default, use with caution!") + public static boolean GlobalNPCScripts = false; + + @ConfigProp(info = "If scripts are too long (>65535 characters), they normally won't be saved in NBT data.\n" + + "This config adds additional compound tags to scripts that need it, so you can store much larger scripts!\n" + + "Every additional compound tag adds 65535 more characters to your script length limit. Use incrementally, with caution.") + public static int ExpandedScriptLimit = 2; + + @ConfigProp(info = "Enables if Player Information (WAND-USE) should be printed to CustomNPCs Logs. IF on Server \n" + + "Logs will only be present SERVER-SIDE only in CustomNPCs-latest, -1, -2, and -3") + public static boolean PlayerLogging = false; + + @ConfigProp(info = "Enables if Scripting Information should be printed to CustomNPCs Logs. IF on Server \n" + + "Logs will only be present SERVER-SIDE only in CustomNPCs-latest, -1, -2, and -3") + public static boolean ScriptLogging = false; + + @ConfigProp(info = "Amount of Messages marked as SPAM [5, 3000]. Lower Number means MORE accurate messages \n" + + "This frequency will determine if the log will print a line with [SPAM] to warn the console.") + public static int ScriptFrequency = 20; + + @ConfigProp(info = "IN Milliseconds 1s = 1000s. If a recent LOG of the same event is SENT within this threshold it will be ignored.") + public static int ScriptIgnoreTime = 2000; + + @ConfigProp(info = "Comma separated list of NPC Script Types that will omit these from the logs,\n" + + "INIT,TICK,INTERACT,DIALOG,DAMAGED,KILLED,ATTACK,TARGET,COLLIDE,KILLS,DIALOG_CLOSE,TIMER") + public static String ScriptLogIgnoreType = "TICK"; + + @ConfigProp(info = "Navigation search range for NPCs. Not recommended to increase if you have a slow pc or on a server. Minimum of 16, maximum of 96.") + public static int NpcNavRange = 32; + + @ConfigProp(info = "Size limit for NPCs. Default 100, larger sizes may cause lag on clients and servers that can't take it!") + public static int NpcSizeLimit = 100; + + @ConfigProp(info = "Set to true if you want the dialog command option to be able to use op commands like tp etc") + public static boolean NpcUseOpCommands = false; + + @ConfigProp(info = "Client sided! Determines where tracking quest info shows up on the screen based on a number from 0 to 8. Default: 3") + public static int TrackingInfoAlignment = 3; + + @ConfigProp(info = "Client sided! Offsets the tracking info GUI by this amount in the X direction.") + public static int TrackingInfoX = 0; + + @ConfigProp(info = "Client sided! Offsets the tracking info GUI by this amount in the Y direction.") + public static int TrackingInfoY = 0; + + @ConfigProp + public static boolean InventoryGuiEnabled = true; + + @ConfigProp + public static boolean DisableExtraItems = false; + + @ConfigProp + public static boolean DisableExtraBlock = false; + + @ConfigProp(info = "Only ops can create and edit npcs") + public static boolean OpsOnly = false; + + @ConfigProp(info = "Only ops can see and edit scripts") + public static boolean ScriptOpsOnly = false; + + @ConfigProp(info = "Comma separated list of player UUIDs that can see and edit scripts. If ScriptsOpsOnly is true,\n" + + "ops and players with these IDs can see and edit scripts. Example:\n" + + "b876ec32-e396-476b-a115-8438d83c67d4,069a79f4-44e9-4726-a5be-fca90e38aaf5,be951074-c7ea-4f02-a725-bf017bc88650\n" + + "Get a player's UUID from a site like NameMC or the API IPlayer.getUniqueID() function!\n" + + "If left empty and ScriptsOpsOnly is false, anyone can see and edit scripts with a scripter.") + public static String ScriptDevIDs = ""; + + @ConfigProp(info = "Default interact line. Leave empty to not have one") + public static String DefaultInteractLine = "Hello @p"; + + @ConfigProp + public static boolean DisableEnchants = false; + @ConfigProp(info = "Start Id for enchants. IDs can only range from 0-256") + public static int EnchantStartId = 100; + + @ConfigProp(info = "Number of chunk loading npcs that can be active at the same time") + public static int ChunkLoaders = 20; + + @ConfigProp(info = "The maximum number of images any dialog can hold.") + public static int DialogImageLimit = 10; + + @ConfigProp(info = "The maximum number of overlays any npc/player can hold.") + public static int SkinOverlayLimit = 10; + + @ConfigProp(info = "Set to false if you want to disable guns") + public static boolean GunsEnabled = true; + + @ConfigProp(info = "Enables leaves decay") + public static boolean LeavesDecayEnabled = true; + + @ConfigProp(info = "Enables Vine Growth") + public static boolean VineGrowthEnabled = true; + + @ConfigProp(info = "Enables Ice Melting") + public static boolean IceMeltsEnabled = true; + + @ConfigProp(info = "Normal players can use soulstone on animals") + public static boolean SoulStoneAnimals = true; + + @ConfigProp(info = "Normal players can use soulstone on villagers") + public static boolean SoulStoneVillagers = false; + + @ConfigProp(info = "Normal players can use soulstone on all npcs") + public static boolean SoulStoneNPCs = false; + + @ConfigProp(info = "Normal players can use soulstone on friendly npcs") + public static boolean SoulStoneFriendlyNPCs = false; + + @ConfigProp(info="When set to Minecraft it will use minecrafts font, when Default it will use OpenSans. Can only use fonts installed on your PC") + public static String FontType = "Default"; + + @ConfigProp(info="Font size for custom fonts (doesn't work with minecrafts font)") + public static int FontSize = 18; + + @ConfigProp(info = "Enables Overlay Mixins for Conflicts relating to Optifine or other Skin Renderers. If crashes occur, please disable.") + public static boolean EntityRendererMixin = true; + + @ConfigProp(info = "Enables CustomNpcs startup update message") + public static boolean EnableUpdateChecker = true; + + public static LegacyLoader Config; + + public void init(){ + MinecraftServer server = MinecraftServer.getServer(); + String dir = ""; + if (server != null) { + dir = new File(".").getAbsolutePath(); + } else { + dir = Minecraft.getMinecraft().mcDataDir.getAbsolutePath(); + } + + Config = new LegacyLoader(this.getClass(), new File(dir, "config"), "CustomNpcs"); + Config.loadConfig(); + } +} diff --git a/src/main/java/noppes/npcs/config/ConfigLoader.java b/src/main/java/noppes/npcs/config/legacy/LegacyLoader.java similarity index 97% rename from src/main/java/noppes/npcs/config/ConfigLoader.java rename to src/main/java/noppes/npcs/config/legacy/LegacyLoader.java index a0471eb62..2a4ea58bf 100644 --- a/src/main/java/noppes/npcs/config/ConfigLoader.java +++ b/src/main/java/noppes/npcs/config/legacy/LegacyLoader.java @@ -1,4 +1,4 @@ -package noppes.npcs.config; +package noppes.npcs.config.legacy; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -12,14 +12,14 @@ import java.util.LinkedList; import noppes.npcs.LogWriter; -public class ConfigLoader { +public class LegacyLoader { private boolean updateFile = false; private File dir; private String fileName; private Class configClass; private LinkedList configFields; - public ConfigLoader(Class clss, File dir, String fileName){ + public LegacyLoader(Class clss, File dir, String fileName){ if(!dir.exists()) dir.mkdir(); this.dir = dir; diff --git a/src/main/java/noppes/npcs/controllers/ChunkController.java b/src/main/java/noppes/npcs/controllers/ChunkController.java index 6a6ae4a66..ed457de54 100644 --- a/src/main/java/noppes/npcs/controllers/ChunkController.java +++ b/src/main/java/noppes/npcs/controllers/ChunkController.java @@ -13,6 +13,7 @@ import net.minecraftforge.common.ForgeChunkManager.LoadingCallback; import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.common.ForgeChunkManager.Type; import noppes.npcs.CustomNpcs; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumJobType; import noppes.npcs.entity.EntityNPCInterface; @@ -33,7 +34,7 @@ public class ChunkController implements LoadingCallback{ Ticket ticket = tickets.get(npc); if(ticket != null) return ticket; - if(size() >= CustomNpcs.ChunkLoaders) + if(size() >= ConfigMain.ChunkLoaders) return null; ticket = ForgeChunkManager.requestTicket(CustomNpcs.instance, npc.worldObj, Type.ENTITY); if(ticket == null) diff --git a/src/main/java/noppes/npcs/controllers/ScriptContainer.java b/src/main/java/noppes/npcs/controllers/ScriptContainer.java index 543549896..c512bc643 100644 --- a/src/main/java/noppes/npcs/controllers/ScriptContainer.java +++ b/src/main/java/noppes/npcs/controllers/ScriptContainer.java @@ -16,6 +16,7 @@ import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.nbt.NBTTagCompound; import noppes.npcs.CustomNpcs; import noppes.npcs.NBTTags; +import noppes.npcs.config.ConfigScript; import noppes.npcs.controllers.data.IScriptHandler; import noppes.npcs.constants.EnumScriptType; import noppes.npcs.scripted.NpcAPI; @@ -46,7 +47,7 @@ public class ScriptContainer { public void readFromNBT(NBTTagCompound compound) { this.script = compound.getString("Script"); - for (int i = 0; i < CustomNpcs.ExpandedScriptLimit; i++) { + for (int i = 0; i < ConfigScript.ExpandedScriptLimit; i++) { if (compound.hasKey("ExpandedScript"+i)) { this.script += compound.getString("ExpandedScript"+i); } else { @@ -63,10 +64,10 @@ public class ScriptContainer { if (this.script.length() < 65535) { compound.setString("Script", this.script); } else { - if (CustomNpcs.ExpandedScriptLimit > 0) { + if (ConfigScript.ExpandedScriptLimit > 0) { int i = 0; int length = this.script.length(); - while (length > 0 && i <= CustomNpcs.ExpandedScriptLimit) { + while (length > 0 && i <= ConfigScript.ExpandedScriptLimit) { String str = ""; if (i == 0) { compound.setString("Script", this.script.substring(0, 65535)); @@ -136,14 +137,14 @@ public class ScriptContainer { } public void run(EnumScriptType type, Event event) { - if(!CustomNpcs.ScriptingEnabled) + if(!ConfigScript.ScriptingEnabled) return; this.run((String)type.function, (Object)event); } public void run(String type, Object event) { - if(!CustomNpcs.ScriptingEnabled) + if(!ConfigScript.ScriptingEnabled) return; if (!this.errored && this.hasCode() && !this.unknownFunctions.contains(type)) { @@ -210,7 +211,7 @@ public class ScriptContainer { public void setEngine(String scriptLanguage) { if(currentScriptLanguage != null && currentScriptLanguage.equals(scriptLanguage)) return; - if (CustomNpcs.ScriptingECMA6 && scriptLanguage.equals("ECMAScript")) { + if (ConfigScript.ScriptingECMA6 && scriptLanguage.equals("ECMAScript")) { System.setProperty("nashorn.args", "--language=es6"); } ScriptEngine engine = new ScriptEngineManager().getEngineByName(scriptLanguage.toLowerCase()); diff --git a/src/main/java/noppes/npcs/controllers/data/DataScript.java b/src/main/java/noppes/npcs/controllers/data/DataScript.java index 499fc713f..16e082bbc 100644 --- a/src/main/java/noppes/npcs/controllers/data/DataScript.java +++ b/src/main/java/noppes/npcs/controllers/data/DataScript.java @@ -15,6 +15,8 @@ import net.minecraft.world.WorldServer; import noppes.npcs.CustomNpcs; import noppes.npcs.EventHooks; import noppes.npcs.LogWriter; +import noppes.npcs.config.ConfigDebug; +import noppes.npcs.config.ConfigScript; import noppes.npcs.constants.EnumScriptType; import noppes.npcs.controllers.ScriptContainer; import noppes.npcs.controllers.ScriptController; @@ -134,7 +136,7 @@ public class DataScript implements IScriptHandler { ob = NpcAPI.Instance().getIEntity((Entity)ob); script.engine.put(obs[i].toString(), ob); } - if(CustomNpcs.ScriptLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ + if(ConfigDebug.ScriptLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ if(obs.length > 1 && obs[1] == null){ LogWriter.postScriptLog(npc.field_110179_h, type, String.format("[%s] NPC %s (%s, %s, %s)", ((String)type.function).toUpperCase(), npc.display.name, (int)npc.posX, (int)npc.posY, (int)npc.posZ)); } else { @@ -170,7 +172,7 @@ public class DataScript implements IScriptHandler { } public boolean isEnabled(){ - return enabled && ScriptController.HasStart && !npc.worldObj.isRemote && !scripts.isEmpty() && CustomNpcs.ScriptingEnabled; + return enabled && ScriptController.HasStart && !npc.worldObj.isRemote && !scripts.isEmpty() && ConfigScript.ScriptingEnabled; } public Map getConsoleText() { diff --git a/src/main/java/noppes/npcs/controllers/data/Dialog.java b/src/main/java/noppes/npcs/controllers/data/Dialog.java index af619f452..88090edb0 100644 --- a/src/main/java/noppes/npcs/controllers/data/Dialog.java +++ b/src/main/java/noppes/npcs/controllers/data/Dialog.java @@ -10,6 +10,8 @@ import net.minecraft.nbt.NBTTagList; import noppes.npcs.CustomNpcs; import noppes.npcs.ICompatibilty; import noppes.npcs.VersionCompatibility; +import noppes.npcs.config.ConfigDebug; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumOptionType; import noppes.npcs.controllers.DialogController; import noppes.npcs.controllers.QuestController; @@ -530,7 +532,7 @@ public class Dialog implements ICompatibilty, IDialog { } public void addImage(int id, IDialogImage image) { - if (dialogImages.size() >= CustomNpcs.DialogImageLimit) { + if (dialogImages.size() >= ConfigMain.DialogImageLimit) { return; } diff --git a/src/main/java/noppes/npcs/controllers/data/ForgeDataScript.java b/src/main/java/noppes/npcs/controllers/data/ForgeDataScript.java index d08c44edd..4c34d4c5b 100644 --- a/src/main/java/noppes/npcs/controllers/data/ForgeDataScript.java +++ b/src/main/java/noppes/npcs/controllers/data/ForgeDataScript.java @@ -16,6 +16,8 @@ import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.nbt.NBTTagCompound; import noppes.npcs.CustomNpcs; import noppes.npcs.EventHooks; +import noppes.npcs.config.ConfigMain; +import noppes.npcs.config.ConfigScript; import noppes.npcs.controllers.ScriptContainer; import noppes.npcs.NBTTags; import noppes.npcs.constants.EnumScriptType; @@ -75,7 +77,7 @@ public class ForgeDataScript implements IScriptHandler { } public boolean isEnabled() { - return this.enabled && CustomNpcs.GlobalForgeScripts && ScriptController.HasStart && this.scripts.size() > 0; + return this.enabled && ConfigScript.GlobalForgeScripts && ScriptController.HasStart && this.scripts.size() > 0; } public boolean isClient() { diff --git a/src/main/java/noppes/npcs/controllers/data/NPCDataScript.java b/src/main/java/noppes/npcs/controllers/data/NPCDataScript.java index d9dcd2dbe..903ff3ae3 100644 --- a/src/main/java/noppes/npcs/controllers/data/NPCDataScript.java +++ b/src/main/java/noppes/npcs/controllers/data/NPCDataScript.java @@ -6,6 +6,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; import noppes.npcs.CustomNpcs; import noppes.npcs.NBTTags; +import noppes.npcs.config.ConfigScript; import noppes.npcs.constants.EnumScriptType; import noppes.npcs.controllers.ScriptContainer; import noppes.npcs.controllers.ScriptController; @@ -69,7 +70,7 @@ public class NPCDataScript implements IScriptHandler { } public boolean isEnabled() { - return CustomNpcs.GlobalNPCScripts && this.enabled && ScriptController.HasStart && this.scripts.size() > 0; + return ConfigScript.GlobalNPCScripts && this.enabled && ScriptController.HasStart && this.scripts.size() > 0; } public boolean isClient() { return this.npc.isClientWorld(); diff --git a/src/main/java/noppes/npcs/controllers/data/PlayerDataScript.java b/src/main/java/noppes/npcs/controllers/data/PlayerDataScript.java index 7d5809b7e..6f7f1f7b7 100644 --- a/src/main/java/noppes/npcs/controllers/data/PlayerDataScript.java +++ b/src/main/java/noppes/npcs/controllers/data/PlayerDataScript.java @@ -13,6 +13,8 @@ import net.minecraft.util.math.BlockPos; import cpw.mods.fml.common.eventhandler.Event; import noppes.npcs.CustomNpcs; import noppes.npcs.EventHooks; +import noppes.npcs.config.ConfigClient; +import noppes.npcs.config.ConfigScript; import noppes.npcs.controllers.ScriptContainer; import noppes.npcs.NBTTags; import noppes.npcs.constants.EnumScriptType; @@ -108,7 +110,7 @@ public class PlayerDataScript implements IScriptHandler { } public boolean isEnabled() { - return CustomNpcs.GlobalPlayerScripts && ScriptController.Instance.playerScripts.enabled && ScriptController.HasStart && (this.player == null || !this.player.worldObj.isRemote); + return ConfigScript.GlobalPlayerScripts && ScriptController.Instance.playerScripts.enabled && ScriptController.HasStart && (this.player == null || !this.player.worldObj.isRemote); } public boolean isClient() { return this.player.isClientWorld(); diff --git a/src/main/java/noppes/npcs/controllers/data/RecipesDefault.java b/src/main/java/noppes/npcs/controllers/data/RecipesDefault.java index d4bce8d2e..8a2d51937 100644 --- a/src/main/java/noppes/npcs/controllers/data/RecipesDefault.java +++ b/src/main/java/noppes/npcs/controllers/data/RecipesDefault.java @@ -7,6 +7,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import noppes.npcs.CustomItems; import noppes.npcs.CustomNpcs; +import noppes.npcs.config.ConfigMain; import noppes.npcs.controllers.RecipeController; public class RecipesDefault { @@ -30,7 +31,7 @@ public class RecipesDefault { addRecipe("Mob Cloner", CustomItems.cloner, true, "XX","XY"," Y",'X', Items.bread,'Y', Items.stick); addRecipe("Carpentry Bench", CustomItems.carpentyBench, true, "XYX","Z Z","Z Z", 'X', Blocks.planks, 'Z', Items.stick, 'Y', Blocks.crafting_table); - if(!CustomNpcs.DisableExtraItems){ + if(!ConfigMain.DisableExtraItems){ addRecipe("Mana", CustomItems.mana, true, "XY",'X',Items.redstone,'Y',Items.glowstone_dust); addRecipe("Gun Wooden", CustomItems.gunWood, false, "XXXY"," ZM "," M ",'Y', Blocks.lever, 'M', Items.stick, 'Z', Blocks.stone_button,'X', Blocks.planks); addRecipe("Gun Stone", CustomItems.gunStone, false, "XXXY"," ZM "," M ",'Y', Blocks.lever, 'M', Items.stick, 'Z', Blocks.stone_button,'X', Blocks.cobblestone); @@ -50,7 +51,7 @@ public class RecipesDefault { } } if(i < 1){ - if(!CustomNpcs.DisableExtraBlock){ + if(!ConfigMain.DisableExtraBlock){ addRecipe("WallBanner Wooden", new ItemStack(CustomItems.wallBanner, 1, 0), false, "XXX","ZZZ","ZZZ","Z Z",'Z', Blocks.wool, 'X', Blocks.planks); addRecipe("WallBanner Stone", new ItemStack(CustomItems.wallBanner, 1, 1), false, "XXX","ZZZ","ZZZ","Z Z",'Z', Blocks.wool, 'X', Blocks.cobblestone); addRecipe("WallBanner Iron", new ItemStack(CustomItems.wallBanner, 1, 2), false, "XXX","ZZZ","ZZZ","Z Z",'Z', Blocks.wool, 'X', Items.iron_ingot); @@ -151,7 +152,7 @@ public class RecipesDefault { addRecipe("BigSign", new ItemStack(CustomItems.bigsign, 2), false, "XXX","XXX","XXX", 'X', Blocks.planks); } - if(!CustomNpcs.DisableExtraItems){ + if(!ConfigMain.DisableExtraItems){ addRecipe("Battle Axe1", CustomItems.battleAxeWood, false, "XX","XY"," Y", " Y", 'Y', Items.stick, 'X', Blocks.planks); addRecipe("Battle Axe2", CustomItems.battleAxeStone, false, "XX","XY"," Y", " Y", 'Y', Items.stick, 'X', Blocks.cobblestone); addRecipe("Battle Axe3", CustomItems.battleAxeIron, false, "XX","XY"," Y", " Y", 'Y', Items.stick, 'X', Items.iron_ingot); diff --git a/src/main/java/noppes/npcs/enchants/EnchantInterface.java b/src/main/java/noppes/npcs/enchants/EnchantInterface.java index 408d4c37a..bff45ea85 100644 --- a/src/main/java/noppes/npcs/enchants/EnchantInterface.java +++ b/src/main/java/noppes/npcs/enchants/EnchantInterface.java @@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import noppes.npcs.CustomNpcs; import noppes.npcs.LogWriter; +import noppes.npcs.config.ConfigMain; import noppes.npcs.items.ItemStaff; public abstract class EnchantInterface extends Enchantment{ @@ -21,7 +22,7 @@ public abstract class EnchantInterface extends Enchantment{ private Class[] classes; protected EnchantInterface(int par2, Class... obs) { - super(CustomNpcs.EnchantStartId++, par2, CustomNpcsType); + super(ConfigMain.EnchantStartId++, par2, CustomNpcsType); classes = obs; } @@ -37,7 +38,7 @@ public abstract class EnchantInterface extends Enchantment{ } public static void load(){ - if(!CustomNpcs.DisableEnchants){ + if(!ConfigMain.DisableEnchants){ CustomNpcsType = EnumHelper.addEnchantmentType("customnpcs_enchants"); try{ Damage = new EnchantDamage(); @@ -52,7 +53,7 @@ public abstract class EnchantInterface extends Enchantment{ } public static int getLevel(EnchantInterface enchant, ItemStack stack) { - if(CustomNpcs.DisableEnchants || enchant == null) + if(ConfigMain.DisableEnchants || enchant == null) return 0; return EnchantmentHelper.getEnchantmentLevel(enchant.effectId, stack); } diff --git a/src/main/java/noppes/npcs/entity/EntityNPCInterface.java b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java index 24d9e175e..0ddf73623 100644 --- a/src/main/java/noppes/npcs/entity/EntityNPCInterface.java +++ b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java @@ -56,6 +56,7 @@ import noppes.npcs.ai.target.EntityAIClosestTarget; import noppes.npcs.ai.target.EntityAIOwnerHurtByTarget; import noppes.npcs.ai.target.EntityAIOwnerHurtTarget; import noppes.npcs.client.EntityUtil; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumAnimation; import noppes.npcs.constants.EnumJobType; import noppes.npcs.constants.EnumMovingType; @@ -142,8 +143,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti } dialogs = new HashMap(); - if(!CustomNpcs.DefaultInteractLine.isEmpty()) - advanced.interactLines.lines.put(0, new Line(CustomNpcs.DefaultInteractLine)); + if(!ConfigMain.DefaultInteractLine.isEmpty()) + advanced.interactLines.lines.put(0, new Line(ConfigMain.DefaultInteractLine)); experienceValue = 0; scaleX = scaleY = scaleZ = 0.9375f; @@ -177,7 +178,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(stats.maxHealth); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(CustomNpcs.NpcNavRange); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(ConfigMain.NpcNavRange); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(this.getSpeed()); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(stats.getAttackStrength()); } @@ -978,7 +979,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti if(!isRemote()) LinkedNpcController.Instance.loadNpcData(this); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(CustomNpcs.NpcNavRange); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(ConfigMain.NpcNavRange); this.updateTasks(); } @@ -1619,7 +1620,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti @Override public boolean canCommandSenderUseCommand(int var1, String var2) { - if(CustomNpcs.NpcUseOpCommands) + if(ConfigMain.NpcUseOpCommands) return true; return var1 <= 2; } diff --git a/src/main/java/noppes/npcs/entity/data/DataSkinOverlays.java b/src/main/java/noppes/npcs/entity/data/DataSkinOverlays.java index 1ae6237d3..cc5a4ab86 100644 --- a/src/main/java/noppes/npcs/entity/data/DataSkinOverlays.java +++ b/src/main/java/noppes/npcs/entity/data/DataSkinOverlays.java @@ -4,6 +4,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import noppes.npcs.CustomNpcs; import noppes.npcs.Server; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumPacketClient; import noppes.npcs.controllers.data.PlayerData; import noppes.npcs.controllers.data.SkinOverlay; @@ -61,7 +62,7 @@ public class DataSkinOverlays implements IOverlayHandler { } public void add(int id, ISkinOverlay data) { - if (this.overlayList.size() >= CustomNpcs.SkinOverlayLimit) { + if (this.overlayList.size() >= ConfigMain.SkinOverlayLimit) { return; } diff --git a/src/main/java/noppes/npcs/items/ItemGun.java b/src/main/java/noppes/npcs/items/ItemGun.java index 3df84154b..ee5910505 100644 --- a/src/main/java/noppes/npcs/items/ItemGun.java +++ b/src/main/java/noppes/npcs/items/ItemGun.java @@ -11,6 +11,7 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; import noppes.npcs.CustomItems; import noppes.npcs.CustomNpcs; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumNpcToolMaterial; import noppes.npcs.enchants.EnchantInterface; import noppes.npcs.entity.EntityProjectile; @@ -33,7 +34,7 @@ public class ItemGun extends ItemNpcInterface implements IProjectileCallback{ if(worldObj.isRemote) return; - if (!hasBullet(player, stack) || !CustomNpcs.GunsEnabled){ + if (!hasBullet(player, stack) || !ConfigMain.GunsEnabled){ worldObj.playSoundAtEntity(player, "customnpcs:gun.empty", 1.0F,1); return; } diff --git a/src/main/java/noppes/npcs/items/ItemMachineGun.java b/src/main/java/noppes/npcs/items/ItemMachineGun.java index 88e01ae43..fed760232 100644 --- a/src/main/java/noppes/npcs/items/ItemMachineGun.java +++ b/src/main/java/noppes/npcs/items/ItemMachineGun.java @@ -7,6 +7,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import noppes.npcs.CustomItems; import noppes.npcs.CustomNpcs; +import noppes.npcs.config.ConfigMain; import noppes.npcs.entity.EntityProjectile; import org.lwjgl.opengl.GL11; @@ -54,14 +55,14 @@ public class ItemMachineGun extends ItemNpcInterface{ } int shotsleft = stack.stackTagCompound.getInteger("ShotsLeft") - ticks/6; - if(!player.capabilities.isCreativeMode || !CustomNpcs.GunsEnabled){ + if(!player.capabilities.isCreativeMode || !ConfigMain.GunsEnabled){ if(stack.stackTagCompound.getBoolean("Reloading2") && hasItem(player, CustomItems.bulletBlack)){ if(ticks > 0 && ticks <= 24){ player.worldObj.playSoundAtEntity(player, "customnpcs:gun.ak47.load", 1.0F,1); } return; } - else if((shotsleft <= 0 || !hasItem(player, CustomItems.bulletBlack)) || !CustomNpcs.GunsEnabled) + else if((shotsleft <= 0 || !hasItem(player, CustomItems.bulletBlack)) || !ConfigMain.GunsEnabled) { player.worldObj.playSoundAtEntity(player, "customnpcs:gun.empty", 1.0F,1); return; diff --git a/src/main/java/noppes/npcs/items/ItemMusket.java b/src/main/java/noppes/npcs/items/ItemMusket.java index 1e9c836f4..45f6dd7aa 100644 --- a/src/main/java/noppes/npcs/items/ItemMusket.java +++ b/src/main/java/noppes/npcs/items/ItemMusket.java @@ -7,6 +7,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import noppes.npcs.CustomItems; import noppes.npcs.CustomNpcs; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumParticleType; import noppes.npcs.entity.EntityProjectile; @@ -23,7 +24,7 @@ public class ItemMusket extends ItemNpcInterface{ if(player.worldObj.isRemote) return; - if(!stack.stackTagCompound.getBoolean("IsLoaded2") && !player.capabilities.isCreativeMode || !CustomNpcs.GunsEnabled) { + if(!stack.stackTagCompound.getBoolean("IsLoaded2") && !player.capabilities.isCreativeMode || !ConfigMain.GunsEnabled) { player.worldObj.playSoundAtEntity(player, "customnpcs:gun.empty", 1.0F,1); return; } diff --git a/src/main/java/noppes/npcs/items/ItemNpcMovingPath.java b/src/main/java/noppes/npcs/items/ItemNpcMovingPath.java index dade35f4f..99238198c 100644 --- a/src/main/java/noppes/npcs/items/ItemNpcMovingPath.java +++ b/src/main/java/noppes/npcs/items/ItemNpcMovingPath.java @@ -15,6 +15,7 @@ import noppes.npcs.CustomItems; import noppes.npcs.CustomNpcs; import noppes.npcs.CustomNpcsPermissions; import noppes.npcs.NoppesUtilServer; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumGuiType; import noppes.npcs.entity.EntityNPCInterface; import cpw.mods.fml.common.registry.GameRegistry; @@ -56,8 +57,8 @@ public class ItemNpcMovingPath extends Item{ double distance = (double)MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5); player.addChatMessage(new ChatComponentText("Added point x:" + x + " y:"+ y + " z:" + z + " to npc " + npc.getCommandSenderName())); - if(distance > CustomNpcs.NpcNavRange) - player.addChatMessage(new ChatComponentText("Warning: point is too far away from previous point. Max block walk distance = " + CustomNpcs.NpcNavRange)); + if(distance > ConfigMain.NpcNavRange) + player.addChatMessage(new ChatComponentText("Warning: point is too far away from previous point. Max block walk distance = " + ConfigMain.NpcNavRange)); return true; } diff --git a/src/main/java/noppes/npcs/items/ItemNpcScripter.java b/src/main/java/noppes/npcs/items/ItemNpcScripter.java index e68564ef3..636fc1fe5 100644 --- a/src/main/java/noppes/npcs/items/ItemNpcScripter.java +++ b/src/main/java/noppes/npcs/items/ItemNpcScripter.java @@ -5,7 +5,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.server.MinecraftServer; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.world.World; import noppes.npcs.CustomItems; @@ -13,6 +12,7 @@ import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import noppes.npcs.CustomNpcs; +import noppes.npcs.config.ConfigScript; import noppes.npcs.constants.EnumGuiType; public class ItemNpcScripter extends Item{ @@ -36,7 +36,7 @@ public class ItemNpcScripter extends Item{ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player){ if(!world.isRemote) return itemStack; - if(!CustomNpcs.isScriptDev(player)){ + if(!ConfigScript.isScriptDev(player)){ player.addChatMessage(new ChatComponentTranslation("availability.permission")); } else { CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.ScriptEvent, player); diff --git a/src/main/java/noppes/npcs/items/ItemNpcWand.java b/src/main/java/noppes/npcs/items/ItemNpcWand.java index 6e6783e4c..1eea0097d 100644 --- a/src/main/java/noppes/npcs/items/ItemNpcWand.java +++ b/src/main/java/noppes/npcs/items/ItemNpcWand.java @@ -12,6 +12,7 @@ import noppes.npcs.CustomItems; import noppes.npcs.CustomNpcs; import noppes.npcs.CustomNpcsPermissions; import noppes.npcs.NoppesUtilServer; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumGuiType; import noppes.npcs.entity.EntityCustomNpc; import noppes.npcs.entity.EntityNPCInterface; @@ -39,7 +40,7 @@ public class ItemNpcWand extends Item{ { if(par3World.isRemote) return true; - if(CustomNpcs.OpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile())){ + if(ConfigMain.OpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile())){ player.addChatMessage(new ChatComponentTranslation("availability.permission")); } else if(CustomNpcsPermissions.Instance.hasPermission(player, CustomNpcsPermissions.NPC_CREATE)){ diff --git a/src/main/java/noppes/npcs/items/ItemScripted.java b/src/main/java/noppes/npcs/items/ItemScripted.java index 6d9d82bd3..b430c457a 100644 --- a/src/main/java/noppes/npcs/items/ItemScripted.java +++ b/src/main/java/noppes/npcs/items/ItemScripted.java @@ -17,6 +17,7 @@ import net.minecraft.world.World; import noppes.npcs.CustomItems; import noppes.npcs.CustomNpcs; import noppes.npcs.EventHooks; +import noppes.npcs.config.ConfigScript; import noppes.npcs.constants.EnumGuiType; import noppes.npcs.entity.EntityItemScripted; import noppes.npcs.scripted.event.ItemEvent; @@ -63,7 +64,7 @@ public class ItemScripted extends Item implements ItemRenderInterface { public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if(player.isSneaking() && player.capabilities.isCreativeMode) { - if(!CustomNpcs.isScriptDev(player)){ + if(!ConfigScript.isScriptDev(player)){ player.addChatMessage(new ChatComponentTranslation("availability.permission")); } else { CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.ScriptItem, player); diff --git a/src/main/java/noppes/npcs/items/ItemSoulstoneEmpty.java b/src/main/java/noppes/npcs/items/ItemSoulstoneEmpty.java index 3ebba0a74..33cc33585 100644 --- a/src/main/java/noppes/npcs/items/ItemSoulstoneEmpty.java +++ b/src/main/java/noppes/npcs/items/ItemSoulstoneEmpty.java @@ -14,6 +14,8 @@ import noppes.npcs.CustomItems; import noppes.npcs.CustomNpcs; import noppes.npcs.CustomNpcsPermissions; import noppes.npcs.NoppesUtilServer; +import noppes.npcs.config.ConfigClient; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumRoleType; import noppes.npcs.controllers.PlayerDataController; import noppes.npcs.controllers.ServerCloneController; @@ -79,7 +81,7 @@ public class ItemSoulstoneEmpty extends Item { if(entity instanceof EntityNPCInterface){ EntityNPCInterface npc = (EntityNPCInterface) entity; if (npc.advanced.refuseSoulStone) return false; - if (CustomNpcs.SoulStoneFriendlyNPCs && npc.getFaction() != null) { + if (ConfigMain.SoulStoneFriendlyNPCs && npc.getFaction() != null) { int p = npc.advanced.minFactionPointsToSoulStone; if (p == -1 && npc.getFaction().isFriendlyToPlayer(player)) return true; else if (p != -1) { @@ -97,10 +99,10 @@ public class ItemSoulstoneEmpty extends Item { if(role.getOwner() == player) return !role.refuseSoulStone; } - return CustomNpcs.SoulStoneNPCs; + return ConfigMain.SoulStoneNPCs; } - if (entity instanceof EntityAnimal) return CustomNpcs.SoulStoneAnimals; - if (entity instanceof EntityVillager) return CustomNpcs.SoulStoneVillagers; + if (entity instanceof EntityAnimal) return ConfigMain.SoulStoneAnimals; + if (entity instanceof EntityVillager) return ConfigMain.SoulStoneVillagers; return false; } } diff --git a/src/main/java/noppes/npcs/items/ItemSoulstoneFilled.java b/src/main/java/noppes/npcs/items/ItemSoulstoneFilled.java index 0c92a194c..6e62f7f3c 100644 --- a/src/main/java/noppes/npcs/items/ItemSoulstoneFilled.java +++ b/src/main/java/noppes/npcs/items/ItemSoulstoneFilled.java @@ -14,6 +14,8 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import noppes.npcs.CustomNpcs; import noppes.npcs.LogWriter; +import noppes.npcs.config.ConfigDebug; +import noppes.npcs.config.ConfigScript; import noppes.npcs.constants.EnumRoleType; import noppes.npcs.controllers.data.PlayerData; import noppes.npcs.controllers.PlayerDataController; @@ -76,7 +78,7 @@ public class ItemSoulstoneFilled extends Item { if(entity == null) return false; entity.setPosition(x + 0.5, y + 1 + 0.2F, z + 0.5); - if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ + if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){ LogWriter.script(String.format("[%s] %s PLACED ENTITY %s", "SOULSTONE", player.getCommandSenderName(), entity)); } if(entity instanceof EntityNPCInterface){ diff --git a/src/main/java/noppes/npcs/mixin/CustomNPCsMixinPlugin.java b/src/main/java/noppes/npcs/mixin/CustomNPCsMixinPlugin.java index 630444f5c..49cc8de08 100644 --- a/src/main/java/noppes/npcs/mixin/CustomNPCsMixinPlugin.java +++ b/src/main/java/noppes/npcs/mixin/CustomNPCsMixinPlugin.java @@ -1,6 +1,8 @@ package noppes.npcs.mixin; import noppes.npcs.CustomNpcs; +import noppes.npcs.config.ConfigClient; +import noppes.npcs.config.ConfigMain; import org.spongepowered.asm.lib.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; import org.spongepowered.asm.mixin.extensibility.IMixinInfo; @@ -33,7 +35,7 @@ public class CustomNPCsMixinPlugin implements IMixinConfigPlugin { @Override public List getMixins() { List mixins = new ArrayList<>(); - if (CustomNpcs.EntityRendererMixin){ + if (ConfigClient.EntityRendererMixin){ mixins.add("MixinEntityRenderer"); } return mixins; diff --git a/src/main/java/noppes/npcs/roles/JobFollower.java b/src/main/java/noppes/npcs/roles/JobFollower.java index 69e44850a..1313c4f43 100644 --- a/src/main/java/noppes/npcs/roles/JobFollower.java +++ b/src/main/java/noppes/npcs/roles/JobFollower.java @@ -5,6 +5,7 @@ import java.util.List; import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; import noppes.npcs.CustomNpcs; +import noppes.npcs.config.ConfigMain; import noppes.npcs.entity.EntityNPCInterface; public class JobFollower extends JobInterface{ @@ -53,8 +54,8 @@ public class JobFollower extends JobInterface{ } private int getRange(){ - if(range > CustomNpcs.NpcNavRange) - return CustomNpcs.NpcNavRange; + if(range > ConfigMain.NpcNavRange) + return ConfigMain.NpcNavRange; return range; } diff --git a/src/main/java/noppes/npcs/scripted/NpcAPI.java b/src/main/java/noppes/npcs/scripted/NpcAPI.java index 3c22a49a7..bf6f93698 100644 --- a/src/main/java/noppes/npcs/scripted/NpcAPI.java +++ b/src/main/java/noppes/npcs/scripted/NpcAPI.java @@ -33,6 +33,7 @@ import net.minecraft.world.biome.BiomeGenBase; import noppes.npcs.CustomNpcs; import noppes.npcs.NoppesUtilServer; import noppes.npcs.api.*; +import noppes.npcs.config.ConfigScript; import noppes.npcs.containers.ContainerNpcInterface; import noppes.npcs.controllers.*; import noppes.npcs.controllers.data.SkinOverlay; @@ -516,27 +517,27 @@ public class NpcAPI extends AbstractNpcAPI { } public boolean arePlayerScriptsEnabled() { - return CustomNpcs.GlobalPlayerScripts; + return ConfigScript.GlobalPlayerScripts; } public boolean areForgeScriptsEnabled() { - return CustomNpcs.GlobalForgeScripts; + return ConfigScript.GlobalForgeScripts; } public boolean areGlobalNPCScriptsEnabled() { - return CustomNpcs.GlobalNPCScripts; + return ConfigScript.GlobalNPCScripts; } public void enablePlayerScripts(boolean enable) { - CustomNpcs.GlobalPlayerScripts = enable; + ConfigScript.GlobalPlayerScripts = enable; } public void enableForgeScripts(boolean enable) { - CustomNpcs.GlobalForgeScripts = enable; + ConfigScript.GlobalForgeScripts = enable; } public void enableGlobalNPCScripts(boolean enable) { - CustomNpcs.GlobalNPCScripts = enable; + ConfigScript.GlobalNPCScripts = enable; } public ICustomGui createCustomGui(int id, int width, int height, boolean pauseGame) { diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java b/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java index 0f9d47f34..6441e4764 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java @@ -8,6 +8,7 @@ import noppes.npcs.CustomNpcs; import noppes.npcs.NoppesUtilServer; import noppes.npcs.api.jobs.IJob; import noppes.npcs.api.roles.IRole; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumAnimation; import noppes.npcs.constants.EnumJobType; import noppes.npcs.constants.EnumNavType; @@ -66,8 +67,8 @@ public class ScriptNpc extends ScriptLiving imp public void setSize(int size){ if(size < 1) size = 1; - if(size > CustomNpcs.NpcSizeLimit) - size = CustomNpcs.NpcSizeLimit; + if(size > ConfigMain.NpcSizeLimit) + size = ConfigMain.NpcSizeLimit; npc.display.modelSize = size; npc.script.clientNeedsUpdate = true; @@ -1189,7 +1190,7 @@ public class ScriptNpc extends ScriptLiving imp } public void setOverlayTexture(String overlayTexture) { - if (this.getOverlays().size() >= CustomNpcs.SkinOverlayLimit) { + if (this.getOverlays().size() >= ConfigMain.SkinOverlayLimit) { return; } diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptPlayer.java b/src/main/java/noppes/npcs/scripted/entity/ScriptPlayer.java index 5a6bbebdf..db73c1260 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptPlayer.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptPlayer.java @@ -17,6 +17,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.WorldSettings; import noppes.npcs.*; import noppes.npcs.api.*; +import noppes.npcs.config.ConfigScript; import noppes.npcs.constants.EnumPacketClient; import noppes.npcs.constants.EnumQuestType; import noppes.npcs.containers.ContainerCustomGui; @@ -717,7 +718,7 @@ public class ScriptPlayer extends ScriptLivingBase } public boolean isScriptingDev() { - return CustomNpcs.isScriptDev(player); + return ConfigScript.isScriptDev(player); } public IQuest[] getActiveQuests() {