[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. Such images. Very wow.
     
    Jamboozlez, DogeDev, DSH105 and 2 others like this.
  2. Offline

    DrJava

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

    Code:java
    1. ImageIO.read(this.getResource("creepermap.png"))
     
  4. Probably because that resource doesn't exist in your plugin.
     
  5. bobacadodl What do you mean it dosent excist?

    C:\Users\Dev\IdeaProjects\MinereachCore\src\main\resources\creepermap.png
     
  6. 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. What does your pom.xml look like?
     
  8. Skyost Where should it be located then in Maven? Ive located it in Resources but idk where it has to be.
     
  9. 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.
     
  10. 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.
     
  11. DevRosemberg I dont have my comp with me right now but what i means was something along the lines of "saveResource()"
     
  12. 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]
     

  13. Really? It worked well here! :confused:
    Remember that the code is for a Listener '-'
     
  14. ArthurMaker It actually should be without the URL tags and with /128.png
     
  15. 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.
     
  16. Dat left eye tho
     
  17. Offline

    BungeeTheCookie

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

    Ba7marker

    Leave the poor cow alone! Meh anyway you can tell what it is..
     
    Jamboozlez likes this.
  19. 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.
  20. 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
    
     
  21. krists23
    That probably means that the resource "test.png" doesn't exist
     
    Skyost likes this.
  22. bobacadodl I need to put it in new folder called recourses, or just drag and drop it to the project in eclipse?
     
  23. Awesome man! Amazing work i may implement this on my server!
     
  24. hawkfalcon likes this.
  25. codename_B
    Nice! Do I have permission to update this library with this?
     
    Skyost likes this.
  26. 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