v0.5.9 - Fixed prison armor dropping upon death.
This commit is contained in:
parent
fb347e7268
commit
ec47789a8c
|
@ -0,0 +1,90 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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>me.NVus</groupId>
|
||||||
|
<artifactId>NVus_Prison_Setup</artifactId>
|
||||||
|
<name>NVus_PrisonSetup</name>
|
||||||
|
<version>0.5.6</version>
|
||||||
|
<url>https://FNGnation.net</url>
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.2.4</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.github.wvengen</groupId>
|
||||||
|
<artifactId>proguard-maven-plugin</artifactId>
|
||||||
|
<version>2.6.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>proguard</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<obfuscate>true</obfuscate>
|
||||||
|
<injar>${project.build.finalName}.jar</injar>
|
||||||
|
<outjar>${project.build.finalName}-proguard.jar</outjar>
|
||||||
|
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||||
|
<proguardInclude>${basedir}/proguard.conf</proguardInclude>
|
||||||
|
<libs>
|
||||||
|
<lib>${java.home}/jmods/java.base.jmod</lib>
|
||||||
|
</libs>
|
||||||
|
<options>
|
||||||
|
<option>-keep public class me.nvus.nvus_prison_setup.PrisonSetup extends org.bukkit.plugin.java.JavaPlugin { *; }</option>
|
||||||
|
<option>-keep public class me.nvus.nvus_prison_setup.PrisonSetup extends org.bukkit.plugin.java.JavaPlugin</option>
|
||||||
|
<option>-overloadaggressively</option>
|
||||||
|
<option>-repackageclasses</option>
|
||||||
|
</options>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>papermc-repo</id>
|
||||||
|
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype</id>
|
||||||
|
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.papermc.paper</groupId>
|
||||||
|
<artifactId>paper-api</artifactId>
|
||||||
|
<version>1.20.4-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
</project>
|
70
pom.xml
70
pom.xml
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<groupId>me.NVus</groupId>
|
<groupId>me.NVus</groupId>
|
||||||
<artifactId>NVus_Prison_Setup</artifactId>
|
<artifactId>NVus_Prison_Setup</artifactId>
|
||||||
<version>0.5.3</version>
|
<version>0.5.9</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>NVus_PrisonSetup</name>
|
<name>NVus_PrisonSetup</name>
|
||||||
|
@ -42,35 +42,35 @@
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<!-- <plugin>-->
|
||||||
<groupId>com.github.wvengen</groupId>
|
<!-- <groupId>com.github.wvengen</groupId>-->
|
||||||
<artifactId>proguard-maven-plugin</artifactId>
|
<!-- <artifactId>proguard-maven-plugin</artifactId>-->
|
||||||
<version>2.6.1</version>
|
<!-- <version>2.6.1</version>-->
|
||||||
<executions>
|
<!-- <executions>-->
|
||||||
<execution>
|
<!-- <execution>-->
|
||||||
<phase>package</phase>
|
<!-- <phase>package</phase>-->
|
||||||
<goals>
|
<!-- <goals>-->
|
||||||
<goal>proguard</goal>
|
<!-- <goal>proguard</goal>-->
|
||||||
</goals>
|
<!-- </goals>-->
|
||||||
</execution>
|
<!-- </execution>-->
|
||||||
</executions>
|
<!-- </executions>-->
|
||||||
<configuration>
|
<!-- <configuration>-->
|
||||||
<obfuscate>true</obfuscate>
|
<!-- <obfuscate>true</obfuscate>-->
|
||||||
<injar>${project.build.finalName}.jar</injar>
|
<!-- <injar>${project.build.finalName}.jar</injar>-->
|
||||||
<outjar>${project.build.finalName}-proguard.jar</outjar>
|
<!-- <outjar>${project.build.finalName}-proguard.jar</outjar>-->
|
||||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
<!-- <outputDirectory>${project.build.directory}</outputDirectory>-->
|
||||||
<proguardInclude>${basedir}/proguard.conf</proguardInclude>
|
<!-- <proguardInclude>${basedir}/proguard.conf</proguardInclude>-->
|
||||||
<libs>
|
<!-- <libs>-->
|
||||||
<lib>${java.home}/jmods/java.base.jmod</lib>
|
<!-- <lib>${java.home}/jmods/java.base.jmod</lib>-->
|
||||||
</libs>
|
<!-- </libs>-->
|
||||||
<options>
|
<!-- <options>-->
|
||||||
<option>-keep public class me.nvus.nvus_prison_setup.PrisonSetup extends org.bukkit.plugin.java.JavaPlugin { *; }</option>
|
<!-- <option>-keep public class me.nvus.nvus_prison_setup.PrisonSetup extends org.bukkit.plugin.java.JavaPlugin { *; }</option>-->
|
||||||
<option>-keep public class me.nvus.nvus_prison_setup.PrisonSetup extends org.bukkit.plugin.java.JavaPlugin</option>
|
<!-- <option>-keep public class me.nvus.nvus_prison_setup.PrisonSetup extends org.bukkit.plugin.java.JavaPlugin</option>-->
|
||||||
<option>-overloadaggressively</option>
|
<!-- <option>-overloadaggressively</option>-->
|
||||||
<option>-repackageclasses</option>
|
<!-- <option>-repackageclasses</option>-->
|
||||||
</options>
|
<!-- </options>-->
|
||||||
</configuration>
|
<!-- </configuration>-->
|
||||||
</plugin>
|
<!-- </plugin>-->
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
<resources>
|
<resources>
|
||||||
|
@ -99,11 +99,11 @@
|
||||||
<version>1.20.4-R0.1-SNAPSHOT</version>
|
<version>1.20.4-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.github.wvengen</groupId>
|
<!-- <groupId>com.github.wvengen</groupId>-->
|
||||||
<artifactId>proguard-maven-plugin</artifactId>
|
<!-- <artifactId>proguard-maven-plugin</artifactId>-->
|
||||||
<version>2.6.1</version>
|
<!-- <version>2.6.1</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.bukkit.Color;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
@ -14,7 +15,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||||
|
|
||||||
public class PlayerSpawn implements Listener {
|
public class PlayerSpawn implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
Player joinedPlayer = event.getPlayer();
|
Player joinedPlayer = event.getPlayer();
|
||||||
|
|
||||||
|
@ -25,18 +26,19 @@ public class PlayerSpawn implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerDeath(PlayerDeathEvent event) {
|
public void onPlayerDeath(PlayerDeathEvent event) {
|
||||||
Player deadPlayer = event.getEntity();
|
Player deadPlayer = event.getEntity();
|
||||||
|
|
||||||
// Check if the player has the permission
|
// Check if the player has the permission
|
||||||
if (deadPlayer.hasPermission("nvus.prisoner")) {
|
if (deadPlayer.hasPermission("nvus.prisoner")) {
|
||||||
// Destroy default prisoner armor
|
// Remove prisoner armor from the list of dropped items
|
||||||
destroyDefaultPrisonerArmor(deadPlayer);
|
event.getDrops().removeIf(drop -> isPrisonerArmor(drop.getType()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
Player respawnedPlayer = event.getPlayer();
|
Player respawnedPlayer = event.getPlayer();
|
||||||
|
|
||||||
|
@ -78,6 +80,40 @@ public class PlayerSpawn implements Listener {
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&',"&6&lYou're a prisoner! &6You've been given the default prisoner armor!"));
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&',"&6&lYou're a prisoner! &6You've been given the default prisoner armor!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy armor upon death etc.
|
||||||
|
private void destroyDefaultPrisonerArmor(Player player) {
|
||||||
|
player.getInventory().setHelmet(null);
|
||||||
|
player.getInventory().setChestplate(null);
|
||||||
|
player.getInventory().setLeggings(null);
|
||||||
|
player.getInventory().setBoots(null);
|
||||||
|
|
||||||
|
// Using this as a debug/check, will comment out later!
|
||||||
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6&lYour default prisoner armor has been destroyed!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isPrisonerArmor(Material material) {
|
||||||
|
return material == Material.LEATHER_HELMET ||
|
||||||
|
material == Material.LEATHER_CHESTPLATE ||
|
||||||
|
material == Material.LEATHER_LEGGINGS ||
|
||||||
|
material == Material.LEATHER_BOOTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
private void destroyDefaultPrisonerArmor(Player player) {
|
||||||
|
player.getInventory().setHelmet(null);
|
||||||
|
player.getInventory().setChestplate(null);
|
||||||
|
player.getInventory().setLeggings(null);
|
||||||
|
player.getInventory().setBoots(null);
|
||||||
|
|
||||||
|
// Using this as a debug/check, will comment out later!
|
||||||
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6&lYour default prisoner armor has been destroyed!"));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
// Destroy armor upon death etc.
|
// Destroy armor upon death etc.
|
||||||
private void destroyDefaultPrisonerArmor(Player player) {
|
private void destroyDefaultPrisonerArmor(Player player) {
|
||||||
// Loop through the armor slots and remove any armor pieces
|
// Loop through the armor slots and remove any armor pieces
|
||||||
|
@ -90,4 +126,5 @@ public class PlayerSpawn implements Listener {
|
||||||
// Using this as a debug/check, will comment out later!
|
// Using this as a debug/check, will comment out later!
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6&lYour default prisoner armor has been destroyed!"));
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6&lYour default prisoner armor has been destroyed!"));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue