made BoolOption show true or false, shortened tetris Timeout after first death
This commit is contained in:
parent
720d3c8d65
commit
f85ebbbb5d
@ -52,8 +52,6 @@ public class StatelessGame extends Game {
|
|||||||
switch (timeLeft) {
|
switch (timeLeft) {
|
||||||
case 60, 30, 10, 5, 4, 3, 2, 1 ->
|
case 60, 30, 10, 5, 4, 3, 2, 1 ->
|
||||||
new ChatMessage(Icon.SCIENCE).appendStatic("Noch " + timeLeft + " Sekunden!").send(getPlayers());
|
new ChatMessage(Icon.SCIENCE).appendStatic("Noch " + timeLeft + " Sekunden!").send(getPlayers());
|
||||||
case 120 ->
|
|
||||||
new ChatMessage(Icon.SCIENCE).appendStatic("Noch 2 Minuten!").send(getPlayers());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
timePlayed++;
|
timePlayed++;
|
||||||
|
@ -9,6 +9,7 @@ import net.minestom.server.item.ItemStack;
|
|||||||
import net.minestom.server.item.Material;
|
import net.minestom.server.item.Material;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public abstract class Option<T> {
|
public abstract class Option<T> {
|
||||||
private RestrictionHandler restrictionHandler;
|
private RestrictionHandler restrictionHandler;
|
||||||
@ -44,11 +45,11 @@ public abstract class Option<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getCurrent(Player p) {
|
public ItemStack getCurrent(Player p) {
|
||||||
int amount = Integer.parseInt(options.get(pointer).toString());
|
String value = options.get(pointer).toString();
|
||||||
return ItemStack.builder(item)
|
return ItemStack.builder(item)
|
||||||
.customName(name.getAssembled(p))
|
.customName(name.getAssembled(p))
|
||||||
.lore(TranslatedComponent.byId("optionCommon#value").setColor(NamedTextColor.GOLD).getAssembled(p)
|
.lore(TranslatedComponent.byId("optionCommon#value").setColor(NamedTextColor.GOLD).getAssembled(p)
|
||||||
.append(Component.text(": ")).append(Component.text(amount)))
|
.append(Component.text(": ")).append(Component.text(value)))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ public abstract class Option<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean getAsBoolean() {
|
public boolean getAsBoolean() {
|
||||||
return getAsInt() != 0;
|
return Objects.equals(getAsString(), "true") || Objects.equals(getAsString(), "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAsString() {
|
public String getAsString() {
|
||||||
|
@ -6,8 +6,8 @@ import net.minestom.server.item.Material;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BoolOption extends Option<Integer> {
|
public class BoolOption extends Option<String> {
|
||||||
public BoolOption(String id, Material item, TranslatedComponent name) {
|
public BoolOption(String id, Material item, TranslatedComponent name) {
|
||||||
super(id, item, name, List.of(1, 0));
|
super(id, item, name, List.of("true", "false"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import eu.mhsl.minenet.minigames.instance.game.stateless.StatelessGame;
|
|||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.tetris.game.TetrisGame;
|
import eu.mhsl.minenet.minigames.instance.game.stateless.types.tetris.game.TetrisGame;
|
||||||
import eu.mhsl.minenet.minigames.instance.Dimension;
|
import eu.mhsl.minenet.minigames.instance.Dimension;
|
||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.tetris.game.Tetromino;
|
import eu.mhsl.minenet.minigames.instance.game.stateless.types.tetris.game.Tetromino;
|
||||||
|
import eu.mhsl.minenet.minigames.message.Icon;
|
||||||
|
import eu.mhsl.minenet.minigames.message.type.ChatMessage;
|
||||||
import eu.mhsl.minenet.minigames.score.PointsWinScore;
|
import eu.mhsl.minenet.minigames.score.PointsWinScore;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.minestom.server.coordinate.Pos;
|
import net.minestom.server.coordinate.Pos;
|
||||||
@ -129,8 +131,9 @@ class Tetris extends StatelessGame {
|
|||||||
getScore().insertResult(event.getPlayer(), tetrisGame.getScore());
|
getScore().insertResult(event.getPlayer(), tetrisGame.getScore());
|
||||||
|
|
||||||
if(!setTimeLimit) {
|
if(!setTimeLimit) {
|
||||||
this.setTimeLimit(120);
|
this.setTimeLimit(90);
|
||||||
setTimeLimit = true;
|
setTimeLimit = true;
|
||||||
|
new ChatMessage(Icon.SCIENCE).appendStatic("Noch 90 Sekunden!").send(getPlayers());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user