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/>.
#
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_BACK=§eZurück
SCHEM_SELECTOR_DIR=§9Ordner

Datei anzeigen

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