Colin Posted February 19, 2022 Share Posted February 19, 2022 (edited) Hallo zusammen Ich habe vorhin kurz ein invsee plugin geschrieben, welches auch gut funktioniert. Allerdings möchte ich, dass man das Inventar eines Spielers anzeigen, jedoch nichts verschieben kann. Ich denke ich muss das irgendwie über das InventoryClickEvent canceln, aber wie überprüfe ich, ob in dem inventar des targets geklickt wurde? Vielen Dank für eure Hilfe Code: package com.advancedfeatures.commands; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import com.advancedfeatures.main.Main; public class Command_Invsee implements CommandExecutor, Listener { @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(sender instanceof Player) { Player p = (Player) sender; if(args.length == 1) { Player t = Bukkit.getPlayer(args[0]); if(t != null) { if(!(t.hasPermission("invsee.noaccess"))) { p.openInventory(t.getInventory()); }else { sender.sendMessage(Main.messagesFileCfg.getString("invsee.noaccess").replace("&", "§")); } }else { sender.sendMessage(Main.messagesFileCfg.getString("targetIsOffline").replace("&", "§")); } }else { sender.sendMessage(Main.messagesFileCfg.getString("invsee.wrongargs").replace("&", "§")); } }else { sender.sendMessage(Main.messagesFileCfg.getString("onlyForPlayers").replace("&", "§")); } return false; } @EventHandler public void onInventoryClick(InventoryClickEvent e) { } } Edited February 19, 2022 by Colin Link to comment Share on other sites More sharing options...
Matzuake Posted April 30, 2022 Share Posted April 30, 2022 Du könntest das einfach lösen public static List<UUID> getNoClicked() { return noclicked; } if (p.hasPermission("invsee.use")) { if (args.length == 1) { Player t = Bukkit.getPlayer(args[0]); if (t != null) { if (!p.hasPermission("invsee.edit")) Hauptmanager.getNoClicked().add(p.getUniqueId()); p.openInventory((Inventory)t.getInventory()); } else { String InvseeError = ChatColor.translateAlternateColorCodes('&', CityBuild.cfg.getString("Message.InvseeError")); p.sendMessage(Prefix + InvseeError); } } else { String InvseeHelp = ChatColor.translateAlternateColorCodes('&', CityBuild.cfg.getString("Help.InvseeHelp")); p.sendMessage(Prefix + InvseeHelp); } so sollte es funktionieren 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