Dieser Commit ist enthalten in:
Ursprung
66a6396e43
Commit
5ae758fe34
@ -33,6 +33,9 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
|
||||
public class InventoryInteraction extends BasicListener {
|
||||
|
||||
@EventHandler
|
||||
@ -42,8 +45,17 @@ public class InventoryInteraction extends BasicListener {
|
||||
return;
|
||||
|
||||
if(item.getType() == Material.FIREWORK_ROCKET && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
|
||||
int offset;
|
||||
LocalDate localDate = LocalDate.now();
|
||||
Month month = localDate.getMonth();
|
||||
if (month == Month.NOVEMBER || month == Month.DECEMBER || month == Month.JANUARY) {
|
||||
offset = -1;
|
||||
} else {
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> {
|
||||
event.getPlayer().getInventory().setItem(PlayerSpawn.FIREWORK_SLOT, PlayerSpawn.FIREWORK);
|
||||
event.getPlayer().getInventory().setItem(PlayerSpawn.FIREWORK_SLOT + offset, PlayerSpawn.FIREWORK);
|
||||
}, 1L);
|
||||
return;
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren