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


Java PlayerEditBookEvent.setNewBookMeta方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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


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