use of me.gameisntover.kbffa.api.Knocker in project KnockbackFFA by GaMeIsNtOvEr.
the class Expansion method onRequest.
@Override
public String onRequest(OfflinePlayer player, @NotNull String placeholder) {
Player player1 = player.getPlayer();
Knocker knocker = KnockbackFFA.getInstance().getKnocker(player1);
if (placeholder.equalsIgnoreCase("player_kills"))
return knocker.getConfig().getInt("kills") + "";
if (placeholder.equalsIgnoreCase("player_deaths"))
return knocker.getConfig().getInt("deaths") + "";
if (placeholder.equalsIgnoreCase("player_balance"))
return knocker.getBalance() + "";
if (placeholder.equalsIgnoreCase("current_map")) {
String arenaName = KnockbackFFA.getInstance().getArenaManager().getEnabledArena().getName();
if (arenaName == null)
return "No Arena";
else
return arenaName;
}
if (placeholder.equalsIgnoreCase("timer_nextmap")) {
int timer = KnockbackFFA.getInstance().getTimer();
int seconds = timer % 60;
int minutes = timer / 60;
return minutes + ":" + seconds;
}
if (placeholder.equalsIgnoreCase("next_map")) {
if (KnockbackFFA.getInstance().getArenaManager().getFolder().list() == null || KnockbackFFA.getInstance().getArenaManager().getFolder().list().length <= 1)
return "No Arena";
String currentArenaName = KnockbackFFA.getInstance().getArenaManager().getEnabledArena().getName();
List<String> arenaList = Arrays.asList(KnockbackFFA.getInstance().getArenaManager().getFolder().list());
int index = arenaList.indexOf(currentArenaName);
if (index == arenaList.size() - 1)
return arenaList.get(0).replace(".yml", "");
else
return arenaList.get(index + 2).replace(".yml", "");
}
return "Invalid Placeholder";
}
use of me.gameisntover.kbffa.api.Knocker in project KnockbackFFA by GaMeIsNtOvEr.
the class ArenaSettings method onBlockBreak.
@EventHandler
public void onBlockBreak(BlockBreakEvent e) {
Player player = e.getPlayer();
Knocker knocker = KnockbackFFA.getInstance().getKnocker(player);
if (knocker.isInArena())
return;
String[] arenaList = KnockbackFFA.getInstance().getArenaManager().getFolder().list();
if (arenaList == null)
return;
for (String arenaName : arenaList) {
Arena arena = KnockbackFFA.getInstance().getArenaManager().load(arenaName.replace(".yml", ""));
e.setCancelled(!arena.getConfig().getBoolean("block-break"));
}
}
use of me.gameisntover.kbffa.api.Knocker in project KnockbackFFA by GaMeIsNtOvEr.
the class GameEventsListener method playerChatFormat.
@EventHandler
public void playerChatFormat(AsyncPlayerChatEvent e) {
Player player = e.getPlayer();
Knocker knocker = KnockbackFFA.getInstance().getKnocker(e.getPlayer());
if (KnockbackFFA.getInstance().BungeeMode() || knocker.isInGame())
e.setFormat(Message.CHATFORMAT.toString().replace("%player%", player.getName()).replace("%message%", e.getMessage()));
}
Aggregations