Compare commits
5 Commits
c89d885fd8
...
Crystals
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5be759ce9 | ||
|
|
5a6b5a7f89 | ||
| 7d3363812f | |||
|
|
1329b616f5 | ||
|
|
4e65e1bcb2 |
@@ -29,6 +29,7 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -272,9 +273,9 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
// Armor Stand break alerts
|
// Armor Stand break alerts
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onArmorStandBreak(EntityDamageByEntityEvent event) {
|
public void onArmorStandBreak(EntityDeathEvent event) {
|
||||||
if (!(event.getEntity() instanceof ArmorStand armorStand)) return;
|
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 x = armorStand.getLocation().getBlockX();
|
||||||
int y = armorStand.getLocation().getBlockY();
|
int y = armorStand.getLocation().getBlockY();
|
||||||
int z = armorStand.getLocation().getBlockZ();
|
int z = armorStand.getLocation().getBlockZ();
|
||||||
@@ -288,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);
|
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);
|
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
|
// Armor Stand item interaction alerts
|
||||||
@@ -810,6 +812,54 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
}, 1L);
|
}, 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() {
|
private CoreProtectAPI getCoreProtect() {
|
||||||
Plugin plugin = getServer().getPluginManager().getPlugin("CoreProtect");
|
Plugin plugin = getServer().getPluginManager().getPlugin("CoreProtect");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user