You are not logged in.

  • Login

[Bukkit-Plugin] Open Inventory Sound

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

xlson

User / Kunde

  • "xlson" is male
  • "xlson" started this thread

Posts: 513

  • Send private message

1

Thursday, February 5th 2015, 4:33pm

Open Inventory Sound

Liebe Community,

Wie kann ich Sounds einfügen wen man mit dem block per rechtsklick interagiert?

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
	@EventHandler
	public void onPlayer(PlayerInteractEvent e){
		Player p = e.getPlayer();
		
		if(e.getAction()== Action.RIGHT_CLICK_AIR){
			e.setCancelled(true);
			if(e.getMaterial().equals(Material.SKULL_ITEM)){
				Inventory inv = p.getServer().createInventory(null, 54, " ");
			        //**************************************************************
				//**************************************************************
				//**************************************************************
				p.openInventory(inv);
			}
		}
	}

Anno35

User / Kunde

Posts: 1,223

Thanks: 3

  • Send private message

2

Thursday, February 5th 2015, 4:34pm

Player.playSound();

xlson

User / Kunde

  • "xlson" is male
  • "xlson" started this thread

Posts: 513

  • Send private message

3

Thursday, February 5th 2015, 4:36pm

Player.playSound();


Hättest du den Code für mich?

Anno35

User / Kunde

Posts: 1,223

Thanks: 3

  • Send private message

4

Thursday, February 5th 2015, 4:41pm

Da steht er doch?
Player.playSound(Location, Sound, Pitch, Lautstärke);

xlson

User / Kunde

  • "xlson" is male
  • "xlson" started this thread

Posts: 513

  • Send private message

5

Thursday, February 5th 2015, 4:50pm

aber in welche zeile?

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
	@SuppressWarnings({"deprecation" })
	@EventHandler
	public void onPlayer(PlayerInteractEvent e){
		Player p = e.getPlayer();
		
		if(e.getAction()== Action.RIGHT_CLICK_AIR){
			e.setCancelled(true);
			if(e.getMaterial().equals(Material.NETHER_STAR)){
				Inventory inv = p.getServer().createInventory(null, 9, " ");
			        //**************************************************************
				ItemStack boot1 = new ItemStack(Material.LEATHER_BOOTS);
				LeatherArmorMeta boot1meta = (LeatherArmorMeta)boot1.getItemMeta();
				boot1meta.setDisplayName("§2Slime Boots");
				boot1meta.setColor(Color.LIME);
				boot1.setItemMeta(boot1meta);
				
				inv.setItem(4, boot1);
				//**************************************************************
				ItemStack glass = new ItemStack(160, 1, (short) 15);
				ItemMeta glassmeta = glass.getItemMeta();
				glassmeta.setDisplayName(" ");
				glass.setItemMeta(glassmeta);
				
				inv.setItem(0, glass);
				inv.setItem(1, glass);
				inv.setItem(2, glass);
				inv.setItem(3, glass);
				inv.setItem(5, glass);
				inv.setItem(6, glass);
				inv.setItem(7, glass);
				inv.setItem(8, glass);
				//**************************************************************
				p.openInventory(inv);

Anno35

User / Kunde

Posts: 1,223

Thanks: 3

  • Send private message

6

Thursday, February 5th 2015, 4:52pm

Das ist egal, du kannst das an den Anfang deines Codes oder am Ande hinschreiben.
Zur übersichtlichkeit würde ich es unter dem öffnen schreiben.

xlson

User / Kunde

  • "xlson" is male
  • "xlson" started this thread

Posts: 513

  • Send private message

7

Saturday, February 7th 2015, 8:46pm

//close

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