mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Add combat debug info for player versus player combat /mmodebug
This commit is contained in:
parent
0bf3f98d95
commit
5ea18e8ba7
@ -1,3 +1,5 @@
|
||||
Version 2.1.211
|
||||
Added /mmodebug info for players hitting other players
|
||||
Version 2.1.210
|
||||
Fixed a memory leak involving mob metadata
|
||||
Fixed a potential null pointer exception in InventoryListener
|
||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.210</version>
|
||||
<version>2.1.211-SNAPSHOT</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<scm>
|
||||
|
@ -28,9 +28,11 @@ import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.*;
|
||||
@ -453,6 +455,62 @@ public class EntityListener implements Listener {
|
||||
if(entityDamageEvent.getDamager() instanceof Projectile) {
|
||||
CombatUtils.cleanupArrowMetadata((Projectile) entityDamageEvent.getDamager());
|
||||
}
|
||||
|
||||
if(entityDamageEvent.getEntity() instanceof Player player && entityDamageEvent.getDamager() instanceof Player) {
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
if(mmoPlayer != null) {
|
||||
if(mmoPlayer.isDebugMode()) {
|
||||
player.sendMessage(ChatColor.GOLD + "(mmodebug start of combat report) EntityDamageByEntityEvent DEBUG Info:");
|
||||
player.sendMessage("You are being damaged by another player in this event");
|
||||
player.sendMessage("Damage: " + entityDamageEvent.getDamage());
|
||||
player.sendMessage("Final damage: " + entityDamageEvent.getFinalDamage());
|
||||
player.sendMessage("Your max health: "+player.getAttribute(Attribute.GENERIC_MAX_HEALTH));
|
||||
player.sendMessage("Your current health: "+player.getHealth());
|
||||
|
||||
if(entityDamageEvent instanceof FakeEntityDamageByEntityEvent) {
|
||||
player.sendMessage("This report is for a fake damage event used by mcMMO to test a players permission to hurt another");
|
||||
}
|
||||
|
||||
if(entityDamageEvent instanceof McMMOEntityDamageByRuptureEvent) {
|
||||
player.sendMessage("This report is for a Rupture damage event, which is sent out by mcMMO");
|
||||
}
|
||||
|
||||
if(entityDamageEvent.isCancelled()) {
|
||||
player.sendMessage("Event was cancelled, which means no damage should be done.");
|
||||
}
|
||||
|
||||
player.sendMessage(ChatColor.RED + "(mmodebug end of combat report)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(entityDamageEvent.getDamager() instanceof Player player && entityDamageEvent.getEntity() instanceof Player otherPlayer) {
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
if(mmoPlayer != null) {
|
||||
if(mmoPlayer.isDebugMode()) {
|
||||
player.sendMessage(ChatColor.GOLD + "(mmodebug start of combat report) EntityDamageByEntityEvent DEBUG Info:");
|
||||
player.sendMessage("You are dealing damage to another player in this event");
|
||||
player.sendMessage("Damage: " + entityDamageEvent.getDamage());
|
||||
player.sendMessage("Final damage: " + entityDamageEvent.getFinalDamage());
|
||||
player.sendMessage("Target players max health: "+otherPlayer.getAttribute(Attribute.GENERIC_MAX_HEALTH));
|
||||
player.sendMessage("Target players current health: "+otherPlayer.getHealth());
|
||||
|
||||
if(entityDamageEvent instanceof FakeEntityDamageByEntityEvent) {
|
||||
player.sendMessage("This report is for a fake damage event used by mcMMO to test a players permission to hurt another");
|
||||
}
|
||||
|
||||
if(entityDamageEvent instanceof McMMOEntityDamageByRuptureEvent) {
|
||||
player.sendMessage("This report is for a Rupture damage event, which is sent out by mcMMO");
|
||||
}
|
||||
|
||||
if(entityDamageEvent.isCancelled()) {
|
||||
player.sendMessage("Event was cancelled, which means no damage should be done.");
|
||||
}
|
||||
|
||||
player.sendMessage(ChatColor.RED + "(mmodebug end of combat report)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkParties(Cancellable event, Player defendingPlayer, Player attackingPlayer) {
|
||||
|
Loading…
Reference in New Issue
Block a user