Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Exp-Bar

Comments in 'Plugin Development' started by CraftYourBukkit, Sep 26, 2015.

  1. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Is there a way I can set the XP/Level of a player?
    Muqsit likes this.
  2. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    Yes add new data packet but i don't know where can you find packet ID
  3. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Not yet, I think. I believe this hasn't been implemented into PocketMine yet. Feel free to correct me if I'm wrong.
  4. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    PHP:
        public static function calculateLevelInfo($xp) {

            if (
    $xp instanceof Player){
                
    $xp self::getXP($xp);
            }
         
            
    $level = ($xpneededforlevel 0);
            
    $remainingxp $xp;

            while (
    true) {
                if (
    $level >= 30) {
                    
    $xpneededforlevel 62 + ($level 30) * 7;
                } elseif (
    $level >= 15) {
                    
    $xpneededforlevel 17 + ($level 15) * 3;
                } else {
                    
    $xpneededforlevel 17;
                }

                if (
    $xpneededforlevel $remainingxp) {
                    break;
                } else {
                    
    $level++;
                    
    $remainingxp $remainingxp $xpneededforlevel;
                }
            }

            return array(
                
    "level" => $level,
                
    "remainingxp" => $remainingxp,
                
    "xpnextlevel" => $xpneededforlevel,
            );
    @ Source Tschrok

    way to create a way of levels
    Minecrafter9203 likes this.
  5. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    You used the code from @tschrock. At least give him credit... :p
  6. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    ah xD it can be dragged from one year on my keyboard.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    That doesn't do anything to the client.
    CraftYourBukkit and Creeperface like this.
  8. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    So how can we find out info about packet?
    CraftYourBukkit likes this.
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Decompile libminecraftpe.so in the MCPE APK file and read the contents yourself. You can try using PocketBurger https://github.com/PocketMine/PocketBurger although it may be outdated.

Share This Page

Advertisement