Added configname command

And removed some old config descriptions
This commit is contained in:
Sn0wStorm
2019-08-18 17:46:49 +02:00
parent 930d4a2028
commit a5e33be15e
15 changed files with 223 additions and 84 deletions
@@ -44,6 +44,7 @@ public class ConfigUpdater {
}
// adds some Lines at the index
// Will push all lines including the one at index down
public void addLines(int index, String... newLines) {
config.addAll(index, Arrays.asList(newLines));
}
@@ -163,6 +164,7 @@ public class ConfigUpdater {
if (P.use1_13 && oldMat) {
updateMaterials(true);
updateMaterialDescriptions(de);
}
if (!fromVersion.equals("1.8")) {
@@ -1150,6 +1152,18 @@ public class ConfigUpdater {
if (index != -1) {
addLines(index + 1, "# Oder RGB Farben (Hex: also zB '99FF33') (Ohne #) (mit '') (Einfach nach \"HTML color\" im Internet suchen)");
}
index = indexOfStart("# ingredients:");
if (index == -1) {
index = indexOfStart("# Eine Liste von allen Materialien");
if (index == -1) {
index = indexOfStart("# -- Rezepte");
}
}
if (index != -1) {
addLines(index + 1, "# Halte ein Item in der Hand und benutze /brew configname um dessen Material herauszufinden und für ein Rezept zu benutzen");
}
if (P.use1_13) updateMaterialDescriptions(true);
}
// Update en from 1.7 to 1.8
@@ -1185,6 +1199,18 @@ public class ConfigUpdater {
if (index != -1) {
addLines(index + 1, "# Or RGB colors (hex: for example '99FF33') (with '') (search for \"HTML color\" on the internet)");
}
index = indexOfStart("# ingredients:");
if (index == -1) {
index = indexOfStart("# A list of materials");
if (index == -1) {
index = indexOfStart("# -- Recipes");
}
}
if (index != -1) {
addLines(index + 1, "# With an item in your hand, use /brew configname to get its material for use in a recipe");
}
if (P.use1_13) updateMaterialDescriptions(false);
}
// Update all Materials to Minecraft 1.13
@@ -1293,5 +1319,82 @@ public class ConfigUpdater {
}
}
private void updateMaterialDescriptions(boolean de) {
int index;
if (de) {
index = indexOfStart("# ingredients: Auflistung von 'Material,Data/Anzahl'");
if (index != -1) {
setLine(index, "# ingredients: Auflistung von 'Material/Anzahl'");
}
index = indexOfStart("# Es kann ein Data-Wert (durability) angegeben werden");
if (index != -1) {
config.remove(index);
}
index = indexOfStart("# Wenn Vault installiert ist");
if (index != -1) {
config.remove(index);
}
index = indexOfStart("# Vault erkennt Namen wie");
if (index != -1) {
config.remove(index);
}
index = indexOfStart("# - Jungle Leaves/64 # Nur mit Vault");
if (index != -1) {
config.remove(index);
}
index = indexOfStart("# - Green Dye/6 # Nur mit Vault");
if (index != -1) {
config.remove(index);
}
index = indexOfStart("# Ein 'X' an den Namen");
if (index != -1) {
config.remove(index);
}
index = indexOfStart("# Effekte sind ab der 1.9 immer verborgen");
if (index != -1) {
config.remove(index);
}
} else {
index = indexOfStart("# ingredients: List of 'material,data/amount'");
if (index != -1) {
setLine(index, "# ingredients: List of 'material/amount'");
}
index = indexOfStart("# You can specify a data (durability) value");
if (index != -1) {
config.remove(index);
}
index = indexOfStart("# If Vault is installed normal names can be used");
if (index != -1) {
config.remove(index);
}
index = indexOfStart("# Vault will recognize things");
if (index != -1) {
config.remove(index);
}
index = indexOfStart("# - Jungle Leaves/64 # Only with Vault");
if (index != -1) {
config.remove(index);
}
index = indexOfStart("# - Green Dye/6 # Only with Vault");
if (index != -1) {
config.remove(index);
}
index = indexOfStart("# Suffix name with 'X' to hide effect");
if (index != -1) {
config.remove(index);
}
index = indexOfStart("# Effects are always hidden in 1.9 and newer");
if (index != -1) {
config.remove(index);
}
}
}
}
@@ -34,9 +34,10 @@ public class LanguageReader {
}
private void setDefaults() {
/* Player */
defaults.put("Player_BarrelCreated", "Barrel created");
defaults.put("Player_BarrelFull", "&cThis barrel can''t hold any more drinks");
defaults.put("Player_CauldronInfo1", "This cauldron has been boiling for &v1 minutes.");
defaults.put("Player_CauldronInfo2", "This cauldron has just started boiling.");
defaults.put("Player_CantDrink", "You can't drink any more.");
@@ -74,9 +75,11 @@ public class LanguageReader {
defaults.put("Brew_HundredsOfYears", "Hundreds of Years");
defaults.put("Brew_Woodtype", "Woodtype");
defaults.put("Brew_ThickBrew", "Muddy Brew");
/* Commands */
defaults.put("CMD_Reload", "&aConfig was successfully reloaded");
defaults.put("CMD_Configname", "&aName for the Config is: &f&v1");
defaults.put("CMD_Configname_Error", "&cCould not find item in your hand");
defaults.put("CMD_Player", "&a&v1 is now &6&v2% &adrunk, with a quality of &6&v3");
defaults.put("CMD_Player_Error", "&cThe quality has to be between 1 and 10!");
defaults.put("CMD_Info_NotDrunk", "&v1 is not drunk");
@@ -89,7 +92,7 @@ public class LanguageReader {
defaults.put("CMD_CopyNotPersistent", "&eThese copies of this Brew will not be persistent or static!");
defaults.put("CMD_Static", "&aPotion is now static and will not change in barrels or brewing stands.");
defaults.put("CMD_NonStatic", "&ePotion is not static anymore and will normally age in barrels.");
/* Error */
defaults.put("Error_UnknownCommand", "Unknown Command");
defaults.put("Error_ShowHelp", "Use &6/brew help &fto display the help");
@@ -108,7 +111,7 @@ public class LanguageReader {
defaults.put("Perms_NoBigBarrelCreate", "&cYou don't have permissions to create big barrels!");
defaults.put("Perms_NoCauldronInsert", "&cYou don't have permissions to put ingredients into cauldrons!");
defaults.put("Perms_NoCauldronFill", "&cYou don't have permissions to fill bottles from this cauldron!");
/* Help */
defaults.put("Help_Help", "&6/brew help [Page] &9Shows a specific help-page");
defaults.put("Help_Player", "&6/brew <Player> <%Drunkeness> [Quality]&9 Sets Drunkeness (and Quality) of a Player");
@@ -124,10 +127,11 @@ public class LanguageReader {
defaults.put("Help_WakeupAdd", "&6/brew wakeup add &9Adds a wakeup point at your current position");
defaults.put("Help_WakeupRemove", "&6/brew wakeup remove <id> &9Removes the wakeup point with <id>");
defaults.put("Help_Reload", "&6/brew reload &9Reload config");
defaults.put("Help_Configname", "&6/brew configname &9Display name of item in hand for the config");
defaults.put("Help_Persist", "&6/brew persist &9Make Brew persistent -> copyable by any plugin and technique");
defaults.put("Help_Static", "&6/brew static &9Make Brew static -> No further ageing or distilling");
defaults.put("Help_Create", "&6/brew create <Recipe> [Quality] [Player] &9Create a Brew with optional quality (1-10)");
/* Etc. */
defaults.put("Etc_Usage", "Usage:");
defaults.put("Etc_Page", "Page");