Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
import net.minestom.server.event.player.AsyncPlayerConfigurationEvent;
import net.minestom.server.event.player.PlayerBlockBreakEvent;
import net.minestom.server.event.player.PlayerCustomClickEvent;
import net.minestom.server.event.player.PlayerDisconnectEvent;
import net.minestom.server.event.player.PlayerSpawnEvent;
import net.minestom.server.event.player.PlayerUseItemEvent;
import net.onelitefeather.cygnus.common.ListenerHandling;
import net.minestom.server.instance.Instance;
import net.onelitefeather.cygnus.setup.command.SetupCommand;
import net.onelitefeather.cygnus.setup.event.MapSetupSaveEvent;
import net.onelitefeather.cygnus.setup.event.MapSetupSelectEvent;
import net.onelitefeather.cygnus.setup.event.PositionSetEvent;
import net.onelitefeather.cygnus.setup.event.dialog.DialogRequestEvent;
import net.onelitefeather.cygnus.setup.inventory.MapSetupInventory;
import net.onelitefeather.cygnus.setup.listener.InstanceAddListener;
Expand All @@ -26,8 +28,8 @@
import net.onelitefeather.cygnus.setup.listener.dialog.DialogPayloadListener;
import net.onelitefeather.cygnus.setup.listener.dialog.DialogRequestListener;
import net.onelitefeather.cygnus.setup.listener.map.MapSetupSaveListener;
import net.onelitefeather.cygnus.setup.listener.position.PositionSetListener;
import net.onelitefeather.cygnus.setup.map.SetupMapProvider;
import net.onelitefeather.cygnus.setup.util.SetupData;
import net.theevilreaper.aves.map.provider.AbstractMapProvider;
import net.theevilreaper.aves.util.functional.PlayerConsumer;
import net.onelitefeather.guira.SetupDataService;
Expand All @@ -39,14 +41,12 @@
public class SetupExtension implements ListenerHandling {

private final SetupDataService dataService;
private final SetupData setupData;
private final MapSetupInventory mapSetupInventory;
private final AbstractMapProvider mapProvider;

public SetupExtension() {
this.setupData = new SetupData();
this.dataService = SetupDataService.create();
this.mapProvider = new SetupMapProvider(Paths.get(""));
this.mapProvider = new SetupMapProvider(Paths.get("").resolve("setup"));
this.mapSetupInventory = new MapSetupInventory(mapProvider.getEntries());
registerSetupComponents();
this.registerMapListeners();
Expand All @@ -56,26 +56,31 @@
var manager = MinecraftServer.getGlobalEventHandler();
var commandManager = MinecraftServer.getCommandManager();
var spawnPos = new Pos(0, 150, 0);
commandManager.register(new SetupCommand(setupData));

Check failure on line 59 in setup/src/main/java/net/onelitefeather/cygnus/setup/SetupExtension.java

View workflow job for this annotation

GitHub Actions / Build Pull Request Branch (ubuntu-latest)

cannot find symbol

Supplier<Instance> instanceSupplier = this.mapProvider.getActiveInstance();
UUID instanceUUID = instanceSupplier.get().getUuid();

manager.addListener(MapSetupSelectEvent.class, new MapSetupSelectListener(setupData));
manager.addListener(PlayerUseItemEvent.class, new SetupItemListener(setupData, mapSetupInventory));
manager.addListener(MapSetupSelectEvent.class, new MapSetupSelectListener(this.dataService));
manager.addListener(PlayerUseItemEvent.class, new SetupItemListener(this.dataService, mapSetupInventory));

manager.addListener(AsyncPlayerConfigurationEvent.class, event -> event.setSpawningInstance(instanceSupplier.get()));
manager.addListener(PlayerSpawnEvent.class, new PlayerSpawnListener(spawnPos));

manager.addListener(PlayerBlockBreakEvent.class, new PageCreationListener(setupData));
manager.addListener(PlayerDisconnectEvent.class, event -> {
this.dataService.remove(event.getPlayer().getUuid());
});
manager.addListener(PlayerBlockBreakEvent.class, new PageCreationListener(this.dataService));

manager.addListener(AddEntityToInstanceEvent.class, new InstanceAddListener(instanceUUID));
manager.addListener(RemoveEntityFromInstanceEvent.class, new InstanceRemoveListener(instanceUUID));
registerCancelListener(manager);

//Dialog listener
manager.addListener(DialogRequestEvent.class, new DialogRequestListener());
manager.addListener(PlayerCustomClickEvent.class, new DialogPayloadListener(setupData));
manager.addListener(PlayerCustomClickEvent.class, new DialogPayloadListener(this.dataService));

manager.addListener(PositionSetEvent.class, new PositionSetListener(this.dataService));
}

/**
Expand All @@ -84,6 +89,6 @@
private void registerMapListeners() {
GlobalEventHandler node = MinecraftServer.getGlobalEventHandler();
PlayerConsumer teleport = player -> this.mapProvider.teleportToSpawn(player, true);
node.addListener(MapSetupSaveEvent.class, new MapSetupSaveListener(teleport));
node.addListener(MapSetupSaveEvent.class, new MapSetupSaveListener(this.dataService, teleport));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@
import net.minestom.server.command.builder.Command;
import net.minestom.server.command.builder.condition.Conditions;
import net.onelitefeather.cygnus.common.Messages;
import net.onelitefeather.cygnus.setup.command.parts.SetupBuildersCommand;
import net.onelitefeather.cygnus.setup.command.parts.SetupNameCommand;
import net.onelitefeather.cygnus.setup.command.parts.SetupPageCommand;
import net.onelitefeather.cygnus.setup.command.parts.SetupSlenderSpawnCommand;
import net.onelitefeather.cygnus.setup.command.parts.SetupSpawnCommand;
import net.onelitefeather.cygnus.setup.command.parts.SetupSurvivorSpawnCommand;
import net.onelitefeather.cygnus.setup.util.SetupData;

Check failure on line 10 in setup/src/main/java/net/onelitefeather/cygnus/setup/command/SetupCommand.java

View workflow job for this annotation

GitHub Actions / Build Pull Request Branch (ubuntu-latest)

cannot find symbol

/**
* The setup command class is the root node for all setup commands.
Expand All @@ -29,12 +25,12 @@
*
* @param setupData the involved {@link SetupData} class to get some information from it
*/
public SetupCommand(SetupData setupData) {

Check failure on line 28 in setup/src/main/java/net/onelitefeather/cygnus/setup/command/SetupCommand.java

View workflow job for this annotation

GitHub Actions / Build Pull Request Branch (ubuntu-latest)

cannot find symbol
super("setup");
this.setCondition(Conditions::playerOnly);
this.addSubcommand(new SetupNameCommand(setupData));

Check failure on line 31 in setup/src/main/java/net/onelitefeather/cygnus/setup/command/SetupCommand.java

View workflow job for this annotation

GitHub Actions / Build Pull Request Branch (ubuntu-latest)

cannot find symbol
this.addSubcommand(new SetupBuildersCommand(setupData));

Check failure on line 32 in setup/src/main/java/net/onelitefeather/cygnus/setup/command/SetupCommand.java

View workflow job for this annotation

GitHub Actions / Build Pull Request Branch (ubuntu-latest)

cannot find symbol
this.addSubcommand(new SetupSpawnCommand(setupData));

Check failure on line 33 in setup/src/main/java/net/onelitefeather/cygnus/setup/command/SetupCommand.java

View workflow job for this annotation

GitHub Actions / Build Pull Request Branch (ubuntu-latest)

cannot find symbol
this.addSubcommand(new SetupSurvivorSpawnCommand(setupData));
this.addSubcommand(new SetupSlenderSpawnCommand(setupData));
this.addSubcommand(new SetupPageCommand(setupData));
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading