Are you up to develop a plugin with me ? I have posted plugin also And I want people in my level developing with me !
OMG, I am juste laughing my ass off . Where did you find a such idea ! It's so great Just keep on !! I really like it !
I don't know if you've done it but here is a little improvement : Use a configuration file to manually set the object that appear when lightning happen.
I was about to do that, but I suck at understanding how to use a yaml config. I will release a new version tomorrow I think
I don't think so, if you use understandable variables. Look at the config.json file from Vampire plugin : Code: "jumpMaterials": [ "RED_ROSE" ], "jumpDeltaSpeed": 3.0, "jumpBloodCost": 3.0, "jumpMessageNotEnoughBlood": "Not enough blood to jump.", "regenStartDelayMilliseconds": 8000, "regenHealthPerSecond": 0.25, "regenBloodPerHealth": 2.5, "regenStartMessage": "Your wounds start to close. This drains blood over time.", "combatDamageDealtFactor": 1.5, "combatDamageReceivedFactor": 0.7, "combatDamageReceivedWoodFactor": 3.5, I think it's quiet understandable
@Naga: using a config.yml file is not that hard if you know how ^^ If you only need one config.yml file and store simple stuff in it you can use the following. Note: Brakets with pseudo or pseudocode-Tags are not really there you have to implement this by yourself ^^ For further details lookup http://javadoc.lukegb.com/Bukkit/ and search for Configuration or JavaPlugin or browse the forum to see codeexamples on their github. Btw if you didnt already do that SamplePlugin is always a good starting point for small plugins. You only have to change the namespace and maven values ^^ adapt your main plugin class like this Code: public Class YourPlugin extends JavaPlugin { public Configuration config; public SpawnManager spawnManager; public int spawnItemId; ... @Override public void onEnable() { /** this will load an existing plugins/<pluginsdir>/config.yml * if no file was found it will return an empty Configuration */ this.config = this.getConfiguration(); loadConfiguration(); // your spawnManager here {pseudo} spawnManager = new SpawnManager(this); {pseudocode start} {pseudo seperate file SpawnManager.java} private YourPlugin plugin; public SpawnManager(YourPlugin plugin) { this.plugin = plugin; } public void setSpawnItem(Int id) { {pseudo spawnItem(Location loc, Int id)} } {pseudocode end} } @Override public void onDisable() { /** save configuration onDisable() for debugging; * * comment it out if you have created your config.yml file as this will * prevent you from editing the config.yml from outside. * For a correct implementation you would need a command * that uses Configuration::setProperty() to apply changes * and a reload command that can reload the config ingame */ config.save(); // Quick&Dirty without extra commands // loadConfiguration(); // config.save(); } public void loadConfiguration() { config.load(); // loads config this.spawnItemId = config.getInt("settings.spawn-item-id", 92); // if not found set default to 92 = cake } } If you like you can use as many config files with different names as you want but that is another story and can be looked up by examination of existing plugins (or by javadoc) Regards, Lycano
Reading simple stuff issnt the problem (thanks for the example btw.) but my problem is to read such things: Code: messages: -player: Playername1 msg: blah enabled: false -player: Playername2 msg: blah2 enabled: false But I think I will use the json for now.
Well, it is up to you what format you use. In your case you could simply rely on flatfile format as you will have only a hand full of options available at first. Means Code: spawnItemId=92 with yaml Code: settings: spawn-item-id: 92 Personally i prefer yaml because of its clean tree structure. For me json is not that good for saving config options for plugins as long as it has no other need e.g. using it for javascript ajax calls. And .. its not that fast readable for humans. So much double quotes and brakets .. uurg ^^ last-mentioned: yaml is already there ^^
The point for me is to do something like: for (node n : getAllNodes("player")) { n.getString("msg"); n.getBoolean("enabled); } just to get all players, the simple data issnt really a problem
Well, its just a different way of implementation you can do the same with Configuration but with lesser code. You should take a look at ConfigurationNode About the for loop: Without background information its hard to tell what you want to do but if you want to get a List of a Node then its a simple getNodeList(String path) in your case getNodeList("player") thats all. Now you have a NodeList that can be iterated (for filtering) or directly accessed through its member methods.
On our server we have events where TheCakeBandit attacks the players and spawns lots of Cakes and such. This just seemed like the logical next step!
Could you make it so it adds to the block and not take the block away? I have a lightning plugin with a goldsword and I love spamming it. It would be better if it added the cake to the air block above where it strikes. If that made sense, THANKS!
Well, as the modder of the plugin, I can help y'a ! It's REALLY easy ! Go to your plugins folder, go to NagaLightningCake, then open config.yml. The 'plugin.bPos' is the Y axe modifier. So the value -1 replace the block because the output of the event is not the block that have been striken, but above it. So just set it to '0' (zero). Hope it helped. P.S.: Sorry if I bragged a little . Coming with a new Beta update where you can change the properties with commands (such as /lightningcake (from the client) or lightningcake (from the server) to disable the plugin.) Done ! New jars and source at http://bukkit.webmilio.webege.com/NagaLightningCake !! The new commands are (for server-side just remove the slash '/'): /lightningcake : disable/enable the plugin in game ! /lightningcakeset <block_id> : set the block with <block_id> that appears when the lightning strike. /lightningcakebpos <bPos> : set the bPos <bPos> value. There are still errors: when you do a command it returns the way you need to write it event if you got it right. Don't worry, just relly on the blue or green text that will appear (in the client) or in the console (all white). EDIT by Moderator: merged posts, please use the edit button instead of double posting.