many things
This commit is contained in:
parent
c164d1b6cd
commit
c25886d72d
10 changed files with 261 additions and 24 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,3 +2,4 @@
|
|||
/target/
|
||||
/.vscode
|
||||
*.log
|
||||
Minecleaner.iml
|
||||
|
|
|
|||
|
|
@ -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,6 +35,9 @@ 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;
|
||||
|
|
@ -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<String> 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(),
|
||||
|
|
@ -189,6 +217,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<String> 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,11 +358,12 @@ 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<Cell> floodedCells = currentMinecleanerGame.getfloodedCells();
|
||||
|
|
@ -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<Cell> explodedCells = currentMinecleanerGame.getExplodedCells();
|
||||
if(explodedCells != null) {
|
||||
|
|
@ -453,4 +521,9 @@ public class MinecleanerArena {
|
|||
return BoardSize.boardSizes[widthIndex];
|
||||
}
|
||||
|
||||
// Difficulty
|
||||
public int getWidthIndex() {
|
||||
return widthIndex;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
@ -46,6 +50,10 @@ public class MinecleanerManager {
|
|||
statisticsGamesTotal.setIsMonthlyStats(true);
|
||||
statisticsGamesTotal.setDisplayName("Runden gespielt");
|
||||
|
||||
statisticsPointsAcquired = plugin.getCubesideStatistics().getStatisticKey("minecleaner.pointsTotal");
|
||||
statisticsPointsAcquired.setIsMonthlyStats(true);
|
||||
statisticsPointsAcquired.setDisplayName("Punkte erspielt");
|
||||
|
||||
}
|
||||
|
||||
public void joinArena(Player player, MinecleanerArena arena) {
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,24 @@ public class PlayerStatisticsData {
|
|||
private String playerName;
|
||||
private int gamesPlayed;
|
||||
private int gamesPlayedThisMonth;
|
||||
// private HashMap<Integer, Integer> gamesPlayedSize;
|
||||
// private HashMap<Integer, Integer> 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() {
|
||||
|
|
@ -31,4 +43,22 @@ public class PlayerStatisticsData {
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 "<name> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,3 +6,8 @@ commands:
|
|||
minecleaner:
|
||||
description: main command
|
||||
aliases: "mcl"
|
||||
|
||||
|
||||
permissions:
|
||||
minecleaner.admin: {}
|
||||
minecleaner.play: {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue