From cc95db85f627b1388ba18e912b690330cfe0875d Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sat, 26 Mar 2022 14:08:49 +0100 Subject: [PATCH 01/11] Impl. not finished --- src/de/steamwar/lobby/LobbySystem.java | 1 + .../steamwar/lobby/listener/PlayerSpawn.java | 4 ++ .../lobby/listener/TeleporterListener.java | 67 +++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 src/de/steamwar/lobby/listener/TeleporterListener.java diff --git a/src/de/steamwar/lobby/LobbySystem.java b/src/de/steamwar/lobby/LobbySystem.java index 96cb5f5..96cb8d0 100644 --- a/src/de/steamwar/lobby/LobbySystem.java +++ b/src/de/steamwar/lobby/LobbySystem.java @@ -58,6 +58,7 @@ public class LobbySystem extends JavaPlugin { new WorldInteraction(); new PlayerSeatListener(); new MapsRotateListener(); + new TeleporterListener(); new AlphaWall(l -> l.getX() > 1199, AlphaWall.REFLECT_X); new AlphaWall(l -> l.getX() < 2977, AlphaWall.REFLECT_X); diff --git a/src/de/steamwar/lobby/listener/PlayerSpawn.java b/src/de/steamwar/lobby/listener/PlayerSpawn.java index b386287..7233889 100644 --- a/src/de/steamwar/lobby/listener/PlayerSpawn.java +++ b/src/de/steamwar/lobby/listener/PlayerSpawn.java @@ -39,8 +39,10 @@ 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 int NETHER_STAR_SLOT = 4; 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(); + public static final ItemStack NETHER_STAR = new ItemBuilder(Material.NETHER_STAR).setDisplayName("§5Teleporter").setUnbreakable(true).removeAllAttributes().build(); @EventHandler(priority = EventPriority.HIGH) public void onJoin(PlayerJoinEvent e) { @@ -66,6 +68,8 @@ public class PlayerSpawn extends BasicListener { player.getInventory().setItem(FIREWORK_SLOT, FIREWORK); player.getInventory().setItem(PARTICLE_SLOT, PARTICLE); + + player.getInventory().setItem(NETHER_STAR_SLOT, NETHER_STAR); } @EventHandler(priority = EventPriority.HIGH) diff --git a/src/de/steamwar/lobby/listener/TeleporterListener.java b/src/de/steamwar/lobby/listener/TeleporterListener.java new file mode 100644 index 0000000..a5dd4da --- /dev/null +++ b/src/de/steamwar/lobby/listener/TeleporterListener.java @@ -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; + } + +} -- 2.39.5 From a4afc5fe88dc11392fe92b89d215f2614ee5ba45 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sat, 26 Mar 2022 14:36:50 +0100 Subject: [PATCH 02/11] Player Seat Listener --- .../lobby/listener/TeleporterListener.java | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/lobby/listener/TeleporterListener.java b/src/de/steamwar/lobby/listener/TeleporterListener.java index a5dd4da..08d4d6a 100644 --- a/src/de/steamwar/lobby/listener/TeleporterListener.java +++ b/src/de/steamwar/lobby/listener/TeleporterListener.java @@ -3,14 +3,18 @@ package de.steamwar.lobby.listener; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; +import de.steamwar.lobby.Config; import de.steamwar.lobby.particle.SpecialParticle; import org.bukkit.Bukkit; +import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.World; 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.InventoryClickEvent; import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.Inventory; @@ -20,6 +24,11 @@ import org.bukkit.inventory.meta.ItemMeta; public class TeleporterListener extends BasicListener{ private static final Inventory inventory; + private static final World world = Bukkit.getWorlds().get(0); + + private static final Location spawn = world.getSpawnLocation().clone().add(0.5, 0, 0.5); + private static final Location team = new Location(world,1524,55,1440); + private static final Location map = new Location(world,2337,38,1424); static { inventory = createInventory(); @@ -34,16 +43,21 @@ public class TeleporterListener extends BasicListener{ } @EventHandler(priority = EventPriority.HIGH) - public void handlePlayerInventoryInteract(PlayerInteractEvent event) { - ItemStack item = event.getItem(); + public void handlePlayerInventoryInteract(InventoryClickEvent event) { + Player player = (Player) event.getWhoClicked(); + ItemStack item = event.getCurrentItem(); + 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 + if(item.getType() == Material.MAGMA_CREAM) { + player.teleport(spawn); + }else if(item.getType() == Material.BEACON) { + player.teleport(team); + }else if(item.getType() == Material.MAP) { + player.teleport(map); } + } private static Inventory createInventory() { @@ -55,6 +69,12 @@ public class TeleporterListener extends BasicListener{ item1.setItemMeta(meta1); inv.setItem(1, item1); + ItemStack item2 = new ItemStack(Material.BEACON, 1); + ItemMeta meta2 = item2.getItemMeta(); + meta2.setDisplayName("§eTeamhalle"); + item2.setItemMeta(meta2); + inv.setItem(2, item2); + ItemStack item3 = new ItemStack(Material.MAP, 1); ItemMeta meta3 = item3.getItemMeta(); meta3.setDisplayName("§eMap"); -- 2.39.5 From 9fde17cb71b192a3d24e0ad395398be0324ea034 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sat, 26 Mar 2022 16:06:10 +0100 Subject: [PATCH 03/11] Error Fixes --- .../steamwar/lobby/listener/PlayerSpawn.java | 4 +- .../lobby/listener/TeleporterListener.java | 45 +++++++++++++++---- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/de/steamwar/lobby/listener/PlayerSpawn.java b/src/de/steamwar/lobby/listener/PlayerSpawn.java index 7233889..b3e70fe 100644 --- a/src/de/steamwar/lobby/listener/PlayerSpawn.java +++ b/src/de/steamwar/lobby/listener/PlayerSpawn.java @@ -36,9 +36,9 @@ import org.bukkit.inventory.PlayerInventory; public class PlayerSpawn extends BasicListener { - public static final int FIREWORK_SLOT = 3; + public static final int FIREWORK_SLOT = 2; 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 = 6; public static final int NETHER_STAR_SLOT = 4; 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(); diff --git a/src/de/steamwar/lobby/listener/TeleporterListener.java b/src/de/steamwar/lobby/listener/TeleporterListener.java index 08d4d6a..5e481ab 100644 --- a/src/de/steamwar/lobby/listener/TeleporterListener.java +++ b/src/de/steamwar/lobby/listener/TeleporterListener.java @@ -1,19 +1,31 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package de.steamwar.lobby.listener; -import de.steamwar.inventory.SWInventory; -import de.steamwar.inventory.SWItem; -import de.steamwar.inventory.SWListInv; -import de.steamwar.lobby.Config; -import de.steamwar.lobby.particle.SpecialParticle; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; -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.InventoryClickEvent; import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerInteractEvent; @@ -29,6 +41,8 @@ public class TeleporterListener extends BasicListener{ private static final Location spawn = world.getSpawnLocation().clone().add(0.5, 0, 0.5); private static final Location team = new Location(world,1524,55,1440); private static final Location map = new Location(world,2337,38,1424); + private static final Location bau = new Location(world,1951,66,1337); + private static final Location arenen = new Location(world,2255,21,1448); static { inventory = createInventory(); @@ -56,13 +70,22 @@ public class TeleporterListener extends BasicListener{ player.teleport(team); }else if(item.getType() == Material.MAP) { player.teleport(map); + }else if(item.getType() == Material.WOODEN_AXE) { + player.teleport(bau); + }else if(item.getType() == Material.CLOCK) { + player.teleport(arenen); } - } private static Inventory createInventory() { Inventory inv = Bukkit.createInventory(null, InventoryType.HOPPER, "§6Teleporter"); + ItemStack item = new ItemStack(Material.WOODEN_AXE, 1); + ItemMeta meta = item.getItemMeta(); + meta.setDisplayName("§eBaubereich"); + item.setItemMeta(meta); + inv.setItem(0, item); + ItemStack item1 = new ItemStack(Material.MAGMA_CREAM, 1); ItemMeta meta1 = item1.getItemMeta(); meta1.setDisplayName("§eSpawn"); @@ -81,6 +104,12 @@ public class TeleporterListener extends BasicListener{ item3.setItemMeta(meta3); inv.setItem(3, item3); + ItemStack item4 = new ItemStack(Material.CLOCK, 1); + ItemMeta meta4 = item4.getItemMeta(); + meta4.setDisplayName("§eArenen"); + item4.setItemMeta(meta4); + inv.setItem(4, item4); + return inv; } -- 2.39.5 From bc39fa447315f0120f072f5e055e1a3718ec40bb Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sat, 26 Mar 2022 16:13:33 +0100 Subject: [PATCH 04/11] Arenen Teleport Kaputt --- src/de/steamwar/lobby/listener/TeleporterListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/lobby/listener/TeleporterListener.java b/src/de/steamwar/lobby/listener/TeleporterListener.java index 5e481ab..c3e8f69 100644 --- a/src/de/steamwar/lobby/listener/TeleporterListener.java +++ b/src/de/steamwar/lobby/listener/TeleporterListener.java @@ -42,7 +42,7 @@ public class TeleporterListener extends BasicListener{ private static final Location team = new Location(world,1524,55,1440); private static final Location map = new Location(world,2337,38,1424); private static final Location bau = new Location(world,1951,66,1337); - private static final Location arenen = new Location(world,2255,21,1448); + private static final Location arenen = new Location(world,2255,21,1450); static { inventory = createInventory(); -- 2.39.5 From b0444cbe8e3c94091439ffef24acdc3b4652dc16 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sat, 26 Mar 2022 16:17:41 +0100 Subject: [PATCH 05/11] Things --- src/de/steamwar/lobby/listener/TeleporterListener.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/lobby/listener/TeleporterListener.java b/src/de/steamwar/lobby/listener/TeleporterListener.java index c3e8f69..84ff9fa 100644 --- a/src/de/steamwar/lobby/listener/TeleporterListener.java +++ b/src/de/steamwar/lobby/listener/TeleporterListener.java @@ -56,7 +56,7 @@ public class TeleporterListener extends BasicListener{ player.openInventory(inventory); } - @EventHandler(priority = EventPriority.HIGH) + @EventHandler public void handlePlayerInventoryInteract(InventoryClickEvent event) { Player player = (Player) event.getWhoClicked(); ItemStack item = event.getCurrentItem(); @@ -64,6 +64,8 @@ public class TeleporterListener extends BasicListener{ if(item == null) return; + if(event.getClickedInventory().getContents() != inventory.getContents()) return; + if(item.getType() == Material.MAGMA_CREAM) { player.teleport(spawn); }else if(item.getType() == Material.BEACON) { -- 2.39.5 From ea73d24b8b428d4d68d2563a8e2b6d1338f64f67 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Mar 2022 16:42:37 +0100 Subject: [PATCH 06/11] Update TeleporterListener --- .../lobby/listener/TeleporterListener.java | 89 +++++-------------- 1 file changed, 20 insertions(+), 69 deletions(-) diff --git a/src/de/steamwar/lobby/listener/TeleporterListener.java b/src/de/steamwar/lobby/listener/TeleporterListener.java index 84ff9fa..035d499 100644 --- a/src/de/steamwar/lobby/listener/TeleporterListener.java +++ b/src/de/steamwar/lobby/listener/TeleporterListener.java @@ -19,6 +19,8 @@ package de.steamwar.lobby.listener; +import de.steamwar.inventory.SWInventory; +import de.steamwar.inventory.SWItem; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -26,16 +28,11 @@ import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.inventory.InventoryClickEvent; 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{ +public class TeleporterListener extends BasicListener { - private static final Inventory inventory; private static final World world = Bukkit.getWorlds().get(0); private static final Location spawn = world.getSpawnLocation().clone().add(0.5, 0, 0.5); @@ -44,75 +41,29 @@ public class TeleporterListener extends BasicListener{ private static final Location bau = new Location(world,1951,66,1337); private static final Location arenen = new Location(world,2255,21,1450); - 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 - public void handlePlayerInventoryInteract(InventoryClickEvent event) { - Player player = (Player) event.getWhoClicked(); - ItemStack item = event.getCurrentItem(); - - if(item == null) - return; - - if(event.getClickedInventory().getContents() != inventory.getContents()) return; - - if(item.getType() == Material.MAGMA_CREAM) { - player.teleport(spawn); - }else if(item.getType() == Material.BEACON) { - player.teleport(team); - }else if(item.getType() == Material.MAP) { - player.teleport(map); - }else if(item.getType() == Material.WOODEN_AXE) { + SWInventory swInventory = new SWInventory(player, () -> { + return Bukkit.createInventory(null, InventoryType.HOPPER, "§6Teleporter"); + }); + swInventory.setItem(0, new SWItem(Material.WOODEN_AXE, "§eBaubereich").getItemStack(), clickType -> { player.teleport(bau); - }else if(item.getType() == Material.CLOCK) { + }); + swInventory.setItem(1, new SWItem(Material.MAGMA_CREAM, "§eSpawn").getItemStack(), clickType -> { + player.teleport(spawn); + }); + swInventory.setItem(1, new SWItem(Material.BEACON, "§eTeamhalle").getItemStack(), clickType -> { + player.teleport(team); + }); + swInventory.setItem(1, new SWItem(Material.MAP, "§eMap").getItemStack(), clickType -> { + player.teleport(map); + }); + swInventory.setItem(1, new SWItem(Material.CLOCK, "§eArenen").getItemStack(), clickType -> { player.teleport(arenen); - } + }); + swInventory.open(); } - - private static Inventory createInventory() { - Inventory inv = Bukkit.createInventory(null, InventoryType.HOPPER, "§6Teleporter"); - - ItemStack item = new ItemStack(Material.WOODEN_AXE, 1); - ItemMeta meta = item.getItemMeta(); - meta.setDisplayName("§eBaubereich"); - item.setItemMeta(meta); - inv.setItem(0, item); - - ItemStack item1 = new ItemStack(Material.MAGMA_CREAM, 1); - ItemMeta meta1 = item1.getItemMeta(); - meta1.setDisplayName("§eSpawn"); - item1.setItemMeta(meta1); - inv.setItem(1, item1); - - ItemStack item2 = new ItemStack(Material.BEACON, 1); - ItemMeta meta2 = item2.getItemMeta(); - meta2.setDisplayName("§eTeamhalle"); - item2.setItemMeta(meta2); - inv.setItem(2, item2); - - ItemStack item3 = new ItemStack(Material.MAP, 1); - ItemMeta meta3 = item3.getItemMeta(); - meta3.setDisplayName("§eMap"); - item3.setItemMeta(meta3); - inv.setItem(3, item3); - - ItemStack item4 = new ItemStack(Material.CLOCK, 1); - ItemMeta meta4 = item4.getItemMeta(); - meta4.setDisplayName("§eArenen"); - item4.setItemMeta(meta4); - inv.setItem(4, item4); - - return inv; - } - } -- 2.39.5 From 1695d026785b2035e286d9524a8318230325dccf Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Mar 2022 16:43:12 +0100 Subject: [PATCH 07/11] Fix TeleporterListener --- src/de/steamwar/lobby/listener/TeleporterListener.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/lobby/listener/TeleporterListener.java b/src/de/steamwar/lobby/listener/TeleporterListener.java index 035d499..48c7bf6 100644 --- a/src/de/steamwar/lobby/listener/TeleporterListener.java +++ b/src/de/steamwar/lobby/listener/TeleporterListener.java @@ -55,13 +55,13 @@ public class TeleporterListener extends BasicListener { swInventory.setItem(1, new SWItem(Material.MAGMA_CREAM, "§eSpawn").getItemStack(), clickType -> { player.teleport(spawn); }); - swInventory.setItem(1, new SWItem(Material.BEACON, "§eTeamhalle").getItemStack(), clickType -> { + swInventory.setItem(2, new SWItem(Material.BEACON, "§eTeamhalle").getItemStack(), clickType -> { player.teleport(team); }); - swInventory.setItem(1, new SWItem(Material.MAP, "§eMap").getItemStack(), clickType -> { + swInventory.setItem(3, new SWItem(Material.MAP, "§eMap").getItemStack(), clickType -> { player.teleport(map); }); - swInventory.setItem(1, new SWItem(Material.CLOCK, "§eArenen").getItemStack(), clickType -> { + swInventory.setItem(4, new SWItem(Material.CLOCK, "§eArenen").getItemStack(), clickType -> { player.teleport(arenen); }); swInventory.open(); -- 2.39.5 From 2e6677cb983d7fbaa5789ee063dac0c159566fe0 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Mar 2022 16:44:49 +0100 Subject: [PATCH 08/11] Fix TeleporterListener --- src/de/steamwar/lobby/listener/TeleporterListener.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/de/steamwar/lobby/listener/TeleporterListener.java b/src/de/steamwar/lobby/listener/TeleporterListener.java index 48c7bf6..224ae2f 100644 --- a/src/de/steamwar/lobby/listener/TeleporterListener.java +++ b/src/de/steamwar/lobby/listener/TeleporterListener.java @@ -21,6 +21,7 @@ package de.steamwar.lobby.listener; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; +import de.steamwar.lobby.util.LobbyPlayer; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -51,18 +52,23 @@ public class TeleporterListener extends BasicListener { }); swInventory.setItem(0, new SWItem(Material.WOODEN_AXE, "§eBaubereich").getItemStack(), clickType -> { player.teleport(bau); + Portals.getStack(player).clear(); }); swInventory.setItem(1, new SWItem(Material.MAGMA_CREAM, "§eSpawn").getItemStack(), clickType -> { player.teleport(spawn); + Portals.getStack(player).clear(); }); swInventory.setItem(2, new SWItem(Material.BEACON, "§eTeamhalle").getItemStack(), clickType -> { player.teleport(team); + Portals.getStack(player).clear(); }); swInventory.setItem(3, new SWItem(Material.MAP, "§eMap").getItemStack(), clickType -> { player.teleport(map); + Portals.getStack(player).clear(); }); swInventory.setItem(4, new SWItem(Material.CLOCK, "§eArenen").getItemStack(), clickType -> { player.teleport(arenen); + Portals.getStack(player).clear(); }); swInventory.open(); } -- 2.39.5 From f7ce9950c776d9b347e7f363fb0dedb6379e696f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Mar 2022 16:49:29 +0100 Subject: [PATCH 09/11] Fix TeleporterListener --- .../lobby/listener/TeleporterListener.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/de/steamwar/lobby/listener/TeleporterListener.java b/src/de/steamwar/lobby/listener/TeleporterListener.java index 224ae2f..e615229 100644 --- a/src/de/steamwar/lobby/listener/TeleporterListener.java +++ b/src/de/steamwar/lobby/listener/TeleporterListener.java @@ -51,25 +51,25 @@ public class TeleporterListener extends BasicListener { return Bukkit.createInventory(null, InventoryType.HOPPER, "§6Teleporter"); }); swInventory.setItem(0, new SWItem(Material.WOODEN_AXE, "§eBaubereich").getItemStack(), clickType -> { - player.teleport(bau); - Portals.getStack(player).clear(); + teleport(bau, player); }); swInventory.setItem(1, new SWItem(Material.MAGMA_CREAM, "§eSpawn").getItemStack(), clickType -> { player.teleport(spawn); - Portals.getStack(player).clear(); }); swInventory.setItem(2, new SWItem(Material.BEACON, "§eTeamhalle").getItemStack(), clickType -> { player.teleport(team); - Portals.getStack(player).clear(); }); swInventory.setItem(3, new SWItem(Material.MAP, "§eMap").getItemStack(), clickType -> { player.teleport(map); - Portals.getStack(player).clear(); }); swInventory.setItem(4, new SWItem(Material.CLOCK, "§eArenen").getItemStack(), clickType -> { - player.teleport(arenen); - Portals.getStack(player).clear(); + teleport(arenen, player); }); swInventory.open(); } + + private void teleport(Location location, Player player) { + player.teleport(location); + Portals.getStack(player).clear(); + } } -- 2.39.5 From b0444691535a5dab8fd2a08258f5a0bc7af2666f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Mar 2022 16:50:10 +0100 Subject: [PATCH 10/11] Fix TeleporterListener --- src/de/steamwar/lobby/listener/TeleporterListener.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/lobby/listener/TeleporterListener.java b/src/de/steamwar/lobby/listener/TeleporterListener.java index e615229..9cac882 100644 --- a/src/de/steamwar/lobby/listener/TeleporterListener.java +++ b/src/de/steamwar/lobby/listener/TeleporterListener.java @@ -54,13 +54,13 @@ public class TeleporterListener extends BasicListener { teleport(bau, player); }); swInventory.setItem(1, new SWItem(Material.MAGMA_CREAM, "§eSpawn").getItemStack(), clickType -> { - player.teleport(spawn); + teleport(spawn, player); }); swInventory.setItem(2, new SWItem(Material.BEACON, "§eTeamhalle").getItemStack(), clickType -> { - player.teleport(team); + teleport(team, player); }); swInventory.setItem(3, new SWItem(Material.MAP, "§eMap").getItemStack(), clickType -> { - player.teleport(map); + teleport(map, player); }); swInventory.setItem(4, new SWItem(Material.CLOCK, "§eArenen").getItemStack(), clickType -> { teleport(arenen, player); -- 2.39.5 From 0fd7288d022c965168dd2df04d6da7993eb3a785 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Mar 2022 16:51:32 +0100 Subject: [PATCH 11/11] Fix TeleporterListener --- src/de/steamwar/lobby/listener/TeleporterListener.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/de/steamwar/lobby/listener/TeleporterListener.java b/src/de/steamwar/lobby/listener/TeleporterListener.java index 9cac882..845ab5d 100644 --- a/src/de/steamwar/lobby/listener/TeleporterListener.java +++ b/src/de/steamwar/lobby/listener/TeleporterListener.java @@ -21,14 +21,12 @@ package de.steamwar.lobby.listener; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; -import de.steamwar.lobby.util.LobbyPlayer; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerInteractEvent; @@ -42,7 +40,7 @@ public class TeleporterListener extends BasicListener { private static final Location bau = new Location(world,1951,66,1337); private static final Location arenen = new Location(world,2255,21,1450); - @EventHandler(priority = EventPriority.NORMAL) + @EventHandler public void handlePlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); if (!PlayerSpawn.NETHER_STAR.equals(event.getItem())) return; -- 2.39.5