diff --git a/src/main/java/dev/emortal/Main.java b/src/main/java/dev/emortal/Main.java index ce2c608..dd95e35 100644 --- a/src/main/java/dev/emortal/Main.java +++ b/src/main/java/dev/emortal/Main.java @@ -6,7 +6,10 @@ import com.jme3.bullet.objects.PhysicsRigidBody; import com.jme3.math.Vector3f; import com.jme3.system.NativeLibraryLoader; -import dev.emortal.commands.*; +import dev.emortal.commands.ChainLengthCommand; +import dev.emortal.commands.ClearCommand; +import dev.emortal.commands.PerformanceCommand; +import dev.emortal.commands.PlayerSizeCommand; import dev.emortal.objects.BlockRigidBody; import dev.emortal.objects.ChainPhysics; import dev.emortal.objects.LanternPhysics; @@ -27,7 +30,6 @@ import net.minestom.server.entity.Entity; import net.minestom.server.entity.EntityType; import net.minestom.server.entity.GameMode; -import net.minestom.server.entity.Player; import net.minestom.server.entity.metadata.other.PrimedTntMeta; import net.minestom.server.event.GlobalEventHandler; import net.minestom.server.event.item.ItemDropEvent; @@ -109,22 +111,18 @@ public static void main(String[] args) { GlobalEventHandler global = MinecraftServer.getGlobalEventHandler(); global.addListener(PlayerSpawnEvent.class, e -> { - Player player = e.getPlayer(); e.getPlayer().showBossBar(bossBar); e.getPlayer().setGameMode(GameMode.CREATIVE); e.getPlayer().sendMessage(Component.text("Welcome to your physics playground!")); e.getPlayer().sendMessage(Component.text("Check your inventory for more tools")); e.getPlayer().sendMessage(Component.text("Use /clear to clear all objects in the world")); -// e.getPlayer().sendMessage(Component.text("You can interact with the cubes by moving into them")); - - if (e.getPlayer().getUsername().equals("emortaldev")) { - e.getPlayer().getInventory().setItemStack(9, new DiamondLayerTool(e.getPlayer(), physicsHandler).getItem()); - e.getPlayer().getInventory().setItemStack(7, new DeleteTool(e.getPlayer(), physicsHandler).getItem()); - e.getPlayer().getInventory().setItemStack(6, new PlayerSpawnerTool(e.getPlayer(), physicsHandler).getItem()); - e.getPlayer().getInventory().setItemStack(5, new GrabberTool(e.getPlayer(), physicsHandler).getItem()); - e.getPlayer().getInventory().setItemStack(4, new WeldTool(e.getPlayer(), physicsHandler).getItem()); - } + + e.getPlayer().getInventory().setItemStack(9, new DiamondLayerTool(e.getPlayer(), physicsHandler).getItem()); + e.getPlayer().getInventory().setItemStack(7, new DeleteTool(e.getPlayer(), physicsHandler).getItem()); + e.getPlayer().getInventory().setItemStack(6, new PlayerSpawnerTool(e.getPlayer(), physicsHandler).getItem()); + e.getPlayer().getInventory().setItemStack(5, new GrabberTool(e.getPlayer(), physicsHandler).getItem()); + e.getPlayer().getInventory().setItemStack(4, new WeldTool(e.getPlayer(), physicsHandler).getItem()); e.getPlayer().getInventory().setItemStack(3, ItemStack.of(Material.CHAIN)); e.getPlayer().getInventory().setItemStack(2, ItemStack.of(Material.TNT)); @@ -281,8 +279,6 @@ public void run() { commandManager.register(new ChainLengthCommand()); commandManager.register(new ClearCommand(physicsHandler)); commandManager.register(new PerformanceCommand(MinecraftServer.getGlobalEventHandler(), physicsHandler)); - commandManager.register(new TrustCommand(physicsHandler)); - commandManager.register(new UnTrustCommand()); commandManager.register(new PlayerSizeCommand()); server.start("0.0.0.0", 25563); diff --git a/src/main/java/dev/emortal/commands/TrustCommand.java b/src/main/java/dev/emortal/commands/TrustCommand.java deleted file mode 100644 index 37b0893..0000000 --- a/src/main/java/dev/emortal/commands/TrustCommand.java +++ /dev/null @@ -1,36 +0,0 @@ -package dev.emortal.commands; - -import dev.emortal.MinecraftPhysicsHandler; -import dev.emortal.tools.*; -import net.minestom.server.MinecraftServer; -import net.minestom.server.command.builder.Command; -import net.minestom.server.command.builder.arguments.ArgumentType; -import net.minestom.server.entity.Player; - -import java.util.ArrayList; -import java.util.List; - -public class TrustCommand extends Command { - - public static final List TRUSTED_PLAYERS = new ArrayList<>(); - - public TrustCommand(MinecraftPhysicsHandler physicsHandler) { - super("trust"); - - TRUSTED_PLAYERS.add("emortaldev"); - - var playerArg = ArgumentType.String("trust"); - addConditionalSyntax((sender, ctx) -> ((Player) sender).getUsername().equals("emortaldev"), (sender, ctx) -> { - Player player = MinecraftServer.getConnectionManager().findOnlinePlayer(ctx.get(playerArg)); - - if (player == null) return; - - TRUSTED_PLAYERS.add(player.getUsername()); - player.getInventory().setItemStack(9, new DiamondLayerTool(player, physicsHandler).getItem()); - player.getInventory().setItemStack(7, new DeleteTool(player, physicsHandler).getItem()); - player.getInventory().setItemStack(6, new PlayerSpawnerTool(player, physicsHandler).getItem()); - player.getInventory().setItemStack(5, new GrabberTool(player, physicsHandler).getItem()); - player.getInventory().setItemStack(4, new WeldTool(player, physicsHandler).getItem()); - }, playerArg); - } -} diff --git a/src/main/java/dev/emortal/commands/UnTrustCommand.java b/src/main/java/dev/emortal/commands/UnTrustCommand.java deleted file mode 100644 index 142ceb3..0000000 --- a/src/main/java/dev/emortal/commands/UnTrustCommand.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.emortal.commands; - -import net.minestom.server.MinecraftServer; -import net.minestom.server.command.builder.Command; -import net.minestom.server.command.builder.arguments.ArgumentType; -import net.minestom.server.entity.Player; - -import static dev.emortal.commands.TrustCommand.TRUSTED_PLAYERS; - -public class UnTrustCommand extends Command { - - public UnTrustCommand() { - super("untrust"); - - - var playerArg = ArgumentType.String("untrust"); - addConditionalSyntax((sender, ctx) -> ((Player) sender).getUsername().equals("emortaldev"), (sender, ctx) -> { - Player player = MinecraftServer.getConnectionManager().findOnlinePlayer(ctx.get(playerArg)); - - if (player == null) return; - - TRUSTED_PLAYERS.remove(player.getUsername()); - player.getInventory().clear(); - player.kick("lol"); - }, playerArg); - } -}