5 Commits

26 changed files with 120 additions and 5 deletions

View File

@@ -60,9 +60,9 @@ dependencies {
implementation 'io.github.TogAr2:MinestomPvP:PR62-SNAPSHOT' implementation 'io.github.TogAr2:MinestomPvP:PR62-SNAPSHOT'
// Hephaestus engine // Hephaestus engine
implementation("team.unnamed:hephaestus-api:0.2.1-SNAPSHOT") // implementation("team.unnamed:hephaestus-api:0.2.1-SNAPSHOT")
implementation("team.unnamed:hephaestus-reader-blockbench:0.2.1-SNAPSHOT") // implementation("team.unnamed:hephaestus-reader-blockbench:0.2.1-SNAPSHOT")
implementation("team.unnamed:hephaestus-runtime-minestom:0.2.1-SNAPSHOT") // implementation("team.unnamed:hephaestus-runtime-minestom:0.2.1-SNAPSHOT")
} }
tasks { tasks {

View File

@@ -6,6 +6,7 @@ import eu.mhsl.minenet.minigames.instance.game.stateless.types.anvilRun.AnvilRun
import eu.mhsl.minenet.minigames.instance.game.stateless.types.backrooms.BackroomsFactory; import eu.mhsl.minenet.minigames.instance.game.stateless.types.backrooms.BackroomsFactory;
import eu.mhsl.minenet.minigames.instance.game.stateless.types.bedwars.BedwarsFactory; import eu.mhsl.minenet.minigames.instance.game.stateless.types.bedwars.BedwarsFactory;
import eu.mhsl.minenet.minigames.instance.game.stateless.types.blockBreakRace.BlockBreakRaceFactory; import eu.mhsl.minenet.minigames.instance.game.stateless.types.blockBreakRace.BlockBreakRaceFactory;
import eu.mhsl.minenet.minigames.instance.game.stateless.types.boatRace.BoatRaceFactory;
import eu.mhsl.minenet.minigames.instance.game.stateless.types.bowSpleef.BowSpleefFactory; import eu.mhsl.minenet.minigames.instance.game.stateless.types.bowSpleef.BowSpleefFactory;
import eu.mhsl.minenet.minigames.instance.game.stateless.types.deathcube.DeathcubeFactory; import eu.mhsl.minenet.minigames.instance.game.stateless.types.deathcube.DeathcubeFactory;
import eu.mhsl.minenet.minigames.instance.game.stateless.types.elytraRace.ElytraRaceFactory; import eu.mhsl.minenet.minigames.instance.game.stateless.types.elytraRace.ElytraRaceFactory;
@@ -44,7 +45,8 @@ public enum GameList {
HIGHGROUND(new HighGroundFactory(), GameType.PVP), HIGHGROUND(new HighGroundFactory(), GameType.PVP),
FASTBRIDGE(new FastbridgeFactory(), GameType.OTHER), FASTBRIDGE(new FastbridgeFactory(), GameType.OTHER),
BLOCKBREAKRACE(new BlockBreakRaceFactory(), GameType.OTHER), BLOCKBREAKRACE(new BlockBreakRaceFactory(), GameType.OTHER),
SPACESNAKE(new SpaceSnakeFactory(), GameType.PVP); SPACESNAKE(new SpaceSnakeFactory(), GameType.PVP),
BOATRACE(new BoatRaceFactory(), GameType.OTHER);
private final GameFactory factory; private final GameFactory factory;
private final GameType type; private final GameType type;

View File

@@ -0,0 +1,75 @@
package eu.mhsl.minenet.minigames.instance.game.stateless.types.boatRace;
import eu.mhsl.minenet.minigames.Resource;
import eu.mhsl.minenet.minigames.handler.global.PlayerLoginHandler;
import eu.mhsl.minenet.minigames.instance.Dimension;
import eu.mhsl.minenet.minigames.instance.game.stateless.StatelessGame;
import eu.mhsl.minenet.minigames.score.FirstWinsScore;
import eu.mhsl.minenet.minigames.util.CommonProperties;
import net.minestom.server.MinecraftServer;
import net.minestom.server.coordinate.Pos;
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.event.player.PlayerMoveEvent;
import net.minestom.server.instance.anvil.AnvilLoader;
import net.minestom.server.instance.block.Block;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.CompletableFuture;
public class BoatRace extends StatelessGame {
public BoatRace() {
super(Dimension.OVERWORLD.key, "boatRace", new FirstWinsScore());
this.setChunkLoader(new AnvilLoader(Resource.GAME_MAP.getPath().resolve("boatRace/woodlandMansion")));
}
@Override
protected boolean onPlayerJoin(Player p) {
Entity boat = new Entity(EntityType.OAK_BOAT);
boat.setInstance(this, this.getSpawn());
boat.setSynchronizationTicks(100000);
PlayerLoginHandler.globalTeam.addMember(boat.getUuid().toString());
MinecraftServer.getSchedulerManager().scheduleNextTick(() -> boat.addPassenger(p));
return super.onPlayerJoin(p);
}
@Override
protected void onLoad(@NotNull CompletableFuture<Void> callback) {
for(int z = 9; z <= 32; z++) {
this.setBlock(31, 235, z, Block.CHERRY_FENCE.withProperties(CommonProperties.fenceNorthSouth));
}
}
@Override
protected void onStart() {
for(int z = 9; z <= 32; z++) {
this.setBlock(31, 235, z, Block.AIR);
}
}
@Override
protected void onPlayerMove(@NotNull PlayerMoveEvent event) {
if (this.isBeforeBeginning) return;
if(event.getNewPosition().z() > 469) {
Player player = event.getPlayer();
this.getScore().insertResult(player);
Entity vehicle = player.getVehicle();
if(vehicle != null) {
vehicle.removePassenger(player);
player.teleport(player.getPosition().withY(y -> y + 3));
player.setGameMode(GameMode.SPECTATOR);
vehicle.remove();
}
}
}
@Override
public Pos getSpawn() {
return new Pos(20, 236, 20, -90, 0);
}
}

View File

@@ -0,0 +1,27 @@
package eu.mhsl.minenet.minigames.instance.game.stateless.types.boatRace;
import eu.mhsl.minenet.minigames.instance.game.Game;
import eu.mhsl.minenet.minigames.instance.game.stateless.config.GameFactory;
import eu.mhsl.minenet.minigames.instance.game.stateless.config.Option;
import eu.mhsl.minenet.minigames.instance.room.Room;
import eu.mhsl.minenet.minigames.message.component.TranslatedComponent;
import net.minestom.server.item.Material;
import java.util.Map;
public class BoatRaceFactory implements GameFactory {
@Override
public TranslatedComponent name() {
return TranslatedComponent.byId("game_BoatRace#name");
}
@Override
public Material symbol() {
return Material.OAK_BOAT;
}
@Override
public Game manufacture(Room parent, Map<String, Option<?>> configuration) throws Exception {
return new BoatRace().setParent(parent);
}
}

View File

@@ -10,4 +10,11 @@ public class CommonProperties {
this.put("east", "true"); this.put("east", "true");
} }
}; };
public static Map<String, String> fenceNorthSouth = new HashMap<>() {
{
this.put("north", "true");
this.put("south", "true");
}
};
} }

