From 64ef4722cd9be8377a357e03819c6c95ec201ac6 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Fri, 14 Jun 2019 13:13:16 +0200 Subject: [PATCH] Small code cleanup of FightTeam --- .../yaruma/fightsystem/fight/FightTeam.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/me/yaruma/fightsystem/fight/FightTeam.java b/src/me/yaruma/fightsystem/fight/FightTeam.java index bab746c..a77d53c 100644 --- a/src/me/yaruma/fightsystem/fight/FightTeam.java +++ b/src/me/yaruma/fightsystem/fight/FightTeam.java @@ -194,7 +194,7 @@ public class FightTeam { if(Fight.getOpposite(this).hasSchematic()){ pasteSchematic(); Fight.getOpposite(this).pasteSchematic(); - Bukkit.getScheduler().scheduleSyncDelayedTask(FightSystem.getPlugin(), () -> WinconditionTechKO.addWater(), 20*10L); + Bukkit.getScheduler().scheduleSyncDelayedTask(FightSystem.getPlugin(), WinconditionTechKO::addWater, 20*10L); } } @@ -240,7 +240,6 @@ public class FightTeam { } public void sendPlayerSchematicList(boolean publicSchematics, int currentPage, int filesPerPage, Player player, SchematicType schematicType) { - List preSchematicList; List schematicList = new ArrayList<>(); if(publicSchematics) { @@ -261,7 +260,7 @@ public class FightTeam { int pages; - double doublePages = (Double.valueOf(schematicList.size()) / Double.valueOf(filesPerPage)); + double doublePages = (double) schematicList.size() / (double) filesPerPage; int intPages = schematicList.size() / filesPerPage; if(schematicList.size() <= filesPerPage) { @@ -271,13 +270,11 @@ public class FightTeam { } else pages = intPages; - int currPage = currentPage; - - if(currPage >= pages) return; + if(currentPage >= pages) return; player.sendMessage("§5======§8[§dSeite " + (currentPage + 1) + " §7/ §d" + pages + " §7| §d" + schematicList.size() + " Schematic(s)§8]§5======"); - for(int i = currPage * filesPerPage; i < (currPage * filesPerPage) + filesPerPage; i++) { + for(int i = currentPage * filesPerPage; i < (currentPage * filesPerPage) + filesPerPage; i++) { if(schematicList.size() <= i) break; Schematic schematic = schematicList.get(i); @@ -293,28 +290,28 @@ public class FightTeam { if(pages <= 1) return; - if(currPage == 0) { + if(currentPage == 0) { TextComponent nextPage = new TextComponent("Nächste Seite >>"); nextPage.setColor(ChatColor.RED); nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Nächste Seite...").create())); nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ak schemlist 1")); player.spigot().sendMessage(nextPage); - } else if((currPage + 1) == pages) { + } else if((currentPage + 1) == pages) { TextComponent beforePage = new TextComponent("<< Vorherige Seite"); beforePage.setColor(ChatColor.RED); beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Vorherige Seite...").create())); - beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ak schemlist " + (currPage - 1))); + beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ak schemlist " + (currentPage - 1))); player.spigot().sendMessage(beforePage); } else { TextComponent beforePage = new TextComponent("<< Seite "); beforePage.setColor(ChatColor.RED); beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Vorherige Seite...").create())); - beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ak schemlist " + (currPage - 1))); + beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ak schemlist " + (currentPage - 1))); TextComponent nextPage = new TextComponent(">>"); nextPage.setColor(ChatColor.RED); nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Nächste Seite...").create())); - nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ak schemlist " + (currPage + 1))); + nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ak schemlist " + (currentPage + 1))); beforePage.addExtra(nextPage); player.spigot().sendMessage(beforePage);