CMI sucks

This commit is contained in:
2026-06-21 07:43:22 -04:00
parent 4d6fb8b213
commit 226dae83ef
7 changed files with 24 additions and 13 deletions
@@ -42,7 +42,6 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
private final Map<UUID, BukkitTask> expiryTasks = new HashMap<>();
private final Map<UUID, Boolean> previousAllowFlight = new HashMap<>();
private final Set<UUID> notifyToggledOff = new HashSet<>();
private final Set<UUID> combatLogged = new HashSet<>();
private final List<KillRewardRule> killRewardRules = new ArrayList<>();
private long combatDurationTicks;
@@ -75,6 +74,7 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
private boolean combatLogClearInventoryOnLogout;
private boolean combatLogKillPlayerOnLogout;
private boolean combatLogLightningEffect;
private List<String> combatLogConsoleCommands;
private boolean notificationsEnabled;
private boolean notifyConsole;
@@ -136,7 +136,6 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
combatUntil.clear();
previousAllowFlight.clear();
notifyToggledOff.clear();
combatLogged.clear();
killRewardRules.clear();
}
@@ -210,9 +209,15 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
this.combatLogEnabled = config.getBoolean("combat-log.enabled", true);
this.combatLogDropInventoryOnLogout = config.getBoolean("combat-log.drop-inventory-on-logout", true);
this.combatLogClearInventoryOnLogout = config.getBoolean("combat-log.clear-inventory-on-logout", true);
this.combatLogClearInventoryOnLogout = config.getBoolean("combat-log.clear-inventory-on-logout", false);
this.combatLogKillPlayerOnLogout = config.getBoolean("combat-log.kill-player-on-logout", false);
this.combatLogLightningEffect = config.getBoolean("combat-log.lightning-effect", false);
this.combatLogConsoleCommands = new ArrayList<>();
for (String command : config.getStringList("combat-log.console-commands")) {
if (command != null && !command.isBlank()) {
combatLogConsoleCommands.add(command);
}
}
this.notificationsEnabled = config.getBoolean("notifications.enabled", true);
this.notifyConsole = config.getBoolean("notifications.notify-console", false);
@@ -400,8 +405,6 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
return;
}
combatLogged.add(player.getUniqueId());
Location location = player.getLocation();
if (combatLogLightningEffect) {
@@ -416,6 +419,8 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
clearPlayerInventory(player);
}
runCombatLogConsoleCommands(player);
if (combatLogKillPlayerOnLogout) {
player.setHealth(0.0);
}
@@ -424,7 +429,6 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
notifyStaff(msgNotifyCombatLog.replace("%player%", player.getName()));
}
player.sendMessage(withPrefix(msgCombatLogSelf));
clearCombatState(player.getUniqueId());
}
@@ -455,10 +459,6 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (combatLogged.remove(player.getUniqueId())) {
clearPlayerInventory(player);
}
if (!disableFlightOnJoinIfTagged) {
return;
}
@@ -595,6 +595,13 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
player.updateInventory();
}
private void runCombatLogConsoleCommands(Player player) {
for (String rawCommand : combatLogConsoleCommands) {
String finalCommand = rawCommand.replace("%player%", player.getName());
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), finalCommand);
}
}
private void clearCombatState(UUID uuid) {
combatUntil.remove(uuid);
+3 -1
View File
@@ -63,9 +63,11 @@ kill-rewards:
combat-log:
enabled: true
drop-inventory-on-logout: true
clear-inventory-on-logout: true
clear-inventory-on-logout: false
kill-player-on-logout: false
lightning-effect: false
console-commands:
- "cmi clear %player%"
notifications:
enabled: true
Binary file not shown.
+3 -1
View File
@@ -63,9 +63,11 @@ kill-rewards:
combat-log:
enabled: true
drop-inventory-on-logout: true
clear-inventory-on-logout: true
clear-inventory-on-logout: false
kill-player-on-logout: false
lightning-effect: false
console-commands:
- "cmi clear %player%"
notifications:
enabled: true
+1 -1
View File
@@ -1,5 +1,5 @@
#Generated by Maven
#Sat Jun 20 12:16:51 EDT 2026
#Sun Jun 21 07:37:02 EDT 2026
artifactId=DirtPVP
groupId=com.bitnix
version=1.0