From c25886d72d66f39a9d1a6a00dabcc8b1f00e4da9 Mon Sep 17 00:00:00 2001 From: LunarAkai Date: Sat, 23 Mar 2024 15:58:46 +0100 Subject: [PATCH] many things --- .gitignore | 1 + .../minecleaner/MinecleanerArena.java | 93 +++++++++++++++++-- .../minecleaner/MinecleanerListener.java | 7 +- .../minecleaner/MinecleanerManager.java | 65 +++++++++++-- .../minecleaner/PlayerStatisticsData.java | 32 ++++++- .../minecleaner/commands/CreateCommand.java | 4 +- .../commands/DeletePlayerScoreCommand.java | 58 ++++++++++++ .../minecleaner/commands/StatsCommand.java | 2 + .../de/lunarakai/minecleaner/game/Game.java | 16 ++++ src/main/resources/plugin.yml | 7 +- 10 files changed, 261 insertions(+), 24 deletions(-) create mode 100644 src/main/java/de/lunarakai/minecleaner/commands/DeletePlayerScoreCommand.java diff --git a/.gitignore b/.gitignore index bd4b3c6..b2bf803 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /target/ /.vscode *.log +Minecleaner.iml diff --git a/src/main/java/de/lunarakai/minecleaner/MinecleanerArena.java b/src/main/java/de/lunarakai/minecleaner/MinecleanerArena.java index 4b0c736..d392f6b 100644 --- a/src/main/java/de/lunarakai/minecleaner/MinecleanerArena.java +++ b/src/main/java/de/lunarakai/minecleaner/MinecleanerArena.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; -import java.util.logging.Level; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; @@ -23,6 +22,9 @@ import de.lunarakai.minecleaner.game.BoardSize; import de.lunarakai.minecleaner.game.Cell; import de.lunarakai.minecleaner.game.Game; import de.lunarakai.minecleaner.utils.MinecleanerHeads; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.TextComponent; public class MinecleanerArena { private final MinecleanerPlugin plugin; @@ -33,7 +35,10 @@ public class MinecleanerArena { private final BlockFace orientation; private ArenaStatus arenaStatus = ArenaStatus.INACTIVE; private UUID[] blockDisplays; + // private UUID[] textDisplays; + private int flagsPlaced = 0; + private Player currentPlayer; private long currentGameStartTime; private Game currentMinecleanerGame; @@ -60,6 +65,7 @@ public class MinecleanerArena { this.location = Preconditions.checkNotNull(arenaSection.getLocation("location")); this.widthIndex = Preconditions.checkNotNull(arenaSection.getInt("fieldwidth")); this.blockDisplays = new UUID[BoardSize.boardSizes[widthIndex] * BoardSize.boardSizes[widthIndex]]; + // this.textDisplays = new UUID[1]; BlockFace orientation = BlockFace.NORTH; try { @@ -78,6 +84,14 @@ public class MinecleanerArena { blockDisplays[i] = UUID.fromString(blockDisplay); } } + + // List textList = arenaSection.getStringList("textdisplay"); + // for(int i = 0; i < textList.size(); i++) { + // String textString = list.get(i); + // if(textString != null) { + // textDisplays[0] = UUID.fromString(textString); + // } + // } } public MinecleanerArena(MinecleanerPlugin plugin, String name, Location location, int widthIndex, BlockFace orientation) { @@ -86,6 +100,7 @@ public class MinecleanerArena { this.location = Preconditions.checkNotNull(location, "location"); this.widthIndex = Preconditions.checkNotNull(widthIndex, ("fieldwidth")); this.blockDisplays = new UUID[BoardSize.boardSizes[widthIndex] * BoardSize.boardSizes[widthIndex]]; + //this.textDisplays = new UUID[1]; Preconditions.checkArgument(Math.abs(orientation.getModX()) + Math.abs(orientation.getModZ()) == 1, "no cardinal direction"); this.orientation = orientation; @@ -109,7 +124,7 @@ public class MinecleanerArena { // todo: larger grids - for (int fx = -1; fx < 2 + widthIndex; fx++) { + for (int fx = -1 - widthIndex; fx < 2 ; fx++) { for (int fy = -1; fy < 2 + widthIndex; fy++) { loc.set(location.getX() + d1x * fx, location.getY() + fy, location.getZ() + d1z * fx); boolean f = (fx + fy) % 2 == 0; @@ -137,14 +152,27 @@ public class MinecleanerArena { Arrays.fill(blockDisplays, null); float rotation0 = 0; + double eastWestGapFixX = 0.0; + double eastWestGapFixZ = 0.0; + + double southGapFixX = 0.0; + double southGapFixZ = 0.0; if(orientation == BlockFace.EAST) { rotation0 = 90; + eastWestGapFixX = 0.55; + eastWestGapFixZ = -0.46; } else if(orientation == BlockFace.SOUTH) { rotation0 = 180; + southGapFixX = 1.02; + southGapFixZ = 0.1; } else if(orientation == BlockFace.WEST) { rotation0 = 270; + eastWestGapFixX = 0.5; + eastWestGapFixZ = 0.5725; } + + float rotation = rotation0; int d0x = orientation.getModX(); @@ -160,16 +188,16 @@ public class MinecleanerArena { // Todo not correctly alligned at different orientations (other than NORTH) //loc.set(location.getX() + 0.11 - (d1x * fz) / 3.0 + d0x * 0.501 + d1x * 1.847, location.getY() - 0.9725 + fxf / 3.0, location.getZ() + 0.45 - (d1z * fz) / 3.0 + d0z * 0.501 + d1z * 1.847); - loc.set(location.getX() - (d1x * fz) / 3.0 + d0x * 0.55 + d1x * 1.847, - location.getY() - 0.8 + fxf / 3.0, - location.getZ() + 0.45 - (d1z * fz) / 3.0 + d0z * 0.55 + d1z * 1.847); + loc.set(location.getX() - 0.016 + eastWestGapFixX + southGapFixX - (d1x * fz) / 3.0 + d0x * 0.55 + d1x * 1.847, + location.getY() - 0.8225 + fxf / 3.0, + location.getZ() + 0.45 + eastWestGapFixZ + southGapFixZ - (d1z * fz) / 3.0 + d0z * 0.55 + d1z * 1.847); // Todo: Z-Fighting on Unknown Tile Heads && Flags(Front) // Todo: Z-Fighting on the Sides for all Tiles Display blockDisplay = world.spawn(loc, ItemDisplay.class, blockdisplay -> { Transformation transformation = blockdisplay.getTransformation(); Transformation newTransform; - Vector3f newTranslationScale = new Vector3f(0.65f, 0.65f, 0.65f); + Vector3f newTranslationScale = new Vector3f(0.60f, 0.60f, 0.60f); newTransform = new Transformation( transformation.getTranslation(), transformation.getLeftRotation(), @@ -188,6 +216,29 @@ public class MinecleanerArena { } } } + + // Location textLocation = location.clone(); + // TextDisplay textDisplay = world.spawn(textLocation.add(-1, 2 + widthIndex, -0.25), TextDisplay.class, textdisplay -> { + // Transformation transformation = textdisplay.getTransformation(); + // Transformation newTransformation; + // newTransformation = new Transformation( + // transformation.getTranslation(), + // transformation.getLeftRotation(), + // transformation.getTranslation(), + // transformation.getRightRotation()); + + // textdisplay.setTransformation(newTransformation); + // textdisplay.setRotation(rotation, 0); + + // textdisplay.setVisibleByDefault(true); + // textdisplay.setDisplayHeight(3); + // textdisplay.setDisplayWidth(9); + // textdisplay.setText("Minecleaner"); + // }); + + // if(textDisplay != null) { + // textDisplays[0] = textDisplay.getUniqueId(); + // } // show Displays } @@ -202,6 +253,11 @@ public class MinecleanerArena { blockDisplays.add(uuid == null ? null : uuid.toString()); } arenaSection.set("blockdisplays", blockDisplays); + // List textd = new ArrayList<>(); + // for(UUID uuid : this.textDisplays) { + // textd.add(uuid == null ? null : uuid.toString()); + // } + // arenaSection.set("textdisplay", textd); } private void setDiplayBlock(int x, int y, MinecleanerHeads head) { @@ -218,6 +274,7 @@ public class MinecleanerArena { public void startNewGame() { currentMinecleanerGame = new Game(plugin, BoardSize.boardSizes[widthIndex], BoardSize.mineCounter[widthIndex]); currentMinecleanerGame.start(); + flagsPlaced = 0; arenaStatus = ArenaStatus.PLAYING; } @@ -273,7 +330,9 @@ public class MinecleanerArena { //plugin.getLogger().log(Level.SEVERE, " Is Flagged (before first if): " + cell.isFlagged()); if(cell.isFlagged() == true) { - plugin.getLogger().log(Level.SEVERE, "Flagged Cell: [" + cell.position.x + "," + cell.position.y + "]"); + //plugin.getLogger().log(Level.SEVERE, "Flagged Cell: [" + cell.position.x + "," + cell.position.y + "]"); + flagsPlaced = flagsPlaced + 1; + sendActionBarMessage(player); setDiplayBlock(x, y, MinecleanerHeads.MINESWEEPER_TILE_FLAG); } @@ -281,7 +340,9 @@ public class MinecleanerArena { //plugin.getLogger().log(Level.SEVERE, " Is Flagged (before second if): " + cell.isFlagged()); if(cell.isFlagged() == false) { - plugin.getLogger().log(Level.SEVERE, "Unflagged Cell: [" + cell.position.x + "," + cell.position.y + "]"); + //plugin.getLogger().log(Level.SEVERE, "Unflagged Cell: [" + cell.position.x + "," + cell.position.y + "]"); + flagsPlaced = flagsPlaced - 1; + sendActionBarMessage(player); setDiplayBlock(x, y, MinecleanerHeads.MINESWEEPER_TILE_UNKNOWN); } } @@ -297,12 +358,13 @@ public class MinecleanerArena { Player player = this.currentPlayer; currentMinecleanerGame.reveal(x, y); - setBlockForCellType(x, y, cell); if(currentMinecleanerGame.gameover) { plugin.getManager().handleGameover(player, this, !(cell.isRevealed() && cell.isExploded())); - } + } else { + sendActionBarMessage(player); + } ArrayList floodedCells = currentMinecleanerGame.getfloodedCells(); if(floodedCells != null) { @@ -315,6 +377,12 @@ public class MinecleanerArena { } } + private void sendActionBarMessage(Player player) { + TextComponent textComponent = new TextComponent("Flaggen gesetzt: " + flagsPlaced + " Minen insgesamt: " + BoardSize.mineCounter[widthIndex]); + textComponent.setColor(ChatColor.GOLD); + player.sendMessage(ChatMessageType.ACTION_BAR, textComponent); + } + public void showMines() { ArrayList explodedCells = currentMinecleanerGame.getExplodedCells(); if(explodedCells != null) { @@ -452,5 +520,10 @@ public class MinecleanerArena { public int getSize() { return BoardSize.boardSizes[widthIndex]; } + + // Difficulty + public int getWidthIndex() { + return widthIndex; + } } diff --git a/src/main/java/de/lunarakai/minecleaner/MinecleanerListener.java b/src/main/java/de/lunarakai/minecleaner/MinecleanerListener.java index 1450c67..aff521c 100644 --- a/src/main/java/de/lunarakai/minecleaner/MinecleanerListener.java +++ b/src/main/java/de/lunarakai/minecleaner/MinecleanerListener.java @@ -85,10 +85,11 @@ public class MinecleanerListener implements Listener { } */ - //player.sendMessage(ChatColor.GRAY + "blockx: " + blockx + " ,blockz: " + blockz); - // player.sendMessage(ChatColor.GRAY + "blockxInt: " + blockxInt + " ,blockzInt: " + blockzInt); + player.sendMessage(ChatColor.GRAY + "blockx: " + blockx + " ,blockz: " + blockz); + //player.sendMessage(ChatColor.GRAY + "blockxInt: " + blockxInt + " ,blockzInt: " + blockzInt); - if (blockx >= 0.1 && blockx <= 0.9 && blockz >= 0.1 && blockz <= 0.9) { + if (blockx >= 0.1 && blockx <= 0.95 && blockz >= 0.0125 && blockz <= 0.98125) { + //if ((blockx >= 0.13 && blockx <= 0.9825 && blockx <= 0.12) && blockz >= 0.0125 && blockz <= 0.98125) { boolean hasRightClicked = false; if(e.getAction() == Action.RIGHT_CLICK_BLOCK) { hasRightClicked = true; diff --git a/src/main/java/de/lunarakai/minecleaner/MinecleanerManager.java b/src/main/java/de/lunarakai/minecleaner/MinecleanerManager.java index 17e584d..97fabae 100644 --- a/src/main/java/de/lunarakai/minecleaner/MinecleanerManager.java +++ b/src/main/java/de/lunarakai/minecleaner/MinecleanerManager.java @@ -4,10 +4,11 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; import java.util.function.Consumer; -import java.util.logging.Level; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.OfflinePlayer; +import org.bukkit.Sound; +import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.Inventory; @@ -27,7 +28,10 @@ import net.md_5.bungee.api.ChatColor; public class MinecleanerManager { private final MinecleanerPlugin plugin; private final Inventory confirmPlayingInventory; + + // Statistics private final StatisticKey statisticsGamesTotal; + private final StatisticKey statisticsPointsAcquired; private int prevTick = 0; @@ -45,6 +49,10 @@ public class MinecleanerManager { statisticsGamesTotal = plugin.getCubesideStatistics().getStatisticKey("minecleaner.gamesTotal"); statisticsGamesTotal.setIsMonthlyStats(true); statisticsGamesTotal.setDisplayName("Runden gespielt"); + + statisticsPointsAcquired = plugin.getCubesideStatistics().getStatisticKey("minecleaner.pointsTotal"); + statisticsPointsAcquired.setIsMonthlyStats(true); + statisticsPointsAcquired.setDisplayName("Punkte erspielt"); } @@ -78,22 +86,56 @@ public class MinecleanerManager { } public void handleGameover(Player player, MinecleanerArena arena, boolean isSuccessfullyCleared) { + World world = player.getWorld(); if(!isSuccessfullyCleared) { + world.playSound(player.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.5f, 0.5f); player.sendMessage(ChatColor.YELLOW + "Game Over! Du konntest das Feld nicht erfolgreich lösen!"); arena.showMines(); - + Bukkit.getScheduler().runTaskLater(plugin, () -> { - leaveArena(player, false); + if(arena.getCurrentPlayer() == null) { + arena.removePlayer(); + } else { + leaveArena(player, false); + } + }, 100L); return; } player.sendMessage(ChatColor.YELLOW + "Glückwunsch, du konntest das Feld erfolgreich lösen!"); + + + world.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 0.5f, 0.5f); + PlayerStatistics ps = plugin.getCubesideStatistics().getStatistics(player.getUniqueId()); ps.increaseScore(statisticsGamesTotal, 1); - + int wIndex = arena.getWidthIndex(); + switch (wIndex) { + case 0: { + ps.increaseScore(statisticsPointsAcquired, 1); + break; + } + case 1: { + ps.increaseScore(statisticsPointsAcquired, 3); + break; + } + case 2: { + ps.increaseScore(statisticsPointsAcquired, 5); + break; + } + default: { + ps.increaseScore(statisticsPointsAcquired, 0); + break; + } + } Bukkit.getScheduler().runTaskLater(plugin, () -> { + if(arena.getCurrentPlayer() == null) { + arena.removePlayer(); + } else { + leaveArena(player, false); + } leaveArena(player, false); }, 100L); @@ -122,11 +164,11 @@ public class MinecleanerManager { // Fires Twice for Right Click on Same Tick, but only once for left click... stupid :< if(hasRightClicked) { // flag - plugin.getLogger().log(Level.SEVERE, " Right Clicked @ Tick: " + plugin.getServer().getCurrentTick()); + //plugin.getLogger().log(Level.SEVERE, " Right Clicked @ Tick: " + plugin.getServer().getCurrentTick()); arena.flagCell(x, y); } else { // reveal - plugin.getLogger().log(Level.SEVERE, " Left Clicked @ Tick: " + plugin.getServer().getCurrentTick()); + //plugin.getLogger().log(Level.SEVERE, " Left Clicked @ Tick: " + plugin.getServer().getCurrentTick()); arena.revealCell(x, y); } } @@ -142,11 +184,19 @@ public class MinecleanerManager { PlayerStatisticsQueryKey kMatchesPlayedMonth; keys.add(kMatchesPlayedMonth = new PlayerStatisticsQueryKey(pStatistics, statisticsGamesTotal, QueryType.SCORE, TimeFrame.MONTH)); + PlayerStatisticsQueryKey kPointsAcquired; + keys.add(kPointsAcquired = new PlayerStatisticsQueryKey(pStatistics, statisticsPointsAcquired, QueryType.SCORE)); + PlayerStatisticsQueryKey kPointsAcquiredMonth; + keys.add(kPointsAcquiredMonth = new PlayerStatisticsQueryKey(pStatistics, statisticsPointsAcquired, QueryType.SCORE, TimeFrame.MONTH)); + plugin.getCubesideStatistics().queryStats(keys, (c) -> { int matchesPlayed = c.getOrDefault(kMatchesPlayed, 0); int matchesPlayedMonth = c.getOrDefault(kMatchesPlayedMonth, 0); + int pointsAcquiredTotal = c.getOrDefault(kPointsAcquired, 0); + int pointsAcquiredMonth = c.getOrDefault(kPointsAcquiredMonth, 0); - callback.accept(new PlayerStatisticsData(player.getUniqueId(), player.getName(), matchesPlayed, matchesPlayedMonth)); + callback.accept(new PlayerStatisticsData(player.getUniqueId(), player.getName(), matchesPlayed, matchesPlayedMonth, + pointsAcquiredTotal, pointsAcquiredMonth)); }); } @@ -162,5 +212,6 @@ public class MinecleanerManager { public void deleteScores(UUID playerId) { PlayerStatistics statsPlayer = plugin.getCubesideStatistics().getStatistics(playerId); statsPlayer.deleteScore(statisticsGamesTotal); + statsPlayer.deleteScore(statisticsPointsAcquired); } } diff --git a/src/main/java/de/lunarakai/minecleaner/PlayerStatisticsData.java b/src/main/java/de/lunarakai/minecleaner/PlayerStatisticsData.java index fd8271f..7b557e9 100644 --- a/src/main/java/de/lunarakai/minecleaner/PlayerStatisticsData.java +++ b/src/main/java/de/lunarakai/minecleaner/PlayerStatisticsData.java @@ -7,12 +7,24 @@ public class PlayerStatisticsData { private String playerName; private int gamesPlayed; private int gamesPlayedThisMonth; + // private HashMap gamesPlayedSize; + // private HashMap gamesPlayedSizeThisMonth; + private int pointsAcquiredTotal; + private int pointsAcquiredMonth; - public PlayerStatisticsData(UUID playerUUID, String playerName, int gamesPlayed, int gamesPlayedThisMonth) { + public PlayerStatisticsData(UUID playerUUID, String playerName, int gamesPlayed, int gamesPlayedThisMonth, + int pointsAcquiredTotal, int pointsAcquiredMonth) { this.playerUUID = playerUUID; this.playerName = playerName; + this.gamesPlayed = gamesPlayed; this.gamesPlayedThisMonth = gamesPlayedThisMonth; + + // this.gamesPlayedSize = gamesPlayedSize; + // this.gamesPlayedSizeThisMonth = gamesPlayedSizeThisMonth; + + this.pointsAcquiredTotal = pointsAcquiredTotal; + this.pointsAcquiredMonth = pointsAcquiredMonth; } public UUID getPlayerID() { @@ -30,5 +42,23 @@ public class PlayerStatisticsData { public int getGamesPlayedThisMonth() { return gamesPlayedThisMonth; } + + // public int getGamesPlayedSize(Integer widthIndex) { + // Integer value = gamesPlayedSize.get(widthIndex); + // return value == null ? 0 : value; + // } + + // public int getGamesPlayedSizeThisMonth(Integer widthIndex) { + // Integer value = gamesPlayedSizeThisMonth.get(widthIndex); + // return value == null ? 0 : value; + // } + + public int getPointsAcquiredTotal() { + return pointsAcquiredTotal; + } + + public int getPointsAquiredMonth() { + return pointsAcquiredMonth; + } } diff --git a/src/main/java/de/lunarakai/minecleaner/commands/CreateCommand.java b/src/main/java/de/lunarakai/minecleaner/commands/CreateCommand.java index 1663bfe..6535c0e 100644 --- a/src/main/java/de/lunarakai/minecleaner/commands/CreateCommand.java +++ b/src/main/java/de/lunarakai/minecleaner/commands/CreateCommand.java @@ -75,12 +75,12 @@ public class CreateCommand extends SubCommand { widthindex = Integer.parseInt(arg); } catch(NumberFormatException e) { sender.sendMessage(ChatColor.DARK_RED + "Kein Valider Arena WidthIndex!"); - sender.sendMessage(ChatColor.DARK_RED + "0 (oder weglassen) = 9*9, 1 = 15*15, 2 = 24*24"); + sender.sendMessage(ChatColor.DARK_RED + "0 (oder weglassen) = 9*9, 1 = 12*12, 2 = 15*15"); return true; } if(widthindex > 2) { sender.sendMessage(ChatColor.DARK_RED + "Arena WidthIndex darf nicht größer als 2 sein"); - sender.sendMessage(ChatColor.DARK_RED + "0 (oder weglassen) = 9*9, 1 = 15*15, 2 = 24*24"); + sender.sendMessage(ChatColor.DARK_RED + "0 (oder weglassen) = 9*9, 1 = 12*12, 2 = 15*15"); return true; } } else { diff --git a/src/main/java/de/lunarakai/minecleaner/commands/DeletePlayerScoreCommand.java b/src/main/java/de/lunarakai/minecleaner/commands/DeletePlayerScoreCommand.java new file mode 100644 index 0000000..2965406 --- /dev/null +++ b/src/main/java/de/lunarakai/minecleaner/commands/DeletePlayerScoreCommand.java @@ -0,0 +1,58 @@ +package de.lunarakai.minecleaner.commands; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import de.iani.cubesideutils.bukkit.commands.SubCommand; +import de.iani.cubesideutils.bukkit.commands.exceptions.DisallowsCommandBlockException; +import de.iani.cubesideutils.bukkit.commands.exceptions.IllegalSyntaxException; +import de.iani.cubesideutils.bukkit.commands.exceptions.InternalCommandException; +import de.iani.cubesideutils.bukkit.commands.exceptions.NoPermissionException; +import de.iani.cubesideutils.bukkit.commands.exceptions.RequiresPlayerException; +import de.iani.cubesideutils.commands.ArgsParser; +import de.iani.playerUUIDCache.CachedPlayer; +import de.lunarakai.minecleaner.MinecleanerPlugin; +import net.md_5.bungee.api.ChatColor; + +public class DeletePlayerScoreCommand extends SubCommand{ + private final MinecleanerPlugin plugin; + + public DeletePlayerScoreCommand(MinecleanerPlugin plugin) { + this.plugin = plugin; + } + + @Override + public String getUsage() { + return " DELETE"; + } + + @Override + public boolean requiresPlayer() { + return true; + } + + @Override + public String getRequiredPermission() { + return MinecleanerPlugin.PERMISSION_ADMIN; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String alias, String commandString, + ArgsParser args) throws DisallowsCommandBlockException, RequiresPlayerException, + NoPermissionException, IllegalSyntaxException, InternalCommandException { + String player = args.getNext(null); + String deleteConfirm = args.getNext(null); + if(player == null || deleteConfirm == null || !deleteConfirm.equals("DELETE") || args.remaining() > 0) { + sender.sendMessage(ChatColor.DARK_RED + commandString + getUsage()); + return true; + } + + CachedPlayer cachedPlayer = plugin.getPlayerUUIDCache().getPlayer(player); + if(cachedPlayer == null) { + sender.sendMessage(ChatColor.DARK_RED + "Ein Spieler mit dem Namen '" + player + "' konnte nicht gefunden werden."); + } + plugin.getManager().deleteScores(cachedPlayer.getUUID()); + sender.sendMessage(ChatColor.DARK_RED + "Alle Minecleaner-Statistiken von Spieler '" + cachedPlayer.getName() + "' wurden gelöscht."); + return true; + } + +} diff --git a/src/main/java/de/lunarakai/minecleaner/commands/StatsCommand.java b/src/main/java/de/lunarakai/minecleaner/commands/StatsCommand.java index d3616c0..4e02c51 100644 --- a/src/main/java/de/lunarakai/minecleaner/commands/StatsCommand.java +++ b/src/main/java/de/lunarakai/minecleaner/commands/StatsCommand.java @@ -54,6 +54,8 @@ public class StatsCommand extends SubCommand { sender.sendMessage(ChatColor.GREEN + "Minecleaner-Statitik von " + data.getPlayerName() + ":"); } sender.sendMessage(ChatColor.BLUE + " Runden gespielt: " + ChatColor.GREEN + data.getGamesPlayed() + " (Dieser Monat: " + data.getGamesPlayedThisMonth() + ")"); + sender.sendMessage(ChatColor.BLUE + " Punkte erspielt: " + ChatColor.GREEN + data.getPointsAcquiredTotal() + " (Dieser Monat: " + data.getPointsAquiredMonth() + ")"); + } }; if(playerName == null) { diff --git a/src/main/java/de/lunarakai/minecleaner/game/Game.java b/src/main/java/de/lunarakai/minecleaner/game/Game.java index e4fc82e..5e69c21 100644 --- a/src/main/java/de/lunarakai/minecleaner/game/Game.java +++ b/src/main/java/de/lunarakai/minecleaner/game/Game.java @@ -188,6 +188,7 @@ public class Game { floodedCells.add(cell); state[cell.position.x][cell.position.y] = cell; + // this looks bad, i should probably go to the doctor with it D: if(cell.getType() == Cell.CellType.Empty) { if(isValid(cell.position.x -1, cell.position.y)) { flood(getCell(cell.position.x -1, cell.position.y)); @@ -202,6 +203,21 @@ public class Game { if(isValid(cell.position.x, cell.position.y +1)) { flood(getCell(cell.position.x, cell.position.y +1)); } + + // Corners + // Todo: oben links geht nicht + if(isValid(cell.position.x + 1, cell.position.y +1)) { + flood(getCell(cell.position.x +1, cell.position.y +1)); + } + if(isValid(cell.position.x + 1, cell.position.y -1)) { + flood(getCell(cell.position.x +1, cell.position.y -1)); + } + if(isValid(cell.position.x - 1, cell.position.y +1)) { + flood(getCell(cell.position.x -1, cell.position.y +1)); + } + if(isValid(cell.position.x - 1, cell.position.y - 1)) { + flood(getCell(cell.position.x -1, cell.position.y -1)); + } } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 6cc291e..0a4a2f8 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -5,4 +5,9 @@ api-version: '1.20' commands: minecleaner: description: main command - aliases: "mcl" \ No newline at end of file + aliases: "mcl" + + +permissions: + minecleaner.admin: {} + minecleaner.play: {} \ No newline at end of file