Compare commits
20 Commits
develop-up
...
develop-ja
| Author | SHA1 | Date | |
|---|---|---|---|
| e760cdb2c6 | |||
| c111c027ff | |||
| 2f8ff36e5e | |||
| 5cb71c5c32 | |||
| 5ab42fde4b | |||
| d5c2f06409 | |||
| 1ff8cca7e9 | |||
| 47c40c4941 | |||
| d4a7fcada7 | |||
| a0124f1bcb | |||
| c79fbf3136 | |||
| 660eb645e4 | |||
| 3c50aca1e8 | |||
| 865cdfa605 | |||
| fe88e3f921 | |||
| 5e94479949 | |||
| b15c9c97b0 | |||
| 334e130cf6 | |||
| 31385fbd7f | |||
| b1b1e24104 |
@@ -60,9 +60,9 @@ dependencies {
|
||||
implementation 'io.github.TogAr2:MinestomPvP:PR62-SNAPSHOT'
|
||||
|
||||
// Hephaestus engine
|
||||
implementation("team.unnamed:hephaestus-api: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-api:0.2.1-SNAPSHOT")
|
||||
// implementation("team.unnamed:hephaestus-reader-blockbench:0.2.1-SNAPSHOT")
|
||||
// implementation("team.unnamed:hephaestus-runtime-minestom:0.2.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
||||
@@ -25,7 +25,7 @@ public class PublishRewardCommand extends PrivilegedCommand {
|
||||
|
||||
String rewardRequestJson = new Gson().toJson(room.getTournament().getRewards());
|
||||
HttpRequest giveRewardsRequest = HttpRequest.newBuilder()
|
||||
.uri(new URI("http://10.20.7.1:8080/api/event/reward"))
|
||||
.uri(new URI("http://10.20.9.3:8080/api/event/reward"))
|
||||
.POST(HttpRequest.BodyPublishers.ofString(rewardRequestJson))
|
||||
.build();
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package eu.mhsl.minenet.minigames.handler.global;
|
||||
|
||||
import eu.mhsl.minenet.minigames.message.Icon;
|
||||
import eu.mhsl.minenet.minigames.message.type.ChatMessage;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.minestom.server.event.EventListener;
|
||||
import net.minestom.server.event.player.PlayerChatEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -14,7 +16,14 @@ public class ChatFormatHandler implements EventListener<PlayerChatEvent> {
|
||||
|
||||
@Override
|
||||
public @NotNull Result run(@NotNull PlayerChatEvent event) {
|
||||
event.setFormattedMessage(new ChatMessage(Icon.CHAT).appendStatic(event.getRawMessage()).build(event.getPlayer()));
|
||||
NamedTextColor color = event.getPlayer().getPermissionLevel() > 0 ? NamedTextColor.AQUA : NamedTextColor.GRAY;
|
||||
event.setFormattedMessage(
|
||||
new ChatMessage(Icon.CHAT)
|
||||
.appendStatic(Component.text(event.getPlayer().getUsername(), color))
|
||||
.appendStatic(Component.text(" > ", NamedTextColor.DARK_GRAY))
|
||||
.appendStatic(event.getRawMessage())
|
||||
.build(event.getPlayer())
|
||||
);
|
||||
return Result.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.bedwars.BedwarsFactory;
|
||||
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.deathcube.DeathcubeFactory;
|
||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.elytraRace.ElytraRaceFactory;
|
||||
@@ -44,7 +45,8 @@ public enum GameList {
|
||||
HIGHGROUND(new HighGroundFactory(), GameType.PVP),
|
||||
FASTBRIDGE(new FastbridgeFactory(), 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 GameType type;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public class ElytraRace extends StatelessGame {
|
||||
return;
|
||||
}
|
||||
|
||||
this.playerCheckpoints.putIfAbsent(player, new CheckPointData(this.ringSpacing, this.ringSpacing * 2));
|
||||
this.playerCheckpoints.putIfAbsent(player, new CheckPointData(0, this.ringSpacing));
|
||||
|
||||
if(newPos.z() > this.generatedUntil - this.ringSpacing) {
|
||||
this.generateRing(this.generatedUntil + this.ringSpacing);
|
||||
@@ -224,7 +224,9 @@ public class ElytraRace extends StatelessGame {
|
||||
}
|
||||
|
||||
private void toCheckpoint(Player p) {
|
||||
CheckPointData data = this.playerCheckpoints.get(p);
|
||||
Point checkpointPos = this.getRingPositionAtZ(this.playerCheckpoints.get(p).currentCheckpoint);
|
||||
if(data.currentCheckpoint == 0) checkpointPos = this.getSpawn().add(0, 3, 0);
|
||||
p.setVelocity(Vec.ZERO);
|
||||
p.setFlyingWithElytra(false);
|
||||
p.teleport(Pos.fromPoint(checkpointPos).add(0.5, 0, 0.5));
|
||||
|
||||
@@ -110,7 +110,7 @@ public class SpaceSnake extends StatelessGame {
|
||||
playerMoveEvent.getPlayer().teleport(this.getSpawn());
|
||||
playerMoveEvent.getPlayer().setGameMode(GameMode.SPECTATOR);
|
||||
long livingPlayers = this.getPlayers().stream()
|
||||
.filter(p -> this.getScore().hasResult(p))
|
||||
.filter(p -> !this.getScore().hasResult(p))
|
||||
.count();
|
||||
if(livingPlayers == 1) this.setTimeLimit(10);
|
||||
if(livingPlayers == 0) this.stop();
|
||||
|
||||
@@ -28,7 +28,8 @@ public class StickFightFactory implements GameFactory {
|
||||
@Override
|
||||
public ConfigManager configuration() {
|
||||
return new ConfigManager()
|
||||
.addOption(new NumericOption("length", Material.SANDSTONE, TranslatedComponent.byId("optionCommon#length"), 7, 10, 13, 16, 19));
|
||||
.addOption(new NumericOption("length", Material.SANDSTONE, TranslatedComponent.byId("optionCommon#length"), 7, 10, 13, 16, 19))
|
||||
.addOption(new NumericOption("seconds", Material.CLOCK, TranslatedComponent.byId("optionCommon#seconds"), 30, 60, 90, 120));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,7 +41,7 @@ public class StickFightFactory implements GameFactory {
|
||||
|
||||
@Override
|
||||
public Game manufacture(Room parent, Map<String, Option<?>> configuration) {
|
||||
return new Stickfight(configuration.get("length").getAsInt()).setParent(parent);
|
||||
return new Stickfight(configuration.get("length").getAsInt(), configuration.get("seconds").getAsInt()).setParent(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,8 @@ import net.minestom.server.coordinate.Pos;
|
||||
import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.event.player.PlayerMoveEvent;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.item.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
@@ -22,10 +24,12 @@ public class Stickfight extends StatelessGame {
|
||||
private final WeakHashMap<Player, Pos> spawnPoints = new WeakHashMap<>();
|
||||
private final Map<Player, Integer> scoreMap = new WeakHashMap<>();
|
||||
private boolean countdownStarted = false;
|
||||
private final int seconds;
|
||||
|
||||
public Stickfight(int length) {
|
||||
public Stickfight(int length, int seconds) {
|
||||
super(Dimension.OVERWORLD.key, "Stickfight", new LowestPointsWinScore());
|
||||
this.radius = length;
|
||||
this.seconds = seconds;
|
||||
|
||||
this.eventNode().addChild(
|
||||
CombatFeatures.empty()
|
||||
@@ -79,10 +83,18 @@ public class Stickfight extends StatelessGame {
|
||||
this.generateBridge(spawnX, spawnY, spawnZ);
|
||||
}
|
||||
|
||||
ItemStack item = ItemStack.of(Material.STICK).withGlowing(true);
|
||||
players.forEach(player -> player.getInventory().addItemStack(item));
|
||||
|
||||
this.setBlock(0, 50, 0, Block.GOLD_BLOCK);
|
||||
super.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
this.setTimeLimit(this.seconds);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
this.scoreMap.forEach((player, score) -> this.getScore().insertResult(player, score));
|
||||
@@ -117,6 +129,7 @@ public class Stickfight extends StatelessGame {
|
||||
player.teleport(this.spawnPoints.get(player));
|
||||
this.scoreMap.putIfAbsent(player, 0);
|
||||
this.scoreMap.put(player, this.scoreMap.get(player) + 1);
|
||||
player.setLevel(this.scoreMap.get(player));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ import net.minestom.server.event.player.PlayerTickEvent;
|
||||
import net.minestom.server.event.player.PlayerUseItemEvent;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.item.Material;
|
||||
import net.minestom.server.potion.Potion;
|
||||
import net.minestom.server.potion.PotionEffect;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -71,7 +73,9 @@ class Tetris extends StatelessGame {
|
||||
@Override
|
||||
protected void onPlayerLeave(Player p) {
|
||||
this.tetrisGames.get(p).sidebar.removeViewer(p);
|
||||
p.clearEffects();
|
||||
this.letPlayerLoose(p);
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -156,6 +160,7 @@ class Tetris extends StatelessGame {
|
||||
|
||||
p.teleport(tetrisGame.getPlayerSpawnPosition());
|
||||
tetrisGame.sidebar.addViewer(p);
|
||||
p.addEffect(new Potion(PotionEffect.SLOWNESS, 4, Potion.INFINITE_DURATION));
|
||||
|
||||
return super.onPlayerJoin(p);
|
||||
}
|
||||
|
||||
@@ -54,18 +54,18 @@ public class Tournament {
|
||||
}
|
||||
|
||||
public List<Set<Player>> getPlaces() {
|
||||
List<Set<Player>> players = new ArrayList<>(
|
||||
this.getGameScores().entrySet().stream()
|
||||
.collect(
|
||||
Collectors.groupingBy(
|
||||
Map.Entry::getValue,
|
||||
Collectors.mapping(Map.Entry::getKey, Collectors.toSet())
|
||||
)
|
||||
).values()
|
||||
);
|
||||
Map<Integer, Set<Player>> players = this.getGameScores().entrySet().stream()
|
||||
.collect(
|
||||
Collectors.groupingBy(
|
||||
Map.Entry::getValue,
|
||||
Collectors.mapping(Map.Entry::getKey, Collectors.toSet())
|
||||
)
|
||||
);
|
||||
|
||||
Collections.reverse(players);
|
||||
return players;
|
||||
return players.entrySet().stream()
|
||||
.sorted(Map.Entry.<Integer, Set<Player>>comparingByKey().reversed())
|
||||
.map(Map.Entry::getValue)
|
||||
.toList();
|
||||
}
|
||||
|
||||
private int boost(int selfPlace, int placeCount) {
|
||||
|
||||
@@ -10,4 +10,11 @@ public class CommonProperties {
|
||||
this.put("east", "true");
|
||||
}
|
||||
};
|
||||
|
||||
public static Map<String, String> fenceNorthSouth = new HashMap<>() {
|
||||
{
|
||||
this.put("north", "true");
|
||||
this.put("south", "true");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ optionPvpEnabled;pvp enabled;PvP aktiviert
|
||||
;;
|
||||
ns:game_Stickfight#;;
|
||||
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#;;
|
||||
name;Red light green light;Rotes licht, Grünes licht
|
||||
@@ -170,3 +170,7 @@ ns:game_TurtleGame#;;
|
||||
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!
|
||||
startSpeed;Start Speed;Startgeschwindigkeit
|
||||
;;
|
||||
ns:game_BoatRace#;;
|
||||
name;Boatrace;Bootrennen
|
||||
description;;
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user