本文整理匯總了Java中org.bukkit.event.hanging.HangingPlaceEvent.getPlayer方法的典型用法代碼示例。如果您正苦於以下問題:Java HangingPlaceEvent.getPlayer方法的具體用法?Java HangingPlaceEvent.getPlayer怎麽用?Java HangingPlaceEvent.getPlayer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.hanging.HangingPlaceEvent
的用法示例。
在下文中一共展示了HangingPlaceEvent.getPlayer方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onFramePlace
import org.bukkit.event.hanging.HangingPlaceEvent; //導入方法依賴的package包/類
public void onFramePlace(HangingPlaceEvent e) {
Player p = e.getPlayer();
Map cpl = RegionMapGen.getPlayerLocations();
cpl.put(p.getUniqueId(), RegionMapGen.getMap()[(int)p.getLocation().getX()][(int)p.getLocation().getZ()]);
RegionMapGen.setPlayerLocations(cpl);
if (cpl.get(p.getUniqueId()).equals("lava")) {
Broadcast.toPlayer(p.getPlayer(), Broadcast.BroadcastType.FAILURE, "You cannot place item frames in Warvale's territory.");
e.setCancelled(true);
} else if (cpl.get(p.getUniqueId()).equals(Main.get().getConfig().getString("Player-Data."+p.getUniqueId()+"Guild-Name"))) {
e.setCancelled(false);
} else {
Broadcast.toPlayer(p, Broadcast.BroadcastType.FAILURE, "You cannot place item frames in "+cpl.get(p.getUniqueId())+"'s territory.");
e.setCancelled(true);
}
}
示例2: onHangingPlace
import org.bukkit.event.hanging.HangingPlaceEvent; //導入方法依賴的package包/類
/**
* On hanging place.
*
* @param event
* the event
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event) {
if (!playerConf.get(event.getPlayer()).isAdminMod()) {
IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(
event.getEntity().getLocation());
Player player = event.getPlayer();
if ((land instanceof ILand && ((ILand) land).isBanned(player))
|| !checkPermission(land, player,
PermissionList.BUILD.getPermissionType())
|| !checkPermission(land, player,
PermissionList.BUILD_PLACE.getPermissionType())) {
messagePermission(player);
event.setCancelled(true);
}
}
}
示例3: NoHangingPlace
import org.bukkit.event.hanging.HangingPlaceEvent; //導入方法依賴的package包/類
/**
* Checks if a player has permission to hang paintings or item frames.
*
* @param event that triggers listener.
*/
@EventHandler(priority = EventPriority.LOW)
public void NoHangingPlace(HangingPlaceEvent event) {
Player player = event.getPlayer();
// Hanging place
if (!player.hasPermission("antibuild.bypass")) {
if (!player.hasPermission("antibuild.painting")) {
event.setCancelled(true);
PlayerMessenger.messageHandler(plugin.getConfigHandler().getNoInteractMessage(), player);
}
}
// // World lock check
// if (!event.isCancelled() && plugin.isUsingLock()) {
// if (plugin.isLockedWorld(player.getWorld().getName())
// && !player.hasPermission("antibuild.lock.bypass") && !player.hasPermission("antibuild.lock
// .bypass" +
// "." + player.getWorld().getName())) {
// event.setCancelled(true);
// messageHandler(plugin.getLockedWorldMessage(), player);
// }
// }
}
示例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包/類
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onHangingPlace(final HangingPlaceEvent e) {
final Block b = e.getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation());
if (PlotSquared.isPlotWorld(loc.getWorld())) {
final Player p = e.getPlayer();
final PlotPlayer pp = BukkitUtil.getPlayer(p);
Plot plot = MainUtil.getPlot(loc);
if (plot == null) {
if (MainUtil.isPlotAreaAbs(loc)) {
if (!Permissions.hasPermission(pp, "plots.admin.build.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
e.setCancelled(true);
return;
}
}
} else {
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
e.setCancelled(true);
return;
}
} else if (!plot.isAdded(pp.getUUID())) {
if (FlagManager.isPlotFlagTrue(plot, "hanging-place")) {
return;
}
if (!Permissions.hasPermission(pp, "plots.admin.build.other")) {
if (MainUtil.isPlotArea(loc)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other");
e.setCancelled(true);
return;
}
}
}
}
}
}
示例6: onHangingPlace
import org.bukkit.event.hanging.HangingPlaceEvent; //導入方法依賴的package包/類
/**
* Handles placing paintings, item frames, leashes
*
* @param event The event
*/
@EventHandler
public void onHangingPlace(HangingPlaceEvent event) {
Player player = event.getPlayer();
NovaPlayer nPlayer = PlayerManager.getPlayer(player);
Location location = event.getEntity().getLocation();
if(RegionManager.get(location) != null
&& (!plugin.getRegionManager().canInteract(player, location) || (!nPlayer.getPreferences().getBypass() && !nPlayer.hasPermission(GuildPermission.BLOCK_PLACE)))) {
event.setCancelled(true);
Message.CHAT_REGION_DENY_INTERACT.send(player);
}
}
示例7: onHangingPlace
import org.bukkit.event.hanging.HangingPlaceEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event) {
Block b = event.getBlock().getRelative(event.getBlockFace());
Location location = BukkitUtil.getLocation(b.getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
Player p = event.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(p);
Plot plot = area.getPlot(location);
if (plot == null) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
event.setCancelled(true);
}
} else {
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
event.setCancelled(true);
}
return;
}
if (!plot.isAdded(pp.getUUID())) {
if (!plot.getFlag(Flags.HANGING_PLACE,false)) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
}
return;
}
}
if (checkEntity(event.getEntity(), plot)) {
event.setCancelled(true);
}
}
}
示例8: HangingPlace
import org.bukkit.event.hanging.HangingPlaceEvent; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void HangingPlace(final HangingPlaceEvent event)
{
final Player player = event.getPlayer();
if (plugin.isLoggedIn(player))
return;
event.setCancelled(true);
plugin.sendAuthReminderMessage(player);
}
示例9: 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(" ");
}
示例10: onItemFramePlaced
import org.bukkit.event.hanging.HangingPlaceEvent; //導入方法依賴的package包/類
@EventHandler
public void onItemFramePlaced(HangingPlaceEvent e) {
if (e != null && e.getEntity().getType().equals(EntityType.ITEM_FRAME) && e.getPlayer() != null) {
ChunkHelper.cancelEventIfNotOwned(e.getPlayer(), e.getEntity().getLocation().getChunk(), e);
}
}