geforkt von SteamWar/BungeeCore
Finalize CalendarCommand
Dieser Commit ist enthalten in:
Ursprung
ca4a5b49dd
Commit
6b0c30c241
@ -22,6 +22,9 @@ package de.steamwar.bungeecore.commands;
|
|||||||
import de.steamwar.bungeecore.Message;
|
import de.steamwar.bungeecore.Message;
|
||||||
import de.steamwar.bungeecore.inventory.SWInventory;
|
import de.steamwar.bungeecore.inventory.SWInventory;
|
||||||
import de.steamwar.bungeecore.inventory.SWItem;
|
import de.steamwar.bungeecore.inventory.SWItem;
|
||||||
|
import de.steamwar.bungeecore.sql.NodeMember;
|
||||||
|
import de.steamwar.bungeecore.sql.SchematicNode;
|
||||||
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
|
||||||
@ -78,16 +81,18 @@ public class CalendarCommand extends SWCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
List<SWItem> items = new ArrayList<>();
|
List<SWItem> items = new ArrayList<>();
|
||||||
for (Map.Entry<Integer, Integer> present : dayToSchematicId.entrySet()) {
|
for (Map.Entry<Integer, Integer> present : dayToSchematicId.entrySet()) {
|
||||||
boolean b = false; // TODO: Add check if player has schematic
|
boolean b = NodeMember.getNodeMember(present.getValue(), user.getId()) != null;
|
||||||
SWItem swItem = b ? SWItem.getSkull("MHF_Chest") : SWItem.getSkull("MHF_Present1");
|
SWItem swItem = b ? SWItem.getSkull("MHF_Chest") : SWItem.getSkull("MHF_Present1");
|
||||||
swItem.setName(Message.parse("ADVENT_CALENDAR_DAY", player, present.getKey()));
|
swItem.setName(Message.parse("ADVENT_CALENDAR_DAY", player, present.getKey()));
|
||||||
swItem.setCallback(click -> {
|
swItem.setCallback(click -> {
|
||||||
if (!click.isRightClick()) return;
|
if (b) return;
|
||||||
if (month != Month.NOVEMBER) return;
|
if (month != Month.DECEMBER) return;
|
||||||
if (present.getKey() != day) return;
|
if (present.getKey() != day) return;
|
||||||
// TODO: Add to schematic
|
NodeMember.createNodeMember(present.getValue(), user.getId());
|
||||||
|
Message.send("ADVENT_CALENDAR_OPEN", player, SchematicNode.getSchematicNode(present.getValue()).getName());
|
||||||
});
|
});
|
||||||
items.add(swItem);
|
items.add(swItem);
|
||||||
}
|
}
|
||||||
|
@ -655,3 +655,4 @@ ADVENT_CALENDAR_TITLE=§eAdvent Calendar
|
|||||||
ADVENT_CALENDAR_DAY=§7Day§8: §e{0}
|
ADVENT_CALENDAR_DAY=§7Day§8: §e{0}
|
||||||
ADVENT_CALENDAR_MESSAGE=§eDid you already open your advent calendar?
|
ADVENT_CALENDAR_MESSAGE=§eDid you already open your advent calendar?
|
||||||
ADVENT_CALENDAR_MESSAGE_HOVER=§eClick to open!
|
ADVENT_CALENDAR_MESSAGE_HOVER=§eClick to open!
|
||||||
|
ADVENT_CALENDAR_OPEN=§7You got §e{0} §7from the advent calendar!
|
@ -633,3 +633,4 @@ ADVENT_CALENDAR_TITLE=§eAdventskalender
|
|||||||
ADVENT_CALENDAR_DAY=§7Tag§8: §e{0}
|
ADVENT_CALENDAR_DAY=§7Tag§8: §e{0}
|
||||||
ADVENT_CALENDAR_MESSAGE=§eHast du heute schon dein Geschenk geholt?
|
ADVENT_CALENDAR_MESSAGE=§eHast du heute schon dein Geschenk geholt?
|
||||||
ADVENT_CALENDAR_MESSAGE_HOVER=§eKlicken zum öffnen!
|
ADVENT_CALENDAR_MESSAGE_HOVER=§eKlicken zum öffnen!
|
||||||
|
ADVENT_CALENDAR_OPEN=§7Du hast §e{0}§7 aus dem Adventskalender erhalten!
|
In neuem Issue referenzieren
Einen Benutzer sperren