mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-03-12 14:39:12 +01:00
Fixed entities being placed outside of the border
This commit is contained in:
parent
43d31880ec
commit
1e1da915fe
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@ import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandLevel;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
import com.songoda.skyblock.levelling.LevellingManager;
|
||||
import com.songoda.skyblock.limit.LimitManager;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
@ -17,6 +18,8 @@ import com.songoda.skyblock.utils.structure.StructureUtil;
|
||||
import com.songoda.skyblock.utils.version.Materials;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
import com.songoda.skyblock.utils.version.Sounds;
|
||||
import com.songoda.skyblock.world.WorldManager;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
@ -197,6 +200,15 @@ public class Interact implements Listener {
|
||||
level.setMaterialAmount(materials.name(), materialAmount + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the clicked block is outside of the border.
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
org.bukkit.block.Block clickedBlock = event.getClickedBlock();
|
||||
IslandWorld world = worldManager.getIslandWorld(clickedBlock.getWorld());
|
||||
if (!islandManager.isLocationAtIsland(island, clickedBlock.getLocation(), world)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getItem() != null && event.getItem().getType() == Materials.BONE_MEAL.parseMaterial() && !islandManager.hasPermission(player, block.getLocation(), "Place")) {
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
@ -597,7 +609,8 @@ public class Interact implements Listener {
|
||||
|
||||
player.updateInventory();
|
||||
}
|
||||
} else if (event.getItem().getType() == Material.ARMOR_STAND) {
|
||||
} else if (event.getItem().getType() == Material.ARMOR_STAND || event.getItem().getType().name().contains("BOAT")
|
||||
|| event.getItem().getType().name().contains("MINECART")) {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "EntityPlacement")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
|
@ -9,50 +9,50 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class Projectile implements Listener {
|
||||
|
||||
private final SkyBlock skyblock;
|
||||
private final SkyBlock skyblock;
|
||||
|
||||
public Projectile(SkyBlock skyblock) {
|
||||
this.skyblock = skyblock;
|
||||
}
|
||||
public Projectile(SkyBlock skyblock) {
|
||||
this.skyblock = skyblock;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||
if (!(event.getEntity().getShooter() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
@EventHandler
|
||||
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||
org.bukkit.entity.Projectile projectile = event.getEntity();
|
||||
ProjectileSource shooter = projectile.getShooter();
|
||||
if (!(shooter instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getEntity().getShooter();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
Player player = (Player) shooter;
|
||||
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
if (!skyblock.getWorldManager().isIslandWorld(player.getWorld()))
|
||||
return;
|
||||
|
||||
if (skyblock.getWorldManager().isIslandWorld(player.getWorld())) {
|
||||
if (event.getEntity() instanceof FishHook) {
|
||||
if (!skyblock.getIslandManager().hasPermission(player, "Fishing")) {
|
||||
event.setCancelled(true);
|
||||
if (projectile instanceof FishHook) {
|
||||
if (!skyblock.getIslandManager().hasPermission(player, "Fishing")) {
|
||||
event.setCancelled(true);
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
||||
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
||||
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
if (!skyblock.getIslandManager().hasPermission(player, "Projectile")) {
|
||||
event.setCancelled(true);
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
||||
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!skyblock.getIslandManager().hasPermission(player, "Projectile")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
||||
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user