I wrote a Minecraft plugin and need an import of the main class.
I can't import the main class. Here is the code:
package me.mommde.date.lobbyitems;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
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.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 navigator implements listener {
@EventHandler
public void onInteract (PlayerInteractEvent e) {
Player p = e.getPlayer ();
try {
if (e.getItem (). GetItemMeta (). GetDisplayName (). EqualsIgnoreCase ("§a§lNAVI")) {
if (e.getAction (). Equals (Action.RIGHT_CLICK_AIR) || e.getAction (). Equals (Action.RIGHT_CLICK_BLOCK)) {
Inventory inv = Bukkit.createInventory (null, InventoryType.CHEST, "§a§lNAVI");
ItemStack Spawn = new ItemStack (Material.NETHER_STAR);
ItemMeta SpawnMeta = Spawn.getItemMeta ();
SpawnMeta.setDisplayName ("§aSpawn");
Spawn.setItemMeta (SpawnMeta);
ItemStack BuildFir = new ItemStack (Material.IRON_AXE);
ItemMeta BuildFirMeta = BuildFir.getItemMeta ();
BuildFirMeta.setDisplayName ("§5BuildFir");
BuildFir.setItemMeta (BuildFirMeta);
ItemStack BuildSec = new ItemStack (Material.ANDESITE);
ItemMeta BuildSecMeta = BuildSec.getItemMeta ();
BuildSecMeta.setDisplayName ("§bBuildSec");
BuildSec.setItemMeta (BuildSecMeta);
p.openInventory (inv);
inv.setItem (13, spawn);
inv.setItem (11, BuildFir);
inv.setItem (15, BuildSec);
}
}
}
catch (exception e1) {
}
}
@EventHandler
public void onClick (InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked ();
try {
if (e.getView (). GetTitle (). Equals ("§a§lNAVI")) {
e.setCancelled (true);
try {
if (e.getCurrentItem (). GetType () == Material.NETHER_STAR) {
if (e.getCurrentItem (). GetItemMeta (). GetDisplayName (). EqualsIgnoreCase ("§aSpawn")) {
p.sendMessage (Main.pr + "spawn teleport");
Location loc = new Location (Bukkit.getWorld (Main.world), 100, 100, 100, -29.100);
loc.setYaw ((float) 180);
loc.setPitch ((float) 0);
p.teleport (loc);
p.playSound (p.getLocation (), Sound.ENTITY_ENDERMAN_TELEPORT, 2F, 1F);
p.closeInventory ();
}
}
}
catch (NullPointerException e2) {
}
}
}
catch (NullPointerException e1) {
}
}
}
Import me.mommde.date.lobbyitems.Navigator;
You already have your import
Unfortunately the import does not work or IntelliJ IDEA greyed them out (or what that means)
That is all I can import.
Where is the class located that should import the Navigator? The class must already be in the same project.
Otherwise you have to make "Navigator" known in classpath. For example, as Lib.
Thank you lifesaver
Ok it doesn't work.