Source:
public String onPlaceholderRequest(Player player, String identifier){ if(player == null){ return ""; } Set<String> games = plugin.getMinigameManager().getAllMinigames().keySet(); if(identifier.contains("_")){ String[] parts = identifier.split("_"); String gameName = parts[0]; if(games.contains(gameName)){ Minigame minigame = plugin.getMinigameManager().getMinigame(gameName); try { switch (parts[1]) { case "enabled": return Boolean.toString(minigame.isEnabled()); case "maxPlayers": return Integer.toString(minigame.getMaxPlayers()); case "currentPlayers": return Integer.toString(minigame.getPlayers().size()); case "type": return minigame.getType().getName(); case "mechanic": return minigame.getMechanicName(); case "state": return minigame.getState().name(); case "objective": return minigame.getObjective(); case "gameType": return minigame.getGametypeName(); case "timeLeft": return Integer.toString(minigame.getMinigameTimer().getTimeLeft()); case "name": return minigame.getName(true); default: return null; } }catch (Exception e){ plugin.getLogger().warning("Error processing PAPI:" + identifier); plugin.getLogger().warning(e.getMessage()); if(plugin.isDebugging()){ e.printStackTrace(); } return null; } } else { return null; } } switch(identifier){ case "gameCount": return Integer.toString(plugin.getMinigameManager().getAllMinigames().size()); case "enabledGameCount": return Long.toString(plugin.getMinigameManager().getAllMinigames().values() .stream().filter(Minigame::isEnabled).count()); case "totalPlaying": return Long.toString(plugin.getPlayerManager().getAllMinigamePlayers().stream() .filter(MinigamePlayer::isInMinigame).count()); default: return null; } }

Target:
public String onPlaceholderRequest(Player player, String identifier){ if(player == null){ return ""; } if(!identifiers.containsKey(identifier)) { return null; } Set<String> games = plugin.getMinigameManager().getAllMinigames().keySet(); if(identifier.contains("_")){ String[] parts = identifier.split("_"); String gameName = parts[0]; if(games.contains(gameName)){ Minigame minigame = plugin.getMinigameManager().getMinigame(gameName); try { switch (parts[1]) { case "enabled": return Boolean.toString(minigame.isEnabled()); case "maxPlayers": return Integer.toString(minigame.getMaxPlayers()); case "currentPlayers": return Integer.toString(minigame.getPlayers().size()); case "type": return minigame.getType().getName(); case "mechanic": return minigame.getMechanicName(); case "state": return minigame.getState().name(); case "objective": return minigame.getObjective(); case "gameType": return minigame.getGametypeName(); case "timeLeft": return Integer.toString(minigame.getMinigameTimer().getTimeLeft()); case "name": return minigame.getName(true); default: for (ModulePlaceHolderProvider provider: providers) { if(provider.hasPlaceHolder(parts[1])){ return provider.onPlaceHolderRequest(player,gameName,parts[1]); } } return null; } }catch (Exception e){ plugin.getLogger().warning("Error processing PAPI:" + identifier); plugin.getLogger().warning(e.getMessage()); if(plugin.isDebugging()){ e.printStackTrace(); } return null; } } else { return null; } } else { switch (identifier) { case "gameCount": return Integer.toString(plugin.getMinigameManager().getAllMinigames().size()); case "enabledGameCount": return Long.toString(plugin.getMinigameManager().getAllMinigames().values() .stream().filter(Minigame::isEnabled).count()); case "totalPlaying": return Long.toString(plugin.getPlayerManager().getAllMinigamePlayers().stream() .filter(MinigamePlayer::isInMinigame).count()); default: return null; } } }