Add option to change when a:inventory is logged
This commit is contained in:
Heliosares
2022-10-22 08:39:54 -04:00
parent ad399cd074
commit 40e2bf0ee8
4 changed files with 25 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>AuxProtect</groupId>
<artifactId>AuxProtect</artifactId>
<version>1.2-pre1</version>
<version>1.2-pre2</version>
<name>AuxProtect</name>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>

View File

@@ -60,7 +60,10 @@ public class APConfig {
skipV6Migration = config.getBoolean("skipv6migration");
for (EntryAction action : EntryAction.values()) {
boolean enabled = config.getBoolean("Actions." + action.toString().toLowerCase() + ".Enabled", true);
boolean priority = config.getBoolean("Actions." + action.toString().toLowerCase() + ".LowestPriority",
false);
action.setEnabled(enabled);
action.setLowestpriority(priority);
}
overrideCommands = config.getBoolean("OverrideCommands");
}

View File

@@ -107,6 +107,7 @@ public class EntryAction {
public final int idPos;
public final String name;
private boolean enabled;
private boolean lowestpriority;
private String overridePText;
private String overrideNText;
@@ -256,4 +257,13 @@ public class EntryAction {
EntryAction other = (EntryAction) other_;
return this.id == other.id && this.idPos == other.idPos;
}
public boolean isLowestpriority() {
return lowestpriority;
}
public void setLowestpriority(boolean lowestpriority) {
this.lowestpriority = lowestpriority;
}
}

View File

@@ -218,9 +218,18 @@ public class EntityListener implements Listener {
plugin.add(entry);
}
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerDeathLowest(PlayerDeathEvent e) {
if (EntryAction.INVENTORY.isLowestpriority()) {
plugin.getAPPlayer(e.getEntity()).logInventory("death");
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerDeath(PlayerDeathEvent e) {
plugin.getAPPlayer(e.getEntity()).logInventory("death");
public void onPlayerDeathMonitor(PlayerDeathEvent e) {
if (!EntryAction.INVENTORY.isLowestpriority()) {
plugin.getAPPlayer(e.getEntity()).logInventory("death");
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)