Help

Discussion in 'Spigot Plugin Development' started by justin2001, Jun 27, 2015.

  1. I havea question: If I want to give a player a spam point or a swear point, how should I code to let eclipse know that this is a point? How do I add a player spam or swear points? How do I let eclipse know that player can only type use spam and swear point e.g. (/pointsadd player spam/swear) and dont allow other points type, e.g. (/pointsadd player sbshwbs)? And how can I give a player a spam or swear points with that command in eclipse(The spam and swear point have different function.)?
    Is it:
    Code (Text):
    if (cmd.getName().equalsIgnoreCase("pointsadd")) {

    Player target = Bukkit.getServer().getPlayer(args[0]);

      if (args[1] != spam) {
        sender.sendMessage(args[1]+" is not a point type!");
      }

      if (args[1] != swear) {
        sender.sendMessage(args[1]+" is not a point type!");
      }
      target.get(args[1]);
    }
    Is this code correct?
     
  2. check if they type (spam or swear "if not return false;") and that cancels the command excecution of the command and maybe provide then the good types in a row

    but it should work

    ant maybe change the != to args[1].equals("spam/swear")

    and the check will be probbly like
    Code (Text):
    if(!args[1].equals("spam") && !args[1].equals("swear")){//do what ever you want to tell then}
     
  3. Thanks. But can you explain more clearer so that I can understand? And please rewrite all my code. Thank you very much!
     
  4. Code (Text):
    if (cmd.getName().equalsIgnoreCase("pointsadd")) {

    Player target = Bukkit.getServer().getPlayer(args[0]);
      if(!args[1].equals("spam") && !args[1].equals("swear")){
          //do what ever you want to tell then or do
    }
      if (args[1] != spam) {
        sender.sendMessage(args[1]+" is not a point type!");
        //check if player is in swear
        //if true remove them from there and add them in this array
        //if false just add them
        //add then to  a list so you know where there need to or even a config and add them there incase you server crashes
        // and tp them to the place and maybe add the location in the config so you change it on the fly
      }

      if (args[1] != swear) {
        sender.sendMessage(args[1]+" is not a point type!");
        //check if player is in spam
        //if true remove them from there and add them in this array
        //if false just add them
        // and tp them to the place and maybe add the location in the config so you change it on the fly
      }
      target.get(args[1]);
    }
     
  5. Thanks. But why did you double the code?

    if(!args[1].equals("spam") && !args[1].equals("swear")){
    //do what ever you want to tell then or do
    }
    if (args[1] != spam) {
    sender.sendMessage(args[1]+" is not a point type!");
    //check if player is in swear
    //if true remove them from there and add them in this array
    //if false just add them
    //add then to a list so you know where there need to or even a config and add them there incase you server crashes
    // and tp them to the place and maybe add the location in the config so you change it on the fly
    }

    if (args[1] != swear) {
    sender.sendMessage(args[1]+" is not a point type!");
    //check if player is in spam
    //if true remove them from there and add them in this array
    //if false just add them
    // and tp them to the place and maybe add the location in the config so you change it on the fly
    }
    target.get(args[1]);
    }

    And how do I let eclipse know that this a point?
     
  6. with a location
     
  7. take a loot at what jailers do its the type of thing you want to do maybe you can get some inspiration from it
     
  8. I have pm you in spigot. Please help me by pm. Thanks a lot!
     
  9. Code (Text):
    if (cmd.getName().equalsIgnoreCase("pointsadd")) {

    Player target = Bukkit.getServer().getPlayer(args[0]);

      if (args.length != 2) {
        sender.sendMessage("Strange arguments, try typing /pointsadd (player) (type of point).");
      }

      if(!args[1].equals.IgnoreCase("spam") && )!args[1].equals.IgnoreCase("swear")) {
        sender.sendMessage(args[1]+" is not a point type!");
      }

      target.get(args[1]);
    }
    Someone please tell me if the console or a staff do /pointsadd Notch spam, will this plugin gives a spam point to Notch? Will the console know that is a spam point?
     
  10. nope
    because you never store it somewhere so its not remember it later
     
  11. You need a way of storing the points. To do this if it is just a spam and point system built in one you can use a hashtag with the key as the uuid and the key as a integer. Although if the points are different you will need to create a object which will hold the uuid the f each player and the score.
     
  12. Can you write out the code? Thanks!
     
  13. it's a help forum not a make me my plugin forum
     
  14. I know, i just want help on sone code that i dont know. How do i store the points in the config. How do i code it so if the player gets 3 spam point, he will be temp banned for 1 day and 3 swear point he will be temp muted for 2 hours? And how do i code it so if the console runs this pointsadd command, he will get a spam or swear points and it will countdown 20 minutes to reset the spam or swear points to 0. If the console runs that command again, the countdown will start all over again to 20 minutes.
     
  15. You are one of the worst kind of person... You know that right?
    "please rewrite all my code."
    "Can you write out the code? Thanks!"
    Really?

    This is a place where you ask questions for parts you can't figure out, so we can help you and assist you.
    You aren't asking for assistance, you are just asking us to do all the work.

    Start going through these tutorials, get some practice and if you still need help AFTER those tutorials, I will be glad to help you.
    http://docs.oracle.com/javase/tutorial/
    http://wiki.bukkit.org/Plugin_Tutorial

    Until that time. I wouldn't expect for a lot of help on here (from me at least)
     
    • Agree Agree x 3
  16. I know what you are trying to say but I have read through that:
    http://docs.oracle.com/javase/tutorial/
    http://wiki.bukkit.org/Plugin_Tutorial
    But i still dont know how to create a point system. I cant figure out and i just need a little assist to creating point system. Just do me a small favour: How do i let eclipse know that
    Code (Text):
    if (cmd.getName().equalsIgnoreCase("pointsadd")) {

    Player target = Bukkit.getServer().getPlayer(args[0]);

      if (args.length != 2) {
        sender.sendMessage("Strange arguments, try typing /pointsadd (player) (type of point).");
      }

      if(!args[1].equals.IgnoreCase("spam") && (!args[1].equals.IgnoreCase("swear")) {
        sender.sendMessage(args[1]+" is not a point type!");
      }

      target.get(args[1]);
    }
    spam and swear is a point?
     
  17. If you have read the tutorials you would've known.
     
    • Agree Agree x 1
  18. Can you just help me once? Ill be very appreciated.
     
  19. Helping you at this point would not help you.
    You see helping as me giving you the code. I see helping as ASSISTING someone, giving them the information to figure it out ON THEIR OWN.
    But just this little sentence "How do i let eclipse know that" gives me enough reasons to think that you just started creating plugins, can't figure something out and just ask us to feed you the code.

    There is at this point no information I can give you to ASSIST you so you can figure it out ON YOUR OWN.
     
    • Agree Agree x 4
  20. I already learn some from tutorials but i need help on some code. If you cant help me, then please dont post here.