SteamWar/FightSystem
Archiviert
13
1

Small code cleanup of FightTeam

Dieser Commit ist enthalten in:
Travis CI 2019-06-14 13:13:16 +02:00
Ursprung 0ea523e15e
Commit 64ef4722cd

Datei anzeigen

@ -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<Schematic> preSchematicList;
List<Schematic> 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);