13
0

Merge branch 'master' into Seat
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
YoyoNow 2022-03-26 11:18:11 +01:00
Commit f6a70fafb2
2 geänderte Dateien mit 17 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -19,13 +19,18 @@
package de.steamwar.lobby.listener; package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.command.ModifyCommand; import de.steamwar.lobby.command.ModifyCommand;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.*; import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class InventoryInteraction extends BasicListener { public class InventoryInteraction extends BasicListener {
@ -37,7 +42,9 @@ public class InventoryInteraction extends BasicListener {
return; return;
if(item.getType() == Material.FIREWORK_ROCKET && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) { if(item.getType() == Material.FIREWORK_ROCKET && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
item.setAmount(2); Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> {
event.getPlayer().getInventory().setItem(PlayerSpawn.FIREWORK_SLOT, PlayerSpawn.FIREWORK);
}, 1L);
return; return;
} }

Datei anzeigen

@ -36,6 +36,12 @@ import org.bukkit.inventory.PlayerInventory;
public class PlayerSpawn extends BasicListener { public class PlayerSpawn extends BasicListener {
public static final int FIREWORK_SLOT = 3;
public static final ItemStack FIREWORK = new ItemBuilder(Material.FIREWORK_ROCKET, 1).setDisplayName("§5Rakete").build();
public static final int PARTICLE_SLOT = 5;
public static final ItemStack PARTICLE = new ItemBuilder(Material.NAME_TAG).setDisplayName("§6Partikel").setUnbreakable(true).removeAllAttributes().build();
private static final ItemStack ELYTRA = new ItemBuilder(Material.ELYTRA).setDisplayName("§5Elytra").setUnbreakable(true).removeAllAttributes().build();
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onJoin(PlayerJoinEvent e) { public void onJoin(PlayerJoinEvent e) {
Player player = e.getPlayer(); Player player = e.getPlayer();
@ -52,17 +58,14 @@ public class PlayerSpawn extends BasicListener {
Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> new ImALobbyPacket().send(player), 20); Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> new ImALobbyPacket().send(player), 20);
} }
private static final ItemStack ELYTRA = new ItemBuilder(Material.ELYTRA).setDisplayName("§5Elytra").setUnbreakable(true).removeAllAttributes().build();
public static final ItemStack PARTICLE = new ItemBuilder(Material.NAME_TAG).setDisplayName("§6Partikel").setUnbreakable(true).removeAllAttributes().build();
private void giveItems(Player player) { private void giveItems(Player player) {
PlayerInventory inventory = player.getInventory(); PlayerInventory inventory = player.getInventory();
inventory.setItem(EquipmentSlot.CHEST, ELYTRA); inventory.setItem(EquipmentSlot.CHEST, ELYTRA);
player.getInventory().setItem(3, new ItemBuilder(Material.FIREWORK_ROCKET, 1).setDisplayName("§5Rakete").build()); player.getInventory().setItem(FIREWORK_SLOT, FIREWORK);
player.getInventory().setItem(5, PARTICLE); player.getInventory().setItem(PARTICLE_SLOT, PARTICLE);
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)