本文整理汇总了Java中org.bukkit.event.player.PlayerPickupItemEvent.getPlayer方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerPickupItemEvent.getPlayer方法的具体用法?Java PlayerPickupItemEvent.getPlayer怎么用?Java PlayerPickupItemEvent.getPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.player.PlayerPickupItemEvent
的用法示例。
在下文中一共展示了PlayerPickupItemEvent.getPlayer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPickUp
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPickUp(PlayerPickupItemEvent e) {
Player p = e.getPlayer();
if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.PickUp.Disable")) {
if (!ConfigGPlayerItems.getConfig().getBoolean("Server.Items.PickUp.World.All_World")) {
if (WorldUtils.getWItemPickUp().contains(p.getWorld().getName())) {
if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.PickUp.Bypass")) {
if (!p.hasPermission("ultimatespawn.event.playeritem.bypass.pickup")) {
e.setCancelled(true);
}
} else {
e.setCancelled(true);
}
}
} else {
if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.PickUp.Bypass")) {
if (!p.hasPermission("ultimatespawn.event.playeritem.bypass.pickup")) {
e.setCancelled(true);
}
} else {
e.setCancelled(true);
}
}
}
}
示例2: onPickupToQuickSlot
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onPickupToQuickSlot(PlayerPickupItemEvent event) {
Player player = event.getPlayer();
if (!InventoryManager.playerIsLoaded(player) || !ItemManager.allowedForPlayer(player, event.getItem().getItemStack(), false)) {
return;
}
for (Slot quickSlot : SlotManager.instance().getQuickSlots()) {
int slotId = quickSlot.getQuickSlot();
if (quickSlot.isCup(player.getInventory().getItem(slotId)) && quickSlot.isValidItem(event.getItem().getItemStack())) {
player.getInventory().setItem(slotId, event.getItem().getItemStack());
event.getItem().remove();
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_PICKUP, .3f, 1.7f);
if (Config.getConfig().getBoolean("attack.auto-held")) {
player.getInventory().setHeldItemSlot(quickSlot.getQuickSlot());
}
event.setCancelled(true);
}
}
}
示例3: onPlayerPickupItem
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
void onPlayerPickupItem(PlayerPickupItemEvent event)
{
Player player = event.getPlayer();
if(!player.isSneaking() && PhantomAdmin.instance.isInvisible(player))
{
event.setCancelled(true);
PlayerData data = PlayerData.FromPlayer(player);
if(!data.gotItemPickupInfo)
{
PhantomAdmin.sendMessage(player, TextMode.Warn, Messages.NoItemPickupWhileInvisible);
data.gotItemPickupInfo = true;
}
return;
}
}
示例4: onItemPickup
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onItemPickup(PlayerPickupItemEvent event)
{
System.out.println("Item pickup");
Item item = event.getItem();
ItemStack stack = item.getItemStack();
Location location = item.getLocation();
Player player = event.getPlayer();
String playerName = player == null ? "null" : player.getName();
PickupItemObsel obsel = new PickupItemObsel(
new Date().getTime(),
stack.getType().toString(),
stack.getAmount(),
stack.getData().getData(),
location.getBlockX(),
location.getBlockY(),
location.getBlockZ(),
location.getWorld().getName(),
playerName);
JSONObselManager.getInstance().addObsel(obsel);
}
示例5: onPickupItem
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPickupItem(PlayerPickupItemEvent event)
{
Player player = event.getPlayer();
if(featureEnabled(Features.SortInventory, player))
{
PlayerData playerData = PlayerData.FromPlayer(player);
if(playerData.firstEmptySlot >= 0) return;
PlayerInventory inventory = player.getInventory();
int firstEmpty = inventory.firstEmpty();
if(firstEmpty < 9) return;
playerData.firstEmptySlot = firstEmpty;
PickupSortTask task = new PickupSortTask(player, playerData, inventory);
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AutomaticInventory.instance, task, 100L);
}
}
示例6: onPlayerPickUp
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerPickUp(final PlayerPickupItemEvent event) {
final PlayerStat stat = PlayerStat.ITEMS_PICKED_UP;
// Get player
final 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", event.getItem().getItemStack().getAmount(), "world", player.getWorld().getName(), "item", event.getItem().getItemStack().getType().toString()));
}
示例7: onPickup
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPickup(PlayerPickupItemEvent ppie) {
Player player = ppie.getPlayer();
Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(player);
if (game == null) {
game = BedwarsRel.getInstance().getGameManager().getGameByLocation(player.getLocation());
if (game == null) {
return;
}
}
if (game.getState() != GameState.WAITING && game.isInGame(player)) {
return;
}
ppie.setCancelled(true);
}
示例8: onPickup
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPickup(PlayerPickupItemEvent e){
Item item = e.getItem();
if(item.getCustomName()!=null) {
String name = ChatColor.stripColor(item.getCustomName());
// if(name!=null && ChatColor.stripColor(language.get("nameSyntax")).replace("{money}", "").equals(name.replaceAll(regex, ""))){
e.setCancelled(true);
String money = plugin.getMoney(name);
Player p = e.getPlayer();
if (p.hasPermission("PickupMoney.pickup")) {
item.remove();
float amount = Float.parseFloat(money);
if(plugin.pickupMulti.containsKey(p.getUniqueId())) amount*=plugin.pickupMulti.get(p.getUniqueId());
plugin.giveMoney(amount, p);
p.sendMessage(plugin.language.get("pickup").replace("{money}", String.valueOf(amount)));
if (plugin.fc.getBoolean("sound.enable")) {
p.getLocation().getWorld().playSound(p.getLocation(), Sound.valueOf(plugin.fc.getString("sound.type"))
, (float) plugin.fc.getDouble("sound.volumn")
, (float) plugin.fc.getDouble("sound.pitch"));
}
}
// }
}
}
示例9: onPlayerPickupBook
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
public void onPlayerPickupBook(PlayerPickupItemEvent event) {
final Player player = event.getPlayer();
if (player.getWorld().equals(griefFree)) {
Item drop = event.getItem();
if (drop.equals(droppedBook) || drop.equals(droppedShovel) || drop.equals(droppedStick)) {
// PlayerInventory playerInv = player.getInventory();
if (!recieved.contains(player)) {
if (drop.equals(droppedBook)) {
spawnBook(false);
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
recieved.add(player);
}
}, 2);
}
} else {
event.setCancelled(true);
}
}
}
}
示例10: PickupItem
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
/**
* Checks if player has proper permission to pickup items.
*
* @param event that triggers listener.
*/
@EventHandler(priority = EventPriority.LOW)
private void PickupItem(PlayerPickupItemEvent event) {
Player player = event.getPlayer();
// Pickup item check.
if (player != null && !player.hasPermission("antibuild.bypass")) {
if (!player.hasPermission("antibuild.pickupitems")) {
event.setCancelled(true);
// We can't message the player here or it spams.
}
}
// // World 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);
// // We can't message the player here or it spams.
// }
// }
}
示例11: onPlayerPickupItem
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerPickupItem(PlayerPickupItemEvent event)
{
Player pl = event.getPlayer();
if (pl != null)
{
if (plugin.isInArena(pl))
{
if (plugin.getArena(pl).type.equals("Hunger"))
{
event.setCancelled(false);
}
else
{
event.setCancelled(true);
}
}
}
}
示例12: onPlayerPickupItem
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
Player p = event.getPlayer();
ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();
// Is the current player playing
if(am.isInArena(p)) {
ArenaPlayer ap = am.getPlayer(p);
// Is the player in the lobby of the arena
if(ap.isInLobby()) {
// Has the player a arena spawn assigned
if(ap.hasAssignedAreanSpawn())
event.setCancelled(true);
}
// Is the player an spectators
if(ap.isSpectator())
event.setCancelled(true);
}
}
示例13: onPlayerPickupItem
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerPickupItem(PlayerPickupItemEvent event)
{
final Player user = event.getPlayer();
final ItemStack item = event.getItem().getItemStack();
if (antib.getSettings().getData().isDisableUse() && !Permissions.BUILD.isAuthorized(user))
{
if (!Permissions.PICKUP.isAuthorized(user, item.getType(), item.getData()))
{
event.setCancelled(true);
event.getItem().setPickupDelay(50);
}
}
}
示例14: onItemPickup
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onItemPickup(PlayerPickupItemEvent e) {
Game bw = io.github.bedwarsrel.BedwarsRel.Main.getInstance()
.getGameManager().getGameOfPlayer(e.getPlayer());
if (bw == null) {
return;
}
if (!Config.isGameEnabledXP(bw.getName())) {
return;
}
Player p = e.getPlayer();
Item entity = e.getItem();
ItemStack stack = entity.getItemStack();
int count = Res.convertResToXP(stack);
if (count == 0) {
return;
}
e.setCancelled(true);
XPManager.addXP(bw.getName(), p, count);
p.playSound(p.getLocation(),
SoundMachine.get("ORB_PICKUP", "ENTITY_EXPERIENCE_ORB_PICKUP"),
10.0F, 1.0F);
if (!Config.Message.equals("")) {
ActionBarUtils.sendActionBar(p,
Config.Message.replaceAll("%xp%", Integer.toString(count)));
/*
* if (!ActionBarUtils.works) {
* p.sendMessage(Config.Message.replaceAll("%xp%",
* Integer.toString(count))); }
*/
}
entity.remove();
}
示例15: onItemPickup
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onItemPickup(PlayerPickupItemEvent e) {
Game bw = io.github.yannici.bedwars.Main.getInstance().getGameManager()
.getGameOfPlayer(e.getPlayer());
if (bw == null) {
return;
}
if (!Config.isGameEnabledXP(bw.getName())) {
return;
}
Player p = e.getPlayer();
Item entity = e.getItem();
ItemStack stack = entity.getItemStack();
int count = Res.convertResToXP(stack);
if (count == 0) {
return;
}
e.setCancelled(true);
XPManager.addXP(bw.getName(), p, count);
p.playSound(p.getLocation(),
SoundMachine.get("ORB_PICKUP", "ENTITY_EXPERIENCE_ORB_PICKUP"),
10.0F, 1.0F);
if (!Config.Message.equals("")) {
ActionBarUtils.sendActionBar(p,
Config.Message.replaceAll("%xp%", Integer.toString(count)));
/*
* if (!ActionBarUtils.works) {
* p.sendMessage(Config.Message.replaceAll("%xp%",
* Integer.toString(count))); }
*/
}
entity.remove();
}