Updating permissions and such

This commit is contained in:
sekwah41 2018-02-01 21:49:47 +00:00 committed by Sekwah
parent b73da10f65
commit bd497a5e7f

View File

@ -1,9 +1,13 @@
package com.sekwah.advancedportals.spigot; package com.sekwah.advancedportals.spigot;
import com.sekwah.advancedportals.core.CoreListeners; import com.sekwah.advancedportals.core.CoreListeners;
import com.sekwah.advancedportals.core.data.PortalLocation;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
import org.bukkit.Location;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
public class Listeners implements Listener { public class Listeners implements Listener {
@ -21,4 +25,15 @@ public class Listeners implements Listener {
coreListeners.playerJoin(new PlayerContainer(event.getPlayer())); coreListeners.playerJoin(new PlayerContainer(event.getPlayer()));
} }
@EventHandler
public void onItemInteract(PlayerInteractEvent event) {
if ((event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK) && event.getItem() != null) {
Location blockloc = event.getClickedBlock().getLocation();
this.coreListeners.playerInteractWithBlock(new PlayerContainer(event.getPlayer()), event.getMaterial().toString(),
event.getItem().getItemMeta().getDisplayName(),
new PortalLocation(blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ()),
event.getAction() == Action.LEFT_CLICK_BLOCK);
}
}
} }