Merge remote-tracking branch 'origin/3.6.0' into 3.6.0

# Conflicts:
#	Plan/src/main/resources/analysis.html
This commit is contained in:
Rsl1122 2017-07-27 17:54:34 +03:00
commit 81a2c26832
15 changed files with 248 additions and 212 deletions

View File

@ -1,13 +1,13 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: com.djrapitops:abstract-plugin-framework:2.0.0"> <library name="Maven: com.djrapitops:abstract-plugin-framework:2.0.1">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.0/abstract-plugin-framework-2.0.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.1/abstract-plugin-framework-2.0.1.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.0/abstract-plugin-framework-2.0.0-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.1/abstract-plugin-framework-2.0.1-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.0/abstract-plugin-framework-2.0.0-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.1/abstract-plugin-framework-2.0.1-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>

View File

@ -1,183 +1,186 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion> <groupId>com.djrapitops</groupId>
<groupId>com.djrapitops</groupId> <artifactId>Plan</artifactId>
<artifactId>Plan</artifactId> <version>3.5.5</version>
<version>3.5.4</version> <build>
<build> <sourceDirectory>${basedir}/src</sourceDirectory>
<sourceDirectory>${basedir}/src</sourceDirectory> <defaultGoal>clean package install</defaultGoal>
<defaultGoal>clean package install</defaultGoal> <resources>
<resources> <resource>
<resource> <targetPath>.</targetPath>
<targetPath>.</targetPath> <directory>${basedir}/src/main/resources</directory>
<directory>${basedir}/src/main/resources</directory> <includes>
<includes> <include>*.yml</include>
<include>*.yml</include> <include>*.html</include>
<include>*.html</include> </includes>
</includes> </resource>
</resource> </resources>
</resources> <finalName>${project.name}</finalName>
<finalName>${project.name}</finalName> <plugins>
<plugins> <plugin>
<plugin> <artifactId>maven-compiler-plugin</artifactId>
<artifactId>maven-compiler-plugin</artifactId> <version>3.3</version>
<version>3.3</version> <configuration>
<configuration> <source>1.8</source>
<source>1.8</source> <target>1.8</target>
<target>1.8</target> </configuration>
</configuration> </plugin>
</plugin> <plugin>
<plugin> <artifactId>maven-shade-plugin</artifactId>
<artifactId>maven-shade-plugin</artifactId> <version>2.4.3</version>
<version>2.4.3</version> <executions>
<executions> <execution>
<execution> <phase>package</phase>
<phase>package</phase> <goals>
<goals> <goal>shade</goal>
<goal>shade</goal> </goals>
</goals> </execution>
</execution> </executions>
</executions> <configuration>
<configuration> <artifactSet>
<artifactSet> <excludes>
<excludes> <exclude>org.powermock:*</exclude>
<exclude>org.powermock:*</exclude> <exclude>org.javassist:*</exclude>
<exclude>org.javassist:*</exclude> <exclude>com.thoughtworks.xstream:*</exclude>
<exclude>com.thoughtworks.xstream:*</exclude> <exclude>xmlpull:*</exclude>
<exclude>xmlpull:*</exclude> <exclude>xpp3:*</exclude>
<exclude>xpp3:*</exclude> <exclude>org.objenesis:*</exclude>
<exclude>org.objenesis:*</exclude> <exclude>cglib:*</exclude>
<exclude>cglib:*</exclude> <exclude>org.*:*</exclude>
<exclude>org.*:*</exclude> <exclude>org.easymock:*</exclude>
<exclude>org.easymock:*</exclude> <exclude>junit:*</exclude>
<exclude>junit:*</exclude> </excludes>
</excludes> </artifactSet>
</artifactSet> </configuration>
</configuration> </plugin>
</plugin> <plugin>
<plugin> <artifactId>maven-jar-plugin</artifactId>
<artifactId>maven-jar-plugin</artifactId> <version>2.6</version>
<version>2.6</version> <configuration>
<configuration> <excludes>
<excludes> <exclude>**/test/*</exclude>
<exclude>**/test/*</exclude> <exclude>**/*/test/*</exclude>
<exclude>**/*/test/*</exclude> <exclude>**/*/test.*</exclude>
<exclude>**/*/test.*</exclude> <exclude>**/test/**/*</exclude>
<exclude>**/test/**/*</exclude> </excludes>
</excludes> </configuration>
</configuration> </plugin>
</plugin> <plugin>
<plugin> <groupId>org.pitest</groupId>
<groupId>org.pitest</groupId> <artifactId>pitest-maven</artifactId>
<artifactId>pitest-maven</artifactId> <version>1.1.8</version>
<version>1.1.8</version> <configuration>
<configuration> <targetClasses>
<targetClasses> <param>main.java.com.djrapitops.plan.*</param>
<param>main.java.com.djrapitops.plan.*</param> </targetClasses>
</targetClasses> <targetTests>
<targetTests> <param>test.java.main.java.com.djrapitops.plan.*</param>
<param>test.java.main.java.com.djrapitops.plan.*</param> </targetTests>
</targetTests> <timeoutConstant>1000</timeoutConstant>
<timeoutConstant>1000</timeoutConstant> </configuration>
</configuration> </plugin>
</plugin> <plugin>
<plugin> <artifactId>maven-checkstyle-plugin</artifactId>
<artifactId>maven-checkstyle-plugin</artifactId> <version>2.17</version>
<version>2.17</version> <configuration>
<configuration> <excludes>**/test/**/*</excludes>
<excludes>**/test/**/*</excludes> <configLocation>checkstyle.xml</configLocation>
<configLocation>checkstyle.xml</configLocation> </configuration>
</configuration> </plugin>
</plugin> <plugin>
<plugin> <artifactId>maven-javadoc-plugin</artifactId>
<artifactId>maven-javadoc-plugin</artifactId> <version>2.10.4</version>
<version>2.10.4</version> <configuration>
<configuration> <excludePackageNames>test.*</excludePackageNames>
<excludePackageNames>test.*</excludePackageNames> </configuration>
</configuration> </plugin>
</plugin> </plugins>
</plugins> </build>
</build> <repositories>
<repositories> <repository>
<repository> <id>plan-repo</id>
<id>spigot-repo</id> <url>http://repo.fuzzlemann.de/artifactory/libs-release/</url>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> </repository>
</repository> <repository>
</repositories> <id>plan-snapshot-repo</id>
<dependencies> <url>http://repo.fuzzlemann.de/artifactory/libs-snapshot/</url>
<dependency> </repository>
<groupId>org.spigotmc</groupId> </repositories>
<artifactId>spigot</artifactId> <dependencies>
<version>1.12-R0.1-SNAPSHOT</version> <dependency>
<scope>provided</scope> <groupId>com.destroystokyo.paper</groupId>
</dependency> <artifactId>paper</artifactId>
<dependency> <version>1.12-R0.1-20170725.202533-1</version>
<groupId>org.powermock</groupId> <scope>provided</scope>
<artifactId>powermock</artifactId> </dependency>
<version>1.6.6</version> <dependency>
<type>pom</type> <groupId>org.powermock</groupId>
<scope>compile</scope> <artifactId>powermock</artifactId>
</dependency> <version>1.6.6</version>
<dependency> <type>pom</type>
<groupId>org.powermock</groupId> <scope>compile</scope>
<artifactId>powermock-api-mockito</artifactId> </dependency>
<version>1.6.6</version> <dependency>
<scope>compile</scope> <groupId>org.powermock</groupId>
</dependency> <artifactId>powermock-api-mockito</artifactId>
<dependency> <version>1.6.6</version>
<groupId>org.powermock</groupId> <scope>compile</scope>
<artifactId>powermock-module-junit4</artifactId> </dependency>
<version>1.6.6</version> <dependency>
<scope>compile</scope> <groupId>org.powermock</groupId>
</dependency> <artifactId>powermock-module-junit4</artifactId>
<dependency> <version>1.6.6</version>
<groupId>org.powermock</groupId> <scope>compile</scope>
<artifactId>powermock-module-junit4-rule</artifactId> </dependency>
<version>1.6.6</version> <dependency>
<scope>compile</scope> <groupId>org.powermock</groupId>
</dependency> <artifactId>powermock-module-junit4-rule</artifactId>
<dependency> <version>1.6.6</version>
<groupId>org.powermock</groupId> <scope>compile</scope>
<artifactId>powermock-classloading-xstream</artifactId> </dependency>
<version>1.6.6</version> <dependency>
<scope>compile</scope> <groupId>org.powermock</groupId>
</dependency> <artifactId>powermock-classloading-xstream</artifactId>
<dependency> <version>1.6.6</version>
<groupId>org.mockito</groupId> <scope>compile</scope>
<artifactId>mockito-core</artifactId> </dependency>
<version>1.10.19</version> <dependency>
<scope>compile</scope> <groupId>org.mockito</groupId>
</dependency> <artifactId>mockito-core</artifactId>
<dependency> <version>1.10.19</version>
<groupId>org.powermock</groupId> <scope>compile</scope>
<artifactId>powermock-api-easymock</artifactId> </dependency>
<version>1.6.6</version> <dependency>
<scope>compile</scope> <groupId>org.powermock</groupId>
</dependency> <artifactId>powermock-api-easymock</artifactId>
<dependency> <version>1.6.6</version>
<groupId>org.easymock</groupId> <scope>compile</scope>
<artifactId>easymock</artifactId> </dependency>
<version>3.4</version> <dependency>
<scope>compile</scope> <groupId>org.easymock</groupId>
</dependency> <artifactId>easymock</artifactId>
<dependency> <version>3.4</version>
<groupId>junit</groupId> <scope>compile</scope>
<artifactId>junit</artifactId> </dependency>
<version>4.12</version> <dependency>
<scope>compile</scope> <groupId>junit</groupId>
</dependency> <artifactId>junit</artifactId>
<dependency> <version>4.12</version>
<groupId>org.hamcrest</groupId> <scope>compile</scope>
<artifactId>hamcrest-core</artifactId> </dependency>
<version>1.3</version> <dependency>
<scope>test</scope> <groupId>org.hamcrest</groupId>
</dependency> <artifactId>hamcrest-core</artifactId>
</dependencies> <version>1.3</version>
<properties> <scope>test</scope>
<maven.compiler.source>1.8</maven.compiler.source> </dependency>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </dependencies>
<maven.compiler.target>1.8</maven.compiler.target> <properties>
</properties> <maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project> </project>

