CMI sucks
This commit is contained in:
@@ -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, BukkitTask> expiryTasks = new HashMap<>();
|
||||||
private final Map<UUID, Boolean> previousAllowFlight = new HashMap<>();
|
private final Map<UUID, Boolean> previousAllowFlight = new HashMap<>();
|
||||||
private final Set<UUID> notifyToggledOff = new HashSet<>();
|
private final Set<UUID> notifyToggledOff = new HashSet<>();
|
||||||
private final Set<UUID> combatLogged = new HashSet<>();
|
|
||||||
private final List<KillRewardRule> killRewardRules = new ArrayList<>();
|
private final List<KillRewardRule> killRewardRules = new ArrayList<>();
|
||||||
|
|
||||||
private long combatDurationTicks;
|
private long combatDurationTicks;
|
||||||
@@ -75,6 +74,7 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
|
|||||||
private boolean combatLogClearInventoryOnLogout;
|
private boolean combatLogClearInventoryOnLogout;
|
||||||
private boolean combatLogKillPlayerOnLogout;
|
private boolean combatLogKillPlayerOnLogout;
|
||||||
private boolean combatLogLightningEffect;
|
private boolean combatLogLightningEffect;
|
||||||
|
private List<String> combatLogConsoleCommands;
|
||||||
|
|
||||||
private boolean notificationsEnabled;
|
private boolean notificationsEnabled;
|
||||||
private boolean notifyConsole;
|
private boolean notifyConsole;
|
||||||
@@ -136,7 +136,6 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
|
|||||||
combatUntil.clear();
|
combatUntil.clear();
|
||||||
previousAllowFlight.clear();
|
previousAllowFlight.clear();
|
||||||
notifyToggledOff.clear();
|
notifyToggledOff.clear();
|
||||||
combatLogged.clear();
|
|
||||||
killRewardRules.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.combatLogEnabled = config.getBoolean("combat-log.enabled", true);
|
||||||
this.combatLogDropInventoryOnLogout = config.getBoolean("combat-log.drop-inventory-on-logout", 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.combatLogKillPlayerOnLogout = config.getBoolean("combat-log.kill-player-on-logout", false);
|
||||||
this.combatLogLightningEffect = config.getBoolean("combat-log.lightning-effect", 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.notificationsEnabled = config.getBoolean("notifications.enabled", true);
|
||||||
this.notifyConsole = config.getBoolean("notifications.notify-console", false);
|
this.notifyConsole = config.getBoolean("notifications.notify-console", false);
|
||||||
@@ -400,8 +405,6 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
combatLogged.add(player.getUniqueId());
|
|
||||||
|
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
|
|
||||||
if (combatLogLightningEffect) {
|
if (combatLogLightningEffect) {
|
||||||
@@ -416,6 +419,8 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
|
|||||||
clearPlayerInventory(player);
|
clearPlayerInventory(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runCombatLogConsoleCommands(player);
|
||||||
|
|
||||||
if (combatLogKillPlayerOnLogout) {
|
if (combatLogKillPlayerOnLogout) {
|
||||||
player.setHealth(0.0);
|
player.setHealth(0.0);
|
||||||
}
|
}
|
||||||
@@ -424,7 +429,6 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
|
|||||||
notifyStaff(msgNotifyCombatLog.replace("%player%", player.getName()));
|
notifyStaff(msgNotifyCombatLog.replace("%player%", player.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendMessage(withPrefix(msgCombatLogSelf));
|
|
||||||
clearCombatState(player.getUniqueId());
|
clearCombatState(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,10 +459,6 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
|
|||||||
public void onJoin(PlayerJoinEvent event) {
|
public void onJoin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (combatLogged.remove(player.getUniqueId())) {
|
|
||||||
clearPlayerInventory(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!disableFlightOnJoinIfTagged) {
|
if (!disableFlightOnJoinIfTagged) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -595,6 +595,13 @@ public final class DirtPVPPlugin extends JavaPlugin implements Listener, TabExec
|
|||||||
player.updateInventory();
|
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) {
|
private void clearCombatState(UUID uuid) {
|
||||||
combatUntil.remove(uuid);
|
combatUntil.remove(uuid);
|
||||||
|
|
||||||
|
|||||||
@@ -63,9 +63,11 @@ kill-rewards:
|
|||||||
combat-log:
|
combat-log:
|
||||||
enabled: true
|
enabled: true
|
||||||
drop-inventory-on-logout: true
|
drop-inventory-on-logout: true
|
||||||
clear-inventory-on-logout: true
|
clear-inventory-on-logout: false
|
||||||
kill-player-on-logout: false
|
kill-player-on-logout: false
|
||||||
lightning-effect: false
|
lightning-effect: false
|
||||||
|
console-commands:
|
||||||
|
- "cmi clear %player%"
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -63,9 +63,11 @@ kill-rewards:
|
|||||||
combat-log:
|
combat-log:
|
||||||
enabled: true
|
enabled: true
|
||||||
drop-inventory-on-logout: true
|
drop-inventory-on-logout: true
|
||||||
clear-inventory-on-logout: true
|
clear-inventory-on-logout: false
|
||||||
kill-player-on-logout: false
|
kill-player-on-logout: false
|
||||||
lightning-effect: false
|
lightning-effect: false
|
||||||
|
console-commands:
|
||||||
|
- "cmi clear %player%"
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#Generated by Maven
|
#Generated by Maven
|
||||||
#Sat Jun 20 12:16:51 EDT 2026
|
#Sun Jun 21 07:37:02 EDT 2026
|
||||||
artifactId=DirtPVP
|
artifactId=DirtPVP
|
||||||
groupId=com.bitnix
|
groupId=com.bitnix
|
||||||
version=1.0
|
version=1.0
|
||||||
|
|||||||
Reference in New Issue
Block a user