[Lib] ImageMessage (v2.1)- Send images to players via the chat!

Discussion in 'Resources' started by bobacadodl, Dec 10, 2013.

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

    gomeow

    Such images. Very wow.
     
    Jamboozlez, DogeDev, DSH105 and 2 others like this.
  2. Offline

    DrJava

  3. Offline

    DevRosemberg

    bobacadodl
    im getting a java.io.IOException on this line:

    Code:java
    1. ImageIO.read(this.getResource("creepermap.png"))
     
  4. Offline

    bobacadodl

    Probably because that resource doesn't exist in your plugin.
     
  5. Offline

    DevRosemberg

    bobacadodl What do you mean it dosent excist?

    C:\Users\Dev\IdeaProjects\MinereachCore\src\main\resources\creepermap.png
     
  6. Offline

    ArthurMaker

    I did it with your code:
    Code:java
    1. @EventHandler
    2. public void onJoin(PlayerJoinEvent event) {
    3. int onlinePlayers = (Bukkit.getOnlinePlayers().length)-1;
    4. try{
    5. URL playerHead = new URL("[url]https://minotar.net/avatar/[/url]" + event.getPlayer().getName() + "/128");
    6. if(onlinePlayers <= 1){
    7. ImgMessage.imgMessage(event.getPlayer(), ImageIO.read(playerHead), 10, ImgMessage.ImgChar.DARK_SHADE.getChar(), false,
    8. "","","","Welcome," + ChatColor.GOLD + event.getPlayer().getName() + "!","There is " + onlinePlayers + " player online.");
    9. }else{
    10. ImgMessage.imgMessage(event.getPlayer(), ImageIO.read(playerHead), 10, ImgMessage.ImgChar.DARK_SHADE.getChar(), false,
    11. "","","","Welcome," + ChatColor.GOLD + event.getPlayer().getName() + "!","There are " + onlinePlayers + " players online.");
    12. }
    13. }catch (Exception e){
    14. e.printStackTrace();
    15. }
    16. }
     
  7. Offline

    gomeow

    What does your pom.xml look like?
     
  8. Offline

    Skyost

  9. Offline

    DevRosemberg

    Skyost Where should it be located then in Maven? Ive located it in Resources but idk where it has to be.
     
  10. Offline

    Goblom

    DevRosemberg
    if your file exists there then compile the plugin, once plugin compiled open it with a zip file viewer and see if that image still exists (It should be on the top level). If it does then you need to save that file. Then getResourcse() should work.
     
  11. Offline

    DevRosemberg

    Goblom So i compile it and then use it again? I didnt understand the last part: If it does then you need to save that file.
     
  12. Offline

    Goblom

    DevRosemberg I dont have my comp with me right now but what i means was something along the lines of "saveResource()"
     
  13. Offline

    Ba7marker

    Works well with some images as you said and bad with others The Mushroom Cow turned out decently well. If anyone is interested in mob/block heads check out http://minecraft.gamepedia.com/Mob_head[​IMG]
     
  14. Offline

    DevRosemberg

  15. Offline

    ArthurMaker


    Really? It worked well here! :confused:
    Remember that the code is for a Listener '-'
     
  16. Offline

    DevRosemberg

    ArthurMaker It actually should be without the URL tags and with /128.png
     
  17. Offline

    bobacadodl

    The URL tags were only there because of a bug with bukkit forums. If you paste any URL it automatically gets URL tags around it.
     
  18. Offline

    codename_B

    Dat left eye tho
     
  19. Offline

    BungeeTheCookie

    I thought it was beautiful.
     
    Jamboozlez and bobacadodl like this.
  20. Offline

    Ba7marker

    Leave the poor cow alone! Meh anyway you can tell what it is..
     
    Jamboozlez likes this.
  21. Offline

    bobacadodl

    Probably because he set the image to 10x10, when the original image is 32x32 :p If you set it to 8x8, it should turn out fine.
     
    Jamboozlez, Skyost and codename_B like this.
  22. Offline

    krists23

    Unhandled exception type IOException
    Code:
    ImgMessage.imgMessage(
    e.getPlayer(),    //The player
    ImageIO.read(this.getResource("test.png")), //error on this line
    10,    //the height of the image (maximum is 10)
    ImgMessage.ImgChar.MEDIUM_SHADE.getChar(),    //The character the image is made out of: BLOCK, DARK_SHADE, MEDIUM_SHADE, or LIGHT_SHADE
    "Thatssss a","nicceeee house","you've got there");    //the text to append to the image
    
     
  23. Offline

    bobacadodl

    krists23
    That probably means that the resource "test.png" doesn't exist
     
    Skyost likes this.
  24. Offline

    krists23

    bobacadodl I need to put it in new folder called recourses, or just drag and drop it to the project in eclipse?
     
  25. Offline

    rbrick

    Awesome man! Amazing work i may implement this on my server!
     
  26. Offline

    codename_B

  27. Offline

    hawkfalcon

  28. Offline

    Garris0n

    hawkfalcon likes this.
  29. Offline

    bobacadodl

    codename_B
    Nice! Do I have permission to update this library with this?
     
    Skyost likes this.
  30. Offline

    codename_B

    Absolutely :)

    Just replace the color conversion code to this one! :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
Thread Status:
Not open for further replies.

Share This Page