View File

@ -25,7 +25,8 @@ public class ServerVariableHolder {
ip = server.getIp(); ip = server.getIp();
String serverName = server.getName(); String serverName = server.getName();
usingPaper = serverName.equals("Paper") || serverName.equals("TacoSpigot"); usingPaper = serverName.equals("Paper")
|| serverName.equals("TacoSpigot"); //Fork of Paper
} }
/** /**

View File

@ -15,9 +15,7 @@ import main.java.com.djrapitops.plan.ui.text.TextUI;
import main.java.com.djrapitops.plan.utilities.Check; import main.java.com.djrapitops.plan.utilities.Check;
import main.java.com.djrapitops.plan.utilities.HtmlUtils; import main.java.com.djrapitops.plan.utilities.HtmlUtils;
import main.java.com.djrapitops.plan.utilities.MiscUtils; import main.java.com.djrapitops.plan.utilities.MiscUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandException;
/** /**
* This subcommand is used to run the analysis and access the /server link. * This subcommand is used to run the analysis and access the /server link.
@ -150,12 +148,4 @@ public class AnalyzeCommand extends SubCommand {
} }
sender.sendMessage(Phrase.CMD_FOOTER.toString()); sender.sendMessage(Phrase.CMD_FOOTER.toString());
} }
@Deprecated // TODO Will be rewritten to the RslPlugin abstractions in the future.
private void sendLink(ISender sender, String url) throws CommandException {
plugin.getServer().dispatchCommand(
Bukkit.getConsoleSender(),
"tellraw " + sender.getName() + " [\"\",{\"text\":\"" + Phrase.CMD_CLICK_ME + "\",\"underlined\":true,"
+ "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + url + "\"}}]");
}
} }

View File

@ -153,4 +153,4 @@ public class InspectCommand extends SubCommand {
sender.sendMessage(Phrase.CMD_FOOTER + ""); sender.sendMessage(Phrase.CMD_FOOTER + "");
} }
} }

View File

@ -39,6 +39,7 @@ public class ManageCleanCommand extends SubCommand {
if (!Check.isTrue(args.length != 0, Phrase.COMMAND_REQUIRES_ARGUMENTS_ONE.toString(), sender)) { if (!Check.isTrue(args.length != 0, Phrase.COMMAND_REQUIRES_ARGUMENTS_ONE.toString(), sender)) {
return true; return true;
} }
String dbName = args[0].toLowerCase(); String dbName = args[0].toLowerCase();
boolean isCorrectDB = "sqlite".equals(dbName) || "mysql".equals(dbName); boolean isCorrectDB = "sqlite".equals(dbName) || "mysql".equals(dbName);

View File

@ -78,6 +78,7 @@ public class ManageImportCommand extends SubCommand {
if (!Check.isTrue(importPlugins.keySet().contains(importFromPlugin), Phrase.MANAGE_ERROR_INCORRECT_PLUGIN + importFromPlugin, sender)) { if (!Check.isTrue(importPlugins.keySet().contains(importFromPlugin), Phrase.MANAGE_ERROR_INCORRECT_PLUGIN + importFromPlugin, sender)) {
return true; return true;
} }
if (!Check.isTrue(ImportUtils.isPluginEnabled(importFromPlugin), Phrase.MANAGE_ERROR_PLUGIN_NOT_ENABLED + importFromPlugin, sender)) { if (!Check.isTrue(ImportUtils.isPluginEnabled(importFromPlugin), Phrase.MANAGE_ERROR_PLUGIN_NOT_ENABLED + importFromPlugin, sender)) {
return true; return true;
} }

View File

@ -58,9 +58,11 @@ public class ManageMoveCommand extends SubCommand {
if (!Check.isTrue(isCorrectDB, Phrase.MANAGE_ERROR_INCORRECT_DB + toDB, sender)) { if (!Check.isTrue(isCorrectDB, Phrase.MANAGE_ERROR_INCORRECT_DB + toDB, sender)) {
return true; return true;
} }
if (!Check.isTrue(!Verify.equalsIgnoreCase(fromDB, toDB), Phrase.MANAGE_ERROR_SAME_DB.toString(), sender)) { if (!Check.isTrue(!Verify.equalsIgnoreCase(fromDB, toDB), Phrase.MANAGE_ERROR_SAME_DB.toString(), sender)) {
return true; return true;
} }
if (!Check.isTrue(Verify.contains("-a", args), Phrase.COMMAND_ADD_CONFIRMATION_ARGUMENT.parse(Phrase.WARN_REMOVE.parse(args[1])), sender)) { if (!Check.isTrue(Verify.contains("-a", args), Phrase.COMMAND_ADD_CONFIRMATION_ARGUMENT.parse(Phrase.WARN_REMOVE.parse(args[1])), sender)) {
return true; return true;
} }
@ -92,7 +94,9 @@ public class ManageMoveCommand extends SubCommand {
if (Check.isTrue(Verify.isEmpty(uuids), Phrase.MANAGE_ERROR_NO_PLAYERS + " (" + fromDatabase.getName() + ")", sender)) { if (Check.isTrue(Verify.isEmpty(uuids), Phrase.MANAGE_ERROR_NO_PLAYERS + " (" + fromDatabase.getName() + ")", sender)) {
return; return;
} }
sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse()); sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse());
if (ManageUtils.clearAndCopy(toDatabase, fromDatabase, uuids)) { if (ManageUtils.clearAndCopy(toDatabase, fromDatabase, uuids)) {
sender.sendMessage(Phrase.MANAGE_MOVE_SUCCESS + ""); sender.sendMessage(Phrase.MANAGE_MOVE_SUCCESS + "");
boolean movedToCurrentDatabase = Verify.equalsIgnoreCase(toDatabase.getConfigName(), plugin.getDB().getConfigName()); boolean movedToCurrentDatabase = Verify.equalsIgnoreCase(toDatabase.getConfigName(), plugin.getDB().getConfigName());

View File

@ -74,13 +74,16 @@ public class ManageRemoveCommand extends SubCommand {
try { try {
UUID uuid = UUIDUtility.getUUIDOf(playerName); UUID uuid = UUIDUtility.getUUIDOf(playerName);
String message = Phrase.USERNAME_NOT_VALID.toString(); String message = Phrase.USERNAME_NOT_VALID.toString();
if (!Check.isTrue(Verify.notNull(uuid), message, sender)) { if (!Check.isTrue(Verify.notNull(uuid), message, sender)) {
return; return;
} }
message = Phrase.USERNAME_NOT_KNOWN.toString(); message = Phrase.USERNAME_NOT_KNOWN.toString();
if (!Check.isTrue(plugin.getDB().wasSeenBefore(uuid), message, sender)) { if (!Check.isTrue(plugin.getDB().wasSeenBefore(uuid), message, sender)) {
return; return;
} }
message = Phrase.COMMAND_ADD_CONFIRMATION_ARGUMENT.parse(Phrase.WARN_REMOVE.parse(plugin.getDB().getConfigName())); message = Phrase.COMMAND_ADD_CONFIRMATION_ARGUMENT.parse(Phrase.WARN_REMOVE.parse(plugin.getDB().getConfigName()));
if (!Check.isTrue(Verify.contains("-a", args), message, sender)) { if (!Check.isTrue(Verify.contains("-a", args), message, sender)) {
return; return;

View File

@ -44,12 +44,14 @@ public class ManageRestoreCommand extends SubCommand {
if (!Check.isTrue(args.length >= 2, Phrase.COMMAND_REQUIRES_ARGUMENTS.parse(Phrase.USE_RESTORE.toString()), sender)) { if (!Check.isTrue(args.length >= 2, Phrase.COMMAND_REQUIRES_ARGUMENTS.parse(Phrase.USE_RESTORE.toString()), sender)) {
return true; return true;
} }
String db = args[1].toLowerCase(); String db = args[1].toLowerCase();
boolean isCorrectDB = "sqlite".equals(db) || "mysql".equals(db); boolean isCorrectDB = "sqlite".equals(db) || "mysql".equals(db);
if (!Check.isTrue(isCorrectDB, Phrase.MANAGE_ERROR_INCORRECT_DB + db, sender)) { if (!Check.isTrue(isCorrectDB, Phrase.MANAGE_ERROR_INCORRECT_DB + db, sender)) {
return true; return true;
} }
if (!Check.isTrue(Verify.contains("-a", args), Phrase.COMMAND_ADD_CONFIRMATION_ARGUMENT.parse(Phrase.WARN_REWRITE.parse(args[1])), sender)) { if (!Check.isTrue(Verify.contains("-a", args), Phrase.COMMAND_ADD_CONFIRMATION_ARGUMENT.parse(Phrase.WARN_REWRITE.parse(args[1])), sender)) {
return true; return true;
} }
@ -81,20 +83,25 @@ public class ManageRestoreCommand extends SubCommand {
if (containsDBFileExtension) { if (containsDBFileExtension) {
backupDBName = backupDBName.replace(".db", ""); backupDBName = backupDBName.replace(".db", "");
} }
SQLiteDB backupDB = new SQLiteDB(plugin, backupDBName); SQLiteDB backupDB = new SQLiteDB(plugin, backupDBName);
if (!backupDB.init()) { if (!backupDB.init()) {
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE.toString()); sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE.toString());
return; return;
} }
sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse()); sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse());
final Collection<UUID> uuids = ManageUtils.getUUIDS(backupDB); final Collection<UUID> uuids = ManageUtils.getUUIDS(backupDB);
if (!Check.isTrue(!Verify.isEmpty(uuids), Phrase.MANAGE_ERROR_NO_PLAYERS + " (" + backupDBName + ")", sender)) { if (!Check.isTrue(!Verify.isEmpty(uuids), Phrase.MANAGE_ERROR_NO_PLAYERS + " (" + backupDBName + ")", sender)) {
return; return;
} }
if (ManageUtils.clearAndCopy(database, backupDB, uuids)) { if (ManageUtils.clearAndCopy(database, backupDB, uuids)) {
if (database.getConfigName().equals(plugin.getDB().getConfigName())) { if (database.getConfigName().equals(plugin.getDB().getConfigName())) {
plugin.getHandler().getCommandUseFromDb(); plugin.getHandler().getCommandUseFromDb();
} }
sender.sendMessage(Phrase.MANAGE_COPY_SUCCESS.toString()); sender.sendMessage(Phrase.MANAGE_COPY_SUCCESS.toString());
} else { } else {
sender.sendMessage(Phrase.MANAGE_PROCESS_FAIL.toString()); sender.sendMessage(Phrase.MANAGE_PROCESS_FAIL.toString());

View File

@ -37,7 +37,6 @@ public class WebListUsersCommand extends SubCommand {
try { try {
ColorScheme cs = plugin.getColorScheme(); ColorScheme cs = plugin.getColorScheme();
String mCol = cs.getMainColor(); String mCol = cs.getMainColor();
String sCol = cs.getSecondaryColor();
List<WebUser> users = plugin.getDB().getSecurityTable().getUsers(); List<WebUser> users = plugin.getDB().getSecurityTable().getUsers();
users.sort(new WebUserComparator()); users.sort(new WebUserComparator());
sender.sendMessage(Phrase.CMD_FOOTER.parse() + mCol + " WebUsers (" + users.size() + ")"); sender.sendMessage(Phrase.CMD_FOOTER.parse() + mCol + " WebUsers (" + users.size() + ")");

View File

@ -53,10 +53,10 @@ public class GamemodePart extends RawData<GamemodePart> {
long[] times = new long[]{ long[] times = new long[]{
survivalTime, creativeTime, adventureTime, spectatorTime survivalTime, creativeTime, adventureTime, spectatorTime
}; };
String col0 = Settings.HCOLOR_GMP_0 + ""; String col0 = Settings.HCOLOR_GMP_0.toString();
String col1 = Settings.HCOLOR_GMP_1 + ""; String col1 = Settings.HCOLOR_GMP_1.toString();
String col2 = Settings.HCOLOR_GMP_2 + ""; String col2 = Settings.HCOLOR_GMP_2.toString();
String col3 = Settings.HCOLOR_GMP_3 + ""; String col3 = Settings.HCOLOR_GMP_3.toString();
addValue("%gm0col%", col0); addValue("%gm0col%", col0);
addValue("%gm1col%", col1); addValue("%gm1col%", col1);

View File

@ -87,7 +87,5 @@ public class GeolocationCacheHandler {
} finally { } finally {
Benchmark.stop("getUncachedCountry"); Benchmark.stop("getUncachedCountry");
} }
} }
} }

View File

@ -6,11 +6,12 @@ import main.java.com.djrapitops.plan.data.handling.info.DeathInfo;
import main.java.com.djrapitops.plan.data.handling.info.KillInfo; import main.java.com.djrapitops.plan.data.handling.info.KillInfo;
import main.java.com.djrapitops.plan.utilities.MiscUtils; import main.java.com.djrapitops.plan.utilities.MiscUtils;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.*;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityDeathEvent;
/** /**
@ -41,9 +42,21 @@ public class PlanDeathEventListener implements Listener {
public void onDeath(EntityDeathEvent event) { public void onDeath(EntityDeathEvent event) {
long time = MiscUtils.getTime(); long time = MiscUtils.getTime();
LivingEntity dead = event.getEntity(); LivingEntity dead = event.getEntity();
Player killer = dead.getKiller();
boolean killerIsPlayer = killer != null; if (dead instanceof Player) {
if (killerIsPlayer) { handler.addToPool(new DeathInfo(dead.getUniqueId()));
}
EntityDamageEvent entityDamageEvent = dead.getLastDamageCause();
if (!(entityDamageEvent instanceof EntityDamageByEntityEvent)) {
return;
}
EntityDamageByEntityEvent entityDamageByEntityEvent = (EntityDamageByEntityEvent) entityDamageEvent;
Entity killerEntity = entityDamageByEntityEvent.getDamager();
if (killerEntity instanceof Player) {
Player killer = (Player) killerEntity;
Material itemInHand; Material itemInHand;
try { try {
itemInHand = killer.getInventory().getItemInMainHand().getType(); itemInHand = killer.getInventory().getItemInMainHand().getType();
@ -54,10 +67,26 @@ public class PlanDeathEventListener implements Listener {
itemInHand = Material.AIR; itemInHand = Material.AIR;
} }
} }
handler.addToPool(new KillInfo(killer.getUniqueId(), time, dead, itemInHand.name())); handler.addToPool(new KillInfo(killer.getUniqueId(), time, dead, itemInHand.name()));
return;
} }
if (dead instanceof Player) {
handler.addToPool(new DeathInfo(dead.getUniqueId())); if (killerEntity instanceof Wolf) {
Wolf wolf = (Wolf) killerEntity;
if (!wolf.isTamed()) {
return;
}
AnimalTamer owner = wolf.getOwner();
if (!(owner instanceof Player)) {
return;
}
handler.addToPool(new KillInfo(owner.getUniqueId(), time, dead, "Wolf"));
} }
} }
} }

View File

@ -75,8 +75,8 @@ public class TPSCountTimer extends AbsRunnable {
Runtime runtime = Runtime.getRuntime(); Runtime runtime = Runtime.getRuntime();
long totalMemory = runtime.totalMemory() / 1024L; long totalMemory = runtime.totalMemory();
long usedMemory = totalMemory - runtime.freeMemory() / 1024L; long usedMemory = (totalMemory - runtime.freeMemory()) / (1024L * 1024L);
int playersOnline = plugin.getServer().getOnlinePlayers().size(); int playersOnline = plugin.getServer().getOnlinePlayers().size();
int loadedChunks = getLoadedChunks(); int loadedChunks = getLoadedChunks();