Compare commits
7 Commits
develop-fa
...
develop-sp
Author | SHA1 | Date | |
---|---|---|---|
512805de05 | |||
9596800889 | |||
a8a15a1c7c | |||
db78ff33ce | |||
5bb07596a1 | |||
c4aaa7acf9 | |||
097438886c |
@@ -13,6 +13,7 @@ import eu.mhsl.minenet.minigames.instance.game.stateless.types.fastbridge.Fastbr
|
||||
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.minerun.MinerunFactory;
|
||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.spaceSnake.SpaceSnakeFactory;
|
||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.spleef.SpleefFactory;
|
||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.stickfight.StickFightFactory;
|
||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.tetris.TetrisFactory;
|
||||
@@ -40,7 +41,8 @@ public enum GameList {
|
||||
SUMO(new SumoFactory(), GameType.PVP),
|
||||
HIGHGROUND(new HighGroundFactory(), GameType.PVP),
|
||||
FASTBRIDGE(new FastbridgeFactory(), GameType.OTHER),
|
||||
BLOCKBREAKRACE(new BlockBreakRaceFactory(), GameType.OTHER);
|
||||
BLOCKBREAKRACE(new BlockBreakRaceFactory(), GameType.OTHER),
|
||||
SPACESNAKE(new SpaceSnakeFactory(), GameType.PVP);
|
||||
|
||||
private final GameFactory factory;
|
||||
private final GameType type;
|
||||
|
@@ -0,0 +1,181 @@
|
||||
package eu.mhsl.minenet.minigames.instance.game.stateless.types.spaceSnake;
|
||||
|
||||
import eu.mhsl.minenet.minigames.instance.Dimension;
|
||||
import eu.mhsl.minenet.minigames.instance.game.stateless.StatelessGame;
|
||||
import eu.mhsl.minenet.minigames.score.PointsWinScore;
|
||||
import io.github.togar2.pvp.events.FinalAttackEvent;
|
||||
import io.github.togar2.pvp.events.PrepareAttackEvent;
|
||||
import io.github.togar2.pvp.feature.CombatFeatures;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.coordinate.Pos;
|
||||
import net.minestom.server.entity.*;
|
||||
import net.minestom.server.entity.metadata.display.BlockDisplayMeta;
|
||||
import net.minestom.server.event.entity.EntityTickEvent;
|
||||
import net.minestom.server.event.player.PlayerBlockPlaceEvent;
|
||||
import net.minestom.server.event.player.PlayerMoveEvent;
|
||||
import net.minestom.server.instance.WorldBorder;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockFace;
|
||||
import net.minestom.server.inventory.PlayerInventory;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.item.Material;
|
||||
import net.minestom.server.sound.SoundEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class SpaceSnake extends StatelessGame {
|
||||
record PlayState(AtomicInteger length, Queue<Pos> blocks, Material blockType, Pos spawn) {
|
||||
public void cutToLength(Consumer<Pos> removed) {
|
||||
while (this.blocks.size() > this.length.get()) {
|
||||
removed.accept(this.blocks.poll());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<Player, PlayState> playerBlocks = new WeakHashMap<>();
|
||||
private int mapSize;
|
||||
private final Supplier<Integer> posInBoundsW = () -> this.rnd.nextInt(-this.mapSize/2, this.mapSize/2);
|
||||
private final Supplier<Integer> posInBoundsH = () -> this.rnd.nextInt(-60, 300);
|
||||
|
||||
public SpaceSnake(int mapSize, int powerUpCount) {
|
||||
super(Dimension.THE_END.key, "spaceSnake", new PointsWinScore());
|
||||
this.mapSize = mapSize;
|
||||
this.setWorldBorder(new WorldBorder(this.mapSize, 0, 0, 0, 0));
|
||||
|
||||
for (int i = 0; i < powerUpCount; i++) {
|
||||
this.spawnPowerUp();
|
||||
}
|
||||
|
||||
this.eventNode().addChild(
|
||||
CombatFeatures.empty()
|
||||
.add(CombatFeatures.VANILLA_ATTACK)
|
||||
.add(CombatFeatures.VANILLA_DAMAGE)
|
||||
.add(CombatFeatures.VANILLA_KNOCKBACK)
|
||||
.build()
|
||||
.createNode()
|
||||
);
|
||||
|
||||
this.eventNode().addListener(PrepareAttackEvent.class, prepareAttackEvent -> {
|
||||
if (this.isBeforeBeginning) prepareAttackEvent.setCancelled(true);
|
||||
});
|
||||
|
||||
this.eventNode().addListener(FinalAttackEvent.class, finalAttackEvent -> {
|
||||
finalAttackEvent.setBaseDamage(0);
|
||||
((Player) finalAttackEvent.getTarget()).setHealth(20);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
this.getPlayers().forEach(player -> {
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
this.updateInv(player);
|
||||
player.setHeldItemSlot((byte) 1);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onPlayerJoin(Player p) {
|
||||
Pos spawn = new Pos(this.posInBoundsW.get(), -60, this.posInBoundsW.get());
|
||||
PlayState state = new PlayState(
|
||||
new AtomicInteger(3),
|
||||
new ArrayDeque<>(List.of(spawn)),
|
||||
this.getRandomBlock(),
|
||||
spawn
|
||||
);
|
||||
this.playerBlocks.put(p, state);
|
||||
this.setBlock(spawn, state.blockType.block());
|
||||
MinecraftServer.getSchedulerManager().scheduleNextTick(
|
||||
() -> p.teleport(this.getSaveSpawn(spawn))
|
||||
);
|
||||
return super.onPlayerJoin(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPlayerMove(@NotNull PlayerMoveEvent playerMoveEvent) {
|
||||
PlayState state = this.playerBlocks.get(playerMoveEvent.getPlayer());
|
||||
if(this.isBeforeBeginning) {
|
||||
boolean falling = state.blocks.stream().anyMatch(pos -> pos.y() > playerMoveEvent.getNewPosition().y());
|
||||
if(falling) playerMoveEvent.getPlayer().teleport(this.getSaveSpawn(state.spawn));
|
||||
return;
|
||||
}
|
||||
|
||||
if(playerMoveEvent.getNewPosition().y() < -64) {
|
||||
this.getScore().insertResult(playerMoveEvent.getPlayer(), state.length.get());
|
||||
playerMoveEvent.getPlayer().teleport(this.getSpawn());
|
||||
playerMoveEvent.getPlayer().setGameMode(GameMode.SPECTATOR);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBlockPlace(@NotNull PlayerBlockPlaceEvent playerBlockPlaceEvent) {
|
||||
if(this.isBeforeBeginning) {
|
||||
playerBlockPlaceEvent.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
PlayState state = this.playerBlocks.get(playerBlockPlaceEvent.getPlayer());
|
||||
state.blocks.add(playerBlockPlaceEvent.getBlockPosition().asVec().asPosition());
|
||||
state.cutToLength(pos -> this.setBlock(pos, Block.AIR));
|
||||
|
||||
MinecraftServer.getSchedulerManager().scheduleNextTick(() -> this.updateInv(playerBlockPlaceEvent.getPlayer()));
|
||||
playerBlockPlaceEvent.getPlayer().setLevel(state.length.get());
|
||||
}
|
||||
|
||||
private Pos getSaveSpawn(Pos blockPos) {
|
||||
return blockPos.add(0.5).withY((y) -> y + 2);
|
||||
}
|
||||
|
||||
private void updateInv(Player player) {
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
inventory.clear();
|
||||
inventory.addItemStack(ItemStack.of(Material.STICK, 1).with(builder -> builder.glowing(true)));
|
||||
inventory.addItemStack(ItemStack.of(this.playerBlocks.get(player).blockType, 64));
|
||||
}
|
||||
|
||||
private Material getRandomBlock() {
|
||||
List<Material> blocks = Material.values().stream()
|
||||
.filter(Material::isBlock)
|
||||
.filter(material -> material.registry().block() != null)
|
||||
.filter(material -> material.block().isSolid())
|
||||
.filter(material -> Arrays.stream(BlockFace.values())
|
||||
.allMatch(face -> material.block().registry().collisionShape().isFaceFull(face))
|
||||
)
|
||||
.toList();
|
||||
return blocks.get(this.rnd.nextInt(blocks.size()));
|
||||
}
|
||||
|
||||
private void spawnPowerUp() {
|
||||
Pos spawnPos = new Pos(this.posInBoundsW.get(), this.posInBoundsH.get(), this.posInBoundsW.get());
|
||||
Entity display = new Entity(EntityType.BLOCK_DISPLAY);
|
||||
((BlockDisplayMeta) display.getEntityMeta()).setBlockState(Block.DIAMOND_BLOCK);
|
||||
display.setGlowing(true);
|
||||
display.setNoGravity(true);
|
||||
display.setInstance(this, spawnPos);
|
||||
|
||||
display.eventNode().addListener(EntityTickEvent.class, onTick -> {
|
||||
Player player = this.getPlayers().stream()
|
||||
.filter(p -> !this.getScore().hasResult(p))
|
||||
.filter(p -> p.getDistance(onTick.getEntity()) < 2.5)
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if(player == null) return;
|
||||
|
||||
this.spawnPowerUp();
|
||||
display.remove();
|
||||
this.onPowerup(player);
|
||||
});
|
||||
}
|
||||
|
||||
private void onPowerup(Player player) {
|
||||
PlayState state = this.playerBlocks.get(player);
|
||||
state.length.incrementAndGet();
|
||||
player.setLevel(player.getLevel() + 1);
|
||||
player.playSound(Sound.sound(SoundEvent.ENTITY_EXPERIENCE_ORB_PICKUP, Sound.Source.PLAYER, 1f, 1f));
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package eu.mhsl.minenet.minigames.instance.game.stateless.types.spaceSnake;
|
||||
|
||||
import eu.mhsl.minenet.minigames.instance.game.Game;
|
||||
import eu.mhsl.minenet.minigames.instance.game.stateless.config.ConfigManager;
|
||||
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.game.stateless.config.common.NumericOption;
|
||||
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 SpaceSnakeFactory implements GameFactory {
|
||||
@Override
|
||||
public TranslatedComponent name() {
|
||||
return TranslatedComponent.byId("game_SpaceSnake#name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigManager configuration() {
|
||||
return new ConfigManager()
|
||||
.addOption(new NumericOption("width", Material.HEART_OF_THE_SEA, TranslatedComponent.byId("optionCommon#width"), 20, 30, 40, 50, 60, 70, 80))
|
||||
.addOption(new NumericOption("powerUpCount", Material.DIAMOND, TranslatedComponent.byId("game_SpaceSnake#powerUpCount"), 50, 100, 200, 300));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material symbol() {
|
||||
return Material.GREEN_CONCRETE_POWDER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatedComponent description() {
|
||||
return TranslatedComponent.byId("game_SpaceSnake#description");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Game manufacture(Room parent, Map<String, Option<?>> configuration) throws Exception {
|
||||
return new SpaceSnake(configuration.get("width").getAsInt(), configuration.get("powerUpCount").getAsInt()).setParent(parent);
|
||||
}
|
||||
}
|
@@ -28,7 +28,7 @@ public class StickFightFactory implements GameFactory {
|
||||
@Override
|
||||
public ConfigManager configuration() {
|
||||
return new ConfigManager()
|
||||
.addOption(new NumericOption("length", Material.SANDSTONE, TranslatedComponent.byId("optionCommon#length"), 5, 7, 9, 11));
|
||||
.addOption(new NumericOption("length", Material.SANDSTONE, TranslatedComponent.byId("optionCommon#length"), 7, 10, 13, 16, 19));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,7 +40,7 @@ public class StickFightFactory implements GameFactory {
|
||||
|
||||
@Override
|
||||
public Game manufacture(Room parent, Map<String, Option<?>> configuration) {
|
||||
return new Stickfight().setParent(parent);
|
||||
return new Stickfight(configuration.get("length").getAsInt()).setParent(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -18,12 +18,14 @@ import java.util.WeakHashMap;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class Stickfight extends StatelessGame {
|
||||
private final double radius = 20;
|
||||
private final double radius;
|
||||
private final WeakHashMap<Player, Pos> spawnPoints = new WeakHashMap<>();
|
||||
private final Map<Player, Integer> scoreMap = new WeakHashMap<>();
|
||||
private boolean countdownStarted = false;
|
||||
|
||||
public Stickfight() {
|
||||
public Stickfight(int length) {
|
||||
super(Dimension.OVERWORLD.key, "Stickfight", new LowestPointsWinScore());
|
||||
this.radius = length;
|
||||
|
||||
eventNode().addChild(
|
||||
CombatFeatures.empty()
|
||||
@@ -34,6 +36,7 @@ public class Stickfight extends StatelessGame {
|
||||
);
|
||||
|
||||
eventNode().addListener(FinalAttackEvent.class, finalAttackEvent -> {
|
||||
if(isBeforeBeginning) finalAttackEvent.setCancelled(true);
|
||||
finalAttackEvent.setBaseDamage(0);
|
||||
((Player) finalAttackEvent.getTarget()).setHealth(20);
|
||||
});
|
||||
@@ -43,14 +46,26 @@ public class Stickfight extends StatelessGame {
|
||||
|
||||
@Override
|
||||
protected void onLoad(@NotNull CompletableFuture<Void> callback) {
|
||||
setBlock(0, 50, 0, Block.DIAMOND_BLOCK);
|
||||
this.replaceCircle(Block.SANDSTONE);
|
||||
}
|
||||
|
||||
private void replaceCircle(Block block) {
|
||||
int radius = 8;
|
||||
for (int x = -radius; x <= radius; x++) {
|
||||
for (int z = -radius; z <= radius; z++) {
|
||||
Pos blockPosition = this.getSpawn().add(x, -1, z);
|
||||
if(blockPosition.distance(this.getSpawn().sub(0, 1, 0)) <= radius) this.setBlock(blockPosition, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void start() {
|
||||
List<Player> players = getPlayers().stream().toList();
|
||||
int numPlayers = players.size();
|
||||
this.countdownStarted = true;
|
||||
|
||||
this.replaceCircle(Block.AIR);
|
||||
for (int i = 0; i < numPlayers; i++) {
|
||||
double angle = (2 * Math.PI / numPlayers) * i;
|
||||
int spawnX = (int) (radius * Math.cos(angle));
|
||||
@@ -87,7 +102,8 @@ public class Stickfight extends StatelessGame {
|
||||
protected void onPlayerMove(@NotNull PlayerMoveEvent playerMoveEvent) {
|
||||
Player player = playerMoveEvent.getPlayer();
|
||||
if(!spawnPoints.containsKey(player)) {
|
||||
playerMoveEvent.setCancelled(true);
|
||||
if(playerMoveEvent.getNewPosition().y() < 45) player.teleport(this.getSpawn());
|
||||
if(this.countdownStarted) playerMoveEvent.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -3,25 +3,12 @@ package eu.mhsl.minenet.minigames.score;
|
||||
import eu.mhsl.minenet.minigames.util.MapUtil;
|
||||
import net.minestom.server.entity.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public class LowestPointsWinScore extends PointsWinScore {
|
||||
@Override
|
||||
protected void insertResultImplementation(Set<Player> p, int currentPoints) {
|
||||
Set<Player> combined = scoreOrder.entrySet().stream()
|
||||
.filter(entrySet -> Objects.equals(entrySet.getValue(), currentPoints))
|
||||
.map(Map.Entry::getKey)
|
||||
.findFirst()
|
||||
.orElseGet(() -> {
|
||||
Set<Player> s = new HashSet<>();
|
||||
scoreOrder.put(s, currentPoints);
|
||||
return s;
|
||||
});
|
||||
combined.addAll(p);
|
||||
|
||||
this.scoreOrder.put(p, currentPoints);
|
||||
this.scoreOrder = MapUtil.sortReversedByValue(this.scoreOrder);
|
||||
getScores().clear();
|
||||
this.scoreOrder.forEach((player, integer) -> getScores().addFirst(player));
|
||||
|
@@ -16,17 +16,7 @@ public class PointsWinScore extends Score {
|
||||
|
||||
@Override
|
||||
protected void insertResultImplementation(Set<Player> p, int currentPoints) {
|
||||
Set<Player> combined = scoreOrder.entrySet().stream()
|
||||
.filter(entrySet -> Objects.equals(entrySet.getValue(), currentPoints))
|
||||
.map(Map.Entry::getKey)
|
||||
.findFirst()
|
||||
.orElseGet(() -> {
|
||||
Set<Player> s = new HashSet<>();
|
||||
scoreOrder.put(s, currentPoints);
|
||||
return s;
|
||||
});
|
||||
combined.addAll(p);
|
||||
|
||||
this.scoreOrder.put(p, currentPoints);
|
||||
this.scoreOrder = MapUtil.sortByValue(this.scoreOrder);
|
||||
getScores().clear();
|
||||
this.scoreOrder.forEach((player, integer) -> getScores().addFirst(player));
|
||||
@@ -52,12 +42,13 @@ public class PointsWinScore extends Score {
|
||||
.filter(player -> !player.getUsername().isBlank())
|
||||
.toList()
|
||||
.isEmpty())
|
||||
.map(players -> players.stream()
|
||||
.map(Player::getUsername)
|
||||
.sorted()
|
||||
.map(players -> players
|
||||
.stream()
|
||||
.filter(player -> scoreOrder.get(Set.of(player)) != null)
|
||||
.map(player -> player.getUsername()+" : "+scoreOrder.get(Set.of(player)).toString())
|
||||
.collect(Collectors.joining(", "))
|
||||
+ " : " + scoreOrder.get(players)
|
||||
).toList()
|
||||
)
|
||||
.toList()
|
||||
)
|
||||
.undent()
|
||||
.newLine()
|
||||
|
@@ -4,7 +4,6 @@ import eu.mhsl.minenet.minigames.score.Score;
|
||||
import net.minestom.server.entity.Player;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Tournament {
|
||||
private final List<Score> gameScores = new ArrayList<>();
|
||||
@@ -44,11 +43,9 @@ public class Tournament {
|
||||
public Rewards getRewards() {
|
||||
Map<UUID, Integer> itemCount = new HashMap<>();
|
||||
int count = 0;
|
||||
for (Set<Player> players : getPlaces()) {
|
||||
for (Player player : getPlaces()) {
|
||||
if(count >= this.rewardConfiguration.rewardCount().size()) break;
|
||||
for(Player player : players) {
|
||||
itemCount.put(player.getUuid(), this.rewardConfiguration.rewardCount().get(count));
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
@@ -56,21 +53,18 @@ public class Tournament {
|
||||
this.memorialConfiguration.memorialMaterial().namespace().value(),
|
||||
this.memorialConfiguration.memorialTitle(),
|
||||
this.memorialConfiguration.memorialLore(),
|
||||
getGameScores().keySet().stream().map(Player::getUuid).toList(),
|
||||
getPlaces().stream().map(Player::getUuid).toList(),
|
||||
this.rewardConfiguration.item().namespace().value(),
|
||||
itemCount
|
||||
);
|
||||
}
|
||||
|
||||
public List<Set<Player>> getPlaces() {
|
||||
List<Set<Player>> players = new ArrayList<>(
|
||||
public List<Player> getPlaces() {
|
||||
List<Player> players = new ArrayList<>(
|
||||
getGameScores().entrySet().stream()
|
||||
.collect(
|
||||
Collectors.groupingBy(
|
||||
Map.Entry::getValue,
|
||||
Collectors.mapping(Map.Entry::getKey, Collectors.toSet())
|
||||
)
|
||||
).values()
|
||||
.sorted(Map.Entry.comparingByValue())
|
||||
.map(Map.Entry::getKey)
|
||||
.toList()
|
||||
);
|
||||
|
||||
Collections.reverse(players);
|
||||
|
@@ -12,12 +12,10 @@ import net.minestom.server.entity.*;
|
||||
import net.minestom.server.event.player.PlayerMoveEvent;
|
||||
import net.minestom.server.instance.anvil.AnvilLoader;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class TournamentDisplay extends MineNetInstance implements Spawnable {
|
||||
private final List<Set<Player>> places;
|
||||
private final List<Player> places;
|
||||
private final Tournament tournament;
|
||||
|
||||
private final Pos[] placePositions = new Pos[] {
|
||||
@@ -32,7 +30,7 @@ public class TournamentDisplay extends MineNetInstance implements Spawnable {
|
||||
this.places = tournament.getPlaces();
|
||||
this.tournament = tournament;
|
||||
|
||||
this.places.forEach(players -> players.forEach(player -> player.setGameMode(GameMode.ADVENTURE)));
|
||||
this.places.forEach(player -> player.setGameMode(GameMode.ADVENTURE));
|
||||
|
||||
eventNode().addListener(PlayerMoveEvent.class, playerMoveEvent -> {
|
||||
if(isOnDisplay(playerMoveEvent.getPlayer()) && !playerMoveEvent.getNewPosition().sameBlock(placePositions[getRankPosition(playerMoveEvent.getPlayer())])) {
|
||||
@@ -47,10 +45,7 @@ public class TournamentDisplay extends MineNetInstance implements Spawnable {
|
||||
}
|
||||
|
||||
private int getRankPosition(Player player) {
|
||||
for (int i = 0; i < places.size(); i++) {
|
||||
if (places.get(i).contains(player)) return i;
|
||||
}
|
||||
return -1;
|
||||
return this.places.indexOf(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,11 +56,8 @@ public class TournamentDisplay extends MineNetInstance implements Spawnable {
|
||||
p.teleport(placePositions[getRankPosition(p)]);
|
||||
}
|
||||
});
|
||||
List<Player> players = this.places.stream()
|
||||
.flatMap(s -> s.stream().sorted(Comparator.comparing(Player::getUsername)))
|
||||
.toList();
|
||||
new ChatMessage(Icon.STAR)
|
||||
.list(players.stream().map(player -> String.format("%d. %s - %s Punkte", this.getRankPosition(player)+1, player.getUsername(), tournament.getGameScores().get(player))).toList())
|
||||
.numberedList(this.places.stream().map(player -> String.format("%s - %s Punkte", player.getUsername(), tournament.getGameScores().get(player))).toList())
|
||||
.send(p);
|
||||
return false;
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ public enum BlockPallet {
|
||||
STONE(new Block[] {Block.CHISELED_STONE_BRICKS, Block.STONE_BRICKS, Block.POLISHED_ANDESITE, Block.POLISHED_BLACKSTONE, Block.POLISHED_DIORITE}),
|
||||
WINTER(new Block[] {Block.SNOW_BLOCK, Block.ICE, Block.PACKED_ICE, Block.BLUE_CONCRETE, Block.SEA_LANTERN}),
|
||||
STREET(new Block[] {Block.BLACK_CONCRETE_POWDER, Block.GRAY_CONCRETE_POWDER, Block.GRAVEL, Block.BLACK_CONCRETE, Block.GRAY_CONCRETE}),
|
||||
FLOWER(new Block[] {Block.ORANGE_TULIP, Block.PINK_TULIP, Block.RED_TULIP, Block.WHITE_TULIP}),
|
||||
FLOWER(new Block[] {Block.ORANGE_TULIP, Block.PINK_TULIP, Block.RED_TULIP, Block.WHITE_TULIP, Block.DANDELION, Block.POPPY, Block.CORNFLOWER}),
|
||||
PRESSURE_PLATES(new Block[] {Block.ACACIA_PRESSURE_PLATE, Block.BIRCH_PRESSURE_PLATE, Block.CRIMSON_PRESSURE_PLATE, Block.JUNGLE_PRESSURE_PLATE, Block.OAK_PRESSURE_PLATE, Block.DARK_OAK_PRESSURE_PLATE, Block.HEAVY_WEIGHTED_PRESSURE_PLATE, Block.HEAVY_WEIGHTED_PRESSURE_PLATE, Block.POLISHED_BLACKSTONE_PRESSURE_PLATE, Block.SPRUCE_PRESSURE_PLATE, Block.STONE_PRESSURE_PLATE, Block.WARPED_PRESSURE_PLATE});
|
||||
|
||||
final List<Block> list;
|
||||
|
@@ -55,7 +55,19 @@ public class HeightTerrainGenerator extends BaseGenerator {
|
||||
synchronized (batches) {
|
||||
double batchNoise = batches.getNoise(bottomPoint.x(), bottomPoint.z());
|
||||
|
||||
unit.modifier().fill(bottomPoint, bottomPoint.add(1, heightModifier, 1), batchNoise < 0.9 ? batchNoise > 0 ? Block.GRASS_BLOCK : Block.SOUL_SAND : Block.STONE);
|
||||
Block block = batchNoise < 0.9 ? batchNoise > -0.2 ? Block.GRASS_BLOCK : Block.SOUL_SAND : Block.STONE;
|
||||
unit.modifier().fill(bottomPoint, bottomPoint.add(1, heightModifier, 1), block);
|
||||
if(rnd.nextInt(0, 5) < 1 && block == Block.GRASS_BLOCK) {
|
||||
int randomInt = rnd.nextInt(0, 6);
|
||||
if(randomInt > 1) {
|
||||
unit.modifier().setBlock(bottomPoint.add(0, heightModifier, 0), Block.SHORT_GRASS);
|
||||
} else if(randomInt > 0) {
|
||||
unit.modifier().setBlock(bottomPoint.add(0, heightModifier, 0), BlockPallet.FLOWER.rnd());
|
||||
} else {
|
||||
unit.modifier().setBlock(bottomPoint.add(0, heightModifier, 0), Block.TALL_GRASS);
|
||||
unit.modifier().setBlock(bottomPoint.add(0, heightModifier+1, 0), Block.TALL_GRASS.withProperty("half", "upper"));
|
||||
}
|
||||
}
|
||||
|
||||
if(calculateSeaLevel != null) {
|
||||
Point absoluteHeight = bottomPoint.add(0, heightModifier, 0);
|
||||
|
@@ -148,3 +148,7 @@ ns:game_BlockBreakRace#;;
|
||||
name;Block Break Race;Blockbruch-Rennen
|
||||
description;Dig down through the tubes using the right tools. The first player to reach the bottom wins!;Grabe dich durch die Röhren nach unten und verwende dabei das richtige Werkzeug. Wer zuerst unten ankommt, gewinnt!
|
||||
;;
|
||||
ns:game_SpaceSnake#;;
|
||||
name;Space Snake;Weltraum-Snake
|
||||
description;Collect diamonds while extending your snake bridge through space and fight other players. The player with the longest bridge wins!;Sammle Diamanten, während du deine Schlangenbrücke durchs All erweiterst und gegen andere Spieler kämpfst. Der Spieler mit den der Längsten Brücke gewinnt!
|
||||
powerUpCount;Number of diamonds in the arena;Anzahl der Diamanten in der Arena
|
||||
|
Can't render this file because it has a wrong number of fields in line 114.
|
Reference in New Issue
Block a user