SteamWar/SpigotCore
Archiviert
13
0

Merge pull request 'Fix SWListInv and make multilang' (#172) from SWListInv into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #172
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2022-02-11 21:36:05 +01:00
Commit afb4846696
2 geänderte Dateien mit 25 neuen und 14 gelöschten Zeilen

Datei anzeigen

@ -17,6 +17,11 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# #
SWLISINV_NEXT_PAGE_ACTIVE = §eSeite vor
SWLISINV_NEXT_PAGE_INACTIVE = §7Seite vor
SWLISINV_PREVIOUS_PAGE_ACTIVE = §eSeite zurück
SWLISINV_PREVIOUS_PAGE_INACTIVE = §7Seite zurück
SCHEM_SELECTOR_TITLE={0} auswählen: {1} SCHEM_SELECTOR_TITLE={0} auswählen: {1}
SCHEM_SELECTOR_BACK=§eZurück SCHEM_SELECTOR_BACK=§eZurück
SCHEM_SELECTOR_DIR=§9Ordner SCHEM_SELECTOR_DIR=§9Ordner

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.inventory; package de.steamwar.inventory;
import de.steamwar.core.Core;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SchematicType; import de.steamwar.sql.SchematicType;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -57,29 +58,33 @@ public class SWListInv<T> extends SWInventory {
callbacks.clear(); callbacks.clear();
setCallback(-999, (ClickType click) -> player.closeInventory()); setCallback(-999, (ClickType click) -> player.closeInventory());
if(sizeBiggerMax()){ if (sizeBiggerMax()) {
if(page != 0) if (page != 0) {
setItem(45, SWItem.getDye(10), (byte)10, "§eSeite zurück", (ClickType click) -> { setItem(45, SWItem.getDye(10), (byte) 10, Core.MESSAGE.parse("SWLISINV_PREVIOUS_PAGE_ACTIVE", player), (ClickType click) -> {
page--; page--;
open(); open();
}); });
else } else {
setItem(45, SWItem.getDye(8), (byte)8, "§7Seite zurück", (ClickType click) -> {}); setItem(45, SWItem.getDye(8), (byte) 8, Core.MESSAGE.parse("SWLISINV_PREVIOUS_PAGE_INACTIVE", player), (ClickType click) -> {
if(page < elements.size()/45) });
setItem(53, SWItem.getDye(10), (byte)10, "§eSeite vor", (ClickType click) -> { }
if (page < elements.size() / 45 - (elements.size() % 45 == 0 ? 1 : 0)) {
setItem(53, SWItem.getDye(10), (byte) 10, Core.MESSAGE.parse("SWLISINV_NEXT_PAGE_ACTIVE", player), (ClickType click) -> {
page++; page++;
open(); open();
}); });
else } else {
setItem(53, SWItem.getDye(8), (byte)8, "§7Seite vor", (ClickType click) -> {}); setItem(53, SWItem.getDye(8), (byte) 8, Core.MESSAGE.parse("SWLISINV_NEXT_PAGE_INACTIVE", player), (ClickType click) -> {
});
}
} }
int ipageLimit = elements.size() - page*45; int ipageLimit = elements.size() - page * 45;
if(ipageLimit > 45 && sizeBiggerMax()){ if (ipageLimit > 45 && sizeBiggerMax()) {
ipageLimit = 45; ipageLimit = 45;
} }
int i = page*45; int i = page * 45;
for(int ipage=0; ipage < ipageLimit; ipage++ ){ for (int ipage = 0; ipage < ipageLimit; ipage++) {
SWItem e = elements.get(i).getItem(); SWItem e = elements.get(i).getItem();
final int pos = i; final int pos = i;
@ -88,8 +93,9 @@ public class SWListInv<T> extends SWInventory {
i++; i++;
} }
for(Map.Entry<Integer, SWItem> customItem : customItems.entrySet()) for (Map.Entry<Integer, SWItem> customItem : customItems.entrySet()) {
setItem(customItem.getKey(), customItem.getValue()); setItem(customItem.getKey(), customItem.getValue());
}
super.open(); super.open();
} }