View File

@@ -105,7 +105,7 @@ optionPvpEnabled;pvp enabled;PvP aktiviert
;; ;;
ns:game_Stickfight#;; ns:game_Stickfight#;;
name;Stickfight;Stockschlacht name;Stickfight;Stockschlacht
description;Push your opponents off the Bridge;Stoße deine Gegener von der Brücke description;Push your opponents off the Bridge;Stoße deine Gegener von der Brücke, der Spieler mit den wenigsten Toden gewinnt!
;; ;;
ns:game_TrafficlightRace#;; ns:game_TrafficlightRace#;;
name;Red light green light;Rotes licht, Grünes licht name;Red light green light;Rotes licht, Grünes licht
@@ -170,3 +170,7 @@ ns:game_TurtleGame#;;
name;Turtle Game;Turtle Game name;Turtle Game;Turtle Game
description;Eat snacks and dodge bombs to get the highest score!;Esse Snacks und weiche Bomben aus, um den höchsten Score zu erreichen! description;Eat snacks and dodge bombs to get the highest score!;Esse Snacks und weiche Bomben aus, um den höchsten Score zu erreichen!
startSpeed;Start Speed;Startgeschwindigkeit startSpeed;Start Speed;Startgeschwindigkeit
;;
ns:game_BoatRace#;;
name;Boatrace;Bootrennen
description;;
1 map en_us de_de
105
106 ns:game_Stickfight#
107 name Stickfight Stockschlacht
108 description Push your opponents off the Bridge Stoße deine Gegener von der Brücke Stoße deine Gegener von der Brücke, der Spieler mit den wenigsten Toden gewinnt!
109
110 ns:game_TrafficlightRace#
111 name Red light green light Rotes licht, Grünes licht
170 name Turtle Game Turtle Game
171 description Eat snacks and dodge bombs to get the highest score! Esse Snacks und weiche Bomben aus, um den höchsten Score zu erreichen!
172 startSpeed Start Speed Startgeschwindigkeit
173
174 ns:game_BoatRace#
175 name Boatrace Bootrennen
176 description