[URGENT]Have a message be sent to an admin

Discussion in 'Plugin Development' started by XgXXSnipz, Oct 12, 2014.

Thread Status:
Not open for further replies.
  1. pookeythekid and mrCookieSlime like this.
  2. Offline

    mythbusterma

    mrCookieSlime, FerusGrim and AdamQpzm like this.
  3. Offline

    XgXXSnipz

    Bukkit sucks, AdamQpzm im sorry :/ but u guys think ur too good for everyone else, lol I have trouble with one thing and Im told to go learn java -.- so I guess this forum ISNT for helping people got it...
     
  4. Offline

    mrCookieSlime

    In other Threads I have seen you being hostile against people just because they don't know Java.
    And then you tried to treat an integer like an array...

    PS: Tutorials are for helping people. if someone points you to a tutorial you cannot say that he hasn't tried to help you.
    And we are all just trying to help you, if you don't want help then just don't ask for help.
     
    pookeythekid, Skionz and AdamQpzm like this.
  5. Offline

    fireblast709

    They aren't too good for everyone, they simply know what they are talking about. Also when you are told you should learn Java, that means that you simply do not fully grasped the language yet. Most of the time this isn't posted without a good reason (like treating array lengths like arrays)
     
  6. Offline

    XgXXSnipz

    fireblast709 mrCookieSlime mythbusterma AdamQpzm drpk pookeythekid ALRIGHT fine screw this, you want me to learn java, how!?! I dont think me watching all of buckys tutorials(thenewboston) will magically teach me, "I need to make a plugin on getting a players info, I think I remember a tutorial from bucky on this..." -.- no.. how do I "learn java" whats the best way?
     
  7. Offline

    FerusGrim

    https://forums.bukkit.org/threads/best-way-to-learn-how-to-make-plugins.316875/


    Literally on the first page of this forum. How old are you?
     
  8. Offline

    XgXXSnipz

  9. Offline

    FerusGrim

    I decided I wanted to learn, I went to the library, I picked up a few books on Java, and I studied. For weeks. Months.

    Then, I practiced. I practiced. And I practiced.

    How does anyone learn?
     
    pookeythekid likes this.
  10. Offline

    XgXXSnipz

    FerusGrim -.- WOW bro that phrase "how does anyone learn" indicates sarcasm -.- I just wanted to know ur method, was it books, was it internet, jeez
     
  11. Offline

    fireblast709

    It will teach you how to use the language. One does not make plugins thinking about how a second person made it, that way we wouldn't have any plugins we have now. To reuse your example: You would start on getting the Player, and then get the property you want. How do I get the player? There is http://jd.bukkit.org. Is it more advanced? Take a look at the mc-dev repo (which is still public) or check out http://wiki.vg/protocol for the protocol. Once you know that, you use Java to actually write (as in, not copy paste) the code (which is most likely not covered in tutorials, unless you stick to basic stuff).
     
  12. Offline

    FerusGrim

    Sorry, I have a nasty predisposition towards people who learn a few things, and instantly get a superior attitude towards everyone, even in the face of their own ignorance.
     
    AdamQpzm likes this.
  13. Offline

    XgXXSnipz

    fireblast709 k I guess ill be off, Ill resume to bukkit in a few months to check up
     
  14. Offline

    JoeDevelopment

    Checking and sending messages to players with OP:
    Code:java
    1. for(int i=0;i<Bukkit.getServer().getOnlinePlayers().toArray().length;i++) {
    2. if(((Player)Bukkit.getServer().getOnlinePlayers.toArray()).isOp()) {
    3. ((Player)Bukkit.getServer().getOnlinePlayers.toArray()).sendMessage("Message to be sent.");
    4. }
    5. }

    Or, checking for a specific permission and sending a message to the players that have the permission:
    Code:java
    1. for(int i=0;i<Bukkit.getServer().getOnlinePlayers().toArray().length;i++) {
    2. if(((Player)Bukkit.getServer().getOnlinePlayers.toArray()).hasPermission("randomplugin.permission")) {
    3. ((Player)Bukkit.getServer().getOnlinePlayers.toArray()).sendMessage("Message to be sent.");
    4. }
    5. }
     
  15. Offline

    FerusGrim

    JoeDevelopment

    Why not just:

    Code:java
    1. for (Player player : getServer().getOnlinePlayers()) {
    2. if (player.hasPermission("permission") {
    3. player.sendMessage("message");
    4. }
    5. }
     
    Walruski likes this.
  16. Offline

    XgXXSnipz

  17. Offline

    JoeDevelopment

    Bukkit uses a collection object instead of the regular Player array. The latest Bukkit API has changed some things around.
     
  18. Offline

    FerusGrim

  19. Offline

    XgXXSnipz

    FerusGrim indeed I have a whole back of em
     
  20. Offline

    FerusGrim

    Cool. We're a bit off-topic, tho. Any reason for bringing it up? :)
     
  21. Offline

    XgXXSnipz

    FerusGrim Nah, just trying to make myself feel better after all the rant
     
  22. Offline

    FerusGrim

  23. Offline

    mythbusterma

  24. Offline

    pookeythekid

    XgXXSnipz Please don't take anything I say here as sarcasm: As far as I can tell, we are trying to help out. Knowing how to get the length of an array is indeed basic Java, but until now you may not have known that. But now you do, so that's one more thing about Java that you know; one step higher up the ladder of learning the language. Just keep coding, keep practicing, and eventually you'll be the one offering help to people who are just learning Java.

    JoeDevelopment FerusGrim This works too.
    Code:java
    1. Bukkit.broadcastMessage("Message! :D", "plugin.permission");
     
  25. Offline

    fireblast709

    You can use a foreach loop on Collections as well ;3
     
    AdamQpzm and FerusGrim like this.
  26. Offline

    XgXXSnipz

    pookeythekid FerusGrim JoeDevelopment fireblast709 Good bye bukkit, Ill be back later in life, im off to expand my little knowledge on java

    fireblast709 ok so my code actually works, just one weird thing, when it says the reason it also includes the user who was reported, like /report CreeperSwagg34 test; it would output you reported CreeperSwagg34 Reason: CreeperSwagg34test, thats not what I want, I just want the "test" part code:
    Code:java
    1.  
    2. StringBuilder message = new StringBuilder("");
    3. for (String part : args) {
    4. if (!message.toString().equals(""))
    5. message.append("");
    6. message.append(part);
    7. }
    8.  


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

    fireblast709

    XgXXSnipz use a regular for loop, and start at index 1 instead of 0.
     
    FerusGrim likes this.
  28. Offline

    XgXXSnipz

  29. Offline

    Walruski

    I'd really recommend learning more on Java and Bukkit as a whole before continuing with this project. It seems from the comments you don't really understand a lot of the things which other people are saying and if you want to learn something, you shouldn't ask to be "spoon fed".
     
    FerusGrim likes this.
  30. XgXXSnipz Well that "leaving" lasted a good 10 minutes. 0.o

    Aside from that, why exactly are you appending nothing? What does the line message.append("") do? Also, if it "still doesn't work", try posting what you currently have. :)
     
    FerusGrim likes this.
Thread Status:
Not open for further replies.

Share This Page