Lucky Items
Lucky Items
By mining lapis, diamond, iron, or emerald ore, you have a chance of receiving a prize. These prizes are now customizable.
This was a request by FlyingPig_ here: https:forums.bukkit.org/threads/superitems-luckyitems.241128/
Commands
/LI Reload - Reloads config file
Config
Example Config:
BroadCastFinds: true ##Sends a message to everyone on the server that a lucky item was found (false by default) Chances: Emerald: 100.0 Diamond: 100.0 Iron: 100.0 Gold: 100.0 Items: A LuckySword:' ##This line is mostly used to differentiate between the different things that can drop ##This line is also what shows up in the broadcast message if that is enabled Chance: 10.0 ##There is a 10% chance for this item to drop Amount: 1 ##It will drop one item Material: DIAMOND_SWORD ##The item will be a diamond sword. ##It will be easier to use item ids in the material section Data: 0 ##It will be set to the normal durability Enchantments: FIRE_ASPECT: 2 DAMAGE_ALL: 2 KNOCKBACK: 1 ##Like the material (if you're not using item id's), the names of the enchantments need to be exact, they are: ##Enchantments: ARROW_DAMAGE, ARROW_FIRE, ARROW_INFINITE, ARROW_KNOCKBACK, DAMAGE_ALL, DAMAGE_ARTHROPODS, DAMAGE_UNDEAD, DIG_SPEED, DURABILITY, FIRE_ASPECT, KNOCKBACK, LOOT_BONUS_BLOCKS, LOOT_BONUS_MOBS, LUCK, OXYGEN, PROTECTION_ENVIRONMENTAL, PROTECTION_EXPLOSIONS, PROTECTION_FALL, PROTECTION_FIRE, PROTECTION_PROJECTILE, SILK_TOUCH, THORNS, WATER_WORKER Lore: - This sword can be used - to kill mobs or people! ##This is pretty self explanatory, you can extend it as many lines as you want Name: LuckySword ##The name of the item A LuckyPick: Chance: 5.0 Amount: 1 Material: DIAMOND_PICKAXE Data: 0 Enchantments: DURABILITY: 1 LOOT_BONUS_BLOCKS: 2 DIG_SPEED: 1 Name: LuckyPick Some Gapples: Chance: 10.0 Amount: 2 Material: GOLDEN_APPLE Data: 0 Name: God Apples 9 Green Wool: Chance: 20.0 Amount: 9 Material: WOOL Data: 0 Stone: Chance: 0.0 Amount: 1 Material: 1 Data: 0
Videos
Enchantments
In the config, the enchantments need to match the names that bukkit gave for them. Here is a list of the enchantment names. Enchantments: ARROW_DAMAGE, ARROW_FIRE, ARROW_INFINITE, ARROW_KNOCKBACK, DAMAGE_ALL, DAMAGE_ARTHROPODS, DAMAGE_UNDEAD, DIG_SPEED, DURABILITY, FIRE_ASPECT, KNOCKBACK, LOOT_BONUS_BLOCKS, LOOT_BONUS_MOBS, LUCK, OXYGEN, PROTECTION_ENVIRONMENTAL, PROTECTION_EXPLOSIONS, PROTECTION_FALL, PROTECTION_FIRE, PROTECTION_PROJECTILE, SILK_TOUCH, THORNS, WATER_WORKER
Help
If you need any help, post a reply, and I'll try to help you as soon as I can. I finally figured out how to use the subscriptions.
Todo
None at the moment, I'm open to suggestions
I've been using this plugin for a few days now on spigot 1.8 and we're really enjoying it. I do have some concerns though, which has led me to create my own plugin similar to this. I felt I should mention my concerns to you.
Firstly, there is a huge exploit for the ores that drop the ore block item (iron and gold) because you dont need silk touch for these. Just simply break them, replace them, rinse and repeat for as many chances/items you want.
That leads me to my second concern. There is currently no way to specify certain items (or chances of items) to certain ores. Its either all items have chance on all items, or nothing at all. This is troublesome because people mining coal/iron have the same chances of receiving the same lucky items as diamond/emerald. Not to mention the exploit on iron/gold can be easily minimized by putting crap odds and/or crap items on them leaving the good items/odds on the other ores.
Third, your implementation of redstone will never result in a drop. You use REDSTONE_ORE, which technically isn't the block that player's break. Redstone actualy glows when you touch it, turning it into GLOWING_REDSTONE_ORE. My plugin simply checks for both of these just in case of oddities.
Next, the configuration file resets if anything was found wrong with it. Total bummer... I have co-operators on my server and someone today missed a single space after a colon and after reloading the plugin the entire config reset to default instead of just gracefully throwing an error. Totally sucked because I had about 20 lucky items and had to retype the whole thing up again from memory due to not having a backup of it.
Lastly, your random number generator is creating a new seed each roll, which means some uniformity is lost in the calculations. You can make your Random() as a static field instead, or simply use Math.random() which is already static and pretty much the same thing as rand.nextDouble(). To be honest, the way you store and calculate chance altogther seems over the top and very hard to follow/read. Jumping between 3 classes (not counting the multiple SusperStack instances) just to calculate a single chance.. *whew* With all that said, the way you have it seems to work, so consider this one just my simple opinion :p
All things considered, this is a decent plugin still. Just has some loose ends to tie up to become rock solid, imo. ^_^
Hi, i tried adding redstone to the chances and didnt work, can you give an example on how to add the other ores?
Can you have permissions for them so only groups with the permissions can get the items if that is possible
@delsolsi213
I just tested it now, and I cannot get the plugin to give my rewards if I am using silk touch
@MnMaxon
you sure? because i was tetsing it when i posted that comment and silk touch worked perfectly fine and dropped rewards. then again i was using spigot and not bukkit
@delsolsi213
I'm pretty sure you will not get a reward if you have silk touch.
@MnMaxon
block placing protection? so players dont place and break the same block over and over to get free rewards?
I got the plugin to work thanks man for helping me I appreciate it!
I looked in my latest log file and it's just the server starting and stopping I Think.
@TheWolfEats
No, it's in your server folder.
EDIT: http://gyazo.com/42e2f8011629ae46f1b0cc03c2f6ae71
Do I need to open the .jar file
@TheWolfEats
The error can be found in the logs file: logs/latest.log
I don't know that the error is. I only have 1 version of Lucky Items it's 0.2.1
@TheWolfEats
Could you send me the error? Also, are you sure you are not using the right version (LuckyItems 2.1)?
Make sure you do not have both versions in your plugins folder.
If you drag and drop the new version into your plugins folder without deleting the old one, it won't replace the old version because they have different names.
Hey man, it stills says an internal error occurred. I dont know whats wrong. Im useing bukkit I can send you my ip if you want.
Thank you very much. Also love how fast you fixed this error. This is one of my favorite plugins ever!
@TheWolfEats
I found the problem. Your enchantments were too high for MineCraft. But luckily, the level restrictions can be bypassed with Bukkit. I'm sorry, I didn't think about this while coding it. You can download the newest update (which fixes it) here: https://www.dropbox.com/s/iz6jek00f7bp11k/LuckyItems%202.1.jar?dl=0
https://www.dropbox.com/s/cpghjnrjb7n6e5m/Config.yml?dl=0
Theres The Link To My Config.yml
Ill post it on DropBox it is all it a line so it looks wrong
BroadCastFinds: false Chances: Emerald: 30.0 Diamond: 20.0 Iron: 0.0 Gold: 10.0 Items: A LuckySword: Chance: 1.0 Amount: 1 Material: DIAMOND_SWORD Data: 0 Enchantments: FIRE_ASPECT: 2 DAMAGE_ALL: 5 KNOCKBACK: 2 LOOT_BONUS_MOBS: 2 DAMAGE_UNDEAD: 5 Lore: - What a powerful SWORD Name: LuckySword A LuckyPick: Chance: 1.0 Amount: 1 Material: DIAMOND_PICKAXE Data: 0 Enchantments: DURABILITY: 3 LOOT_BONUS_BLOCKS: 4 DIG_SPEED: 4 Name: LuckyPick A LuckyAxe: Chance: 1.0 Amount: 1 Material: DIAMOND_AXE Data: 0 Enchantments: DURABILITY: 3 LOOT_BONUS_BLOCKS: 4 DIG_SPEED: 4 DAMAGE_ALL: 5 DAMAGE_UNDEAD: 3 Name: LuckyAxe
Theres My Config.yml Do I need to reload the server?