当前位置: 首页>>代码示例>>Java>>正文


Java PlayerEditBookEvent类代码示例

本文整理汇总了Java中org.bukkit.event.player.PlayerEditBookEvent的典型用法代码示例。如果您正苦于以下问题:Java PlayerEditBookEvent类的具体用法?Java PlayerEditBookEvent怎么用?Java PlayerEditBookEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PlayerEditBookEvent类属于org.bukkit.event.player包,在下文中一共展示了PlayerEditBookEvent类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBookEdit

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@EventHandler
public void onBookEdit(PlayerEditBookEvent event) {
    ItemWrapper item = ItemManager.constructItem(event.getPlayer().getInventory().getItem(event.getSlot()));
    if (item == null || !(item instanceof ItemInputBook))
        return;

    ItemInputBook book = (ItemInputBook) item;
    event.setCancelled(true);
    event.getPlayer().getInventory().setItem(event.getSlot(), null); // Remove book from inventory.
    book.setMeta(event.getNewBookMeta()); // Update meta.
    book.onUpdate(event.getPlayer());
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:13,代码来源:ItemInputBook.java

示例2: onPlayerEditBook

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerEditBook(PlayerEditBookEvent evt) {
	if (!usingBeeLoginMod)
		return;
	Player player = evt.getPlayer();
	if (!loginStatus.get(player.getName().toLowerCase())) {
		evt.setCancelled(true);
	}
}
 
开发者ID:lj2000lj,项目名称:BeeLogin,代码行数:10,代码来源:EventCanceler.java

示例3: onBookEdit

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@EventHandler
public void onBookEdit(PlayerEditBookEvent e) {
    if (this.playerManager.isFrozen(e.getPlayer()) && !this.plugin.getConfig().getBoolean("book-editing")) {
        e.setCancelled(true);
        for (String msg : this.plugin.getConfig().getStringList("book-edit-message")) {
            e.getPlayer().sendMessage(this.plugin.placeholders(msg));
        }
    }
}
 
开发者ID:7rory768,项目名称:SimpleFreeze,代码行数:10,代码来源:PlayerEditBookListener.java

示例4: onEditBook

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@EventHandler
public void onEditBook(PlayerEditBookEvent event) {
    if (event.isSigning()) {
        ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
        book.setItemMeta(event.getNewBookMeta());
        check(event.getPlayer(), book);
    }
}
 
开发者ID:RocooTheRocoo,项目名称:Magix-Plugin,代码行数:9,代码来源:CommandHandler.java

示例5: handle

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@EventHandler
public void handle(PlayerEditBookEvent event) {
  Player player = event.getPlayer();
  User user = User.byUuid(player.getUniqueId());
  if (user == null) {return;}
  String contents = Joiner.on("\n\n").join(event.getNewBookMeta().getPages());
  if (user.submitResult(contents)) {
    plugin.sendPlayerMessage(player, "Submitted book contents.");
  }
}
 
开发者ID:instructure,项目名称:BukkitLTI,代码行数:11,代码来源:BukkitLTIListener.java

示例6: onSignBook

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@EventHandler
public void onSignBook(PlayerEditBookEvent event)
{
    BytecraftPlayer player = plugin.getPlayer(event.getPlayer());
    if(event.isSigning()){
        BookMeta meta = event.getNewBookMeta();
        meta.setAuthor(player.getNameColor() + player.getName());
        event.setNewBookMeta(meta);
    }
}
 
开发者ID:sabersamus,项目名称:Bytecraft,代码行数:11,代码来源:BookShelfListener.java

示例7: onPlayerEditBook

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerEditBook(PlayerEditBookEvent event) {
    if (event.isSigning()) {
        BookMeta meta = event.getNewBookMeta();
        meta.setAuthor(plugin.getActiveCharacter(event.getPlayer()).getName());
        event.setNewBookMeta(meta);
    }
}
 
开发者ID:WaywardRealms,项目名称:Wayward,代码行数:9,代码来源:PlayerEditBookListener.java

示例8: createBook

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@EventHandler
public void createBook(PlayerEditBookEvent e) {
	if(!e.isSigning()) {
		if(!e.getPreviousBookMeta().hasAuthor()) {
			BookMeta meta = e.getNewBookMeta();
			meta.setAuthor(e.getPlayer().getName());
			e.setNewBookMeta(meta);
			e.setSigning(true);
			sendMessage(e.getPlayer(), ChatColor.GREEN + "book automatic signed, by anti addvertise system!");
		}
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:13,代码来源:AntiAddvertiseEvent.java

示例9: onEditBook

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onEditBook(PlayerEditBookEvent bookEdit) {
    Check check = new Check(plugin, bookEdit.getPlayer());
    for (String page : bookEdit.getNewBookMeta().getPages()) {
        if (check.check(page, 4, true)) {
            bookEdit.setCancelled(true);
            break;
        }
    }
}
 
开发者ID:antiAD,项目名称:AntiAd,代码行数:11,代码来源:ADListener.java

示例10: onBookEdit

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBookEdit(PlayerEditBookEvent evt) {
    if (!noCheatBook) return;
    
    BookMeta prev = evt.getPreviousBookMeta();
    BookMeta meta = evt.getNewBookMeta();
    if (prev.equals(meta)) return;
    
    // Illegally modify lore
    if (prev.hasLore()) {
        if (!meta.hasLore() || !prev.getLore().equals(meta.getLore())) {
            meta.setLore(prev.getLore());
        }
    } else if (meta.hasLore()) {
        meta.setLore(null);
    }
    
    // Illegally modify enchants
    if (prev.hasEnchants()) {
        if (!meta.hasEnchants()) {
            addEnchantFrom(prev, meta);
        } else if (!prev.getLore().equals(meta.getLore())) {
            clearEnchant(meta);
            addEnchantFrom(prev, meta);
        }
    } else if (meta.hasEnchants()) {
        clearEnchant(meta);
    }
    
    // They cannot change title by edit it!
    String title = prev.getTitle();
    if (!title.equals(meta.getTitle())) {
        meta.setTitle(title);
    }
    
    // Book and quill doesn't has a generation!
    if (meta.getGeneration() != null) meta.setGeneration(null);
    
    // Book and quill doesn't has an author!
    if (meta.getAuthor() != null) meta.setAuthor(null);
    
    evt.setNewBookMeta(meta);
    
    AzureAPI.log(evt.getPlayer(), messageCheatBook);
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:46,代码来源:CheatBookBlocker.java

示例11: onPlayerRuinJournal

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerRuinJournal(PlayerEditBookEvent e) {
	if (!getPlayer().isOnline()) {
		return;
	}
	
	if (!e.getPlayer().equals(getPlayer().getPlayer())) {
		return;
	}
	
	BookMeta oldMeta = e.getPreviousBookMeta(),
			newMeta = e.getNewBookMeta();
	
	if (oldMeta.hasTitle() && oldMeta.getTitle().equals("Journal")
		&& oldMeta.hasAuthor() && oldMeta.getAuthor().equals(e.getPlayer().getName())
		&& oldMeta.getEnchantLevel(Enchantment.LUCK) == 5) {
		//grab the player notes
		int pageNum;
		String page;
		for (pageNum = 1; pageNum <= newMeta.getPageCount(); pageNum++) {
			page = newMeta.getPage(pageNum);
			if (page.contains("  Player Notes")) {
				break;
			}
		}
		pageNum++;
		this.journalNotes.clear();
		if (pageNum > newMeta.getPageCount()) {
			//we went beyond what we have
		} else {
			//save their notes
			for (; pageNum <= newMeta.getPageCount(); pageNum++) {
				journalNotes.add(newMeta.getPage(pageNum));
			}
		}
		
		e.setCancelled(true);
		QuestJournal.updateQuestJournal(this, true);
		
	}
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:42,代码来源:QuestPlayer.java

示例12: onPlayerEditBook

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerEditBook(final PlayerEditBookEvent event) {
    if (this.loggedOutPlayers.containsKey(event.getPlayer().getUniqueId())) {
        event.setCancelled(true);
    }
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:7,代码来源:LoggedOutUserHandler.java

示例13: onPlayerEditBook

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerEditBook(PlayerEditBookEvent event) {
    if (listenerService.shouldCancelEvent(event)) {
        event.setCancelled(true);
    }
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:7,代码来源:PlayerListener16.java

示例14: shouldCancelEvent

import org.bukkit.event.player.PlayerEditBookEvent; //导入依赖的package包/类
@Test
public void shouldCancelEvent() {
    withServiceMock(listenerService)
        .check(listener::onPlayerEditBook, PlayerEditBookEvent.class);
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:6,代码来源:PlayerListener16Test.java


注:本文中的org.bukkit.event.player.PlayerEditBookEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。