mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-23 01:27:37 +00:00
Band aid fix
This commit is contained in:
parent
6071567eb3
commit
def099c3a3
@ -1,6 +1,7 @@
|
|||||||
package dev.plex.listener.impl;
|
package dev.plex.listener.impl;
|
||||||
|
|
||||||
import dev.plex.Plex;
|
import dev.plex.Plex;
|
||||||
|
import dev.plex.cache.DataUtils;
|
||||||
import dev.plex.cache.player.PlayerCache;
|
import dev.plex.cache.player.PlayerCache;
|
||||||
import dev.plex.listener.PlexListener;
|
import dev.plex.listener.PlexListener;
|
||||||
import dev.plex.player.PlexPlayer;
|
import dev.plex.player.PlexPlayer;
|
||||||
@ -12,6 +13,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -19,11 +21,12 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
|
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class WorldListener extends PlexListener
|
public class WorldListener extends PlexListener
|
||||||
{
|
{
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockPlace(BlockPlaceEvent e)
|
public void onBlockPlace(BlockPlaceEvent e)
|
||||||
{
|
{
|
||||||
@ -118,6 +121,18 @@ public class WorldListener extends PlexListener
|
|||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Add an entry setting in the config.yml and allow checking for all worlds
|
||||||
|
@EventHandler
|
||||||
|
public void onWorldTeleport(PlayerTeleportEvent e)
|
||||||
|
{
|
||||||
|
final World adminworld = Bukkit.getWorld("adminworld");
|
||||||
|
PlexPlayer plexPlayer = DataUtils.getPlayer(e.getPlayer().getUniqueId());
|
||||||
|
if (e.getTo().getWorld().equals(adminworld) && !plexPlayer.isAdminActive())
|
||||||
|
{
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean checkLevel(PlexPlayer player, String[] requiredList)
|
private boolean checkLevel(PlexPlayer player, String[] requiredList)
|
||||||
{
|
{
|
||||||
PlexLog.debug("Checking world required levels " + Arrays.toString(requiredList));
|
PlexLog.debug("Checking world required levels " + Arrays.toString(requiredList));
|
||||||
|
Loading…
Reference in New Issue
Block a user