9 Commits

Author SHA1 Message Date
urtypicalblahajlunatic
c5be759ce9 little ownership update 2026-07-07 18:03:55 +02:00
urtypicalblahajlunatic
5a6b5a7f89 message that endercrystals explode now 2026-07-07 12:03:49 +02:00
7d3363812f Merge pull request 'changed Armorstand Logic' (#3) from armorstand-DeathLogic into main
Reviewed-on: #3
2026-06-27 14:38:18 +00:00
urtypicalblahajlunatic
1329b616f5 debugged and fixed EntityDeathEvent 2026-06-27 16:21:36 +02:00
urtypicalblahajlunatic
4e65e1bcb2 armorstand changed from EntityHitEvent to EntityDeathEvent, SHOULD cause less fake errors 2026-06-27 14:29:49 +02:00
c89d885fd8 Update src/main/java/net/ardakaz/griefalert/GriefAlert.java
2nd try to frickign update this BS
(also removed cancel stuff)
2026-06-27 10:55:30 +00:00
a61436effa Update src/main/java/net/ardakaz/griefalert/GriefAlert.java
removed some unneeded cancel events
2026-06-27 10:48:19 +00:00
ThePindabaas
5913a8060a bump co version + change test to always succeed 2026-06-27 11:45:36 +02:00
48fd811f2a Merge pull request 'add-gradle project' (#1) from add-gradle into main
Reviewed-on: #1
2026-06-27 09:33:29 +00:00
3 changed files with 54 additions and 9 deletions

View File

@@ -20,7 +20,7 @@ repositories{
dependencies {
compileOnly "io.papermc.paper:paper-api:26.1.2.build.72-stable"
compileOnly "net.coreprotect:coreprotect:23.1"
compileOnly "net.coreprotect:coreprotect:23.2"
testImplementation(platform('org.junit:junit-bom:5.10.5'))
testImplementation('org.junit.jupiter:junit-jupiter')

View File

@@ -29,6 +29,7 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.projectiles.ProjectileSource;
import java.sql.*;
import java.util.Arrays;
@@ -272,15 +273,14 @@ public class GriefAlert extends JavaPlugin implements Listener {
// Armor Stand break alerts
@EventHandler(ignoreCancelled = true)
public void onArmorStandBreak(EntityDamageByEntityEvent event) {
public void onArmorStandBreak(EntityDeathEvent event) {
if (!(event.getEntity() instanceof ArmorStand armorStand)) return;
if (!(event.getDamager() instanceof Player player)) return;
if(!(event.getDamageSource().getCausingEntity() instanceof Player player)) return;
int x = armorStand.getLocation().getBlockX();
int y = armorStand.getLocation().getBlockY();
int z = armorStand.getLocation().getBlockZ();
String worldName = armorStand.getWorld().getName();
if (isLocationIgnored(x, y, z, worldName)) {
event.setCancelled(true);
return;
}
String playerName = player.getName();
@@ -289,6 +289,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
String message = ChatColor.GRAY + playerName + " broke an armor stand placed by " + target + " at " + x + " " + y + " " + z + getHumanWorldName(worldName);
alert(message, playerName, "[Map Link](" + MAP_LINK + "/?worldname=" + worldName + "&zoom=7&x=" + x + "&y=" + y + "&z=" + z + ")", target, x, y, z, worldName);
}
}
// Armor Stand item interaction alerts
@@ -301,7 +302,6 @@ public class GriefAlert extends JavaPlugin implements Listener {
int z = armorStand.getLocation().getBlockZ();
String worldName = armorStand.getWorld().getName();
if (isLocationIgnored(x, y, z, worldName)) {
event.setCancelled(true);
return;
}
String target = inspectBlock(armorStand.getLocation().getBlock(), player);
@@ -348,7 +348,6 @@ public class GriefAlert extends JavaPlugin implements Listener {
int z = frame.getLocation().getBlockZ();
String worldName = frame.getWorld().getName();
if (isLocationIgnored(x, y, z, worldName)) {
event.setCancelled(true);
return;
}
String target = inspectBlock(frame.getLocation().getBlock(), player);
@@ -387,7 +386,6 @@ public class GriefAlert extends JavaPlugin implements Listener {
String worldName = frame.getWorld().getName();
if (isLocationIgnored(x, y, z, worldName)) {
event.setCancelled(true);
return;
}
@@ -415,7 +413,6 @@ public class GriefAlert extends JavaPlugin implements Listener {
String worldName = loc.getWorld().getName();
if (isLocationIgnored(x, y, z, worldName)) {
event.setCancelled(true);
return;
}
String target = inspectBlock(loc.getBlock(), player);
@@ -815,6 +812,54 @@ public class GriefAlert extends JavaPlugin implements Listener {
}, 1L);
}
//Ender Crystal shenanigans
@EventHandler
public void onEndCrystalDeath(EntityDamageByEntityEvent event){
//if its not an endercrystal it should not do logic for enderCrystal
if(!(event.getEntity() instanceof EnderCrystal)) return;
Location loc = event.getEntity().getLocation();
int x = loc.getBlockX();
int y = loc.getBlockY();
int z = loc.getBlockZ();
String world = loc.getWorld().getName();
//Placeholder
Player damager = null;
//if its a Player then its a player (damage is like sword or fist or whatever)
if(event.getDamager() instanceof Player player){
damager = player;
//if its not hit by a player, its from a projectile which we need ownership off
}else if(event.getDamager() instanceof Projectile projectile){
ProjectileSource source = projectile.getShooter();
if(source instanceof Player player){
damager = player;
}
}
if(damager == null){
return; //idk what it is, (i do) but it wasnt a player
}
if (isLocationIgnored(x, y, z, world)) {
return;
}
Block block = loc.getBlock();
String target = inspectBlock(block, damager);
if (target == null) return;
//cuz Blåhaj is cute so if you damage your own stuff u gucci
if (target.equals(damager.getName())) return;
String message = ChatColor.GRAY + damager.getName() + " destroyed an ender crystal owned by " + target + " at " + x + " " + y + " " + z;
alert(message, damager.getName(), "[Map Link](" + MAP_LINK + "/?worldname=" + world + "&zoom=7&x=" + x + "&y=" + y + "&z=" + z + ")", target, x, y, z, world);
}
private CoreProtectAPI getCoreProtect() {
Plugin plugin = getServer().getPluginManager().getPlugin("CoreProtect");

View File

@@ -7,6 +7,6 @@ import static org.junit.jupiter.api.Assertions.*;
class GriefAlertTest {
@Test
public void placeholderTest() {
assertTrue(false);
assertTrue(true);
}
}