13
0

Impl. not finished
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
zOnlyKroks 2022-03-26 14:08:49 +01:00
Ursprung 41d8db33ea
Commit cc95db85f6
3 geänderte Dateien mit 72 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -58,6 +58,7 @@ public class LobbySystem extends JavaPlugin {
new WorldInteraction(); new WorldInteraction();
new PlayerSeatListener(); new PlayerSeatListener();
new MapsRotateListener(); new MapsRotateListener();
new TeleporterListener();
new AlphaWall(l -> l.getX() > 1199, AlphaWall.REFLECT_X); new AlphaWall(l -> l.getX() > 1199, AlphaWall.REFLECT_X);
new AlphaWall(l -> l.getX() < 2977, AlphaWall.REFLECT_X); new AlphaWall(l -> l.getX() < 2977, AlphaWall.REFLECT_X);

Datei anzeigen

@ -39,8 +39,10 @@ public class PlayerSpawn extends BasicListener {
public static final int FIREWORK_SLOT = 3; public static final int FIREWORK_SLOT = 3;
public static final ItemStack FIREWORK = new ItemBuilder(Material.FIREWORK_ROCKET, 1).setDisplayName("§5Rakete").build(); public static final ItemStack FIREWORK = new ItemBuilder(Material.FIREWORK_ROCKET, 1).setDisplayName("§5Rakete").build();
public static final int PARTICLE_SLOT = 5; public static final int PARTICLE_SLOT = 5;
public static final int NETHER_STAR_SLOT = 4;
public static final ItemStack PARTICLE = new ItemBuilder(Material.NAME_TAG).setDisplayName("§6Partikel").setUnbreakable(true).removeAllAttributes().build(); 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(); private static final ItemStack ELYTRA = new ItemBuilder(Material.ELYTRA).setDisplayName("§5Elytra").setUnbreakable(true).removeAllAttributes().build();
public static final ItemStack NETHER_STAR = new ItemBuilder(Material.NETHER_STAR).setDisplayName("§5Teleporter").setUnbreakable(true).removeAllAttributes().build();
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onJoin(PlayerJoinEvent e) { public void onJoin(PlayerJoinEvent e) {
@ -66,6 +68,8 @@ public class PlayerSpawn extends BasicListener {
player.getInventory().setItem(FIREWORK_SLOT, FIREWORK); player.getInventory().setItem(FIREWORK_SLOT, FIREWORK);
player.getInventory().setItem(PARTICLE_SLOT, PARTICLE); player.getInventory().setItem(PARTICLE_SLOT, PARTICLE);
player.getInventory().setItem(NETHER_STAR_SLOT, NETHER_STAR);
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)

Datei anzeigen

@ -0,0 +1,67 @@
package de.steamwar.lobby.listener;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import de.steamwar.lobby.particle.SpecialParticle;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
public class TeleporterListener extends BasicListener{
private static final Inventory inventory;
static {
inventory = createInventory();
}
@EventHandler(priority = EventPriority.NORMAL)
public void handlePlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (!PlayerSpawn.NETHER_STAR.equals(event.getItem())) return;
player.openInventory(inventory);
}
@EventHandler(priority = EventPriority.HIGH)
public void handlePlayerInventoryInteract(PlayerInteractEvent event) {
ItemStack item = event.getItem();
if(item == null)
return;
if(item.getType() == Material.MAGMA_CREAM && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
//TODO: TP zum Spawn
}else if(item.getType() == Material.MAP && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
//TODO: TP zur Map
}
}
private static Inventory createInventory() {
Inventory inv = Bukkit.createInventory(null, InventoryType.HOPPER, "§6Teleporter");
ItemStack item1 = new ItemStack(Material.MAGMA_CREAM, 1);
ItemMeta meta1 = item1.getItemMeta();
meta1.setDisplayName("§eSpawn");
item1.setItemMeta(meta1);
inv.setItem(1, item1);
ItemStack item3 = new ItemStack(Material.MAP, 1);
ItemMeta meta3 = item3.getItemMeta();
meta3.setDisplayName("§eMap");
item3.setItemMeta(meta3);
inv.setItem(3, item3);
return inv;
}
}