fix: court bug which kills yall & disable pvp

This commit is contained in:
hexlocation pc 2024-07-24 19:32:22 +02:00
parent 80cf17d14a
commit 55fc458c02
2 changed files with 18 additions and 1 deletions

View file

@ -13,12 +13,29 @@ import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class Court implements Listener,CommandExecutor{ public class Court implements Listener,CommandExecutor{
private World court_world = Bukkit.getWorld("court"); private World court_world = Bukkit.getWorld("court");
private Location court_location = new Location(court_world, 4.5, 70.0, 0.5, -90f, 1.0f); private Location court_location = new Location(court_world, 4.5, 70.0, 0.5, -90f, 1.0f);
@EventHandler
public void PlayerHurt(EntityDamageEvent e) {
if (!(e.getEntity() instanceof Player)) return;
Player p = (Player) e.getEntity();
if (!p.getLocation().getWorld().getName().equals("court")) return;
e.setCancelled(true);
if (e.getCause() == DamageCause.VOID) {
p.teleport(court_location);
return;
}
}
@EventHandler @EventHandler
public void PlayerBreak(BlockBreakEvent e) { public void PlayerBreak(BlockBreakEvent e) {
if (e.getPlayer().isOp()) return; if (e.getPlayer().isOp()) return;

View file

@ -58,8 +58,8 @@ public class Discord extends ListenerAdapter {
public void onReady(ReadyEvent e) { public void onReady(ReadyEvent e) {
this.channel = bot.getTextChannelById(channelId); this.channel = bot.getTextChannelById(channelId);
String webhook_token = civilCore.getConfig().getString("discord.webhook.token"); String webhook_token = civilCore.getConfig().getString("discord.webhook.token");
Long webhook_id = Long.parseLong(civilCore.getConfig().getString("discord.webhook.id"));
if (webhook_token != null) { if (webhook_token != null) {
Long webhook_id = Long.parseLong(civilCore.getConfig().getString("discord.webhook.id"));
this.webhook = new WebhookClientBuilder(webhook_id, webhook_token).build(); this.webhook = new WebhookClientBuilder(webhook_id, webhook_token).build();
} else { } else {
channel.createWebhook("CivilBot").queue((hook) -> { channel.createWebhook("CivilBot").queue((hook) -> {