This commit is contained in:
LunarAkai 2024-03-22 00:16:12 +01:00
commit e46929b4b4
8 changed files with 260 additions and 148 deletions

View file

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import com.google.common.base.Preconditions;
import de.iani.cubesidestats.api.PlayerStatistics;
import de.iani.cubesidestats.api.PlayerStatisticsQueryKey;
@ -86,6 +87,20 @@ public class MinecleanerManager {
return confirmPlayingInventory;
}
public void handleFieldClick(@NotNull Player player, int x, int y, boolean hasRightClicked) {
MinecleanerArena arena = plugin.getArenaList().getPlayerArena(player);
Preconditions.checkArgument(arena != null, "player is in no arena");
Preconditions.checkState(arena.getArenaStatus() == ArenaStatus.PLAYING, "not running");
if(hasRightClicked) {
// flag
arena.flagCell(x, y);
} else {
// reveal
arena.revealCell(x, y);
}
}
public void getStatisticsForPlayer(OfflinePlayer player, Consumer<PlayerStatisticsData> callback) {
List<StatisticsQueryKey> keys = new ArrayList<>();
PlayerStatistics pStatistics = plugin.getCubesideStatistics().getStatistics(player.getUniqueId());