made BoolOption show true or false, shortened tetris Timeout after first death
This commit is contained in:
		| @@ -52,8 +52,6 @@ public class StatelessGame extends Game { | ||||
|                 switch (timeLeft) { | ||||
|                     case 60, 30, 10, 5, 4, 3, 2, 1 -> | ||||
|                         new ChatMessage(Icon.SCIENCE).appendStatic("Noch " + timeLeft + " Sekunden!").send(getPlayers()); | ||||
|                     case 120 -> | ||||
|                         new ChatMessage(Icon.SCIENCE).appendStatic("Noch 2 Minuten!").send(getPlayers()); | ||||
|                 } | ||||
|  | ||||
|                 timePlayed++; | ||||
|   | ||||
| @@ -9,6 +9,7 @@ import net.minestom.server.item.ItemStack; | ||||
| import net.minestom.server.item.Material; | ||||
|  | ||||
| import java.util.List; | ||||
| import java.util.Objects; | ||||
|  | ||||
| public abstract class Option<T> { | ||||
|     private RestrictionHandler restrictionHandler; | ||||
| @@ -44,11 +45,11 @@ public abstract class Option<T> { | ||||
|     } | ||||
|  | ||||
|     public ItemStack getCurrent(Player p) { | ||||
|         int amount = Integer.parseInt(options.get(pointer).toString()); | ||||
|         String value = options.get(pointer).toString(); | ||||
|         return ItemStack.builder(item) | ||||
|                 .customName(name.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(); | ||||
|     } | ||||
|  | ||||
| @@ -57,7 +58,7 @@ public abstract class Option<T> { | ||||
|     } | ||||
|  | ||||
|     public boolean getAsBoolean() { | ||||
|         return getAsInt() != 0; | ||||
|         return Objects.equals(getAsString(), "true") || Objects.equals(getAsString(), "1"); | ||||
|     } | ||||
|  | ||||
|     public String getAsString() { | ||||
|   | ||||
| @@ -6,8 +6,8 @@ import net.minestom.server.item.Material; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| public class BoolOption extends Option<Integer> { | ||||
| public class BoolOption extends Option<String> { | ||||
|     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.Dimension; | ||||
| 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 net.kyori.adventure.text.Component; | ||||
| import net.minestom.server.coordinate.Pos; | ||||
| @@ -129,8 +131,9 @@ class Tetris extends StatelessGame { | ||||
|             getScore().insertResult(event.getPlayer(), tetrisGame.getScore()); | ||||
|  | ||||
|             if(!setTimeLimit) { | ||||
|                 this.setTimeLimit(120); | ||||
|                 this.setTimeLimit(90); | ||||
|                 setTimeLimit = true; | ||||
|                 new ChatMessage(Icon.SCIENCE).appendStatic("Noch 90 Sekunden!").send(getPlayers()); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user