You are not logged in.

  • Login
Bitte besucht unser neues Forum unter https://forum.nitrado.net | Please visit our new Forum at https://forum.nitrado.net

Dear visitor, welcome to Nitrado.net Prepaid Gameserver Community-Support - Archiv. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

RSDarki

User / Kunde

  • "RSDarki" is male
  • "RSDarki" started this thread

Posts: 96

Location: Darki.getLocation ()

Occupation: Schüler, Teilzeitdeveloper

  • Send private message

1

Sunday, March 6th 2016, 2:42pm

Spieler Köpfe mit Skin geben

Ich mache grade ein Teleporter, den man öffnet wo alle Köpfe mit Skin drinne sind jedoch kommt eine EventException. Hier der Code des items:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
        @EventHandler
	public void onInteract(PlayerInteractEvent e){
		if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){
			if(e.getItem().getType() == Material.WATCH){
				e.setCancelled(true);
				Inventory inv = Bukkit.createInventory(null, 36,  ChatColor.DARK_GRAY + "You can spectate: ");
				ItemStack i = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 5);
				ItemMeta m = i.getItemMeta();
				m.setDisplayName(ChatColor.GREEN + "---");
				i.setItemMeta(m);
				inv.setItem(0, i);
				inv.setItem(1, i);
				inv.setItem(2, i);
				inv.setItem(3, i);
				inv.setItem(5, i);
				inv.setItem(6, i);
				inv.setItem(7, i);
				inv.setItem(8, i);
				inv.setItem(27, i);
				inv.setItem(35, i);
				ItemStack i2 = new ItemStack(Material.BARRIER);
				ItemMeta m2 = i2.getItemMeta();
				m2.setDisplayName(ChatColor.RED + "Close");
				i2.setItemMeta(m2);
				inv.setItem(31, i2);
				for(Player players : Bukkit.getOnlinePlayers()){
					if(!(Main.spectator.contains(players))){
						ItemStack i3 = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
						SkullMeta sm = (SkullMeta) i.getItemMeta();
						sm.setOwner(players.getDisplayName());
						i.setItemMeta(sm);
						ItemMeta m3 = i3.getItemMeta();
						m3.setDisplayName(ChatColor.UNDERLINE + "" + ChatColor.BOLD + players.getDisplayName());
						i3.setItemMeta(m3);
						inv.addItem(i3);
					}
				}
				e.getPlayer().openInventory(inv);
			}
		}


Und hier die Exception:
http://pastebin.com/kuK2bEWj

TimBone

User / Kunde

Posts: 1,053

Thanks: 2

  • Send private message

2

Sunday, March 6th 2016, 2:53pm

Du musst diese Klasse importieren: org.bukkit.inventory.ItemStack

Deinen anderen ItemStack Import musst Du dann löschen.

Zitat von »Linus Torvalds«

Nur Weicheier benutzen Datensicherungen auf Band: richtige Männer laden ihren wichtigen Kram einfach auf einen FTP und lassen diesen vom Rest der Welt spiegeln

RSDarki

User / Kunde

  • "RSDarki" is male
  • "RSDarki" started this thread

Posts: 96

Location: Darki.getLocation ()

Occupation: Schüler, Teilzeitdeveloper

  • Send private message

3

Sunday, March 6th 2016, 3:54pm

Habe ich schon bzw das is der richtige Import. Hier die imports:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
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;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;

LucaTecno

User / Kunde

Posts: 61

  • Send private message

4

Sunday, March 6th 2016, 5:01pm

Source code

1
at me.darki.extras.Teleporter.onInteract(Teleporter.java:57) ~[?:?]

RSDarki

User / Kunde

  • "RSDarki" is male
  • "RSDarki" started this thread

Posts: 96

Location: Darki.getLocation ()

Occupation: Schüler, Teilzeitdeveloper

  • Send private message

5

Sunday, March 6th 2016, 5:03pm

SkullMeta sm = (SkullMeta) i.getItemMeta();

LucaTecno

User / Kunde

Posts: 61

  • Send private message

6

Sunday, March 6th 2016, 5:27pm

Ersetz mal i durch i3 hast beim Copy Pasten nicht drauf geachtet..

Bitte besucht unser neues Forum unter https://forum.nitrado.net| Please visit our new Forum at https://forum.nitrado.net