MCCasino
I've taken over the project, and I plan on reviving it fully to the strongest of all capabilities. :) - New Author X_angelz_X
MCCasino
Minecraft's one armed bandit.
Version 0.2.2
This server mod allows you to create a slot machine using signs. The signs will drop items at their location, these correspond to the symbols on a reel. You can set a multiplier reward according to the combination that falls out. The item the player is holding when right clicking the playing sign is considered as the bet. Economy support is also available.
Features
- Simple and easy setup.
- Reel items can't be picked up.
- Simple to play.
- Supports Permissions.
- Supports Vault economy, which mean that, as long as you install Vault, this plugin will work with every economy plugin.
Commands and permissions
- mccasino.use : allows a player to use/play slot machines.
- mccasino.setup : allows a player to use any of the following commands:
- /mccdel (machine name): delete a machine.
- /mcctest (machine name): test run a machine.
- /mccforceactive (machine name): force a machine into activity. Warning! This may cause problems.
Usage
For players: hold your bet (keep in mind that the entire stack will be taken, if the machine doesn't use limits, or a money bet), and right click the play sign (has "Slot Machine" on the second line). The machine will run, after it will be deactivated for 5 seconds, then the drops will be deleted, and it will reactivate. If the machine is set to money bets, you can right click with anything play. Note: items dropped by the reels can't be picked up.
For admins: first read the README.txt file in the zip archive you downloaded.
Now, start by building the slot machine, if you need an example, see the screenshots. Add the signs where the items will be dropped. So they can be identified as reels, you must follow this template:
first line: [MCCasino]
second line: Reel
third line: name of the machine (example: machine1)
fourth line : number of the reel (ex: 2)
The "number of the reel" thing is optional, but it's recommended, if reels are added, removed or replaced, this number will allow the plugin to reorder them. It corresponds to the one set in the config.
Now add next to the machine a sign following this template, this will be the sign the players interact with:
first line: [MCCasino]
second line: Slot Machine
third line: name of the machine (example: machine1, same as the reels)
fourth line : anything you want (or nothing), it's not used.
ALL of the signs need to be wall signs.
Now go to your config, and add/edit an entry to "Machines:", see the "Config" section for help.
Reels are numbered 1 to whatever you want, and have a list of drops with the probability for the drop. For example, reel one has equal chances of dropping all its items (331 is redstone, 266, gold ingot and 264, diamond). Reel 2 has more chances of dropping gold than redstone, and more of dropping diamond than gold. The number you use for the probabilities should always be whole, between 1 and 100, I suggest, although, it's relative: 5, 4 and 3 will get you the same results as 50, 40 and 30. You can have more than 4 reels, just add an entry for '5'.
For the rewards, they're in two parts: a combination of drops, the first in the list belongs to reel one, and etc., and the multiplier reward, a whole number. The drops, again, are IDs, for items or blocks, and the multiplier is used to multiply the quantity of the bet for the winner. If the results do not match any combination, the default is 0.
Limits are basically the maximum allowed item bets. For machine2, those are enabled, and so a player can only bet one gold or one diamond. If he's holding more, only the desired quantity will be taken.
If you enable economy, the machine will ignore items, and take money (same amount as the cost) directly from the player's account. Multipliers are applied here too. YOU NEED Vault for the economy function. If no economy plugin can be found, the machine will used item bets.
Now that you're done, reload/reboot the server (or disable and enable the plugin), and log back in.
You'll need the "setup" permission next: right click the signs for the reels, they'll be registered. IMPORTANT: the order in which you click them matters if you didn't add a reel number on the last line of the sign, you should always go from left to right. The first clicked sign will be linked to reel one, the second to two, and etc.
Now test the machine, you'll need the "use" permission for this. Right click the sign with your bet (use a dirt block or another cheap resource) and it should run. After 5 seconds, the drops are deleted, and the machine activates again. A machine is only first active if all of it signs are present and registered. You can also to a fast test with "/mcctest (machine name)". This doesn't require a bet.
To delete a machine, just punch out the reels, then erase the entry in the config. You can also use "/mccdel (machine name)", but this will not modify the config.
If you have any problems with a machine staying inexplicably inactive, try "/mccforceactive (machine name)".This will force it into activity. I am not responsible for any problems this might cause.
Config
Machines: machine1: reels: '1': - 331-50 - 266-50 - 264-50 '2': - 331-10 - 266-30 - 264-50 '3': - 331-50 - 266-50 - 264-50 '4': - 331-50 - 266-50 - 264-50 rewards: - 264,264,264,264:5 - 331,266,266,331:3 - 266,264,264,266:4 - 331,266,264,331:6 - 331,331,331,331:2 - 266,266,266,266:10 economy: use_economy: true cost: 10 bet_limits: enabled: false allowed: - 266-1 - 264-1 messaging: message: '$6$[MCCasino] $7$$name$ won $$amount$!' send_to: world exclude_winner: true radius: 20 machine2: reels: '1': - 4-50 - 5-50 - 1-50 '2': - 4-50 - 5-50 - 1-50 '3': - 4-50 - 5-50 - 1-50 '4': - 4-50 - 5-50 - 1-50 '5': - 4-50 - 5-50 - 1-50 rewards: - 1,1,1,1,1:5 - 4,5,1,5,4:3 - 5,1,4,1,5:4 - 4,5,1,5,4:6 - 4,4,4,4,4:2 - 5,5,5,5,5:10 - 5,5,5,5,5:10 - X,X,5,X,X:10 #The special character "x" is equal to any possible ID economy: use_economy: false cost: 10 bet_limits: enabled: true allowed: - 266-1 - 264-1 messaging: message: '$6$[MCCasino] $7$$name$ won $amount$ $item$(s)!' send_to: players_nearby exclude_winner: true radius: 15
"machine1" should be the name of the machine you placed on the signs, in-game.
Permissions config
This config can be found in the MCCasino folder, it's called perms_config, and is generated on plugin startup. For most applications, you may not need to change it, but, if you use Permissions 3.0 and older, or if you do not use any permission plugin, you will need to edit it.
PermissionsSystem: SuperPerms #This config is case sensitive!!# PlayerPerms: - mccasino.use
"PermissionsSystem" is the permission checking system to use. If you use any up-to-date permissions plugin that support SuperPerms, leave the config as is.
If you do not use a permissions plugin, set the field to "PlayerAndOP". This will set all permissions at op only, unless you add them to the "PlayerPerms" field. This basically creates a simple group system: players, the default group with no permissions, except the ones added to the "PlayerPerms" field, and ops, who have all the permissions.
Features to add
(Features marked with "added" will be available in the next version.)
Source
The source code can be found here: https://github.com/DDoSQc/MCCasino
Feel free to contribute!
Donate
If you want to make a donation for all my hard work, here's a link: Donate here!
Changelog
Version 0.2.2
- Added messaging
- Compatibility for the latest 1.2 builds
Version 0.2.1
- Fixed a problem with limits, items weren't being removed properly
- Fixed item being pickable as they were dropping.
Version 0.2
- Added a command to test a machine.
- Added a command to delete a machine.
- Added a command to force a machine into activity
- Added Vault economy support, basically, I added support for all economy plugins.
- Fixed items dropping. No more water stuff.
- Added limits.
- Added the special character "x" to the result combinations. Basically, it's equal to any possible ID.
Version 0.1
- Initial release
Wanted to post this to say that McCasino will be coming back :) All built back up and welcoming to the community with warm arms.
ditto iam having the same problems also
mccforceactive and mcctest also
also I hav'nt been running a server to long and was wondering if one knows how to reload the config w/o having to stop the server.
other wise this is a sweet plugin and am looking forward to the up dates.
Thanks and you rock.
Is it just me or does /mccdel machinename not work? I'm trying to delete my slots named slot1 through slot4 and it just tells me the usage ("/mccdel (slot machine name") Thanks for the great plugin!
@quickclay
yep, I'll fix it now.
Is this a typo? Mentions Quarantine...
"Permissions config
This config can be found in the Quarantine folder, it's called perms_config, and is generated on plugin startup. For most applications, you may not need to change it, but, if you use Permissions 3.0 and older, or if you do not use any permission plugin, you will need to edit it.
PermissionsSystem: SuperPerms #This config is case sensitive!!#
PlayerPerms:
- quarantine.play"
Sorry for the lack of updates, I'm currently visiting Italy. I have limited Internet access, and I am unable to update my plugins at the moment. I hope to have them all working by March 15.
These will be compatibilty and feature updates.
Thank you for your patience!
Please update for MC 1.2.3 (CB R0.2)
Great news, because apart from that, it's a very fun and stable plugin, just currently unsafe for us to use due to the incorrect odds ><
@Joymo
I'm planning on improving the random results generation, I'll have a look at SecureRandom.
Thanks.
Something about using "SecureRandom" to solve this properly :P
We've been having issues where our calculated odds for machines are simply not correct in regards to the outcomes. Had someone check out the source, and he said this:
yea its just a coding issue on the plugin end really, no way it should work like tis heres an easier way to do it, but:
weightedNumbers.add((random.nextInt(49999) + 1) * value.getProb()); should be
weightedNumbers.add((random.nextInt(50000 * value.getProb()) + 1));
that would fix it, although poorly
Not sure about the details, just wanted to pass this on...
I cannot get it working. I have same problem as zxcdserf. I did exactly as explained. I'm quite certain I did everything right. Still getting that error, and it works one round..
EDIT: Hmm. Well, it was my bad then. I just used the sample configs and didn't know I need as many reels as in the config.. I was stupid, but I think that the "howto" is a bit difficult.
@DDoSQc
I did. They say they are registered.
Edit: nvm. I double checked, somehow one of them is not registered. Sorry for the bother.
Also a reload command just for this plugin would be super helpful!
@zxcdserf
Did you place all the reel signs and register them by right clicking them?
Hmm, I did everything, still says This Machine is not active. When I force active it, nothing happens, just takes my 10 bucks.
@Joymo
Added your suggestions to the features to add section.
Ok well, requests:
1) Config setting to broadcast game result to local chat, ideally configurable shout range. 2) Able to set a fixed Vault-economy cost per game, in addition to the bet. Including an IGN to configure with a machine. This would allow the host of a machine, to gain a small amount of currency from hosting a specific slot machine, seeing all bets/rewards go/come from thin air.
Thanks, great plugin :)
@weja93
Your reels aren't setup properly.
I'm not really sure what is going on. I set to bet items iron ingot and gold ingot. The machine never activates, and it works once with force active. After that it turns again inactive, and I have to force activate it. The items won't disappear either. This is the error I get in console.
12:02:27 [SEVERE] Could not pass event org.bukkit.event.player.PlayerInteractEvent to MCCasino org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$103.execute(JavaPluginLoader.java:1026) at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:61) at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:460) at org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:187) at net.minecraft.server.ItemInWorldManager.interact(ItemInWorldManager.java:283) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:609) at net.minecraft.server.Packet15Place.handle(SourceFile:39) at net.minecraft.server.NetworkManager.b(NetworkManager.java:226) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:100) at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:552) at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78) at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:537) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:435) at net.minecraft.server.ThreadServerApplication.run(SourceFile:465) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.bukkit.plugin.java.JavaPluginLoader$103.execute(JavaPluginLoader.java:1024) ... 13 more Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 4 at java.util.ArrayList.rangeCheck(ArrayList.java:604) at java.util.ArrayList.get(ArrayList.java:382) at me.DDoS.MCCasino.slotmachine.MCCSlotMachine.spinReels(MCCSlotMachine.java:180) at me.DDoS.MCCasino.slotmachine.MCCSlotMachine.run(MCCSlotMachine.java:250) at me.DDoS.MCCasino.listener.MCCListener.onPlayerInteract(MCCListener.java:64) ... 18 more 12:02:37 [INFO] [PLAYER_COMMAND] Weja: /i ironingot 12:03:45 [SEVERE] Could not pass event org.bukkit.event.player.PlayerInteractEvent to MCCasino org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$103.execute(JavaPluginLoader.java:1026) at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:61) at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:460) at org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:187) at net.minecraft.server.ItemInWorldManager.interact(ItemInWorldManager.java:283) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:609) at net.minecraft.server.Packet15Place.handle(SourceFile:39) at net.minecraft.server.NetworkManager.b(NetworkManager.java:226) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:100) at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:552) at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78) at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:537) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:435) at net.minecraft.server.ThreadServerApplication.run(SourceFile:465) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.bukkit.plugin.java.JavaPluginLoader$103.execute(JavaPluginLoader.java:1024) ... 13 more Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 4 at java.util.ArrayList.rangeCheck(ArrayList.java:604) at java.util.ArrayList.get(ArrayList.java:382) at me.DDoS.MCCasino.slotmachine.MCCSlotMachine.spinReels(MCCSlotMachine.java:180) at me.DDoS.MCCasino.slotmachine.MCCSlotMachine.run(MCCSlotMachine.java:250) at me.DDoS.MCCasino.listener.MCCListener.onPlayerInteract(MCCListener.java:64) ... 17 more
@Joymo
I don't have enough time to handle tickets, and the comment section is good enough. I don't get a lot of help request, this is not a huge or complex plugin.