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