Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc improvements #31

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import de.marcely.bedwars.api.event.arena.RoundEndEvent;
import de.marcely.bedwars.api.game.spawner.Spawner;
import de.marcely.bedwars.tools.Helper;
import de.marcely.bedwars.tools.NMSHelper;
import de.marcely.bedwars.tools.location.XYZ;
import de.marcely.bedwars.tools.location.XYZYP;
import me.metallicgoat.tweaksaddon.MBedwarsTweaksPlugin;
Expand All @@ -21,6 +22,7 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityCreatePortalEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.scheduler.BukkitRunnable;
Expand Down Expand Up @@ -159,8 +161,18 @@ public void onDragonDeath(EntityDeathEvent event) {

// TODO Find a better way... There might not be
// (Possibly remove and use packet to send death effect)
// Hacky way to remove the dragon so the portal never gets created
Bukkit.getScheduler().runTaskLater(MBedwarsTweaksPlugin.getInstance(), this::remove, 20L * 6);
// Hacky way to remove the dragon so the portal never gets created (gets created at tick 200)
if (NMSHelper.get().getVersion() >= 9)
Bukkit.getScheduler().runTaskLater(MBedwarsTweaksPlugin.getInstance(), this::remove, 198L);
}

// This works for 1.8.8, but got broken with 1.9+
@EventHandler
public void onEntityCreatePortalEvent(EntityCreatePortalEvent event) {
if (event.getEntity() != dragon)
return;

event.setCancelled(true);
}

private void updateTarget() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import de.marcely.bedwars.tools.location.XYZYP;
import me.metallicgoat.tweaksaddon.config.MainConfig;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand All @@ -18,9 +17,7 @@ public class LockTeamChest implements Listener {
// Many people will want team chests disabled, use this with only regular chests
@EventHandler
public void playerOpenArenaChest(PlayerOpenArenaChestEvent event) {
final Block teamChestBlock = event.getChestBlock();

if (!MainConfig.lock_team_chest_enabled || teamChestBlock.getType() == Material.ENDER_CHEST)
if (!MainConfig.lock_team_chest_enabled || !event.isTeamChest())
return;

final Arena arena = event.getArena();
Expand Down
Loading