Set XP + Set Level (With no messages at all).

Discussion in 'Archived: Plugin Requests' started by nTiger, Dec 18, 2012.

  1. Offline

    nTiger

    Hey there, I need plugin, witch can set players xp and level, and will not send any messages to player/op/console, nothing at all . Thanks.
     
  2. Offline

    MistPhizzle

    I may be able to get this done tomorrow (Wednesday Night) or Thursday Night. (Finals Week :/)

    If nobody else makes it before I begin coding it, I'll give it a go.
     
    KingVadanite and nTiger like this.
  3. Offline

    nTiger

    Thanks ! No rush there :). You're awesome.
     
  4. Offline

    Woobie

    nTiger
    Here you go, sorry MistPhizzle :p
    Tell me if this was not what you were looking for, I can always modify it :)

    Without messages
    <Edit by Moderator: Redacted mediafire url>
    Source

    With messages
    <Edit by Moderator: Redacted mediafire url>
    Source



    Commands
    * /xp give <player> <amount> - Give xp levels to the target player - 3rd argument as the amount
    * /xp take <player> <amount> - Take xp levels from the target player - 3rd argument as the amount
    * /xp set <player> <integer> -Set the target player level - 3rd argument as the integer (level)

    Permissions
    * xp.give - Allows the use of /xp give
    * xp.take - Allows the use of /xp take
    * xp.set - Allows the use of /xp set
     
    Last edited by a moderator: Nov 8, 2016
    nTiger likes this.
  5. Offline

    nTiger

    Hey :D, Everything is awesome as I wished, just one more thing I need "set xp" to set players xp, like /xp set but this sets level thats good . But if it's possible to add like "/xp set2 <player> <integer>" . Anyway big thanks !.
     
  6. Offline

    Woobie

    Sorry, I didnt quite understand, but do you want a method to give xp, instead of levels?
     
  7. Offline

    nTiger

    I need both : P. Thanks.
     
  8. Offline

    nTiger

    Anyone ?
     
  9. Offline

    Skye

    It makes no sense to me why you want this without any messages at all, as you wouldn't even know if the command worked. A lot of the functions I already use in XPBank though, so here it is.

    Edit: This download no longer takes the player's actual experience into account, as the original poster requested. Source is still of the old version that does.

    Download: http://arsonicgaming.net/XPSet.jar
    Source: http://pastebin.com/Rm1xgrQk

    Commands:
    • /xp set <player> <amount> - Sets <player>'s XP to <amount>
    • /xp setlevel <player> <amount> - Sets <player>'s level to <amount>
    • /xp give <player> <amount> - Gives <player> <amount> XP
    • /xp givelevels <player> <amount> - Gives <player> <amount> levels
    • /xp take <player> <amount> - Takes <amount> XP from <player>
    • /xp takelevels <player> <amount> - Takes <amount> levels from <player>
    Permissions:
    • XPSet.* - Grants all command
    • XPSet.set - Grants /xp set, setlevel
    • XPSet.give - Grants /xp give, givelevels
    • XPSet.take - Grants /xp take, takelevels
     
    nTiger likes this.
  10. Offline

    nTiger

    Because Im working on my own plugin, but Im working with "skript" plugin and it doesnt have any option to change players XP and Level. I dont want any spam in console because one level is added to player every second. It's a timer system, i'll make video on it and show you how awesome is that :D.

    I want to remove message because it's annoying as it spams console with message like "% XP has been added to %".

    Ok here is the video:

     
    Cupcakes69 likes this.
  11. Offline

    ImDeJay

    Thats actually really neat... might have to use something like that some day.
     
    nTiger likes this.
  12. Offline

    nTiger

    [quote uid=90712918 name="Woobie" post=1458739]nTiger
    Here you go, sorry MistPhizzle :p
    Tell me if this was not what you were looking for, I can always modify it :)

    Without messages
    <Edit by Moderator: Redacted mediafire url>
    Source

    With messages
    <Edit by Moderator: Redacted mediafire url>
    Source



    Commands
    * /xp give <player> <amount> - Give xp levels to the target player - 3rd argument as the amount
    * /xp take <player> <amount> - Take xp levels from the target player - 3rd argument as the amount
    * /xp set <player> <integer> -Set the target player level - 3rd argument as the integer (level)

    Permissions

    * xp.give - Allows the use of /xp give
    * xp.take - Allows the use of /xp take
    * xp.set - Allows the use of /xp set

    [/quote]



    Hi!, could you please remade it to "/xp2" not "/xp" and make it possible to be used by console ?. Thanks.
     
    Last edited by a moderator: Nov 8, 2016
  13. Offline

    Woobie

    Okay, but didn't Skye already make this? :confused:
     
  14. Offline

    nTiger

    Yup but i need to use his and yours, its bit hard to explain what im trying to make ;D.

    Because in his when I set players "xp" and then I set players "level" the xp resets to 0, and when I use his and yours,

    his to change XP, yours to change Level, and it works, the XP doesnt restarts.
     
  15. Offline

    CeramicTitan

    how much exp do you give to make it time so nicely?
     
  16. Offline

    nTiger


    hmm, it's hard to say, I'm using plugin "skript" to code and here is my code:

    Code:
    every 2 tick:
        loop all players:
            add 1 to {online}
       
        if {online} > 1:
            loop all players:
                if {map.%loop-player%.started} is 1:
     
                    # adds a Tick
                    add 1 to {Ticks.%loop-player%}
                    # Dispaly Timer
                    if {Ticks.%loop-player%} is 1:
                        execute console command "/xp set %loop-player% 1"
                    if {Ticks.%loop-player%} is 2:
                        execute console command "/xp set %loop-player% 2"
                    if {Ticks.%loop-player%} is 3:
                        execute console command "/xp set %loop-player% 4"
                    if {Ticks.%loop-player%} is 4:
                        execute console command "/xp set %loop-player% 6"
                    if {Ticks.%loop-player%} is 5:
                        execute console command "/xp set %loop-player% 8"
                    if {Ticks.%loop-player%} is 6:
                        execute console command "/xp set %loop-player% 10"
                    if {Ticks.%loop-player%} is 7:
                        execute console command "/xp set %loop-player% 12"
                    if {Ticks.%loop-player%} is 8:
                        execute console command "/xp set %loop-player% 14"
                    if {Ticks.%loop-player%} is 9:
                        execute console command "/xp set %loop-player% 16"
                    if {Ticks.%loop-player%} is 10:
                        execute console command "/xp set %loop-player% 0"
     
                    execute console command "/levelit set level %loop-player% %{secondsTimer.%loop-player%}%"
     
                    # Converts it to Seconds
                    if {Ticks.%loop-player%} is 10: # every 10 times make it to 1 sec
                        set {Ticks.%loop-player%} to 0
                        add 1 to {Sec.%loop-player%}
           
                        # Add 1 level every 1 sec
                        add 1 to {secondsTimer.%loop-player%}
                        execute console command "/levelit set level %loop-player% %{secondsTimer.%loop-player%}%"
     
     
                    # Converts it to Minutes
                    if {Sec.%loop-player%} is 60:
                        set {Sec.%loop-player%} to 0
                        add 1 to {Min.%loop-player%}
    
     
    CeramicTitan likes this.
  17. Offline

    CeramicTitan

    whose plugin are you using? Just so i know which source to look through.
     
  18. Offline

    nTiger

    for adding level ( "/levelit" ) I use "levelit" somewhere from, because I waiting for Woobie's one.

    and for XP set I use Skye's.

    if you make anything more simple with the timer :D could I have the plugin and sorce code ?

    So please could you do this : (, I'm planning to open my server tomorrow. Thanks.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  19. Offline

    Junnesejer

    Hey I've made you a simple (rough) plugin. You can view it at this link:
    https://github.com/YuckFou/Bukkit/t...-xp name amount/net/junnesejer/bukkit/plugins

    I know it isn't the best way to do this so if anyone would like to improve it, feel free to do so.
    Oh and don't feel like you need to copy-paste this you can freely take a look at the code and take some stuff from it.
    And here is what it features: (don't forget you can use the command in-game but also through the console!)

    Command: /xp <playername> amount
    Ex: /xp Junnesejer 400 would give me 400 exp.
    • Automatic String Checks
    Plugin automatically detects if you don't enter a playername or exp amount.
    • Automatic Typo Fixer
    Plugin automatically detects a typo and fixes it.
    Ex: /xp Junnesejer dr400 would result in: /xp Junnesejer 400
    It fixes all characters so:
    /xp Junnesejer @#$#400dfs would result in: /xp Junnesejer 400

    Tested :4 Jan 2013 1.4.6-R02 by: me
     
  20. Offline

    Skye

    It's impossible to give a player levels in the way you're asking for because of how the amount of XP needed to level changes. For anyone interested in giving it a shot, something like this would bring the player closest:

    Code:
        public int giveLevels (Player p, int levels) {
            double newLevel = calcXPLevels(p.getLevel() + levels);
            double newOverflow = (calcXPLevels(p.getLevel() + levels + 1) - newLevel) * p.getExp();
     
            return (int) (newLevel + newOverflow);
        }
     
        protected int calcXPLevels (int levels) {
            int xp = 0;
     
            for (int i = 1; i <= levels; i++) {
                if (i <= 16) {
                    xp += 17;
                } else if (i > 16 && i <= 31) {
                    xp += (i - 16) * 3 + 17;
                } else if (i > 31) {
                    xp += (i - 31) * 7 + 62;
                }
            }
     
            return xp;
        }
    From there, you'd have to cheese it by setting their XP bar to the value it was before they were given the levels, which is probably what levelit does. This may result in the XP bar being inaccurate when the player gains XP while close to a level. I found an XP bar sliding all over the screen to be in poor taste, which is why I count any progress in the current level as a level.
     
  21. Offline

    nTiger


    But everything works as I want it, I just want Woobie's plugin to be working in console, and all will be perfect!

    Thanks :).
     
  22. Offline

    Necrodoom

    if you use essentials, you can use the /xp command and blank the messages from the locale file (google essentials wiki locale)
     
  23. Offline

    nTiger

    naah thats to heavy plugin to be used:p, nvm I already made a way out of it :).
     
  24. Offline

    KylexDavis

    Sorry to be off-topic, but I'm very interested in this server :p
    Mind messaging me the IP when it's up and running? Hope someone can help you out with the plugin.
     
  25. Offline

    nTiger


    Hi!, server isn't out yet. But I can show you around :D, catch me on steam: nTiger or skype: nnnTiger
     
  26. Offline

    Skye

    So you just want the level number to change? You are aware that the player's XP is actually unchanged in his plugin?
     
  27. Offline

    nTiger

    Yes. Everything is working perfectly, I use yours + his together and it works, but his can't be done through console.
     
  28. Offline

    Skye

    Okay, the link in my last post has what you want, with the same details. Source is basically getPlayer().giveExp() and getPlayer().giveExpLevels() with no regard for the player's actual experience. Set level will still set the actual experience to 0 though, so I would use that on anyone leaving the area if your server allows them to play normally.
     
    nTiger likes this.
  29. Offline

    nTiger

    As I wish it!!!!!!!!! love you.

    Almost works,

    the command "/xp set name 1" it gives player 1 xp not sets it :(, is there a way to fix it ? or a command to clear player XP, like "/xp set name 0"

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  30. Offline

    Skye

    Sorry, I accidentally deleted a line of code and didn't notice because I have so many XP manipulation plugins running in my test environment. >.> I updated the download at the same link, it shouldn't do that anymore. :)
     
    nTiger likes this.

Share This Page