Jump to content

Strings in the config files


Laike_Endaril

Recommended Posts

I just added a String in my config file handler class alongside all my booleans, ints, etc. and it isn't posting to the newly created config file.  Are strings not supported?  And if they're not, is the best way to go about this a separate file handled by my own file handler, or is there a little trick I can use to get a string working here?

 

Config handler class:

Spoiler

import net.minecraftforge.common.config.Config;

@Config(modid = CombatTagged.MODID)
public class CombatTagConfig {
    @Config.Comment({
            "",
            "NOTICE: All configuration options are for the SERVER.  On the client, none of these will have any effect",
            "",
            "",
            "",
            "How long a player is considered to be 'in combat' after taking damage from, or dealing damage to, another player (in seconds)",
            "If they disconnect before this amount of time has passed, they die",
            ""
    })
    public static int cooldown = 10;

    @Config.Comment({
            "",
            "",
            "If set to true, sends players messages telling them when then enter and leave combat",
            "I very highly suggest leaving this set to true",
            ""
    })
    public static boolean showMessages = true;

    @Config.Comment({
            "",
            "",
            "If set to true, players who are killed by this mod look like they're hit by lightning (the lightning itself doesn't actually deal any damage)",
            "Why would you ever disable this?",
            ""
    })
    public static boolean zeusWasHere = true;

    @Config.Comment({
            "",
            "",
            "Sets the death message! %s is a tag that is replaced by the name of the killed player",
            ""
    })
    public static String deathMessage = "%s was smote for their cowardice!";
}

 

 

Actual config file, after being deleted and recreated:

Spoiler

# Configuration file

general {
    # 
    # NOTICE: All configuration options are for the SERVER.  On the client, none of these will have any effect
    # 
    # 
    # 
    # How long a player is considered to be 'in combat' after taking damage from, or dealing damage to, another player (in seconds)
    # If they disconnect before this amount of time has passed, they die
    # 
    I:cooldown=10

    # 
    # 
    # Sets the death message! %s is a tag that is replaced by the name of the killed player
    # 
    S:deathMessage=%s was smote for their cowardice!

    # 
    # 
    # If set to true, sends players messages telling them when then enter and leave combat
    # I very highly suggest leaving this set to true
    # 
    B:showMessages=true

    # 
    # 
    # If set to true, players who are killed by this mod look like they're hit by lightning (the lightning itself doesn't actually deal any damage)
    # Why would you ever disable this?
    # 
    B:zeusWasHere=true
}


 

 

Link to comment
Share on other sites

 

1 minute ago, V0idWa1k3r said:

Are you sure? What's this line then?

Oh dear God lol...I forgot that the entries in the config file are ordered alphabetically and not in the same order you put them in (in the java class).  Which annoys me to no end, btw...

Thanks again Voidwalker.  I feel pretty dumb right about now lol

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.