Message customization.

Discussion in 'CommandBook' started by Filly, Feb 5, 2016.

  1. Filly

    Filly New Member

    I'm really liking this plugin as an alternative to Essentials.
    There's just one thing that I've not found yet, how in the hell do I change the messages?
    If I can't change the messages, would someone be so kind as to change the messages to be grey instead of yellow and prefixed with [DARK_GREY][[WHITE][BOLD]ID[RESET][DARK_GREY]] [LIGHT_GREY] (or &8[&f&lID&8] &7)?
  2. wizjany

    wizjany Administrator Developer

    what messages are you talking about? like command feedback? or chat messages? what's "ID"?
  3. Filly

    Filly New Member

    ID stands for Irondale, and command feedback, i.e. Set gamemode to CREATIVE for Filly when /gm is typed.
  4. PseudoKnight

    PseudoKnight Well-Known Member

    Most of those messages are hard-coded. You'd need to edit the code and compile it.
  5. Filly

    Filly New Member

    I'd really appreciate it if someone could teach me how to, it seems this skill comes in handy a lot.
  6. PseudoKnight

    PseudoKnight Well-Known Member

    It does. Sometimes you need to just make a fix or modification. But in the case of CommandBook, it's no longer in active development by the original authors after Bukkit 1.7.10. You can see others making their own updates and modifications here:

    https://github.com/sk89q/CommandBook/network

    I'm not going to get into too many details here, but there are general steps I take when modifying a plugin. Some of this may not be fleshed out because it's been a while since I've set it all up.

    1. First it helps to have the tools. While it's large and intimidating, IntelliJ IDEA should have all the tools you need to import, edit, and compile a Maven project like CommandBook on GitHub. I personally use a separate tool for cloning, but IDEA should be able to do it too. Cloning requires a GitHub account. Also make sure you have the Java JDK installed.

    2. Since it's a Maven project (you can tell by the pom.xml file), you'll want to indicate that when you create the new project. You can select "New -> Project from Existing Sources" if you downloaded it, or "New -> Project from Version Control -> GitHub" to clone it directly. As long as you indicated that it's a Maven project, you can probably use the defaults for the rest of the importing. I changed my defaults, so I can't remember.

    3. Since you're editing messages, you can do a quick search to find the files you want in the Project. Hit Ctrl+Shift+F to search the "Whole project" for something like "You've been teleported" to find the message you want to edit. Make your changes.

    4. To compile the project, click the "Terminal" button below and type "mvn clean package". This will result in a jar inside a folder in the project directory, often something like "/CommandBook/target/commandbook-2.5-SNAPSHOT.jar". However, it might just fail to compile due to some other issue like a failed dependency. In the case of CommandBook, you need to update the repository/dependency information for Bukkit (and others?) in the pom.xml. One solution is to go with Spigot info.

    Instead of:
    Code (Text):

        <repository>
          <id>bukkit-repo</id>
          <url>http://repo.bukkit.org/content/groups/public/</url>
        </repository>

        <dependency>
          <groupId>org.bukkit</groupId>
          <artifactId>bukkit</artifactId>
          <version>1.7.10-R0.1-SNAPSHOT</version>
          <scope>compile</scope>
          <type>jar</type>
        </dependency>
     
    Go with:
    Code (Text):

            <repository>
                <id>spigot-repo</id>
                <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
            </repository>

            <dependency>
                <groupId>org.spigotmc</groupId>
                <artifactId>spigot-api</artifactId>
                <version>1.8.8-R0.1-SNAPSHOT</version>
            </dependency>
     
    Hopefully some of that pointed you in the right direction.
  7. Filly

    Filly New Member

    Thanks! I'll try it out.