Surprise Bags
Description
This plugin adds various treasures and surprise bags to your world. These special items will be dropped by naturally-spawned monsters such as Zombies and Spiders. When players obtain the surprise bags, they can open them by clicking the right mouse button while holding them. They will then get a random item and the bag will disappear.
The list of surprise bags is set in the configuration files of the plugin, as well as the list of items that the player can receive when opening each bag. The plugin comes with a predefined set of bags:
- Treasure
- Trick-or-treat Box (perfect for Halloween)
- Surprise Bag
- Unknown Book
- Wintersday Gift (perfect for Christmas)
Each such item has a different drop-rate. Please see the configuration files for more information.
For example, players who open an Unknown Book might get a sharpness I enchanted book or a different enchanted book. Trick-or-treat boxes might get the player a raw fish, a pumpkin pie or, rarely, a diamond helmet.
Commands
There is one main command and several sub-commands:
- /surprisebags version - Get the plugin's version.
- /surprisebags spawn <bag> [count] [player] - Give you or a player a bag by name.
- /surprisebags list - List of existing bags.
- /surprisebags edit <bag> - Edit the bag's contents.
- /surprisebags save <bag> - Save the bag's contents to the configuration file.
- /surprisebags addbag <bag-id> [name] [drop-chance] - Add a new bag
- /surprisebags removebag <bag-id> - remove a custom bag
- /surprisebags reload - Reload the configuration files.
Permissions
There are three permission settings:
- surprisebags.command - Allows you to use the SurpriseBags admin command (defaults to admins only).
- surprisebags.openbag - Allows you to open bags (defaults to everyone).
- surprisebags.edit - Allows you to edit or save the bags contents (defaults to admins only).
Configuration
You may add/remove surprise bags by using the in-game commands. You can change different settings by editing config.yml, which is in the plugin's folder after installation. Each bag has its own YAML file, where you can list the items that players will receive when opening the bag. The players will always receive exactly one item, so adding many items of the same type will increase the chance of receiving them, whereas items which appear only once will be rare. You may open the configuration files of any of the predefined bags (e.g. Trick-or-treat box) to see how these lists work.
You may change the general drop-rate of bags, as well as the specific drop-rate of each bag.
If you have WorldGuard installed, you may limit the drops to one region. The region ID is set on config.yml.
If you want a bag to drop from a specific list of mobs, you can add the "limit-mob" setting to the bag's yaml file. For example:
# # Limit Mobs # # Limit the drop of this bag to the listed mobs only. # limit-mob: - creeper - zombie
Note that this should be in the bag's file, not in config.yml (in other words, it is defined per bag).
For lack of updates on this one, I have created a similar plugin for 1.9/1,10 here: https://www.spigotmc.org/resources/mystery-bags.27612/
Any code it shares with this one is purely coincidental, but it should function in much the same way.
I updated this plugin it might be buggy but it loads.
https://www.spigotmc.org/resources/surprise-bags.21233/
Are you going to update this for 1.9. My console is getting spammed with errrors.
[18:46:20 ERROR]: Could not pass event PlayerInteractEvent to SurpriseBags v1.8.9 org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at org.bukkit.craftbukkit.v1_9_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:212) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at org.bukkit.craftbukkit.v1_9_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:179) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at org.bukkit.craftbukkit.v1_9_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:175) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at net.minecraft.server.v1_9_R1.PlayerConnection.a(PlayerConnection.java:897) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at net.minecraft.server.v1_9_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:27) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at net.minecraft.server.v1_9_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at net.minecraft.server.v1_9_R1.PlayerConnectionUtils$1.run(SourceFile:13) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_73] at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_73] at net.minecraft.server.v1_9_R1.SystemUtils.a(SourceFile:45) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at net.minecraft.server.v1_9_R1.MinecraftServer.D(MinecraftServer.java:716) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:400) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:655) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:554) [craftbukkit.jar:git-Spigot-7d15d07-c194444] at java.lang.Thread.run(Unknown Source) [?:1.8.0_73] Caused by: java.lang.NoSuchFieldError: ITEM_PICKUP at org.samson.bukkit.plugins.surprisebags.bag.BagController.handleBagOpen(BagController.java:90) [?:?] at org.samson.bukkit.plugins.surprisebags.SurpriseBagsEventListener.onPlayerInteractEvent(SurpriseBagsEventListener.java:50) [?:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [?:1.8.0_73] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [?:1.8.0_73] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [?:1.8.0_73] at java.lang.reflect.Method.invoke(Unknown Source) [?:1.8.0_73] at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) [craftbukkit.jar:git-Spigot-7d15d07-c194444] ... 18 more
@broluigi
What is not working with 1.9? I don't see any errors in the log.
fix for 1.9 dupe?
limit-mob works not with rabbit, pig, sheep, cow, horse etc.
Bags have issues saving when adding custom skulls to the bag?
I've been looking for a way to distribute decorative head blocks from http://heads.freshcoal.com/maincollection.php, however dtlTraders or any other NPC shop does this. I have found that dtlTraders won't delete the data of these SurpriseBags, so I was going to use them as redemtion tickets for the heads (they look like pots and foods). I am trying to keep things as command-free and sign click free as possible.
Any solution to this head issue?
Here is my error log: http://pastebin.com/MMsbqjqU
Anyone with the syntax to do fireworks? I'm planning to play with this some more this weekend.
Update: I used the MiniGames mod to figure out the syntax.
items:
- ==: org.bukkit.inventory.ItemStack type: FIREWORK amount: 4 meta:
: ItemMeta
meta-type: FIREWORK display-name: Punisher firework-effects: - ==: Firework flicker: true trail: false colors: - ==: Color RED: 30 BLUE: 27 GREEN: 27 - ==: Color RED: 37 BLUE: 146 GREEN: 49 fade-colors: - ==: Color RED: 123 BLUE: 190 GREEN: 47 type: BALL_LARGE - ==: Firework flicker: false trail: true colors: - ==: Color RED: 30 BLUE: 27 GREEN: 27 - ==: Color RED: 102 BLUE: 211 GREEN: 137 fade-colors: - ==: Color RED: 123 BLUE: 190 GREEN: 47 type: BALL power: 2
Really love this plugin :D
@eyalzh pls add itemmeta options damage and health.
@biznitchash
Adding more of the same item will just increase the chance of getting that item.
Getting multiple items from a single surprise bag is not possible.
One option is to add a special item (technically, it can be named chest) and trade it for 8 things (e.g. "A chest of obsidian goods" can be sold for 8 obsidian). You would need an economy/shop plugin that supports this, however. Hope this helps.
Not sure if dev replies anymore;
I want to give my players say 8 of an item, is the only way to do that adding multiple stacks of the same item? or will that just continue to increase the likelihood of the item appearing.
How would I go about making it so players can get 8 of an item?
Would be good to turn off of the surprise bag open msg in-game btw.
It would be cool if there was an option to broadcast an (editable) message to other player on the server whenever someone opens a bag, or at least a permission to see the OP alert for opening to let other players see it! :)
Hello
Is it possible to edit this nice plugin in order to allow to translate sentences like "You got PUMPKIN", etc.? And to use the real name of an item like "Orange Dye" and not "INK_SACK"?"
Thanks :)
@eyalzh
The message when they open the bag. It spams me so much xD Nevermind, I found it :D
@Dillzzzzz
The spy message or the personal message?
It seems like the plugin isn't working for me. I put it in the plugins folder and nothing happends. Does it need another plugin to work or is it just me? I'm running Bukkit 1.7.4
I actually works. It just doesn't with the later 3 versions
Is there a way to toggle messages of opening?