HELP WITH XP!!!

Discussion in 'Plugin Development' started by wxwsk8er, Jan 19, 2014.

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

    wxwsk8er

    Ok so I am having some problems, I have googled and seached these forums to no end trying to find how to award all the players on a scroreboard team XP. I have gotten the scource code for the annihilation plugin and have made a sound addon to that but really need the XP part so please let me know if you don't mind. Thanks and like always any help would be awesome!! -wxwsk8er
     
  2. Offline

    Avery246813579

    Can you please put in the code that you already have. It helps me see what I need to do!
     
  3. Offline

    Niknea

    wxwsk8er I have never played on shotbow, so I have no clue what the "XP" thing is, mind taking a pic or explaining better?
     
  4. Offline

    wxwsk8er

    Ok @nikea. Basicly there are four teams, each with a diffirent color, Blue, Green, Red, and Yellow. When you join you goto a lobby and select your team. And when the match starts you are in your teams base. There is a block of end stone and when mined your team loses a life (teams start with 75 lives) and plays a sound. The team who the player who mined the endstone should recieve 2xp for every player. The last team out or out of life wins. (If you want to play the ip is: US.SHOTBOW.NET and look for the big A :) ).

    Avery246813579 there is so much code and spread through a ton of files so I cant post all of it on here.

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

    Garris0n

    Do you mean the XP bar or Shotbow's "XP" system which is a global currency used on their servers? Either way I'm not going to help you steal other people's custom gamemodes, but they're two very different things.
     
  6. Offline

    wxwsk8er

    garrison / Garris0n I am not trying to steal there gamemodes, there plugin just wasnt built right for my system, I am just trying to make a plugin for my server. And no I just mean XP in general.
     
  7. Offline

    Garris0n

    There are a few XP-related methods in Player, look here. As a tip for next time, google search your problems and look at the JavaDocs.

    Also, when you say you "got the source code" for an Annihilation plugin, what exactly do you mean?
     
  8. Offline

    wxwsk8er

    Well you can download the annihilation mini game plugin from bukkit then use a archiver to un-jar it, Simple just look in the .class files. Next I don't know how to use java docs. And I have been googling all day.
     
  9. Offline

    morshu9001

    Actually, you also have to decompile the class files. Java docs are pretty straightforward… you just search what you want and look at the methods. It's standard OOP.

    But here are the methods if you don't want to look through the Java docs: There's a Player.getLevel(), Player.setLevel(int x), Player.getExp(), Player.setExp(float x). You can use those.
     
  10. Offline

    Garris0n

    If you're referring to this plugin, its license is all rights reserved...
     
  11. Offline

    morshu9001

    He can't copy code, but is there anything preventing from looking at it and seeing which methods it calls? A genuine question because I don't actually know.
     
  12. Offline

    Garris0n

    He's trying to modify it and make his own version for his own use as far as I can see. I believe that goes against his license. He can look at it all he wants, though, as far as I know. I mean, there's nothing physical stopping him, but I don't believe a license can say "you can't decompile that". I don't know, ask a lawyer :p
     
  13. Offline

    wxwsk8er

    Yep as for copying the code I didn't really do that :) that . Instead of copying it I looked at how the basic structure of the annihilation game was coded such as: onNexusDestroy(), onNexusHurt(), onTeamJoin() .... And then coded my own version of these. Then searched these forums for getting and paying sound, setting up a scoreboard team, and just this one giving xp. Thanks for your @helpmorshu9001 and one more question to ya'll can you help me make items shoot snowballs? Hard time with that
     
  14. Offline

    Gater12

    wxwsk8er You can listen for PlayerInteractEvent, check if it's a right click, check if it's your item you want to shoot out snowballs, then spawn a snowball with velocity (Or I think it'll just drop to the ground).
     
  15. Offline

    wxwsk8er

    Sorry guys I have been out for a while.. anyway so would this code work?

    Code:java
    1. int playerXp = Player.getExp();
    2. int NewXp = playerXP + 2;
    3. setExp(NewXp);


    Ok so heres my snowball code but yet it doesn't work!! Can someone tell me what im doing wrong?

    Code:java
    1.  
    2. package net.wxwsk8er.guns;
    3. import org.bukkit.Material;
    4. import org.bukkit.event.EventHandler;
    5. import org.bukkit.event.block.Action;
    6. import org.bukkit.event.player.PlayerInteractEvent;
    7. import org.bukkit.entity.Snowball;
    8. import org.bukkit.inventory.ItemStack;
    9. import org.bukkit.inventory.meta.ItemMeta;
    10. import org.bukkit.plugin.java.JavaPlugin;
    11.  
    12. public final class Main extends JavaPlugin {
    13.  
    14.  
    15. @EventHandler
    16. public void onInteract(PlayerInteractEvent e)
    17. {
    18. ItemStack woodHoe = new ItemStack(Material.WOOD_HOE, 1);
    19. ItemMeta woodMeta = (ItemMeta) woodHoe.getItemMeta();
    20. if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK)
    21. {
    22. if(e.getPlayer().getItemInHand().getType() == Material.WOOD_HOE)
    23. {
    24.  
    25. e.getPlayer().launchProjectile(Snowball.class);
    26. return;
    27. }else{
    28. return;
    29. }
    30.  
    31. }
    32. }
    33. }
    34.  


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

    L33m4n123

  17. Offline

    wxwsk8er

    Ok @Leeman1234 one thing though I have read that and made my own plugin before but this one doesn't use commands. But are you saying I need to use them? Thanks for your help :)
     
  18. Offline

    L33m4n123

    wxwsk8er sorry was derping there for what ever reason.

    Wanted to say you need to register your event
     
  19. Offline

    wxwsk8er

    How do you do that?
     
  20. Offline

    L33m4n123

  21. Offline

    wxwsk8er

    Thanks!!
     
Thread Status:
Not open for further replies.

Share This Page