Updated Secret blocks, fixed snow on grass issues (finally)!

Fixed more commands.
This commit is contained in:
Lesley Dom committed 2020-09-14 14:12:54 +02:00
1 parent 08efc339db
commit bc1d9a0312
4 files changed
+33 -18

No files matched your search

@@ -98,7 +98,9 @@ public final class Main extends JavaPlugin {
getCommand("butil").setExecutor(commandExecutor);
getCommand("banner").setExecutor(commandExecutor);
getCommand("banner").setExecutor(commandExecutor);
getCommand("armorcolor").setExecutor(commandExecutor);
getCommand("secretblocks").setExecutor(commandExecutor);
getCommand("blocks").setExecutor(commandExecutor);
getCommand("n").setExecutor(commandExecutor);
getCommand("nc").setExecutor(commandExecutor);
@@ -63,10 +63,10 @@ public class CommandForwarder implements CommandExecutor {
public CommandForwarder() {
commands = new HashMap<>();
registerCommand(new AdvancedFlyCommand(), "af", "advancedfly");
registerCommand(new BannerCommand(), "banner");
registerCommand(new AdvancedFlyCommand(), "af", "advfly");
registerCommand(new BannerCommand(), "banner", "bm");
registerCommand(new ColorCommand(), "color", "ac", "armorcolor");
registerCommand(new SecretBlockCommand(), "blocks");
registerCommand(new SecretBlockCommand(), "blocks", "secretblocks");
registerCommand(new NoClipCommand(), "noclip", "nc");
registerCommand(new NightVisionCommand(), "nv", "nightvision", "n");
registerCommand(new UtilsCommand(), "butil", "bu");
@@ -26,6 +26,7 @@
package net.arcaniax.buildersutilities.listeners;
import net.arcaniax.buildersutilities.Settings;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPhysicsEvent;
@@ -38,13 +39,25 @@ public class BlockPhysicsListener implements Listener {
@EventHandler
public void onPhysics(BlockPhysicsEvent e) {
if (e.getSourceBlock().getType().isAir()){
if (e.getChangedType().isAir()){
if (e.getBlock().getLocation().getBlockY()>0){
if (e.getBlock().getLocation().add(0, -1, 0).getBlock().getType().name().toLowerCase().contains("grass_block")){
return;
}
}
}
}
if (e.getSourceBlock().getType().name().toLowerCase().contains("snow")){
if (e.getBlock().getLocation().getBlockY()>0){
if (e.getBlock().getLocation().add(0, -1, 0).getBlock().getType().name().toLowerCase().contains("grass_block")){
return;
}
}
}
try {
if (e.getChangedType().name().toLowerCase().contains("chest") ||
e.getChangedType().name().toLowerCase().contains("fence") ||
e.getChangedType().name().toLowerCase().contains("grass_block") ||
e.getChangedType().name().toLowerCase().contains("snow") ||
e.getBlock().getType().name().toLowerCase().contains("snow") ||
e.getBlock().getType().name().toLowerCase().contains("grass_block") ||
e.getChangedType().name().toLowerCase().contains("pane") ||
e.getChangedType().name().toLowerCase().contains("wall") ||
e.getChangedType().name().toLowerCase().contains("bar")) {
@@ -25,6 +25,7 @@
package net.arcaniax.buildersutilities.menus;
import net.arcaniax.buildersutilities.Main;
import net.arcaniax.buildersutilities.menus.inv.ClickableItem;
import net.arcaniax.buildersutilities.menus.inv.content.InventoryContents;
import net.arcaniax.buildersutilities.menus.inv.content.InventoryProvider;
@@ -35,21 +36,20 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class SecretBlockMenuProvider implements InventoryProvider {
private static final ItemStack SPAWNER = Items.create(Material.SPAWNER, (short) 0, 1, ChatColor.DARK_AQUA + "Pig Spawner", "");
private static final ItemStack BARRIER = Items.create(Material.BARRIER, (short) 0, 1, ChatColor.DARK_AQUA + "Barrier", "");
private static final ItemStack DRAGON_EGG = Items.create(Material.DRAGON_EGG, (short) 0, 1, ChatColor.DARK_AQUA + "Dragon Egg", "");
private static final ItemStack STRUCTURE_BLOCK = Items.create(Material.STRUCTURE_BLOCK, (short) 0, 1, ChatColor.DARK_AQUA + "Structure Block", "");
private static final ItemStack SPAWNER = Items.create(Material.SPAWNER, (short) 0, 1, ChatColor.BLUE + "Spawner", "");
private static final ItemStack BARRIER = Items.create(Material.BARRIER, (short) 0, 1, ChatColor.RED + "Barrier", "");
private static final ItemStack DRAGON_EGG = Items.create(Material.DRAGON_EGG, (short) 0, 1, ChatColor.LIGHT_PURPLE + "Dragon Egg", "");
private static final ItemStack STRUCTURE_VOID = Items.create(Material.STRUCTURE_VOID, (short) 0, 1, ChatColor.DARK_AQUA + "Structure Void", "");
private static final ItemStack DEBUG_STICK = Items.create(Material.DEBUG_STICK, (short) 0, 1, ChatColor.DARK_AQUA + "Debug Stick", "&7Only works as operator in creative.");
private static final ItemStack DEBUG_STICK = Items.create(Material.DEBUG_STICK, (short) 0, 1, ChatColor.AQUA + "Debug Stick", "");
@Override
public void init(Player player, InventoryContents contents) {
contents.set(0, 0, ClickableItem.of(SPAWNER, inventoryClickEvent -> player.getInventory().addItem(new ItemStack(Material.SPAWNER))));
contents.set(0, 1, ClickableItem.of(BARRIER, inventoryClickEvent -> player.getInventory().addItem(new ItemStack(Material.BARRIER))));
contents.set(0, 2, ClickableItem.of(DRAGON_EGG, inventoryClickEvent -> player.getInventory().addItem(new ItemStack(Material.DRAGON_EGG))));
contents.set(0, 3, ClickableItem.of(STRUCTURE_BLOCK, inventoryClickEvent -> player.getInventory().addItem(new ItemStack(Material.STRUCTURE_BLOCK))));
contents.set(0, 4, ClickableItem.of(STRUCTURE_VOID, inventoryClickEvent -> player.getInventory().addItem(new ItemStack(Material.STRUCTURE_VOID))));
contents.set(0, 5, ClickableItem.of(DEBUG_STICK, inventoryClickEvent -> player.getInventory().addItem(new ItemStack(Material.DEBUG_STICK))));
contents.set(0, 0, ClickableItem.of(DEBUG_STICK, inventoryClickEvent -> player.getInventory().addItem(DEBUG_STICK)));
contents.set(0, 1, ClickableItem.of(SPAWNER, inventoryClickEvent -> player.getInventory().addItem(SPAWNER)));
contents.set(0, 2, ClickableItem.of(BARRIER, inventoryClickEvent -> player.getInventory().addItem(BARRIER)));
contents.set(0, 3, ClickableItem.of(STRUCTURE_VOID, inventoryClickEvent -> player.getInventory().addItem(STRUCTURE_VOID)));
contents.set(0, 4, ClickableItem.of(DRAGON_EGG, inventoryClickEvent -> player.getInventory().addItem(DRAGON_EGG)));
}
}