本文整理汇总了Java中org.bukkit.event.block.BlockPlaceEvent.getPlayer方法的典型用法代码示例。如果您正苦于以下问题:Java BlockPlaceEvent.getPlayer方法的具体用法?Java BlockPlaceEvent.getPlayer怎么用?Java BlockPlaceEvent.getPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.block.BlockPlaceEvent
的用法示例。
在下文中一共展示了BlockPlaceEvent.getPlayer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlaceDropper
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlaceDropper(final BlockPlaceEvent e) {
if (!cm.tileLimitEnabled) {
return;
}
if (e.getBlock().getType() == Material.DROPPER) {
Player p = e.getPlayer();
if (p.isOp()) {
return;
}
int limit = NeverLagUtils.getMaxPermission(p, "neverlag.limit.dropper.");
if (limit <= 0) {
limit = cm.tileLimitDefaultDropper;
}
if (isLimit(e.getBlock().getLocation(), Material.DROPPER, limit)) {
e.setCancelled(true);
p.sendMessage(i18n.tr("message", limit));
}
}
}
示例2: PlaceCheckDoor
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void PlaceCheckDoor(BlockPlaceEvent e) {
if(ConfigPatch.AntiInfSuagrenable){
if(e.isCancelled()){
Player p = e.getPlayer();
List<Entity> entities = p.getNearbyEntities(2, 2, 2);
for(int i=0;i<entities.size();i++){
Entity ent = entities.get(i);
if(ent.getType() == EntityType.DROPPED_ITEM){
Item item = (Item)ent;
if(item.getItemStack().getType() == Material.SUGAR_CANE||item.getItemStack().getType() == Material.CACTUS){
ent.remove();
}
}
}
}
}
}
示例3: onPlaceDispenser
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlaceDispenser(final BlockPlaceEvent e) {
if (!cm.tileLimitEnabled) {
return;
}
if (e.getBlock().getType() == Material.DISPENSER) {
Player p = e.getPlayer();
if (p.isOp()) {
return;
}
int limit = NeverLagUtils.getMaxPermission(p, "neverlag.limit.dispenser.");
if (limit <= 0) {
limit = cm.tileLimitDefaultDispenser;
}
if (isLimit(e.getBlock().getLocation(), Material.DISPENSER, limit)) {
e.setCancelled(true);
p.sendMessage(i18n.tr("message", limit));
}
}
}
示例4: onPlaceHopper
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlaceHopper(final BlockPlaceEvent e) {
if (!cm.tileLimitEnabled) {
return;
}
if (e.getBlock().getType() == Material.HOPPER) {
Player p = e.getPlayer();
if (p.isOp()) {
return;
}
int limit = NeverLagUtils.getMaxPermission(p, "neverlag.limit.hopper.");
if (limit <= 0) {
limit = cm.tileLimitDefaultHopper;
}
if (isLimit(e.getBlock().getLocation(), Material.HOPPER, limit)) {
e.setCancelled(true);
p.sendMessage(i18n.tr("message", limit));
}
}
}
示例5: onBlockBreak
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)
public void onBlockBreak(BlockPlaceEvent event) {
if (event.isCancelled()) {
Player player = event.getPlayer();
if (player.getGameMode() == GameMode.CREATIVE || player.getAllowFlight()) {
return;
}
Block block = event.getBlockPlaced();
if (block.getType().isSolid() && !(block.getState() instanceof Sign)) {
int playerY = player.getLocation().getBlockY();
int blockY = block.getLocation().getBlockY();
if (playerY > blockY) {
Vector vector = player.getVelocity();
vector.setX(-0.1);
vector.setZ(-0.1);
player.setVelocity(vector.setY(vector.getY() - 0.41999998688697815D)); // Magic number acquired from EntityLiving#bj()
}
}
}
}
示例6: onBlockPlace
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onBlockPlace(BlockPlaceEvent event) {
Block block = event.getBlockPlaced();
ItemStack stack = event.getItemInHand();
Player player = event.getPlayer();
if (block.getState() instanceof CreatureSpawner && stack.hasItemMeta()) {
ItemMeta meta = stack.getItemMeta();
if (meta.hasLore() && meta.hasDisplayName()) {
CreatureSpawner spawner = (CreatureSpawner) block.getState();
List<String> lore = meta.getLore();
if (!lore.isEmpty()) {
String spawnerName = ChatColor.stripColor(lore.get(0).toUpperCase());
Optional<EntityType> entityTypeOptional = GuavaCompat.getIfPresent(EntityType.class, spawnerName);
if (entityTypeOptional.isPresent()) {
spawner.setSpawnedType(entityTypeOptional.get());
spawner.update(true, true);
player.sendMessage(ChatColor.AQUA + "Placed a " + ChatColor.BLUE + spawnerName + ChatColor.AQUA + " spawner.");
}
}
}
}
}
示例7: BlockPlaceEvent
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void BlockPlaceEvent(BlockPlaceEvent e){
Player p = e.getPlayer();
Block b = e.getBlock();
if (e.getItemInHand().getType() == Material.DROPPER && e.getItemInHand().getEnchantments() != null && e.getItemInHand().getEnchantments().containsKey(Enchantment.ARROW_DAMAGE)) {
Casino c = new Casino(e.getBlockPlaced().getLocation());
c.effect();
}
for(Entity en : p.getNearbyEntities (4D, 4D, 4D)){
if (en instanceof Player){
if(en == p) continue;
if(b.getType() == Material.FIRE){
if(Files.user.getBoolean("Users." + en.getName() + ".pvp") == false){
p.sendMessage(Utils.colorize(PAData.SURVIVAL.getPrefix() + ChatColor.DARK_RED + " No puedes poner ese bloque cerca de un jugador con el pvp desactivado."));
e.setCancelled(true);
}
}
}
}
}
示例8: onBlockPlace
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
Player player = event.getPlayer();
Block b = event.getBlock();
b.setMetadata("blockBreaker", new FixedMetadataValue(PrisonPicks.getInstance(), player.getUniqueId()));
}
示例9: onBlockPlace
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent e) {
Player player = e.getPlayer();
if (!player.hasPermission("superiorcraft.editworld")) {
e.setCancelled(true);
player.sendMessage(ChatColor.RED + "You may not place blocks here");
}
}
示例10: onBlockPlaced
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPlaced(BlockPlaceEvent e) {
Player player = e.getPlayer();
GamePlayer gPlayer = SkyWarsReloaded.getPC().getPlayer(player.getUniqueId());
if (gPlayer.inGame()) {
gPlayer.setBlocks(gPlayer.getBlocks() + 1);
}
}
示例11: onBlockPlaceEvent
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPlaceEvent(BlockPlaceEvent e) {
Player player = e.getPlayer();
if (!hasIgnorePermission(player)) {
if (inLobbyWorld(player) && SkyWarsReloaded.getCfg().playerBuildDisabled()) {
e.setCancelled(true);
}
}
}
示例12: onPlaceWithItemVisibility
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.HIGHEST)
public void onPlaceWithItemVisibility(BlockPlaceEvent e) {
Player p = e.getPlayer();
if (ConfigGPlayerVisibility.getConfig().getBoolean("PV.Enable")) {
if (ConfigGPlayerVisibility.getConfig().getBoolean("PV.Option.Ultimate-Protection-Of-The-Items")) {
if ((p.getItemInHand().getItemMeta().getDisplayName() == Check) || (p.getItemInHand().getItemMeta().getDisplayName() == CheckTwo)) {
e.setCancelled(true);
}
}
}
}
示例13: onPlacePistion
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlacePistion(final BlockPlaceEvent e) {
if (!cm.tileLimitEnabled) {
return;
}
Player p = e.getPlayer();
if (p.isOp()) {
return;
}
Material type = e.getBlock().getType();
Material checkType = null;
if (type == Material.PISTON_BASE) {
checkType = Material.PISTON_BASE;
} else if (type == Material.PISTON_STICKY_BASE) {
checkType = Material.PISTON_STICKY_BASE;
}
if (checkType != null) {
int limit = NeverLagUtils.getMaxPermission(p, "neverlag.limit.piston.");
if (limit <= 0) {
limit = cm.tileLimitDefaultPiston;
}
if (isLimit(e.getBlock().getLocation(), Material.DISPENSER, limit)) {
e.setCancelled(true);
p.sendMessage(i18n.tr("message", limit));
}
}
}
示例14: onBlockPlace
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent e) {
final Player player = e.getPlayer();
if(player != null) {
DACManager.getBackend().checkFastPlace(player);
}
}
示例15: onPlace
import org.bukkit.event.block.BlockPlaceEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlace(BlockPlaceEvent event)
{
Player player = event.getPlayer();
Material block = event.getBlock().getType();
if ((modMode.contains(player.getName())) &&
(block == Material.CARPET)) {
event.setCancelled(true);
player.updateInventory();
}
}