Jump to content

Wie kann ich die Chest animation beim öffnen abrechen


Recommended Posts

Wie kann nich die animation die beim Öffnen einer Chest kommt abrechen wenn der spieler in einer arraylist drin steht ich habe es mit den playerinsterackt event versucht aber das hat nicht funktioniert

package de.n3yut9j.listener;

import org.bukkit.Material;
import org.bukkit.block.Chest;
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.player.PlayerInteractEvent;

import de.n3yut9j.main.Main;

public class Event_OnInteract implements Listener{
	@SuppressWarnings("unused")
	private Main system;

	public Event_OnInteract(Main system) {
		this.system = system;
	}
	
	@EventHandler
	public void oninteract(PlayerInteractEvent e){
		Player p = e.getPlayer();
		if(Main.ghost.contains(p.getName())){
			if(e.getAction() == Action.RIGHT_CLICK_BLOCK){
				if(e.getClickedBlock().getType() == Material.CHEST){
					e.setCancelled(true);
					Chest chest = (Chest) e.getClickedBlock().getState();
					p.openInventory(chest.getInventory());
				}
			}
		}
		
	}

}

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...
B
B