Custom Player Method???

Discussion in 'Plugin Development' started by TheUpdater, Sep 19, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    TheUpdater

    i want to be able to do for ex; p.GiveCookie(Cookie.SUPERBIG);

    p.GiveCookie();
    p.StandStill();


    how would i do this!
     
  2. Offline

    SmooshCakez

    Custom Bukkit build, or a class that extends Player, and use that. For the cookies, just use player.getInventory().addItem(ItemStack...);
     
  3. Offline

    mythbusterma

    TheUpdater

    You learn Java and understand why SmooshCakez 's idea is bad. Don't extend player, just create a class that accompanies a player and is linked to them by their UUID.
     
  4. Offline

    TheUpdater

    wel i found a way to do this ty for helping, you know how to make every leter lower caste besides the first one in a string?

    COOKIE

    then use code to get it to this

    Cookie
     
  5. Offline

    mrCookieSlime

    public static String format(String string) {
    return Character.toUpperCase(string.toLowerCase().charAt(0)) + string.toLowerCase().substring(1);
    }
     
  6. Offline

    TheUpdater

    dident work i got CCOOKIE

    EDIT i did it wrong but still get all uppercase its an enum class if it helps
     
  7. Offline

    mrCookieSlime

    TheUpdater
    Just use format(Material.COOKIE.toString());
    It should work...
     
  8. Offline

    SmooshCakez

    Having a class that extends Player isn't bad if all he's doing with the methods he adds is using existing Bukkit features, not changing anything that already exists.
     
  9. Offline

    mythbusterma

    SmooshCakez

    Assuming you don't create memory leaks all over the place.
     
  10. Offline

    xTrollxDudex

    If you know English, take the time to spell correctly, I can hardly read it. If it is not your native language, ignore this.

    Basically, split by first character and uppercase first letter, and then append the second split lowercased to the first letter uppercase.
     
  11. Offline

    ChipDev

    Extend player and make static methods, then you could use the player constructor in your method, like Player.giveCookie(enum cookie);
     
  12. Offline

    xTrollxDudex

    Did you even read OP?
     
  13. Offline

    ChipDev

  14. Offline

    xTrollxDudex

    p mean player instance, not random static method. That also will never work because you can't use the instance of the player in a static method...
     
Thread Status:
Not open for further replies.

Share This Page