Remove unused methods

Now supports wolf kills (issue #146)
This commit is contained in:
Fuzzlemann 2017-07-27 14:41:48 +02:00
parent 2df8e7a4a2
commit 845a991308
6 changed files with 223 additions and 221 deletions

View File

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

View File

@ -13,9 +13,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.HtmlUtils;
import main.java.com.djrapitops.plan.utilities.MiscUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandException;
/**
* This subcommand is used to run the analysis and access the /server link.
@ -130,12 +128,4 @@ public class AnalyzeCommand extends SubCommand {
}
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

@ -15,9 +15,7 @@ import main.java.com.djrapitops.plan.utilities.Check;
import main.java.com.djrapitops.plan.utilities.HtmlUtils;
import main.java.com.djrapitops.plan.utilities.MiscUtils;
import main.java.com.djrapitops.plan.utilities.uuid.UUIDUtility;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandException;
import java.sql.SQLException;
import java.util.UUID;
@ -135,12 +133,4 @@ public class InspectCommand extends SubCommand {
sender.sendMessage(Phrase.CMD_FOOTER + "");
}
@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

@ -10,8 +10,6 @@ import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.command.ConditionUtils;
import main.java.com.djrapitops.plan.utilities.Check;
import main.java.com.djrapitops.plan.utilities.HtmlUtils;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandException;
/**
* Command used to display link to the player list webpage.
@ -60,12 +58,4 @@ public class ListCommand extends SubCommand {
}
sender.sendMessage(Phrase.CMD_FOOTER + "");
}
@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

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

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.utilities.MiscUtils;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
/**
@ -41,9 +42,21 @@ public class PlanDeathEventListener implements Listener {
public void onDeath(EntityDeathEvent event) {
long time = MiscUtils.getTime();
LivingEntity dead = event.getEntity();
Player killer = dead.getKiller();
boolean killerIsPlayer = killer != null;
if (killerIsPlayer) {
if (dead instanceof Player) {
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;
try {
itemInHand = killer.getInventory().getItemInMainHand().getType();
@ -54,10 +67,26 @@ public class PlanDeathEventListener implements Listener {
itemInHand = Material.AIR;
}
}
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"));
}
}
}