Added `minealert.ignore` permission (#13)
Added `minealert.ignore` perm + `minealert.ignore.ore` ignores ore alerts generated by the user + `minealert.ignore.grief` ignores grief alerts generated by the user + `minealert.ignore` ignores all alerts generated by the user Co-authored-by: Joey Hines <joey@ahines.net> Reviewed-on: https://git.etztech.xyz/Minecraft/MineAlert/pulls/13 Reviewed-by: Etzelia <etzelia@noreply.example.org> Co-Authored-By: ZeroHD <joey@ahines.net> Co-Committed-By: ZeroHD <joey@ahines.net>master
parent
d9e916e7b2
commit
78791c6ee2
src/main
java/xyz/etztech/minealert
resources
8
pom.xml
8
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<groupId>xyz.etztech</groupId>
|
||||
<artifactId>MineAlert</artifactId>
|
||||
<!-- Version is used in plugin.yml -->
|
||||
<version>0.0.4</version>
|
||||
<version>0.0.5</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<!-- Plugin Information -->
|
||||
|
@ -31,13 +31,13 @@
|
|||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
||||
<version>1.16.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xyz.etztech</groupId>
|
||||
<artifactId>javacord</artifactId>
|
||||
<version>0.2.0</version>
|
||||
<version>0.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
|
@ -58,7 +58,7 @@
|
|||
</repository>
|
||||
<repository>
|
||||
<id>etztech-repo</id>
|
||||
<url>http://repo.etztech.xyz/</url>
|
||||
<url>https://repo.etztech.xyz/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>mvn-repo</id>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package xyz.etztech.minealert;
|
||||
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import xyz.etztech.minealert.commands.AlertMute;
|
||||
import xyz.etztech.minealert.commands.MainCommand;
|
||||
|
@ -66,5 +67,9 @@ public class MineAlert extends JavaPlugin {
|
|||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
static public Boolean hasIgnoreAlertPerm(Player player, MuteType muteType) {
|
||||
return player.hasPermission("minealert.ignore") || player.hasPermission(muteType.getMetadataValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
public enum MuteType {
|
||||
OREALERT_MUTE("MineAlert.OreAlert"),
|
||||
GRIEFALERT_MUTE("MineAlert.GriefAlert");
|
||||
OREALERT_MUTE("minealert.ignore.ore"),
|
||||
GRIEFALERT_MUTE("minealert.ignore.grief");
|
||||
|
||||
private final String metadataValue;
|
||||
|
||||
|
|
|
@ -46,6 +46,10 @@ public class GriefAlertListener implements Listener {
|
|||
}
|
||||
|
||||
public void addAlert(Player player, Location eventLocation, Lang lang) {
|
||||
if (MineAlert.hasIgnoreAlertPerm(player, MuteType.GRIEFALERT_MUTE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = player.getName();
|
||||
String alert = lang.getMessage(playerName);
|
||||
purge();
|
||||
|
|
|
@ -45,6 +45,7 @@ public class OreAlertListener implements Listener {
|
|||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if (MineAlert.hasIgnoreAlertPerm(event.getPlayer(), MuteType.OREALERT_MUTE)) return;
|
||||
if (cache.contains(event.getBlock().getLocation())) return;
|
||||
if (!isMaterialTracked(event.getBlock().getType())) return;
|
||||
|
||||
|
|
|
@ -22,3 +22,16 @@ permissions:
|
|||
minealert.alert_mute:
|
||||
description: Ability to mute alerts
|
||||
default: op
|
||||
minealert.ignore:
|
||||
description: Ignore all alerts for this player
|
||||
default: op
|
||||
children:
|
||||
minealert.ignore.grief: true
|
||||
minealert.ignore.ore: true
|
||||
minealert.ignore.grief:
|
||||
description: Ignore grief alerts for this player
|
||||
default: op
|
||||
minealert.ignore.ore:
|
||||
description: Ignore ore alerts for this player
|
||||
default: op
|
||||
|
||||
|
|
Loading…
Reference in New Issue