= fixed UTF_8 formatting issue for config output

This commit is contained in:
Matthew Cech
2019-06-23 01:58:35 -07:00
parent da699281e9
commit 227bf29b10
3 changed files with 392 additions and 92 deletions
+378 -85
View File
@@ -1,66 +1,3 @@
[[Command Management]]
[CommandEnabler]
beans=1
benchmark, bench=1
bet=1
bethistory=1
blur=1
boop=1
buildhelp=1
c++, g++, cplus, cpp=1
catch=1
charactercreate=1
charactereditbio=1
charactereditname=1
characterediturl=1
choose=1
color, colour=1
crouton=1
dbflush=1
dbstats=1
eightball, 8ball=1
fetch=1
givebeans=1
guildroleadd=1
guildroleallowed=1
guildrolelist=1
guildrolenotallowed=1
guildroleremove=1
help=1
indicator=1
info, about=1
invite=1
java, jdoodle=1
leaderboard=1
map=1
perish, thenperish=1
ping=1
poll=1
raffleend=1
rafflejoin=1
rafflespin=1
rafflestart=1
rating=1
results=1
role=1
roll=1
rpend=1
rpg=1
rpstart=1
searchcharacter=1
showpoll=1
shutdown=1
stats=1
teey=1
tony, stark, dontfeelgood, dontfeelsogood=1
tweet=1
vote=1
wolfram=1
work=1
yeet=1
[[Localized Commands]]
[ObjectBuilderFactory]
indicator=
@@ -124,6 +61,8 @@ invite=
[[Localized Strings]]
[CommandBenchmark]
BenchmarkInfo=Allows you to lookup PC component benchmarks from UserBenchmark! You can use `bench find <name-snippet>` to see what's in the database, `bench info <name-snippet>` to look at a specific component, or the experimental `bench compare` commands!
@@ -138,8 +77,8 @@ GuildRoleNotAllowedSuccess=
GuildRoleNotAllowedInfo=
[CommandBetHistory]
BetHistoryOutput=Kitty has %s beans!
BetHistoryInfo=Sees the amount of beans Kitty has earned through your bets!
BetHistoryOutput=Kitty has %s beans!
BetHistoryInfo=Sees the amount of beans Kitty has earned through your bets!
[CommandCatch]
CatchInfo=Play catch with yourself or with a friend with @!
@@ -149,9 +88,9 @@ LeaderboardInfo=Shows you the 10 users with the most beans on the server
LeaderboardTitle=Server Leaderboard
[CommandGuildRoleList]
GuildRoleListOutput=The allowed roles are %s!
GuildRoleListEmpty=There are no roles allowed!
GuildRoleListInfo=Outputs a list of the roles you are allowed to add to yourself!
GuildRoleListOutput=The allowed roles are %s!
GuildRoleListEmpty=There are no roles allowed!
GuildRoleListInfo=Outputs a list of the roles you are allowed to add to yourself!
[CommandRoll]
RollError=Didn't work ;3;
@@ -159,8 +98,8 @@ RollInfo=Based on input of xdy where x is number of dice and y is faces kitty wi
[CommandGuildRoleAllowed]
GuildRoleAllowedInfo=
GuildRoleAllowedSuccess=Added %s to the allowed roles!
GuildRoleAllowedDuplicate=Can't add the same role twice!
GuildRoleAllowedSuccess=Added %s to the allowed roles!
GuildRoleAllowedDuplicate=Can't add the same role twice!
[CommandStats]
StatsInfo=Displays the actively running KittyBot application information
@@ -187,11 +126,11 @@ PerishInfo=Adds a red, 'a n g e r y' overlay to your icon or the icon of a frien
[CommandTradeBeans]
TradeBeanseStealingBeans=Stealing is wrong! *Steals 10 beans from %s*
TradeBeansNoTargetError=You have to give *someone* your beans!
TradeBeansSuccess=%s gave %s %s of their beans!
TradeBeansSuccess=%s gave %s %s of their beans!
TradeBeansStealingBeans=
TradeBeansInfo=Gives another person some of your beans! Use is `tradebeans amount @person`!
TradeBeansIntParseError=That's not a real number!
TradeBeansNotEnoughError=You don't have enough beans!
TradeBeansIntParseError=That's not a real number!
TradeBeansNotEnoughError=You don't have enough beans!
[CommandPollVote]
PollVoteNotValidNumber=That's not a vaild number!
@@ -209,7 +148,7 @@ ShutdownInfo=Stops kitty. `-s` or `safe` as an argument attempts to sync off the
[CommandRaffleSpin]
RaffleSpinInfo=
RaffleSpinSuccess=The winner issssssss %s!
RaffleSpinFailure=I can't choose a winner D:
RaffleSpinFailure=I can't choose a winner D:
[CommandRaffleEnd]
RaffleEndSuccess=
@@ -218,7 +157,7 @@ RaffleEndFailure=I don't think there's one going!
[CommandCharacterSearch]
CharacterSearchNoCharacterFound=Couldn't find a character with that name or ID!
CharacterSearchMultipleCharacterHeader=I found a couple characters with that name, use `charactersearch UniqueID` with their Unique ID to find them!
CharacterSearchMultipleCharacterHeader=I found a couple characters with that name, use `charactersearch UniqueID` with their Unique ID to find them!
CharacterSearchMultipleCharacter=%s is owned by %s. Unique ID is `%s`
CharacterSearchOneCharacter=I found one character with that name! \n Owner: %s | Name: %s | Bio: %s | Ref: <%s> | Unique ID: `%s`
CharacterSearchInfo=Find a character with their name or Unique ID! `charactersearch name` or `charactersearch UniqueID`
@@ -273,11 +212,11 @@ RPGInfo=Admin+ command only right now - experimental text RPG! Format is !rpg <r
RPGInvalid=Invalid RPG Command!
[CommandFetch]
FetchError=That no picture!
FetchError=That no picture!
FetchEat=Me eat now *monch %s*
FetchInfo=Throw a custom emote and me bring it back!
FetchInfo=Throw a custom emote and me bring it back!
FetchCatchRun=*Catches and runs away with %s*
FetchRunAway=*Runs away and doesn't return for a long time*
FetchRunAway=*Runs away and doesn't return for a long time*
FetchBringBack=Me gots it! %s
FetchBringBackWrong=Me gots it! %s
FetchStare=*Stares at %s*
@@ -288,7 +227,7 @@ InfoInfo=Provides author info and a link to Kitty's website
[CommandGuildRoleRemove]
GuildRoleRemoveNotAllowed=You're not allowed to add %s
GuildRoleRemoveFailure=Couldn't remove %s from %s
GuildRoleRemoveFailure=Couldn't remove %s from %s
GuildRoleRemoveSuccess=Removed %s from %s!
GuildRoleRemoveInfo=Removes the role specified!
@@ -307,11 +246,11 @@ MapHeight=Height
[CommandBeansShow]
BeansShowDisplay=You have %s beans!
BeansShowMentioned=I looked it up and %sbeans!
BeansShowMentioned=I looked it up and %sbeans!
BeansShowInfo=Displays how many beans you have
[CommandRaffleStart]
RaffleStartSuccess=Started a raffle with an entrance fee of %s beans!
RaffleStartSuccess=Started a raffle with an entrance fee of %s beans!
RaffleStartFailure=There's already a raffle going!
RaffleStart=
RaffleStartInfo=
@@ -335,7 +274,7 @@ TweetError=Tweet command failed!
GuildRoleAddSuccess=Added %s to %s
GuildRoleAddFailure=Failed to add %s to %s
GuildRoleAddNotAllowed=You are not allowed to add %s!
GuildRoleAddInfo=Add a role to yourself!
GuildRoleAddInfo=Add a role to yourself!
[CommandCharacterEditName]
CharacterEditNameInfo=
@@ -360,8 +299,8 @@ CroutonInfo=Crouton
[CommandCharacterCreate]
CharacterCreateDuplicate=You can't create a character with the same name!
CharacterCreateInfo=Create a character for kitty to hold onto for you! `createcharacter name, shortbio, refURL`
CharacterCreateSuccess=You successfully created a character!
CharacterCreateNullInfo=There's not enough info!
CharacterCreateSuccess=You successfully created a character!
CharacterCreateNullInfo=There's not enough info!
[CommandTeey]
TeeyInfo=Teey yourself back into existance, or teey a friend with @!
@@ -380,7 +319,7 @@ PollResultsInfo=Will show current results of a poll and percentages of votes per
[CommandRPEnd]
RPEndError=You can't end this RP!
RPEndInfo=Ends RP in channel and gives you a .txt file!
RPEndInfo=Ends RP in channel and gives you a .txt file!
RPEndFileOut=Here's your file!
[CommandBoop]
@@ -434,3 +373,357 @@ RaffleJoinSuccess=You joined the raffle!
DBFlushInfo=Takes all objects queued for the database and writes them to the database, then says how many were written.
[[Command Management]]
[CommandEnabler]
beans=1
beans=1
beans=1
beans=1
beans=1
beans=1
benchmark, bench=1
benchmark, bench=1
benchmark, bench=1
benchmark, bench=1
benchmark, bench=1
benchmark, bench=1
bet=1
bet=1
bet=1
bet=1
bet=1
bet=1
bethistory=1
bethistory=1
bethistory=1
bethistory=1
bethistory=1
bethistory=1
blur=1
blur=1
blur=1
blur=1
blur=1
blur=1
boop=1
boop=1
boop=1
boop=1
boop=1
boop=1
buildhelp=1
buildhelp=1
buildhelp=1
buildhelp=1
buildhelp=1
buildhelp=1
c++, g++, cplus, cpp=1
c++, g++, cplus, cpp=1
c++, g++, cplus, cpp=1
c++, g++, cplus, cpp=1
c++, g++, cplus, cpp=1
c++, g++, cplus, cpp=1
catch=1
catch=1
catch=1
catch=1
catch=1
catch=1
charactercreate=1
charactercreate=1
charactercreate=1
charactercreate=1
charactercreate=1
charactercreate=1
charactereditbio=1
charactereditbio=1
charactereditbio=1
charactereditbio=1
charactereditbio=1
charactereditbio=1
charactereditname=1
charactereditname=1
charactereditname=1
charactereditname=1
charactereditname=1
charactereditname=1
characterediturl=1
characterediturl=1
characterediturl=1
characterediturl=1
characterediturl=1
characterediturl=1
choose=1
choose=1
choose=1
choose=1
choose=1
choose=1
color, colour=1
color, colour=1
color, colour=1
color, colour=1
color, colour=1
color, colour=1
crouton=1
crouton=1
crouton=1
crouton=1
crouton=1
crouton=1
dbflush=1
dbflush=1
dbflush=1
dbflush=1
dbflush=1
dbflush=1
dbstats=1
dbstats=1
dbstats=1
dbstats=1
dbstats=1
dbstats=1
eightball, 8ball=1
eightball, 8ball=1
eightball, 8ball=1
eightball, 8ball=1
eightball, 8ball=1
eightball, 8ball=1
fetch=1
fetch=1
fetch=1
fetch=1
fetch=1
fetch=1
givebeans=1
givebeans=1
givebeans=1
givebeans=1
givebeans=1
givebeans=1
guildroleadd=1
guildroleadd=1
guildroleadd=1
guildroleadd=1
guildroleadd=1
guildroleadd=1
guildroleallowed=1
guildroleallowed=1
guildroleallowed=1
guildroleallowed=1
guildroleallowed=1
guildroleallowed=1
guildrolelist=1
guildrolelist=1
guildrolelist=1
guildrolelist=1
guildrolelist=1
guildrolelist=1
guildrolenotallowed=1
guildrolenotallowed=1
guildrolenotallowed=1
guildrolenotallowed=1
guildrolenotallowed=1
guildrolenotallowed=1
guildroleremove=1
guildroleremove=1
guildroleremove=1
guildroleremove=1
guildroleremove=1
guildroleremove=1
help=1
help=1
help=1
help=1
help=1
help=1
indicator=1
indicator=1
indicator=1
indicator=1
indicator=1
indicator=1
info, about=1
info, about=1
info, about=1
info, about=1
info, about=1
info, about=1
invite=1
invite=1
invite=1
invite=1
invite=1
invite=1
java, jdoodle=1
java, jdoodle=1
java, jdoodle=1
java, jdoodle=1
java, jdoodle=1
java, jdoodle=1
leaderboard=1
leaderboard=1
leaderboard=1
leaderboard=1
leaderboard=1
leaderboard=1
map=1
map=1
map=1
map=1
map=1
map=1
perish, thenperish=1
perish, thenperish=1
perish, thenperish=1
perish, thenperish=1
perish, thenperish=1
perish, thenperish=1
ping=1
ping=1
ping=1
ping=1
ping=1
ping=1
poll=1
poll=1
poll=1
poll=1
poll=1
poll=1
raffleend=1
raffleend=1
raffleend=1
raffleend=1
raffleend=1
raffleend=1
rafflejoin=1
rafflejoin=1
rafflejoin=1
rafflejoin=1
rafflejoin=1
rafflejoin=1
rafflespin=1
rafflespin=1
rafflespin=1
rafflespin=1
rafflespin=1
rafflespin=1
rafflestart=1
rafflestart=1
rafflestart=1
rafflestart=1
rafflestart=1
rafflestart=1
rating=1
rating=1
rating=1
rating=1
rating=1
rating=1
results=1
results=1
results=1
results=1
results=1
results=1
role=1
role=1
role=1
role=1
role=1
role=1
roll=1
roll=1
roll=1
roll=1
roll=1
roll=1
rpend=1
rpend=1
rpend=1
rpend=1
rpend=1
rpend=1
rpg=1
rpg=1
rpg=1
rpg=1
rpg=1
rpg=1
rpstart=1
rpstart=1
rpstart=1
rpstart=1
rpstart=1
rpstart=1
searchcharacter=1
searchcharacter=1
searchcharacter=1
searchcharacter=1
searchcharacter=1
searchcharacter=1
showpoll=1
showpoll=1
showpoll=1
showpoll=1
showpoll=1
showpoll=1
shutdown=1
shutdown=1
shutdown=1
shutdown=1
shutdown=1
shutdown=1
stats=1
stats=1
stats=1
stats=1
stats=1
stats=1
teey=1
teey=1
teey=1
teey=1
teey=1
teey=1
tony, stark, dontfeelgood, dontfeelsogood=1
tony, stark, dontfeelgood, dontfeelsogood=1
tony, stark, dontfeelgood, dontfeelsogood=1
tony, stark, dontfeelgood, dontfeelsogood=1
tony, stark, dontfeelgood, dontfeelsogood=1
tony, stark, dontfeelgood, dontfeelsogood=1
tweet=1
tweet=1
tweet=1
tweet=1
tweet=1
tweet=1
vote=1
vote=1
vote=1
vote=1
vote=1
vote=1
wolfram=1
wolfram=1
wolfram=1
wolfram=1
wolfram=1
wolfram=1
work=1
work=1
work=1
work=1
work=1
work=1
yeet=1
yeet=1
yeet=1
yeet=1
yeet=1
yeet=1
+8
View File
@@ -57,9 +57,13 @@ public class CommandEnabler extends BaseKeyValueFile implements IConfigSection
keyList.add(key);
if(value.equalsIgnoreCase(enabled))
{
enabledMap.putIfAbsent(key, true);
}
else
{
enabledMap.putIfAbsent(key, false);
}
});
}
@@ -92,7 +96,9 @@ public class CommandEnabler extends BaseKeyValueFile implements IConfigSection
String value = enabled.toLowerCase();
if(enabledMap.get(key) == false)
{
value = disabled.toLowerCase();
}
list.add(new Pair<String, String>(key, value));
}
@@ -108,7 +114,9 @@ public class CommandEnabler extends BaseKeyValueFile implements IConfigSection
String toCheck = key.toLowerCase();
if(enabledMap.containsKey(toCheck))
{
return enabledMap.get(toCheck);
}
return true;
}
+6 -7
View File
@@ -1,8 +1,10 @@
package core;
import java.io.File;
import java.io.FileWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Vector;
import utils.GlobalLog;
@@ -84,14 +86,11 @@ public class Config
// Form updated data as necessary for autogeneration
String output = combineConfigs();
String path = configFile.getPath();
// Write to file.
FileWriter fileWriter;
try
{
fileWriter = new FileWriter(path);
OutputStreamWriter fileWriter = new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8);
fileWriter.write(output);
fileWriter.close();
}
@@ -118,7 +117,7 @@ public class Config
else
{
String sectionContents = parsedSections.getOrDefault(currentHeader, "");
parsedSections.put(currentHeader, sectionContents);
parsedSections.put(currentHeader, sectionContents + line + pairSeparator);
}
}