mirror of
https://github.com/itHotL/PlayerStats.git
synced 2025-02-01 23:21:20 +01:00
Fixed stat-name for Deaths (#121)
This commit is contained in:
parent
667d695c75
commit
9942d6fea5
@ -107,6 +107,7 @@
|
|||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-sources</id>
|
<id>attach-sources</id>
|
||||||
|
<phase>deploy</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>jar-no-fork</goal>
|
<goal>jar-no-fork</goal>
|
||||||
</goals>
|
</goals>
|
||||||
@ -119,6 +120,7 @@
|
|||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>sign-artifacts</id>
|
<id>sign-artifacts</id>
|
||||||
|
<phase>deploy</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>sign</goal>
|
<goal>sign</goal>
|
||||||
</goals>
|
</goals>
|
||||||
@ -131,6 +133,7 @@
|
|||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-javadocs</id>
|
<id>attach-javadocs</id>
|
||||||
|
<phase>deploy</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>jar</goal>
|
<goal>jar</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
@ -31,7 +31,9 @@ public final class ComponentUtils {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
else if (LanguageKeyHandler.isKeyForEntityKilledBy(trans.key()) ||
|
else if (LanguageKeyHandler.isKeyForEntityKilledBy(trans.key()) ||
|
||||||
LanguageKeyHandler.isKeyForKillEntity(trans.key())) {
|
LanguageKeyHandler.isAlternativeKeyForEntityKilledBy(trans.key()) ||
|
||||||
|
LanguageKeyHandler.isKeyForKillEntity(trans.key()) ||
|
||||||
|
LanguageKeyHandler.isAlternativeKeyForKillEntity(trans.key())) {
|
||||||
|
|
||||||
TextComponent.Builder temp = Component.text();
|
TextComponent.Builder temp = Component.text();
|
||||||
trans.iterator(ComponentIteratorType.DEPTH_FIRST, ComponentIteratorFlag.INCLUDE_TRANSLATABLE_COMPONENT_ARGUMENTS)
|
trans.iterator(ComponentIteratorType.DEPTH_FIRST, ComponentIteratorFlag.INCLUDE_TRANSLATABLE_COMPONENT_ARGUMENTS)
|
||||||
|
@ -61,19 +61,27 @@ public final class LanguageKeyHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a given Key is the language key "stat_type.minecraft.killed"
|
* Checks if a given Key is the language key "stat_type.minecraft.killed".
|
||||||
* or "commands.kill.success.single" (which results in "Killed %s").
|
|
||||||
*
|
*
|
||||||
* @param statKey the Key to check
|
* @param statKey the Key to check
|
||||||
* @return true if this Key is key for kill-entity
|
* @return true if this Key is key for kill-entity
|
||||||
*/
|
*/
|
||||||
public static boolean isKeyForKillEntity(String statKey) {
|
public static boolean isKeyForKillEntity(String statKey) {
|
||||||
return statKey.equalsIgnoreCase("stat_type.minecraft.killed") ||
|
return statKey.equalsIgnoreCase("stat_type.minecraft.killed");
|
||||||
statKey.equalsIgnoreCase("commands.kill.success.single");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a language key to replace the default Statistic.Kill_Entity key.
|
* Checks if a given Key is the language key for "commands.kill.success.single",
|
||||||
|
* which results in "Killed %s".
|
||||||
|
* @param statKey the Key to check
|
||||||
|
* @return true if this Key is key for commands.kill.success.single
|
||||||
|
*/
|
||||||
|
public static boolean isAlternativeKeyForKillEntity(String statKey) {
|
||||||
|
return statKey.equalsIgnoreCase("commands.kill.success.single");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a language key to replace the default "stat_type.minecraft.killed" key.
|
||||||
*
|
*
|
||||||
* @return the key "commands.kill.success.single", which results in "Killed %s"
|
* @return the key "commands.kill.success.single", which results in "Killed %s"
|
||||||
*/
|
*/
|
||||||
@ -82,19 +90,26 @@ public final class LanguageKeyHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a given Key is the language key "stat_type.minecraft.killed_by"
|
* Checks if a given Key is the language key "stat_type.minecraft.killed_by".
|
||||||
* or "stat.minecraft.deaths" (which results in "Number of Deaths").
|
|
||||||
*
|
*
|
||||||
* @param statKey the Key to check
|
* @param statKey the Key to check
|
||||||
* @return true if this Key is a key for entity-killed-by
|
* @return true if this Key is a key for entity-killed-by
|
||||||
*/
|
*/
|
||||||
public static boolean isKeyForEntityKilledBy(String statKey) {
|
public static boolean isKeyForEntityKilledBy(String statKey) {
|
||||||
return statKey.equalsIgnoreCase("stat_type.minecraft.killed_by") ||
|
return statKey.equalsIgnoreCase("stat_type.minecraft.killed_by");
|
||||||
statKey.equalsIgnoreCase("stat.minecraft.deaths");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a language key to replace the default Statistic.Entity_Killed_By key.
|
* Checks if a given Key is the language key "stat.minecraft.deaths".
|
||||||
|
* @param statKey the Key to check
|
||||||
|
* @return true if this Key is key for stat.minecraft.deaths
|
||||||
|
*/
|
||||||
|
public static boolean isAlternativeKeyForEntityKilledBy(String statKey) {
|
||||||
|
return statKey.equalsIgnoreCase("stat.minecraft.deaths");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a language key to replace the default stat_type.minecraft.killed_by key.
|
||||||
*
|
*
|
||||||
* @return the key "stat.minecraft.deaths", which results in "Number of Deaths"
|
* @return the key "stat.minecraft.deaths", which results in "Number of Deaths"
|
||||||
* (meant to be followed by {@link #getAlternativeKeyForEntityKilledByArg()})
|
* (meant to be followed by {@link #getAlternativeKeyForEntityKilledByArg()})
|
||||||
@ -135,8 +150,8 @@ public final class LanguageKeyHandler {
|
|||||||
return "times_killed";
|
return "times_killed";
|
||||||
} else if (isKeyForEntityKilledBy(key)) {
|
} else if (isKeyForEntityKilledBy(key)) {
|
||||||
return "number_of_times_killed_by";
|
return "number_of_times_killed_by";
|
||||||
} else if (isKeyForEntityKilledByArg(key)) { //this one returns nothing, because the previous one returns the full text
|
} else if (isKeyForEntityKilledByArg(key)) { //this one returns nothing, because it's an extra key I added
|
||||||
return "";
|
return ""; //to make the TranslatableComponent work
|
||||||
}
|
}
|
||||||
String toReplace = "";
|
String toReplace = "";
|
||||||
if (key.contains("stat")) {
|
if (key.contains("stat")) {
|
||||||
@ -145,8 +160,8 @@ public final class LanguageKeyHandler {
|
|||||||
} else {
|
} else {
|
||||||
toReplace = "stat";
|
toReplace = "stat";
|
||||||
}
|
}
|
||||||
} else if (key.contains("entity")) { //for the two entity-related ones, put brackets around it to make up for the multiple-keys/args-serializer issues
|
} else if (key.contains("entity")) { //for the two entity-related ones, put brackets around it to
|
||||||
toReplace = "entity";
|
toReplace = "entity"; //make up for the multiple-keys/args-serializer issues
|
||||||
} else if (key.contains("block")) {
|
} else if (key.contains("block")) {
|
||||||
toReplace = "block";
|
toReplace = "block";
|
||||||
} else if (key.contains("item")) {
|
} else if (key.contains("item")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user