I'm currently working on a plugin which should make a kind of "ServerSwapper"
Server type: BungeeCord, Paper
Version: 1.15.2
Here is my problem.
If I do that
out.WriteUTF ("Connect");
out.WriteUTF ("lobby");
wants to use
it turns RED and does not work accordingly.
But here is my code:
PS: I can open the inventory, but just take things out without anything being played in the chat.
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
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.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class challangewindow implements CommandExecutor {
private final string GUI_NAME = "NAME";
public void openGUI (Player player) {
Inventory inventory = Bukkit.createInventory (null, 9 * 1, GUI_NAME);
inventory.setItem (3, new ItemStack (Material.NETHER_STAR));
inventory.setItem (5, new ItemStack (Material.FIREWORK_STAR));
player.openInventory (inventory);
}
@Override
public boolean onCommand (CommandSender sender, Command command, String label, String [] args) {
Player p = (player) transmitter;
if (! P.hasPermission ("mommde.chwi")) {
p.sendMessage (ChatColor.RED + "NO RIGHTS!");
return false;
} else {
openGUI (p);
}
return true;
}
@EventHandler
public void handleNavigatorGUIClick (InventoryClickEvent e) {
if (! (e.getWhoClicked () instanceof Player)) return;
Player p = (Player) e.getWhoClicked ();
if (e.getView (). GetTitle (). Equals (GUI_NAME)) {
e.setCancelled (true);
switch (e.getCurrentItem (). GetType ()) {
case NETHER_STAR:
p.sendMessage (ChatColor.GRAY + "Server:");
p.closeInventory ();
break;
case FIREWORK_STAR:
p.sendMessage ("test");
p.closeInventory ();
break;
default:
p.sendMessage ("NIX");
break;
}
}
}
WriteUTF → w small
Unfortunately it does not work, to be more precise, the out of out.writeUTF is underlined
I can't find an out in the code you've attached, so I can't help you
I will upload the code updated again in a new question.