Compare commits
4 Commits
13cc6c30b5
...
develop-ha
Author | SHA1 | Date | |
---|---|---|---|
fa69d4976d | |||
e4fff421f5 | |||
e6bded1c9e | |||
37a63e10b0 |
@@ -48,7 +48,7 @@ dependencies {
|
|||||||
|
|
||||||
//Tools
|
//Tools
|
||||||
implementation 'de.articdive:jnoise:3.0.2'
|
implementation 'de.articdive:jnoise:3.0.2'
|
||||||
implementation 'net.md-5:bungeecord-config:1.19-R0.1-SNAPSHOT'
|
implementation 'net.md-5:bungeecord-config:1.21-R0.3'
|
||||||
implementation 'org.apache.commons:commons-text:1.10.0'
|
implementation 'org.apache.commons:commons-text:1.10.0'
|
||||||
implementation 'org.spongepowered:configurate-yaml:4.1.2'
|
implementation 'org.spongepowered:configurate-yaml:4.1.2'
|
||||||
implementation 'com.sparkjava:spark-core:2.9.4'
|
implementation 'com.sparkjava:spark-core:2.9.4'
|
||||||
|
@@ -8,6 +8,7 @@ import eu.mhsl.minenet.minigames.instance.game.stateless.types.backrooms.Backroo
|
|||||||
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.acidRain.AcidRainFactory;
|
import eu.mhsl.minenet.minigames.instance.game.stateless.types.acidRain.AcidRainFactory;
|
||||||
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.fastbridge.FastbridgeFactory;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.highGround.HighGroundFactory;
|
import eu.mhsl.minenet.minigames.instance.game.stateless.types.highGround.HighGroundFactory;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.jumpDive.JumpDiveFactory;
|
import eu.mhsl.minenet.minigames.instance.game.stateless.types.jumpDive.JumpDiveFactory;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.minerun.MinerunFactory;
|
import eu.mhsl.minenet.minigames.instance.game.stateless.types.minerun.MinerunFactory;
|
||||||
@@ -36,7 +37,8 @@ public enum GameList {
|
|||||||
SPLEEF(new SpleefFactory(), GameType.PVP),
|
SPLEEF(new SpleefFactory(), GameType.PVP),
|
||||||
JUMPDIVE(new JumpDiveFactory(), GameType.JUMPNRUN),
|
JUMPDIVE(new JumpDiveFactory(), GameType.JUMPNRUN),
|
||||||
SUMO(new SumoFactory(), GameType.PVP),
|
SUMO(new SumoFactory(), GameType.PVP),
|
||||||
HIGHGROUND(new HighGroundFactory(), GameType.PVP);
|
HIGHGROUND(new HighGroundFactory(), GameType.PVP),
|
||||||
|
FASTBRIDGE(new FastbridgeFactory(), GameType.OTHER);
|
||||||
|
|
||||||
private final GameFactory factory;
|
private final GameFactory factory;
|
||||||
private final GameType type;
|
private final GameType type;
|
||||||
|
@@ -0,0 +1,64 @@
|
|||||||
|
package eu.mhsl.minenet.minigames.instance.game.stateless.types.fastbridge;
|
||||||
|
|
||||||
|
import eu.mhsl.minenet.minigames.instance.Dimension;
|
||||||
|
import eu.mhsl.minenet.minigames.instance.game.stateless.StatelessGame;
|
||||||
|
import eu.mhsl.minenet.minigames.score.FirstWinsScore;
|
||||||
|
import net.minestom.server.coordinate.Pos;
|
||||||
|
import net.minestom.server.entity.GameMode;
|
||||||
|
import net.minestom.server.entity.Player;
|
||||||
|
import net.minestom.server.event.player.PlayerBlockPlaceEvent;
|
||||||
|
import net.minestom.server.event.player.PlayerMoveEvent;
|
||||||
|
import net.minestom.server.instance.Chunk;
|
||||||
|
import net.minestom.server.inventory.PlayerInventory;
|
||||||
|
import net.minestom.server.item.ItemStack;
|
||||||
|
import net.minestom.server.item.Material;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class Fastbridge extends StatelessGame {
|
||||||
|
private int currentSpawn = 0;
|
||||||
|
|
||||||
|
public Fastbridge() {
|
||||||
|
super(Dimension.OVERWORLD.key, "Fastbridge", new FirstWinsScore());
|
||||||
|
this.setGenerator(new FastbridgeChunkgenerator());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPlayerMove(@NotNull PlayerMoveEvent playerMoveEvent) {
|
||||||
|
Player player = playerMoveEvent.getPlayer();
|
||||||
|
Pos newPos = playerMoveEvent.getNewPosition();
|
||||||
|
if(this.getScore().hasResult(player)) return;
|
||||||
|
if(newPos.y() < 0) {
|
||||||
|
player.teleport(getSpawn());
|
||||||
|
if(!isBeforeBeginning) this.resetPlayer(player);
|
||||||
|
}
|
||||||
|
if(newPos.x() > 53) {
|
||||||
|
this.getScore().insertResult(player);
|
||||||
|
player.setGameMode(GameMode.SPECTATOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
getPlayers().forEach(player -> {
|
||||||
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
|
resetPlayer(player);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBlockPlace(@NotNull PlayerBlockPlaceEvent playerBlockPlaceEvent) {
|
||||||
|
if(isBeforeBeginning) playerBlockPlaceEvent.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetPlayer(Player player) {
|
||||||
|
if(isBeforeBeginning) return;
|
||||||
|
PlayerInventory inventory = player.getInventory();
|
||||||
|
inventory.clear();
|
||||||
|
inventory.addItemStack(ItemStack.of(Material.WHITE_WOOL, 64));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized Pos getSpawn() {
|
||||||
|
return new Pos(24, 1, currentSpawn++*Chunk.CHUNK_SIZE_Z*2-8, -90, 0);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,29 @@
|
|||||||
|
package eu.mhsl.minenet.minigames.instance.game.stateless.types.fastbridge;
|
||||||
|
|
||||||
|
import eu.mhsl.minenet.minigames.world.generator.featureEnriched.ValeGenerator;
|
||||||
|
import eu.mhsl.minenet.minigames.world.generator.terrain.BaseGenerator;
|
||||||
|
import net.minestom.server.instance.block.Block;
|
||||||
|
|
||||||
|
public class FastbridgeChunkgenerator extends BaseGenerator {
|
||||||
|
public FastbridgeChunkgenerator() {
|
||||||
|
this.addMixIn(unit -> {
|
||||||
|
if (unit.absoluteStart().chunkZ() % 2 == 0) {
|
||||||
|
unit.modifier().fill(Block.BARRIER);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unit.absoluteStart().chunkX() != 1 && unit.absoluteStart().chunkX() != 3) return;
|
||||||
|
for (int x = 5; x <= 10; x++){
|
||||||
|
for (int z = 5; z <= 10; z++){
|
||||||
|
unit.modifier().setRelative(x, 64, z, unit.absoluteStart().chunkX() == 3 ? Block.GOLD_BLOCK : Block.GRASS_BLOCK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ValeGenerator vale = new ValeGenerator();
|
||||||
|
vale.setXShiftMultiplier(integer -> 0.5d);
|
||||||
|
vale.setHeightNoiseMultiplier(integer -> 2);
|
||||||
|
vale.setXShiftOffset(integer -> 40d);
|
||||||
|
this.addMixIn(vale);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,33 @@
|
|||||||
|
package eu.mhsl.minenet.minigames.instance.game.stateless.types.fastbridge;
|
||||||
|
|
||||||
|
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 FastbridgeFactory implements GameFactory {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TranslatedComponent name() {
|
||||||
|
return TranslatedComponent.byId("game_Fastbridge#name");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TranslatedComponent description() {
|
||||||
|
return TranslatedComponent.byId("game_Fastbridge#description");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Material symbol() {
|
||||||
|
return Material.WHITE_WOOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Game manufacture(Room parent, Map<String, Option<?>> configuration) throws Exception {
|
||||||
|
return new Fastbridge().setParent(parent);
|
||||||
|
}
|
||||||
|
}
|
@@ -22,6 +22,11 @@ public class HighGroundFactory implements GameFactory {
|
|||||||
return TranslatedComponent.byId("game_Highground#description");
|
return TranslatedComponent.byId("game_Highground#description");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Material symbol() {
|
||||||
|
return Material.GOLDEN_HELMET;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConfigManager configuration() {
|
public ConfigManager configuration() {
|
||||||
return new ConfigManager()
|
return new ConfigManager()
|
||||||
|
@@ -21,6 +21,11 @@ public class SumoFactory implements GameFactory {
|
|||||||
return TranslatedComponent.byId("game_Sumo#description");
|
return TranslatedComponent.byId("game_Sumo#description");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Material symbol() {
|
||||||
|
return Material.SLIME_BALL;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConfigManager configuration() {
|
public ConfigManager configuration() {
|
||||||
return new ConfigManager()
|
return new ConfigManager()
|
||||||
|
@@ -21,6 +21,7 @@ public class ValeGenerator extends HeightTerrainGenerator {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
private Function<Integer, Double> xShiftMultiplier = multiplier -> 1d;
|
private Function<Integer, Double> xShiftMultiplier = multiplier -> 1d;
|
||||||
|
private Function<Integer, Double> xShiftOffset = z -> 0d;
|
||||||
|
|
||||||
public ValeGenerator() {
|
public ValeGenerator() {
|
||||||
setCalculateHeight(this::calculateY);
|
setCalculateHeight(this::calculateY);
|
||||||
@@ -32,10 +33,14 @@ public class ValeGenerator extends HeightTerrainGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getXShiftAtZ(int z) {
|
public int getXShiftAtZ(int z) {
|
||||||
return (int) ((curves.getNoise(z) * 32 + largeCurves.getNoise(z) * 64) * xShiftMultiplier.apply(z));
|
return (int) ((curves.getNoise(z) * 32 + largeCurves.getNoise(z) * 64) * xShiftMultiplier.apply(z) + xShiftOffset.apply(z));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setXShiftMultiplier(Function<Integer, Double> xShiftMultiplier) {
|
public void setXShiftMultiplier(Function<Integer, Double> xShiftMultiplier) {
|
||||||
this.xShiftMultiplier = xShiftMultiplier;
|
this.xShiftMultiplier = xShiftMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setXShiftOffset(Function<Integer, Double> xShiftOffset) {
|
||||||
|
this.xShiftOffset = xShiftOffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -139,3 +139,7 @@ description;Knock your enemies off and stay on top!;Versuche deinen Gegner von d
|
|||||||
ns:game_Highground#;;
|
ns:game_Highground#;;
|
||||||
name;Highground;Hochburg
|
name;Highground;Hochburg
|
||||||
description;Stay on the high ground to win!;Bleibe solange wie möglich auf der Hochburg, um zu gewinnen!
|
description;Stay on the high ground to win!;Bleibe solange wie möglich auf der Hochburg, um zu gewinnen!
|
||||||
|
;;
|
||||||
|
ns:game_Fastbridge#;;
|
||||||
|
name;Fastbridge;Fastbridge
|
||||||
|
description;Speedbridge to the other platform. The first one there wins!;Baue dich so schnell wie möglich zur anderen Plattform. Wer zuerst dort ist, gewinnt!
|
||||||
|
Can't render this file because it has a wrong number of fields in line 114.
|
Reference in New Issue
Block a user