progress??
This commit is contained in:
		
					parent
					
						
							
								ce060a26bf
							
						
					
				
			
			
				commit
				
					
						1aeb0d7504
					
				
			
		
					 7 changed files with 197 additions and 32 deletions
				
			
		|  | @ -4,8 +4,12 @@ import java.util.ArrayList; | |||
| import java.util.List; | ||||
| import java.util.UUID; | ||||
| import java.util.function.Consumer; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.OfflinePlayer; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.inventory.InventoryType; | ||||
| import org.bukkit.inventory.Inventory; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| import com.google.common.base.Preconditions; | ||||
| import de.iani.cubesidestats.api.PlayerStatistics; | ||||
| import de.iani.cubesidestats.api.PlayerStatisticsQueryKey; | ||||
|  | @ -13,17 +17,28 @@ import de.iani.cubesidestats.api.PlayerStatisticsQueryKey.QueryType; | |||
| import de.iani.cubesidestats.api.StatisticKey; | ||||
| import de.iani.cubesidestats.api.StatisticsQueryKey; | ||||
| import de.iani.cubesidestats.api.TimeFrame; | ||||
| import de.iani.cubesideutils.bukkit.items.ItemStacks; | ||||
| import de.iani.playerUUIDCache.CachedPlayer; | ||||
| import net.md_5.bungee.api.ChatColor; | ||||
| 
 | ||||
| public class MinecleanerManager { | ||||
|     private final MinecleanerPlugin plugin; | ||||
|     private final Inventory confirmPlayingInventory; | ||||
| 
 | ||||
|     private final StatisticKey statisticsGamesTotal; | ||||
| 
 | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public MinecleanerManager(MinecleanerPlugin plugin) { | ||||
|         this.plugin = plugin; | ||||
| 
 | ||||
|         // Deprecated | ||||
|         this.confirmPlayingInventory = plugin.getServer().createInventory(null, InventoryType.HOPPER, "Möchtest du Minecleaner spielen?"); | ||||
|         this.confirmPlayingInventory.setItem(1,  | ||||
|             ItemStacks.lore(ItemStacks.rename(new ItemStack(Material.GREEN_CONCRETE), ChatColor.GREEN + "Bestätigen"))); | ||||
|         this.confirmPlayingInventory.setItem(3, | ||||
|             ItemStacks.lore(ItemStacks.rename(new ItemStack(Material.RED_CONCRETE), ChatColor.RED + "Abbrechen"))); | ||||
| 
 | ||||
| 
 | ||||
|         statisticsGamesTotal = plugin.getCubesideStatistics().getStatisticKey("minecleaner.gamesTotal"); | ||||
|         statisticsGamesTotal.setIsMonthlyStats(true); | ||||
|         statisticsGamesTotal.setDisplayName("Runden gespielt"); | ||||
|  | @ -38,6 +53,7 @@ public class MinecleanerManager { | |||
|         Preconditions.checkArgument(arena.getArenaStatus() == ArenaStatus.INACTIVE, "arena is in use"); | ||||
|         arena.addJoiningPlayer(player); | ||||
|         plugin.getArenaList().setArenaForPlayer(player, arena); | ||||
|         player.openInventory(confirmPlayingInventory); | ||||
|     } | ||||
| 
 | ||||
|     public void leaveArena(Player player, boolean message) { | ||||
|  | @ -50,6 +66,26 @@ public class MinecleanerManager { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public void startGame(Player player) { | ||||
|         MinecleanerArena arena = plugin.getArenaList().getPlayerArena(player); | ||||
|         Preconditions.checkArgument(arena != null, "player is in no arena"); | ||||
|         Preconditions.checkState(arena.getArenaStatus() == ArenaStatus.CONFIRM_PLAYING, "not confirming playing status"); | ||||
|         arena.startNewGame(); | ||||
|         player.sendMessage(ChatColor.YELLOW + "Du hast eine neue Runde Minecleaner gestartet."); | ||||
|     } | ||||
| 
 | ||||
|     public void clearAllArenas() { | ||||
|         for(MinecleanerArena arena : plugin.getArenaList().getArenas()) { | ||||
|             if(arena.hasPlayer()) { | ||||
|                 leaveArena(arena.getCurrentPlayer(), true); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public Inventory getConfirmPlayingInventory() { | ||||
|         return confirmPlayingInventory; | ||||
|     } | ||||
| 
 | ||||
|     public void getStatisticsForPlayer(OfflinePlayer player, Consumer<PlayerStatisticsData> callback) { | ||||
|         List<StatisticsQueryKey> keys = new ArrayList<>(); | ||||
|         PlayerStatistics pStatistics = plugin.getCubesideStatistics().getStatistics(player.getUniqueId()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue