本文整理汇总了Java中org.bukkit.event.hanging.HangingPlaceEvent.getEntity方法的典型用法代码示例。如果您正苦于以下问题:Java HangingPlaceEvent.getEntity方法的具体用法?Java HangingPlaceEvent.getEntity怎么用?Java HangingPlaceEvent.getEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.hanging.HangingPlaceEvent
的用法示例。
在下文中一共展示了HangingPlaceEvent.getEntity方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerLeashHitch
import org.bukkit.event.hanging.HangingPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerLeashHitch(final HangingPlaceEvent e) {
if (DEBUG) {
plugin.getLogger().info(e.getEventName());
plugin.getLogger().info("DEBUG: block placed " + e.getBlock().getType());
plugin.getLogger().info("DEBUG: entity " + e.getEntity().getType());
}
if (Settings.allowAutoActivator && e.getPlayer().getName().equals("[CoFH]")) {
return;
}
// plugin.getLogger().info(e.getEventName());
if (Util.inWorld(e.getPlayer())) {
if (e.getEntity() != null && e.getEntity().getType().equals(EntityType.LEASH_HITCH)) {
if (!actionAllowed(e.getPlayer(), e.getBlock().getLocation(), SettingsFlag.LEASH)) {
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
}
}
示例2: onPlayerLeashHitch
import org.bukkit.event.hanging.HangingPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerLeashHitch(final HangingPlaceEvent e) {
if (DEBUG) {
plugin.getLogger().info(e.getEventName());
plugin.getLogger().info("DEBUG: block placed " + e.getBlock().getType());
plugin.getLogger().info("DEBUG: entity " + e.getEntity().getType());
}
if (Settings.allowedFakePlayers.contains(e.getPlayer().getName())) return;
// plugin.getLogger().info(e.getEventName());
if (inWorld(e.getPlayer())) {
if (e.getEntity() != null && e.getEntity().getType().equals(EntityType.LEASH_HITCH)) {
if (!actionAllowed(e.getPlayer(), e.getBlock().getLocation(), SettingsFlag.LEASH)) {
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
}
}
示例3: onHangingPlace
import org.bukkit.event.hanging.HangingPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event)
{
Hanging hanging = event.getEntity();
HangingPlace action;
if (hanging instanceof Painting)
{
action = this.newAction(PaintingPlace.class, hanging.getWorld());
if (action != null)
{
((PaintingPlace)action).art = ((Painting)hanging).getArt();
}
}
else
{
action = this.newAction(HangingPlace.class, hanging.getWorld());
}
if (action != null)
{
action.setLocation(hanging.getLocation());
action.setHanging(hanging);
action.setPlayer(event.getPlayer());
this.logAction(action);
}
}
示例4: onHangingPlaceEvent
import org.bukkit.event.hanging.HangingPlaceEvent; //导入方法依赖的package包/类
/**
* Event handler to watch whenever an itemframe is placed.
* This will remove the cache of the hopper it was placed on.
*
* @param event HangingPlaceEvent containing data about the item being hung. We care about an ItemFrame being placed.
*/
@EventHandler(ignoreCancelled=true)
public void onHangingPlaceEvent(HangingPlaceEvent event) {
if (event.getEntity() instanceof ItemFrame) {
if (event.getBlock().getType().equals(Material.HOPPER)) {
Player player = event.getPlayer();
if (!player.hasPermission("hopperfiltersimplified.build.place.itemframe")) {
plugin.sendMessageInfo(player, "You do not have rights to place a hopper filter itemFrame.");
event.setCancelled(true);
return;
}
//debug if requested
if (plugin.debugLevel_get() > 0) plugin.getLogger().info("ItemFrame placed at (" + event.getBlock().getLocation().toString() + ")");
//Clear the cache from the hopper around the Hopper the itemFrame was placed on.
plugin.knownHoppersCache_ClearAroundLocation(event.getBlock().getLocation());
}
}
}
示例5: onHangingPlace
import org.bukkit.event.hanging.HangingPlaceEvent; //导入方法依赖的package包/类
/**
* Handles hanging entity spawning
*
* @param e an event representing a hanging entity that has spawned
* @see HangingPlaceEvent
* @since 4.0.4
*/
@EventHandler(ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent e) {
if (ArenaManager.getInstance().getArena(e.getPlayer()) == null)
return;
Entity entity = e.getEntity();
Plot plot;
if ((plot = Plot.getPlot(entity.getLocation())) != null) {
if (!plot.addEntity(entity))
e.setCancelled(true);
} else
e.setCancelled(true);
}
示例6: onHangingPlaceEvent
import org.bukkit.event.hanging.HangingPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.NORMAL )
public void onHangingPlaceEvent(HangingPlaceEvent event)
{
System.out.println(" plugin: onHangingPlace Event ");
if (event.getEntity() instanceof ItemFrame)
{
Player player = event.getPlayer();
System.out.println(" player: "+player.getDisplayName() );
System.out.println(" event.getBlock().getType() "+event.getBlock().getType() ); // auf was
plugin.itemFrame1 = (ItemFrame)event.getEntity();
}
System.out.println(" ");
}