mirror of
https://github.com/itHotL/PlayerStats.git
synced 2025-01-07 19:27:47 +01:00
commit
6678778e8f
@ -4,7 +4,7 @@
|
||||
<groupId>io.github.ithotl</groupId>
|
||||
<artifactId>PlayerStats</artifactId>
|
||||
<name>PlayerStats</name>
|
||||
<version>1.7.2</version>
|
||||
<version>1.8</version>
|
||||
<description>Statistics Plugin</description>
|
||||
<url>https://www.spigotmc.org/resources/playerstats.102347/</url>
|
||||
<developers>
|
||||
@ -120,7 +120,7 @@
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<phase>deploy</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
|
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>io.github.ithotl</groupId>
|
||||
<artifactId>PlayerStats</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<version>1.8</version>
|
||||
|
||||
<name>PlayerStats</name>
|
||||
<description>Statistics Plugin</description>
|
||||
@ -214,7 +214,7 @@
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<phase>deploy</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
|
@ -30,6 +30,19 @@ public interface PlayerStats {
|
||||
return Main.getPlayerStatsAPI();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current version of PlayerStatsAPI.
|
||||
* Use this method to ensure the correct version of
|
||||
* PlayerStats is running on the server before
|
||||
* accessing further API methods, to prevent
|
||||
* <code>ClassDefNotFoundExceptions</code>.
|
||||
*
|
||||
* @return the version of PlayerStatsAPI present on the server
|
||||
*/
|
||||
default String getVersion() {
|
||||
return "1.8";
|
||||
}
|
||||
|
||||
StatManager getStatManager();
|
||||
|
||||
ApiFormatter getFormatter();
|
||||
|
@ -31,7 +31,9 @@ public final class ComponentUtils {
|
||||
return "";
|
||||
}
|
||||
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();
|
||||
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"
|
||||
* or "commands.kill.success.single" (which results in "Killed %s").
|
||||
* Checks if a given Key is the language key "stat_type.minecraft.killed".
|
||||
*
|
||||
* @param statKey the Key to check
|
||||
* @return true if this Key is key for kill-entity
|
||||
*/
|
||||
public static boolean isKeyForKillEntity(String statKey) {
|
||||
return statKey.equalsIgnoreCase("stat_type.minecraft.killed") ||
|
||||
statKey.equalsIgnoreCase("commands.kill.success.single");
|
||||
return statKey.equalsIgnoreCase("stat_type.minecraft.killed");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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"
|
||||
*/
|
||||
@ -82,19 +90,26 @@ public final class LanguageKeyHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given Key is the language key "stat_type.minecraft.killed_by"
|
||||
* or "stat.minecraft.deaths" (which results in "Number of Deaths").
|
||||
* Checks if a given Key is the language key "stat_type.minecraft.killed_by".
|
||||
*
|
||||
* @param statKey the Key to check
|
||||
* @return true if this Key is a key for entity-killed-by
|
||||
*/
|
||||
public static boolean isKeyForEntityKilledBy(String statKey) {
|
||||
return statKey.equalsIgnoreCase("stat_type.minecraft.killed_by") ||
|
||||
statKey.equalsIgnoreCase("stat.minecraft.deaths");
|
||||
return statKey.equalsIgnoreCase("stat_type.minecraft.killed_by");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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"
|
||||
* (meant to be followed by {@link #getAlternativeKeyForEntityKilledByArg()})
|
||||
@ -135,8 +150,8 @@ public final class LanguageKeyHandler {
|
||||
return "times_killed";
|
||||
} else if (isKeyForEntityKilledBy(key)) {
|
||||
return "number_of_times_killed_by";
|
||||
} else if (isKeyForEntityKilledByArg(key)) { //this one returns nothing, because the previous one returns the full text
|
||||
return "";
|
||||
} else if (isKeyForEntityKilledByArg(key)) { //this one returns nothing, because it's an extra key I added
|
||||
return ""; //to make the TranslatableComponent work
|
||||
}
|
||||
String toReplace = "";
|
||||
if (key.contains("stat")) {
|
||||
@ -145,8 +160,8 @@ public final class LanguageKeyHandler {
|
||||
} else {
|
||||
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
|
||||
toReplace = "entity";
|
||||
} else if (key.contains("entity")) { //for the two entity-related ones, put brackets around it to
|
||||
toReplace = "entity"; //make up for the multiple-keys/args-serializer issues
|
||||
} else if (key.contains("block")) {
|
||||
toReplace = "block";
|
||||
} else if (key.contains("item")) {
|
||||
|
@ -54,7 +54,6 @@ public final class RequestSettings {
|
||||
* <br>- Target target = {@link Target#TOP}
|
||||
* <br>- int topListSize = 10
|
||||
* <br>- boolean playerFlag = false
|
||||
* <br>- boolean isAPIRequest
|
||||
*
|
||||
* @param sender the CommandSender who prompted this RequestGenerator
|
||||
*/
|
||||
@ -112,7 +111,7 @@ public final class RequestSettings {
|
||||
return playerFlag;
|
||||
}
|
||||
|
||||
public void setTarget(Target target) {
|
||||
public void setTarget(@NotNull Target target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
main: com.artemis.the.gr8.playerstats.Main
|
||||
name: PlayerStats
|
||||
version: 1.7.2
|
||||
version: 1.8
|
||||
api-version: 1.13
|
||||
description: adds commands to view player statistics in chat
|
||||
author: Artemis_the_gr8
|
||||
|
Loading…
Reference in New Issue
Block a user