Salary [EASY]

Discussion in 'Archived: Plugin Requests' started by PotatoTears, Dec 10, 2013.

  1. Offline

    PotatoTears

    Config:
    salary: '&c[Salary] &e{salary}'
    money-given-in-seconds: 120

    If i were to give a PEX rank a node salary.50, then users that are that rank would get 50$ Vault money after each 120 seconds. But only if they are on the server. So for example if i give a person salary.1000 (and if the config says money-given-in-seconds: 120) then he gets 1000$ after each 120 seconds. Use /salary to see how much salary you get (doesnt show the time) so based on the config above, /salary would show &c[Salary] &e<Your rank's salary> in chat. Oh and if you make this then one more thing: Everytime users get their salary they will be shown a text in chat "Payday." this can be changed in the config

    Thanks i hope it gets made.

    Permissions:

    salary.<number>

    Commands:

    /salary - shows how much you get each 120 seconds
     
  2. Offline

    AndyMcB1

    What makes you think this is easy if you yourself cannot code?
     
    Atakyn, Aengo, Caprei and 3 others like this.
  3. Offline

    thomas15v

    PotatoTears bukkit plugins are different than normal applications. We can not just start a thread on plugin start and loop trough to check time (looping trough would be easy XD). We would need to use some kind of bukkit timer. And i also think we arent allowed to call bukkit/minecraft things in that timer. So in fact this is much harder than you think XD.
     
  4. Online

    timtower Administrator Administrator Moderator

    thomas15v Constructor, give along the main plugin, BukkitRunnable?
     
    AndyMcB1 likes this.
  5. Offline

    PotatoTears

    Oh and if you make this then one more thing: Everytime users get their salary they will be shown a text in chat "Payday." this can be changed in the config.
     
  6. Online

    timtower Administrator Administrator Moderator

    PotatoTears https://www.dropbox.com/s/61hzwfd48u4dr2o/SalaryLikeMe.jar
    Does everything you requested.
    /salary
    And the money per 120 seconds.
    The maxMoney value in the config is used for where to start counting down, if you want somebody to make 100000 each 120 seconds then you need to increase that value. ( big number can give lag though )
     
  7. Offline

    PotatoTears

    timtower Thanks i'll try it out asap.
    Edit: timtower did you add the perms so each rank gets different salaries? and wheres the 120 sec time i can change?
     
    timtower likes this.
  8. timtower
    I may have misunderstood the maxMoney, but why would a big number cause lag?
     
  9. Offline

    PotatoTears

    timtower I want to give for example a salary.50 permission node to someone and a timer in the config so in config like salary-per-seconds: 60 so that means the person gets 50$ each minute. Get it? And if i give someone salary.9999 the player gets 9999$ per minute Is this what u did timtower?
     
  10. Online

    timtower Administrator Administrator Moderator

    Looping through all values below till the player has the permission: "salary.<money>"
    Don't have the time option yet
     
  11. Offline

    PotatoTears

    timtower tell me when you added that option, i'll be waiting.
    And what was the point of maxMoney? i dont really get what it does.
     
  12. Online

    timtower Administrator Administrator Moderator

    https://www.dropbox.com/s/61hzwfd48u4dr2o/SalaryLikeMe.jar
    Default to 120
    And I go through all of the possible numbers between maxMoney and 0, no other way to check if they have the permission for that
     
  13. Offline

    PotatoTears

    timtower thanks ill try this out

    timtower I don't seem to be getting any salary... I gave myself the salary.45 permission though im not getting any money or anything in the server

    timtower and the config keeps resetting itsself, i can't change it...
     
  14. Online

    timtower Administrator Administrator Moderator

    Edit it when the server isn't running
     
  15. Offline

    PotatoTears

    timtower Okay let me see

    timtower Nope, the config keeps resetting itsself to default. And it does give me salary, but it gives me $1000!!!! Even though i have the salary.45 permission. I want it to give $45 if i have salary.45 perm and 60$ if i have salary.60 etc And i want the /salary to show if i get 45 or 60 etc It just says 0
     
  16. Online

    timtower Administrator Administrator Moderator

    What does /salary say now then?
     
  17. Offline

    PotatoTears

    timtower it says 0$ and pays me 1000$ even though i have a salary.45 perm
     
  18. Online

    timtower Administrator Administrator Moderator

  19. Offline

    pilot3101

    timtower can you make it where you can change the amount of salary and how many days. For example for config:

    Config:
    salaryamount:
    days:
    weeks:
    hours:


    Then make the permission node salary.use and it will give that user X amount of money specified in config, every X amount of days just repeating.
     
  20. Online

    timtower Administrator Administrator Moderator

    pilot3101
    1. You aren't the OP
    2. That would destroy the feature of having different amounts per rank
     
  21. Offline

    PotatoTears

    timtower ill deop myself lemme see

    timtower im not op and still /salary shows 0 and the config keeps resetting
     
  22. Oh yeah, didn't even think of that, but you can easily simplify it.
    Code:
    for (PermissionAttachmentInfo perm : somePlayer.getEffectivePermissions()) {
        if (perm.startsWith("salary.")) {
            String[] split = perm.getPermission().toString().split(".");
            int salary = 0;
     
            try {
                salary = Integer.parseInt(split[1]);
            } catch (NumberFormatException ex) {
                // not a number, deal with it
            }
     
            // 'salary' would now be the number in "salary.<number>"
        }
    }
    If either one of you want, I can re-do this plugin in a bit.
     
  23. Offline

    PotatoTears

  24. Online

    timtower Administrator Administrator Moderator

    Assist Had to knew this before -.-
    I will try, but I won't rush anything
     
  25. Offline

    PotatoTears

  26. Online

    timtower Administrator Administrator Moderator

    thomas15v likes this.
  27. Offline

    PotatoTears

    timtower Let me see it. brb

    timtower /salary now says Internal error occured blabla and spams my console :( And i'm getting no salary heelp
     
  28. Online

    timtower Administrator Administrator Moderator

    Could you post that error?
     
  29. Offline

    PotatoTears

    timtower

    [18:14:53] [Server thread/INFO]: ME issued server command: /salary
    [18:14:53] [Server thread/WARN]: dets 11, 2013 6:14:53 PM net.minecraft.server.v1_7_R1.PlayerConnection handleCommand
    SEVERE: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'salary' in plugin SalaryLikeMe v0.0.1
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:192)
    at org.bukkit.craftbukkit.v1_7_R1.CraftServer.dispatchCommand(CraftServer.java:543)
    at net.minecraft.server.v1_7_R1.PlayerConnection.handleCommand(PlayerConnection.java:923)
    at net.minecraft.server.v1_7_R1.PlayerConnection.a(PlayerConnection.java:803)
    at net.minecraft.server.v1_7_R1.PacketPlayInChat.a(PacketPlayInChat.java:28)
    at net.minecraft.server.v1_7_R1.PacketPlayInChat.handle(PacketPlayInChat.java:47)
    at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:146)
    at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134)
    at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:645)
    at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:243)
    at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:535)
    at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:447)
    at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617)
    Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
    at nl.timdebrouwer.salarylikeme.SalaryLikeMe.getMoney(SalaryLikeMe.java:51)
    at nl.timdebrouwer.salarylikeme.SalaryLikeMe.onCommand(SalaryLikeMe.java:76)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
    ... 13 more


    [18:14:55] [Server thread/WARN]: [WorldEdit] No compatible nms block class found.
    [18:14:55] [Server thread/INFO]: ME lost connection: Disconnected
    [18:14:55] [Server thread/INFO]: ME left the game.
     
  30. Offline

    Garris0n

    Did you give yourself the permission "salary."?
     

Share This Page