Fixed Physics,commands further and fixes issues with the toggle GUI

This commit is contained in:
Lesley Dom committed 2020-09-09 17:57:04 +02:00
1 parent ca0bea0a26
commit d455f46cc7
5 files changed
+30 -47

No files matched your search

@@ -83,11 +83,6 @@ public final class Main extends JavaPlugin {
this.getServer().getPluginManager().registerEvents(new WeatherChangeListener(), this); this.getServer().getPluginManager().registerEvents(new WeatherChangeListener(), this);
CommandForwarder executor = new CommandForwarder(); CommandForwarder executor = new CommandForwarder();
this.getCommand("bu").setExecutor(executor);
this.getCommand("buildersutils").setExecutor(executor);
this.getCommand("builders").setExecutor(executor);
this.getCommand("utils").setExecutor(executor);
this.getCommand("util").setExecutor(executor);
CommandExecutor commandExecutor = new CommandExecutor() { CommandExecutor commandExecutor = new CommandExecutor() {
@Override @Override
@@ -101,6 +96,8 @@ public final class Main extends JavaPlugin {
} }
}; };
getCommand("butil").setExecutor(commandExecutor);
getCommand("banner").setExecutor(commandExecutor); getCommand("banner").setExecutor(commandExecutor);
getCommand("armorcolor").setExecutor(commandExecutor); getCommand("armorcolor").setExecutor(commandExecutor);
getCommand("blocks").setExecutor(commandExecutor); getCommand("blocks").setExecutor(commandExecutor);
@@ -122,7 +119,6 @@ public final class Main extends JavaPlugin {
getCommand("/derot").setExecutor(commandExecutor); getCommand("/derot").setExecutor(commandExecutor);
getCommand("/scale").setExecutor(commandExecutor); getCommand("/scale").setExecutor(commandExecutor);
getCommand("/twist").setExecutor(commandExecutor); getCommand("/twist").setExecutor(commandExecutor);
getCommand("butil").setExecutor(commandExecutor);
} }
private void startMetrics() { private void startMetrics() {
@@ -48,6 +48,7 @@ import net.arcaniax.buildersutilities.commands.aliases.TwistAliasCommand;
import net.arcaniax.buildersutilities.commands.aliases.ScaleAliasCommand; import net.arcaniax.buildersutilities.commands.aliases.ScaleAliasCommand;
import net.arcaniax.buildersutilities.commands.aliases.WalkSpeedAliasCommand; import net.arcaniax.buildersutilities.commands.aliases.WalkSpeedAliasCommand;
import net.arcaniax.buildersutilities.commands.aliases.FlySpeedAliasCommand; import net.arcaniax.buildersutilities.commands.aliases.FlySpeedAliasCommand;
import org.bukkit.Bukkit;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -62,26 +63,25 @@ public class CommandForwarder implements CommandExecutor {
public CommandForwarder() { public CommandForwarder() {
commands = new HashMap<>(); commands = new HashMap<>();
registerCommand(new HelpCommand(), "help", "h", "?");
registerCommand(new AdvancedFlyCommand(), "af", "advancedfly"); registerCommand(new AdvancedFlyCommand(), "af", "advancedfly");
registerCommand(new BannerCommand(), "banner"); registerCommand(new BannerCommand(), "banner");
registerCommand(new ColorCommand(), "color", "ac", "armorcolor"); registerCommand(new ColorCommand(), "color", "ac", "armorcolor");
registerCommand(new SecretBlockCommand(), "secretblock", "secretblocks", "blocks"); registerCommand(new SecretBlockCommand(), "blocks");
registerCommand(new NoClipCommand(), "noclip", "nc"); registerCommand(new NoClipCommand(), "noclip", "nc");
registerCommand(new NightVisionCommand(), "nv", "nightvision", "n"); registerCommand(new NightVisionCommand(), "nv", "nightvision", "n");
registerCommand(new UtilsCommand(), "utils", "u", "util", "gui", "inventory"); registerCommand(new UtilsCommand(), "butil", "bu");
registerCommand(new PosOneAliasCommand(), "p1", "1", "one", "pos1"); registerCommand(new PosOneAliasCommand(), "/p1", "/1");
registerCommand(new PosTwoAliasCommand(), "p2", "2", "two", "pos2"); registerCommand(new PosTwoAliasCommand(), "/p2", "/2");
registerCommand(new CuboidSelectionAliasCommand(), "cuboid", "cube"); registerCommand(new CuboidSelectionAliasCommand(), "/cub");
registerCommand(new ConvexSelectionAliasCommand(), "convex", "conv"); registerCommand(new ConvexSelectionAliasCommand(), "/con");
registerCommand(new SetAliasCommand(), "set", "s"); registerCommand(new SetAliasCommand(), "/s");
registerCommand(new ReplaceAliasCommand(), "replace", "r", "repl", "rep"); registerCommand(new ReplaceAliasCommand(), "/r");
registerCommand(new PasteAliasCommand(), "paste", "pa"); registerCommand(new PasteAliasCommand(), "/pa");
registerCommand(new FlipAliasCommand(), "flip", "f"); registerCommand(new FlipAliasCommand(), "/f");
registerCommand(new CopyAliasCommand(), "copy", "c", "clone"); registerCommand(new CopyAliasCommand(), "/c");
registerCommand(new DeformRotateAliasCommand(), "deformrotate", "defrot", "dr"); registerCommand(new DeformRotateAliasCommand(), "/derot");
registerCommand(new TwistAliasCommand(), "twist", "tw", "t"); registerCommand(new TwistAliasCommand(), "/twist");
registerCommand(new ScaleAliasCommand(), "scale", "sc"); registerCommand(new ScaleAliasCommand(), "/scale");
registerCommand(new WalkSpeedAliasCommand(), "walkspeed", "ws"); registerCommand(new WalkSpeedAliasCommand(), "walkspeed", "ws");
registerCommand(new FlySpeedAliasCommand(), "flyspeed", "fs"); registerCommand(new FlySpeedAliasCommand(), "flyspeed", "fs");
} }
@@ -101,12 +101,7 @@ public class CommandForwarder implements CommandExecutor {
return false; return false;
} }
if (args.length == 0) { ICommand iCommand = commands.get(s.toLowerCase());
new HelpCommand().execute(player, args);
return true;
}
ICommand iCommand = commands.get(args[0].toLowerCase());
if (iCommand != null) { if (iCommand != null) {
iCommand.execute(player, Arrays.copyOfRange(args, 1, args.length)); iCommand.execute(player, Arrays.copyOfRange(args, 1, args.length));
} }
@@ -34,8 +34,6 @@ import org.bukkit.event.block.BlockPhysicsEvent;
public class BlockPhysicsListener implements Listener { public class BlockPhysicsListener implements Listener {
@EventHandler @EventHandler
public void onPhysics(BlockPhysicsEvent e) { public void onPhysics(BlockPhysicsEvent e) {
Bukkit.broadcastMessage(e.getSourceBlock().getType().name());
Bukkit.broadcastMessage(e.getChangedType().name());
try { try {
if (e.getChangedType().name().toLowerCase().contains("chest") || if (e.getChangedType().name().toLowerCase().contains("chest") ||
e.getChangedType().name().toLowerCase().contains("fence") || e.getChangedType().name().toLowerCase().contains("fence") ||
@@ -66,12 +66,12 @@ public class UtilitiesMenuProvider implements InventoryProvider {
return; return;
} }
if (IronTrapdoorListener.ironTrapdoorIds.contains(player.getUniqueId())) { if (!IronTrapdoorListener.ironTrapdoorIds.contains(player.getUniqueId())) {
setEnabledGlassPanes(1, true, contents); setEnabledGlassPanes(1, true, contents);
contents.set(1, 1, ClickableItem.of(Items.create(Material.IRON_TRAPDOOR, contents.set(1, 1, ClickableItem.of(Items.create(Material.IRON_TRAPDOOR,
"&6Iron Trapdoor Interaction", ENABLED_LORE), "&6Iron Trapdoor Interaction", ENABLED_LORE),
inventoryClickEvent -> { inventoryClickEvent -> {
IronTrapdoorListener.ironTrapdoorIds.remove(player.getUniqueId()); IronTrapdoorListener.ironTrapdoorIds.add(player.getUniqueId());
setIronTrapdoorItem(player, contents); setIronTrapdoorItem(player, contents);
})); }));
} else { } else {
@@ -79,7 +79,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
contents.set(1, 1, ClickableItem.of(Items.create(Material.IRON_TRAPDOOR, contents.set(1, 1, ClickableItem.of(Items.create(Material.IRON_TRAPDOOR,
"&6Iron Trapdoor Interaction", DISABLED_LORE), "&6Iron Trapdoor Interaction", DISABLED_LORE),
inventoryClickEvent -> { inventoryClickEvent -> {
IronTrapdoorListener.ironTrapdoorIds.add(player.getUniqueId()); IronTrapdoorListener.ironTrapdoorIds.remove(player.getUniqueId());
setIronTrapdoorItem(player, contents); setIronTrapdoorItem(player, contents);
})); }));
} }
@@ -93,12 +93,12 @@ public class UtilitiesMenuProvider implements InventoryProvider {
return; return;
} }
if (BlockBreakListener.slabIds.contains(player.getUniqueId())) { if (!BlockBreakListener.slabIds.contains(player.getUniqueId())) {
setEnabledGlassPanes(2, true, contents); setEnabledGlassPanes(2, true, contents);
contents.set(1, 2, ClickableItem.of(Items.create(Material.STONE_SLAB, contents.set(1, 2, ClickableItem.of(Items.create(Material.STONE_SLAB,
"&6Custom Slab Breaking", ENABLED_LORE), "&6Custom Slab Breaking", ENABLED_LORE),
inventoryClickEvent -> { inventoryClickEvent -> {
BlockBreakListener.slabIds.remove(player.getUniqueId()); BlockBreakListener.slabIds.add(player.getUniqueId());
setSlabItem(player, contents); setSlabItem(player, contents);
})); }));
} else { } else {
@@ -106,7 +106,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
contents.set(1, 2, ClickableItem.of(Items.create(Material.STONE_SLAB, contents.set(1, 2, ClickableItem.of(Items.create(Material.STONE_SLAB,
"&6Custom Slab Breaking", DISABLED_LORE), "&6Custom Slab Breaking", DISABLED_LORE),
inventoryClickEvent -> { inventoryClickEvent -> {
BlockBreakListener.slabIds.add(player.getUniqueId()); BlockBreakListener.slabIds.remove(player.getUniqueId());
setSlabItem(player, contents); setSlabItem(player, contents);
})); }));
} }
@@ -120,12 +120,12 @@ public class UtilitiesMenuProvider implements InventoryProvider {
return; return;
} }
if (TerracottaInteractListener.terracottaIds.contains(player.getUniqueId())) { if (!TerracottaInteractListener.terracottaIds.contains(player.getUniqueId())) {
setEnabledGlassPanes(3, true, contents); setEnabledGlassPanes(3, true, contents);
contents.set(1, 3, ClickableItem.of(Items.create(Material.ORANGE_GLAZED_TERRACOTTA, contents.set(1, 3, ClickableItem.of(Items.create(Material.ORANGE_GLAZED_TERRACOTTA,
"&6Glazed Terracotta Rotating", ENABLED_LORE), "&6Glazed Terracotta Rotating", ENABLED_LORE),
inventoryClickEvent -> { inventoryClickEvent -> {
TerracottaInteractListener.terracottaIds.remove(player.getUniqueId()); TerracottaInteractListener.terracottaIds.add(player.getUniqueId());
setTerracottaItem(player, contents); setTerracottaItem(player, contents);
})); }));
} else { } else {
@@ -133,7 +133,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
contents.set(1, 3, ClickableItem.of(Items.create(Material.ORANGE_GLAZED_TERRACOTTA, contents.set(1, 3, ClickableItem.of(Items.create(Material.ORANGE_GLAZED_TERRACOTTA,
"&6Glazed Terracotta Rotating", DISABLED_LORE), "&6Glazed Terracotta Rotating", DISABLED_LORE),
inventoryClickEvent -> { inventoryClickEvent -> {
TerracottaInteractListener.terracottaIds.add(player.getUniqueId()); TerracottaInteractListener.terracottaIds.remove(player.getUniqueId());
setTerracottaItem(player, contents); setTerracottaItem(player, contents);
})); }));
} }
+3 -9
View File
@@ -5,11 +5,9 @@ main: net.arcaniax.buildersutilities.Main
authors: [ Ktar5, Arcaniax ] authors: [ Ktar5, Arcaniax ]
website: "https://www.spigotmc.org/resources/42361/" website: "https://www.spigotmc.org/resources/42361/"
commands: commands:
bu: butil:
buildersutils: aliases: bu
builders: description: opens toggle menu
utils:
util:
banner: banner:
description: opens banner creator description: opens banner creator
aliases: bm aliases: bm
@@ -62,10 +60,6 @@ commands:
/copy: /copy:
description: alias description: alias
permission: builders.util.aliases permission: builders.util.aliases
butil:
description: alias
aliases: bu
permission: builders.util.gui
/cuboid: /cuboid:
description: alias description: alias
aliases: /cub aliases: /cub