Small code cleanup of FightTeam
Dieser Commit ist enthalten in:
Ursprung
0ea523e15e
Commit
64ef4722cd
@ -194,7 +194,7 @@ public class FightTeam {
|
|||||||
if(Fight.getOpposite(this).hasSchematic()){
|
if(Fight.getOpposite(this).hasSchematic()){
|
||||||
pasteSchematic();
|
pasteSchematic();
|
||||||
Fight.getOpposite(this).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) {
|
public void sendPlayerSchematicList(boolean publicSchematics, int currentPage, int filesPerPage, Player player, SchematicType schematicType) {
|
||||||
|
|
||||||
List<Schematic> preSchematicList;
|
List<Schematic> preSchematicList;
|
||||||
List<Schematic> schematicList = new ArrayList<>();
|
List<Schematic> schematicList = new ArrayList<>();
|
||||||
if(publicSchematics) {
|
if(publicSchematics) {
|
||||||
@ -261,7 +260,7 @@ public class FightTeam {
|
|||||||
|
|
||||||
int pages;
|
int pages;
|
||||||
|
|
||||||
double doublePages = (Double.valueOf(schematicList.size()) / Double.valueOf(filesPerPage));
|
double doublePages = (double) schematicList.size() / (double) filesPerPage;
|
||||||
int intPages = schematicList.size() / filesPerPage;
|
int intPages = schematicList.size() / filesPerPage;
|
||||||
|
|
||||||
if(schematicList.size() <= filesPerPage) {
|
if(schematicList.size() <= filesPerPage) {
|
||||||
@ -271,13 +270,11 @@ public class FightTeam {
|
|||||||
} else
|
} else
|
||||||
pages = intPages;
|
pages = intPages;
|
||||||
|
|
||||||
int currPage = currentPage;
|
if(currentPage >= pages) return;
|
||||||
|
|
||||||
if(currPage >= pages) return;
|
|
||||||
|
|
||||||
player.sendMessage("§5======§8[§dSeite " + (currentPage + 1) + " §7/ §d" + pages + " §7| §d" + schematicList.size() + " Schematic(s)§8]§5======");
|
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;
|
if(schematicList.size() <= i) break;
|
||||||
|
|
||||||
Schematic schematic = schematicList.get(i);
|
Schematic schematic = schematicList.get(i);
|
||||||
@ -293,28 +290,28 @@ public class FightTeam {
|
|||||||
|
|
||||||
if(pages <= 1) return;
|
if(pages <= 1) return;
|
||||||
|
|
||||||
if(currPage == 0) {
|
if(currentPage == 0) {
|
||||||
TextComponent nextPage = new TextComponent("Nächste Seite >>");
|
TextComponent nextPage = new TextComponent("Nächste Seite >>");
|
||||||
nextPage.setColor(ChatColor.RED);
|
nextPage.setColor(ChatColor.RED);
|
||||||
nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Nächste Seite...").create()));
|
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"));
|
nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ak schemlist 1"));
|
||||||
player.spigot().sendMessage(nextPage);
|
player.spigot().sendMessage(nextPage);
|
||||||
} else if((currPage + 1) == pages) {
|
} else if((currentPage + 1) == pages) {
|
||||||
TextComponent beforePage = new TextComponent("<< Vorherige Seite");
|
TextComponent beforePage = new TextComponent("<< Vorherige Seite");
|
||||||
beforePage.setColor(ChatColor.RED);
|
beforePage.setColor(ChatColor.RED);
|
||||||
beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Vorherige Seite...").create()));
|
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);
|
player.spigot().sendMessage(beforePage);
|
||||||
} else {
|
} else {
|
||||||
TextComponent beforePage = new TextComponent("<< Seite ");
|
TextComponent beforePage = new TextComponent("<< Seite ");
|
||||||
beforePage.setColor(ChatColor.RED);
|
beforePage.setColor(ChatColor.RED);
|
||||||
beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Vorherige Seite...").create()));
|
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(">>");
|
TextComponent nextPage = new TextComponent(">>");
|
||||||
nextPage.setColor(ChatColor.RED);
|
nextPage.setColor(ChatColor.RED);
|
||||||
nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Nächste Seite...").create()));
|
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);
|
beforePage.addExtra(nextPage);
|
||||||
player.spigot().sendMessage(beforePage);
|
player.spigot().sendMessage(beforePage);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren