fix op permissions, reduce false positives, improve messaging

This commit is contained in:
JohnTotonchi
2026-01-25 13:30:15 -05:00
parent 1bfc528108
commit e642d4cac1
11 changed files with 25 additions and 11 deletions

View File

@@ -59,9 +59,8 @@ public class ChatAlertManager {
}
}
plugin.getLogger().info("Chat alert sent: " + event.getDetectionType() + " at " +
event.getWorld().getName() + ":" + event.getCenter().getBlockX() + "," +
event.getCenter().getBlockY() + "," + event.getCenter().getBlockZ());
// Log the same formatted message to console
plugin.getLogger().info("Chat alert sent: " + message);
}
/**

View File

@@ -34,12 +34,18 @@ public class PermissionManager {
/**
* Check if a player has a specific permission.
* Uses caching for performance.
* OPs automatically have all permissions.
*
* @param player The player to check
* @param permission The permission node to check
* @return true if player has permission, false otherwise
*/
public boolean hasPermission(Player player, String permission) {
// OPs have all permissions
if (player.isOp()) {
return true;
}
UUID playerId = player.getUniqueId();
// Check cache first

View File

@@ -118,7 +118,7 @@ public class WebhookManager {
ObjectNode embed = objectMapper.createObjectNode();
// Embed title and color
embed.put("title", "🚨 Grief Detection Alert");
embed.put("title", "LavaCast Detection");
embed.put("description", String.format(
"**Type:** %s\n" +
"**Confidence:** %.1f%%\n" +
@@ -141,17 +141,27 @@ public class WebhookManager {
embed.put("color", getConfidenceColor(event.getConfidence()));
// Fields for additional information
ObjectNode fields = objectMapper.createObjectNode();
StringBuilder fieldsText = new StringBuilder();
// Nearest players field
if (!event.getNearestPlayers().isEmpty()) {
StringBuilder playersText = new StringBuilder();
fieldsText.append("**Players:**\n");
for (DetectionEvent.NearestPlayerInfo player : event.getNearestPlayers()) {
String gamemode = player.isSurvival() ? "Survival" : "Creative";
playersText.append(String.format("- %s (%.1fm, %s)\n",
fieldsText.append(String.format("- %s (%.1fm, %s)\n",
player.getPlayerName(), player.getDistance(), gamemode));
}
embed.put("fields", playersText.toString());
}
// Teleport command field
String tpCommand = String.format("/tp %d %d %d",
event.getCenter().getBlockX(),
event.getCenter().getBlockY(),
event.getCenter().getBlockZ());
fieldsText.append("\n**Teleport:** `").append(tpCommand).append("`");
if (fieldsText.length() > 0) {
embed.put("fields", fieldsText.toString());
}
// Timestamp

View File

@@ -147,9 +147,8 @@ public class LavaCastDetector implements ModuleManager.DetectionModule, Listener
}
private boolean isRelevantFormation(String blockType) {
return blockType.contains("COBBLESTONE") ||
blockType.contains("STONE") ||
blockType.contains("OBSIDIAN");
// Only detect cobblestone formation to reduce false positives from natural stone/obsidian
return blockType.contains("COBBLESTONE");
}
/**