Setting up Fanciful w/ Maven

Discussion in 'Spigot Plugin Development' started by Kozs, May 22, 2016.

  1. Having issues trying to adjust the pom.xml file.

    <repository>
    <id>stealthyone-repo</id>
    <url>http://repo.stealthyone.com/content/groups/public</url>
    </repository>

    <dependency>
    <groupId>mkremins</groupId>
    <artifactId>fanciful</artifactId>
    <version>0.3.3-SNAPSHOT</version>
    </dependency>

    Is what I need to add to my pom.xml file.

    When I try to add, it gives errors but won't give me any direciton to what the error is... Maven..

    [​IMG]

    Never used Maven before, would love to learn how to properly utilize this tool!

    Thanks a lot
    - Kozs
     
  2. I am a gradle fan but I think that you need to put all of your <repository> tags inside a <repositories> tag.
    HTML:
    <repositories>
        <repository>
            [...]
        </repository>
        <repository>
            [...]
        </repository>
    </repositories>
    Pretty sure its the same for dependencies as well. Like how you have it setup for <plugins> and <resources>.

    Also there is the ChatComponent API that you can use instead of fanciful which is shipped with spigot so that you can actually drop that extra dependency. https://www.spigotmc.org/wiki/the-chat-component-api/. You just need to build against the jar that you build with build tools rather than the api. :)
     
  3. I recommend you to use the Chat Component API instead of Fanciful, it is available in both bungeecord and spigot.
    You see more info at https://www.spigotmc.org/wiki/the-chat-component-api/
    To send a component in BungeeCord
    Code (Text):
    ProxiedPlayer#sendMessage(BaseComponent[])
    To send a component in Spigot
    Code (Text):
    Player#spigot().sendMessage(BaseComponent[])
     
  4. Tried using that and it appears to not work for me, I copied and pasted the code they had just to test it would work and it's just a bunch of object info printed out in the sendMessage
     
  5. You have to use p.spigot().sendMessage()
     
  6. Worked! But for some reason I get this after the hello world

    [​IMG]
     
  7. Code (Text):
    Player player = Bukkit.getPlayer("MrJaime");

    TextComponent message = new TextComponent( "Hello world" );
    message.setColor( ChatColor.RED );
    message.setBold( true );

    player.spigot().sendMessage(message);
     
    • Agree Agree x 1
  8. Thanks!
     
    #8 Kozs, May 23, 2016
    Last edited: May 23, 2016