Uzade Posted May 3, 2020 Share Posted May 3, 2020 Ich weiß wirklich nicht warum, ich hoffe irgendwer kann mir helfen. Es gibt keine Fehlermeldungen, der Teleporter geht einfach nicht mehr. Die anderen Cmds aus meinem Plugin gehen aber noch. package de.uzade.main; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.Inventory; public class Navigator implements Listener{ private final String GUI_NAME = "§6§lTest-GUI"; public void openGUI(Player player) { Inventory invent = Bukkit.createInventory(player, 9*3, GUI_NAME); invent.setItem(0, new ItemBuilder(Material.GOLDEN_APPLE).setName("Lobbyapfel").setLore("Hier gehts zur Lobby!").build()); invent.setItem(2, new ItemBuilder(Material.BED).setName("Bedwars").setLore("Hier klicken für Bedwars").build()); invent.setItem(4, new ItemBuilder(Material.IRON_PICKAXE).setName("Masterbuilders").setLore("Teleports yout to masterbuilders").build()); player.openInventory(invent); } @EventHandler public void handleNavigatorOpener(PlayerInteractEvent event) { Player player = event.getPlayer(); if(player.getItemInHand() == null || player.getItemInHand().getType() == Material.AIR) return; if(event.getItem().getType() != Material.COMPASS) return; if(event.getItem().getItemMeta() == null) return; if(event.getItem().getItemMeta().getDisplayName() != "§6Teleporter") return; if(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) { openGUI(event.getPlayer()); } } @EventHandler public void handleNavigatorGUIClick(InventoryClickEvent event) { if(!(event.getWhoClicked() instanceof Player)) return; Player player = (Player) event.getWhoClicked(); player.sendMessage("got Triggert"); if(event.getClickedInventory().getTitle() == null) return; if(event.getClickedInventory().getTitle().equals(GUI_NAME)) { FileConfiguration config = Main.getPlugin().getConfig(); String i = "0"; if(event.getCurrentItem() == null) return; switch(event.getCurrentItem().getType()) { case GOLDEN_APPLE: i = "Spawn"; break; case BED: i = "1"; break; default: break; } World world = Bukkit.getWorld(config.getString(i + ".World")); double x = config.getDouble(i + ".X"); double y = config.getDouble(i + ".Y"); double z = config.getDouble(i + ".Z"); float yaw = (float) config.getDouble(i + ".Yaw"); float pitch = (float) config.getDouble(i + ".Pitch"); Location loc = new Location(world, x, y, z, yaw, pitch); player.teleport(loc); } } }``` Link to comment Share on other sites More sharing options...
boomer41 Posted May 3, 2020 Share Posted May 3, 2020 Geht das Inventar nichtmehr auf, oder kannst du nicht auf deine Items im Inventar klicken? Bitte sei etwas präziser. Link to comment Share on other sites More sharing options...
Uzade Posted May 3, 2020 Author Share Posted May 3, 2020 geht nemmer auf Link to comment Share on other sites More sharing options...
boomer41 Posted May 3, 2020 Share Posted May 3, 2020 if(event.getItem().getItemMeta().getDisplayName() != "§6Teleporter") return; Strings so zu vergleichen ist falsch. Dass es beim ersten mal geht ist pures Glück. 1 Link to comment Share on other sites More sharing options...
Uzade Posted May 3, 2020 Author Share Posted May 3, 2020 wie is es den richtig? Link to comment Share on other sites More sharing options...
Uzade Posted May 3, 2020 Author Share Posted May 3, 2020 besser so? if(!(event.getItem().getItemMeta().getDisplayName().equals("§6Teleporter"))) return; Link to comment Share on other sites More sharing options...
Uzade Posted May 3, 2020 Author Share Posted May 3, 2020 danke, das hat's gefixt Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now