本文整理汇总了Java中org.bukkit.event.player.PlayerEggThrowEvent.getPlayer方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerEggThrowEvent.getPlayer方法的具体用法?Java PlayerEggThrowEvent.getPlayer怎么用?Java PlayerEggThrowEvent.getPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.player.PlayerEggThrowEvent
的用法示例。
在下文中一共展示了PlayerEggThrowEvent.getPlayer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEggThrow
import org.bukkit.event.player.PlayerEggThrowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEggThrow(final PlayerEggThrowEvent event) {
final PlayerStat stat = PlayerStat.EGGS_THROWN;
// Get player
final Player player = (Player) event.getPlayer();
// Do general check
if (!plugin.doGeneralCheck(player, stat))
return;
// Update value to new stat.
plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid",
player.getUniqueId().toString(), "value", 1, "world", player.getWorld().getName()));
}
示例2: onEgg
import org.bukkit.event.player.PlayerEggThrowEvent; //导入方法依赖的package包/类
@EventHandler
public void onEgg(PlayerEggThrowEvent e){
Player p = e.getPlayer();
if (p.getInventory().getItemInMainHand() == null) return;
if (!p.getInventory().getItemInMainHand().hasItemMeta() || !p.getInventory().getItemInMainHand().getItemMeta().hasDisplayName()) return;
if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(pe.getPokeEgg().getItemMeta().getDisplayName())) {
e.setHatching(false);
}
}
示例3: PlayerTrownEgg
import org.bukkit.event.player.PlayerEggThrowEvent; //导入方法依赖的package包/类
@EventHandler
public void PlayerTrownEgg(PlayerEggThrowEvent e){
Location l = e.getEgg().getLocation();
Player p = e.getPlayer();
Region r = RedProtect.get().rm.getTopRegion(l);
if (r != null && !r.canBuild(p)){
e.setHatching(false);
RPLang.sendMessage(p, "playerlistener.region.canthatch");
}
}
示例4: onPlayerEggThrow
import org.bukkit.event.player.PlayerEggThrowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerEggThrow(final PlayerEggThrowEvent e) {
final Location l = BukkitUtil.getLocation(e.getEgg().getLocation());
if (PlotSquared.isPlotWorld(l.getWorld())) {
final Player p = e.getPlayer();
final PlotPlayer pp = BukkitUtil.getPlayer(p);
Plot plot = MainUtil.getPlot(l);
if (plot == null) {
if (!MainUtil.isPlotAreaAbs(l)) {
return;
}
if (!Permissions.hasPermission(pp, "plots.admin.projectile.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.projectile.road");
e.setHatching(false);
return;
}
} else {
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, "plots.admin.projectile.unowned")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.projectile.unowned");
e.setHatching(false);
return;
}
} else if (!plot.isAdded(pp.getUUID())) {
if (!Permissions.hasPermission(pp, "plots.admin.projectile.other")) {
if (MainUtil.isPlotArea(l)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.projectile.other");
e.setHatching(false);
return;
}
}
}
}
}
}
示例5: onEgg
import org.bukkit.event.player.PlayerEggThrowEvent; //导入方法依赖的package包/类
@EventHandler
public void onEgg(PlayerEggThrowEvent e) {
if (!hatchingEnabled || e.getPlayer() == null || !plugin.isSkyAssociatedWorld(e.getPlayer().getWorld())) {
return;
}
if (!plugin.playerIsOnIsland(e.getPlayer())) {
e.setHatching(false);
}
}
示例6: onPlayerEggThrow
import org.bukkit.event.player.PlayerEggThrowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerEggThrow(PlayerEggThrowEvent event) {
Location l = BukkitUtil.getLocation(event.getEgg().getLocation());
PlotArea area = l.getPlotArea();
if (area == null) {
return;
}
Player player = event.getPlayer();
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
Plot plot = area.getPlot(l);
if (plot == null) {
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.road")) {
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.road");
event.setHatching(false);
}
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.unowned")) {
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.unowned");
event.setHatching(false);
}
} else if (!plot.isAdded(plotPlayer.getUUID())) {
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.other")) {
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.other");
event.setHatching(false);
}
}
}