Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void playBedrockSlot(final PlayerInteractEvent e) {
- final Player p = e.getPlayer();
- final Random random = new Random();
- if (e.getAction() != Action.RIGHT_CLICK_BLOCK) {
- return;
- }
- if (e.getClickedBlock().getState() instanceof Sign) {
- final Sign s = (Sign) e.getClickedBlock().getState();
- if (s.getLine(2).equalsIgnoreCase("§8[§9RivalsPVP§8]") && s.getLine(1).equalsIgnoreCase("§0§lBedrock")) {
- final double bal = Core.econ.getBalance((OfflinePlayer) p);
- if (bal <= 499999.99) {
- p.sendMessage("§4Not enough money!");
- return;
- }
- Core.econ.withdrawPlayer((OfflinePlayer) p, 500000.0);
- double fivehunderk = plugin.getConfig().getDouble("dropChance", 1) / 3;
- if (random.nextDouble() <= fivehunderk) {
- Core.econ.depositPlayer(p, 500000.0);
- p.sendMessage("You have won 500k");
- return;
- }
- double onemil= plugin.getConfig().getDouble("dropChance", 1) / 8;
- if (random.nextDouble() <= onemil) {
- Core.econ.depositPlayer(p, 1000000.0);
- p.sendMessage("You have won q million");
- return;
- }
- double twomil= plugin.getConfig().getDouble("dropChance", 1) / 25;
- if (random.nextDouble() <= twomil) {
- Core.econ.depositPlayer(p, 2000000.0);
- p.sendMessage("You have won 2 million");
- return;
- }
- else {
- p.sendMessage("Sorry you did not win anything");
- return;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement