Fixed bug where when both keep inventory and force mob drop were enabled players would both keep their inventory and drop copies.
This commit is contained in:
1 parent
e5c67b7113
commit
bdb8b23417
2 files changed
+20
-1
No files matched your search
@@ -8,7 +8,7 @@
|
|||||||
<groupId>com.rsscripting</groupId>
|
<groupId>com.rsscripting</groupId>
|
||||||
<artifactId>RS-ServerAdmin</artifactId>
|
<artifactId>RS-ServerAdmin</artifactId>
|
||||||
<name>RS-ServerAdmin</name>
|
<name>RS-ServerAdmin</name>
|
||||||
<version>1.0.1</version>
|
<version>1.2.0</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>21</java.version>
|
<java.version>21</java.version>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.rsscripting.serveradmin.RSServerAdmin;
|
|||||||
import com.rsscripting.serveradmin.dao.MobEquipmentDropSettingsDAO;
|
import com.rsscripting.serveradmin.dao.MobEquipmentDropSettingsDAO;
|
||||||
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
@@ -20,6 +21,24 @@ public class MobEquipmentDropListener implements Listener {
|
|||||||
LivingEntity entity =
|
LivingEntity entity =
|
||||||
event.getEntity();
|
event.getEntity();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prevent player equipment duplication.
|
||||||
|
*/
|
||||||
|
if (entity instanceof Player) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Only apply forced equipment drops when a player
|
||||||
|
* actually killed the mob.
|
||||||
|
*/
|
||||||
|
Player killer =
|
||||||
|
entity.getKiller();
|
||||||
|
|
||||||
|
if (killer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
EntityEquipment equipment =
|
EntityEquipment equipment =
|
||||||
entity.getEquipment();
|
entity.getEquipment();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user