Commit 5ede8ccc authored by kellerkindt's avatar kellerkindt
Browse files

Forbid placing black listed blocks for glitched shops (github #8)

parent 07898d85
......@@ -17,6 +17,8 @@
*/
package com.kellerkindt.scs.listeners;
import com.kellerkindt.scs.exceptions.InsufficientPermissionException;
import com.kellerkindt.scs.utilities.Term;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Hanging;
......@@ -44,9 +46,18 @@ public class BlockListener implements Listener{
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled=true)
public void onBlockPlace (BlockPlaceEvent e) {
if ( scs.getShopHandler().isShopBlock(e.getBlock()) ) {
if (scs.getShopHandler().isShopBlock(e.getBlock())) {
// allow placing blocks to restore glitched shops
// e.setCancelled(true);
// still forbid black listed blocks
if (!e.getBlock().getType().isSolid()
|| !e.getBlock().getType().isBlock()
|| scs.getConfiguration().isBlockListBlacklist() == scs.getConfiguration().getBlockListBlocks().contains(e.getBlock().getType().toString())) {
e.setCancelled(true);
scs.sendMessage(e.getPlayer(), Term.BLACKLIST_BLOCK.get());
}
} else if ( scs.getShopHandler().isShopBlock(e.getBlockPlaced().getLocation().subtract(0, 1, 0).getBlock()) ){
//This is the block above.
//CHeck for attchables for the block being placed.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment