mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Do not allow shop creation if player can't interact with the chest
This commit is contained in:
1 parent
9ab80adc58
commit
6a5ce52dea
2 files changed
+10
-1
No files matched your search
@@ -11,12 +11,15 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
@@ -287,6 +290,12 @@ public class QS implements CommandExecutor {
|
||||
Block b = bIt.next();
|
||||
|
||||
if (Util.canBeShop(b)) {
|
||||
PlayerInteractEvent e = new PlayerInteractEvent(p, Action.LEFT_CLICK_BLOCK, item, b, BlockFace.UP);
|
||||
Bukkit.getPluginManager().callEvent(e);
|
||||
if (e.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!plugin.getShopManager().canBuildShop(p, b, Util.getYawFace(p.getLocation().getYaw()))) {
|
||||
// As of the new checking system, most plugins will tell the
|
||||
// player why they can't create a shop there.
|
||||
|
||||
@@ -101,7 +101,7 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
// Handles creating shops
|
||||
else if (shop == null && item != null && item.getType() != Material.AIR && p.hasPermission("quickshop.create.sell") && Util.canBeShop(b) && p.getGameMode() != GameMode.CREATIVE && (plugin.sneakCreate == false || p.isSneaking())) {
|
||||
else if (!e.isCancelled() && shop == null && item != null && item.getType() != Material.AIR && p.hasPermission("quickshop.create.sell") && Util.canBeShop(b) && p.getGameMode() != GameMode.CREATIVE && (plugin.sneakCreate == false || p.isSneaking())) {
|
||||
if (!plugin.getShopManager().canBuildShop(p, b, e.getBlockFace())) {
|
||||
// As of the new checking system, most plugins will tell the
|
||||
// player why they can't create a shop there.
|
||||
|
||||
Reference in new issue
Block a user