Coin Multiplier

Discussion in 'Archived: Plugin Requests' started by TyphoonTricks, May 10, 2014.

  1. Offline

    TyphoonTricks

    Plugin category: Economy

    Suggested name: CoinMultiplier

    What I want: So basicly with the permission node eg coin.x2 it gives you x2!
    But for you to be able to get x2 coins on the weekend you must have node coin.weekend
    and the /coin weekend must be enabled

    When you do /coin x2 it will say:
    "Coin x2 Enabled


    Ideas for commands:
    /coin enable (Enables All)
    /coin disable (Disables All x3 and x4 and x5 and x6)
    /coin reload
    /coin weekend (for staff) and the /coin weekend works for all users not just donors
    Ideas for permissions:
    coin.enable (for staff)
    coin.disable (for staff)
    coin.reload (Dunno why you would need /coin reload but just in-case)
    coin.weekend (x2 Weekend)
    coin.x2 (Donors) Gives x2 Coins To Users With This Node DONORS ONLY
    coin.x3 (Donors) Gives x3 Coins To Users With This Node DONORS ONLY
    coin.x4 (Donors) Gives x4 Coins To Users With This Node DONORS ONLY
    coin.x5 (Donors) Gives x5 Coins To Users With This Node DONORS ONLY
    coin.x6 (Donors) Gives x6 Coins To Users With This Node DONORS ONLY
    NOT DEFAULT ENABLED FOR OP!
    Users Must Have The Perm! OP Does Not Effect It!

    When I'd like it by: When Ever :)
     
  2. Just wanted to add that for the 'Skype' part.
     
  3. Offline

    TyphoonTricks

    Happy Now?
     
  4. Offline

    MCMastery

  5. Offline

    jjoogood

    Ingame Money. (Essentials)

    To Obtain Ingame Money: /eco give {playername} {amount}
     
  6. Online

    timtower Administrator Administrator Moderator

    TyphoonTricks That is a tricky request. There are no events made by Vault for when you get money, following the flow by hand isn't very easy either.
     
  7. Offline

    Jaaakee224

    TyphoonTricks
    I don't think this is possible because like timtower there are no events made by Vault when you receive money. You would need the source of the plugin (Not sure if APIs will work), and then get the rank, and then multiply the money given, which would be difficulty. Also, Bukkit doesn't allow developers to modify other plugins. I suggest you talk to the authors of the plugins you are using.
     
  8. Offline

    jjoogood

    timtower I'm sure there is a way for a plugin to look at what the other plugins are "paying" the player and send the player the money again...
     
  9. Offline

    TyphoonTricks

  10. Offline

    Jaaakee224

    TyphoonTricks
    I'm not sure, but I believe the same goes for Essentials.
     
  11. Online

    timtower Administrator Administrator Moderator

  12. Offline

    DotDash

    TyphoonTricks Vault is what lets you hook into other plugins.
     
  13. Offline

    xMrPoi

    How are you giving the players money?
     
  14. Offline

    LordFox

    yeah he's probably trying to dupe hypixels idea....WHICH wont be easy, hypixel has devs making their own versions of bukkit off the main bukkit source code to accomadate to their own needs,Plus you haven't stated what economy plugin your using cause there is so many
     
  15. Offline

    jjoogood

    AND all of Hypixels games are custom.
     
  16. Offline

    LordFox

    @jjoogood exactly, if you want a coin multiplier your going to need a custom version of bukkit for it to work, there are other alternatives but they are not easy
     
  17. Offline

    Jaaakee224

    LordFox
    I've seen a lot of servers that have economy multipliers. I don't see how he is exactly copying Hypixel, closest thing he said to copying was "coins".

    TyphoonTricks
    Maybe talk to the developer of Vault and ask them to implement an event on when you receive money.
     
  18. Offline

    LordFox

    @Jaaakee224 also in his post he talks about double coins weekend, i haven't seen another major server use this idea so, its using someone else's idea..........PLUS i presume that he will use this with mini games plugins
     
  19. Offline

    Jaaakee224

    LordFox Mineplex has economy multipliers and double gem weekend, and minigames are probably the only reason for this type of plugin.
     
  20. Offline

    SainttX

    TyphoonTricks this should work, let me know of any problems. it doesnt include the weekend thing, just give those players permission "coin.x2"

    * keep in mind this effects all transactions with essentials such as /pay as well; so if users can /pay, they'll be able to dupe money
    dl = https://mega.co.nz/#!ZBUFVTSC!hTSUJFhXOovwDs6E5_d0ESuMtIJIigjz6smMG0QqmD0
    src
    Code:java
    1. package me.sainttx;
    2.  
    3. import java.util.ArrayList;
    4.  
    5. import net.ess3.api.events.UserBalanceUpdateEvent;
    6. import net.milkbowl.vault.economy.Economy;
    7.  
    8. import org.bukkit.Bukkit;
    9. import org.bukkit.ChatColor;
    10. import org.bukkit.command.Command;
    11. import org.bukkit.command.CommandSender;
    12. import org.bukkit.entity.Player;
    13. import org.bukkit.event.EventHandler;
    14. import org.bukkit.event.Listener;
    15. import org.bukkit.plugin.RegisteredServiceProvider;
    16. import org.bukkit.plugin.java.JavaPlugin;
    17.  
    18. public class CoinMultiplier extends JavaPlugin implements Listener {
    19.  
    20. private static Economy economy;
    21. private boolean disable = false; // Disables x3, x4, x5, x6
    22.  
    23. @Override
    24. public void onEnable() {
    25. saveDefaultConfig();
    26. economy();
    27. Bukkit.getPluginManager().registerEvents(this, this);
    28. getCommand("coin").setExecutor(this);
    29. }
    30.  
    31. private boolean economy() {
    32. RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
    33. if (economyProvider != null) {
    34. economy = economyProvider.getProvider();
    35. }
    36. return (economy != null);
    37. }
    38.  
    39. private static ArrayList<String> justChanged = new ArrayList<String>();
    40.  
    41. @EventHandler
    42. public void onBalanceUpdate(UserBalanceUpdateEvent event) {
    43. final Player player = event.getPlayer();
    44. double newBalance = event.getNewBalance().doubleValue();
    45. double oldBalance = event.getOldBalance().doubleValue();
    46. final double difference = newBalance - oldBalance;
    47. final int multiplier = multiplier(player);
    48. if (difference < 0 || multiplier == 0 || disable || justChanged.contains(player.getName())) {
    49. return;
    50. }
    51. justChanged.add(player.getName());
    52.  
    53. Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { // wait so that list will update
    54. @Override
    55. public void run() {
    56. economy.depositPlayer(player.getName(), (difference * multiplier) - difference);
    57. if (getConfig().getBoolean("tell-player-bonus")) {
    58. sendText((CommandSender) player, getConfig().getString("messages.tell-player-bonus").replaceAll("%n", Double.toString((difference * multiplier) - difference)), false);
    59. }
    60. }
    61. }, 5L);
    62.  
    63. Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
    64. @Override
    65. public void run() {
    66. justChanged.remove(player.getName());
    67. }
    68. }, 20L);
    69. }
    70.  
    71. private int multiplier(Player player) {
    72. for (int i = 2; i <= 6; i++) {
    73. if (player.hasPermission("coin.x" + i)) {
    74. return i;
    75. }
    76. }
    77. return 0;
    78. }
    79.  
    80. private void sendMenu(CommandSender sender) {
    81. for (String text : getConfig().getStringList("messages.menu")) {
    82. sendText(sender, text, false);
    83. }
    84. }
    85.  
    86. private void sendText(CommandSender sender, String text, boolean configentry) {
    87. if (configentry) {
    88. sender.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("messages." + text)));
    89. } else {
    90. sender.sendMessage(ChatColor.translateAlternateColorCodes('&', text));
    91. }
    92. }
    93.  
    94. @Override
    95. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    96. if (args.length == 0) {
    97. sendMenu(sender);
    98. } else {
    99. String arg = args[0].toLowerCase();
    100. if (!sender.hasPermission("coin." + arg) && !sender.isOp()) {
    101. sendText(sender, "permission", true);
    102. return false;
    103. }
    104. if (arg.equals("enable")) {
    105. if (disable) {
    106. disable = false;
    107. sendText(sender, "enable", true);
    108. } else {
    109. sendText(sender, "enable2", true);
    110. }
    111. } else if (arg.equals("disable")) { // disable x3/4/5/6
    112. if (!disable) {
    113. disable = true;
    114. sendText(sender, "disable", true);
    115. } else {
    116. sendText(sender, "disable2", true);
    117. }
    118. } else if (arg.equals("reload")) {
    119. reloadConfig();
    120. sendText(sender, "reload", true);
    121. } else {
    122. sendMenu(sender);
    123. }
    124. }
    125. return false;
    126. }
    127. }
    128.  
     

Share This Page