本文整理汇总了Java中org.bukkit.metadata.LazyMetadataValue类的典型用法代码示例。如果您正苦于以下问题:Java LazyMetadataValue类的具体用法?Java LazyMetadataValue怎么用?Java LazyMetadataValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LazyMetadataValue类属于org.bukkit.metadata包,在下文中一共展示了LazyMetadataValue类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: global
import org.bukkit.metadata.LazyMetadataValue; //导入依赖的package包/类
@Command(aliases = {"g", "global", "shout"}, desc = "Talk in global chat.", usage = "<message>")
@CommandPermissions("cardinal.chat.global")
public static void global(final CommandContext cmd, CommandSender sender) throws CommandException {
String locale = ChatUtils.getLocale(sender);
if (sender instanceof Player) {
if (cmd.argsLength() == 0) {
((Player) sender).setMetadata("default-channel", new LazyMetadataValue(GameHandler.getGameHandler().getPlugin(), LazyMetadataValue.CacheStrategy.NEVER_CACHE, new Channel(ChatUtils.ChannelType.GLOBAL)));
sender.sendMessage(ChatColor.YELLOW + new LocalizedChatMessage(ChatConstant.UI_DEFAULT_CHANNEL_GLOBAL).getMessage(locale));
}
if (cmd.argsLength() > 0) {
if (GameHandler.getGameHandler().getGlobalMute() && !PermissionModule.isStaff(((Player) sender)))
throw new CommandException(ChatConstant.ERROR_GLOBAL_MUTE_ENABLED.asMessage().getMessage(ChatUtils.getLocale(sender)));
String message = assembleMessage(cmd);
if (message.trim().equals("")) return;
ChatUtils.getGlobalChannel().sendMessage("<" + TeamUtils.getTeamColorByPlayer((Player) sender) + ((Player) sender).getDisplayName() + ChatColor.RESET + ">: " + message);
}
} else throw new CommandException("Console cannot use this command.");
}
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:19,代码来源:ChatCommands.java
示例2: admin
import org.bukkit.metadata.LazyMetadataValue; //导入依赖的package包/类
@Command(aliases = {"a", "admin"}, desc = "Talk in admin chat.", usage = "<message>")
@CommandPermissions("cardinal.chat.admin")
public static void admin(final CommandContext cmd, CommandSender sender) throws CommandException {
String locale = ChatUtils.getLocale(sender);
if (sender instanceof Player) {
if (cmd.argsLength() == 0) {
((Player) sender).setMetadata("default-channel", new LazyMetadataValue(GameHandler.getGameHandler().getPlugin(), LazyMetadataValue.CacheStrategy.NEVER_CACHE, new Channel(ChatUtils.ChannelType.ADMIN)));
sender.sendMessage(ChatColor.YELLOW + new LocalizedChatMessage(ChatConstant.UI_DEFAULT_CHANNEL_ADMIN).getMessage(locale));
}
if (cmd.argsLength() > 0) {
String message = assembleMessage(cmd);
if (message.trim().equals("")) return;
ChatUtils.getAdminChannel().sendMessage("[" + ChatColor.GOLD + "A" + ChatColor.WHITE + "] " + TeamUtils.getTeamColorByPlayer((Player) sender) + ((Player) sender).getDisplayName() + ChatColor.RESET + ": " + message);
Bukkit.getLogger().info("[" + ChatColor.GOLD + "A" + ChatColor.WHITE + "] " + TeamUtils.getTeamColorByPlayer((Player) sender) + ((Player) sender).getDisplayName() + ChatColor.RESET + ": " + message);
}
} else throw new CommandException("Console cannot use this command.");
}
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:18,代码来源:ChatCommands.java
示例3: playerCheck
import org.bukkit.metadata.LazyMetadataValue; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOW,ignoreCancelled = true)
public void playerCheck(PlayerInteractEvent event)
{
if(event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)
{
final Player player = event.getPlayer();
if(KitUtils.itemHasName(player.getItemInHand(), CustomItem.AREAWAND.getName()))
{
event.setCancelled(true);
final Loc loc = new Loc(event.getClickedBlock().getLocation(),false);
Callable<Object> b = new Callable<Object>(){
@Override
public Object call() throws Exception
{
return loc;
}};
if(event.getAction() == Action.LEFT_CLICK_BLOCK)
{
player.setMetadata("A.Loc1", new LazyMetadataValue(AnnihilationMain.getInstance(),b));
player.sendMessage(ChatColor.LIGHT_PURPLE+"Corner "+ChatColor.GOLD+"1 "+ChatColor.LIGHT_PURPLE+"set.");
}
else
{
player.setMetadata("A.Loc2", new LazyMetadataValue(AnnihilationMain.getInstance(),b));
player.sendMessage(ChatColor.LIGHT_PURPLE+"Corner "+ChatColor.GOLD+"2 "+ChatColor.LIGHT_PURPLE+"set.");
}
}
}
}
开发者ID:MrLittleKitty,项目名称:AnnihilationPro,代码行数:31,代码来源:AreaCommand.java
示例4: setPlayerMeta
import org.bukkit.metadata.LazyMetadataValue; //导入依赖的package包/类
private void setPlayerMeta(Player player, String key, final Object meta)
{
Callable<Object> b = new Callable<Object>(){
@Override
public Object call() throws Exception
{
return meta;
}};
player.setMetadata(key, new LazyMetadataValue(AnnihilationMain.getInstance(),b));
}
开发者ID:MrLittleKitty,项目名称:AnnihilationPro,代码行数:11,代码来源:MapBuilder.java
示例5: onPlayerKill
import org.bukkit.metadata.LazyMetadataValue; //导入依赖的package包/类
@EventHandler
public void onPlayerKill(CardinalDeathEvent event) {
if (event.getKiller() != null && event.getKiller().getHealth() > 0) {
int old = event.getKiller().getMetadata("killstreak").get(0).asInt();
event.getKiller().removeMetadata("killstreak", Cardinal.getInstance());
event.getKiller().setMetadata("killstreak", new LazyMetadataValue(Cardinal.getInstance(), LazyMetadataValue.CacheStrategy.NEVER_CACHE, new KillStreak(old + 1)));
}
}
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:9,代码来源:KillStreakCounter.java
示例6: onPgmSpawn
import org.bukkit.metadata.LazyMetadataValue; //导入依赖的package包/类
@EventHandler
public void onPgmSpawn(CardinalSpawnEvent event) {
try {
event.getPlayer().removeMetadata("killstreak", Cardinal.getInstance());
} catch (NullPointerException e) {
}
event.getPlayer().setMetadata("killstreak", new LazyMetadataValue(Cardinal.getInstance(), LazyMetadataValue.CacheStrategy.NEVER_CACHE, new KillStreak(0)));
}
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:9,代码来源:KillStreakCounter.java
示例7: onPlayerDeath
import org.bukkit.metadata.LazyMetadataValue; //导入依赖的package包/类
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
TeamModule team = TeamUtils.getTeamByPlayer(player);
if (team != null && !team.isObserver()) {
int oldMeta = this.getLives(player);
player.removeMetadata("lives", Cardinal.getInstance());
player.setMetadata("lives", new LazyMetadataValue(Cardinal.getInstance(), LazyMetadataValue.CacheStrategy.NEVER_CACHE, new BlitzLives(oldMeta - 1)));
if (this.getLives(player) == 0) {
TeamUtils.getTeamById("observers").add(player, true);
player.removeMetadata("lives", Cardinal.getInstance());
}
}
}
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:15,代码来源:Blitz.java
示例8: onPgmSpawn
import org.bukkit.metadata.LazyMetadataValue; //导入依赖的package包/类
@EventHandler
public void onPgmSpawn(CardinalSpawnEvent event) {
if (event.isCancelled()) return;
try {
event.getPlayer().removeMetadata("killstreak", Cardinal.getInstance());
} catch (NullPointerException e) {
}
event.getPlayer().setMetadata("killstreak", new LazyMetadataValue(Cardinal.getInstance(), LazyMetadataValue.CacheStrategy.NEVER_CACHE, new KillStreak(0)));
}
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:10,代码来源:KillStreakCounter.java
示例9: onPlayerDeath
import org.bukkit.metadata.LazyMetadataValue; //导入依赖的package包/类
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
Optional<TeamModule> team = Teams.getTeamByPlayer(player);
if (team.isPresent() && !team.get().isObserver()) {
int oldMeta = this.getLives(player);
player.removeMetadata("lives", Cardinal.getInstance());
player.setMetadata("lives", new LazyMetadataValue(Cardinal.getInstance(), LazyMetadataValue.CacheStrategy.NEVER_CACHE, new BlitzLives(oldMeta - 1)));
if (this.getLives(player) == 0) {
Teams.getTeamById("observers").get().add(player, true, false);
player.removeMetadata("lives", Cardinal.getInstance());
}
}
}
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:15,代码来源:Blitz.java
示例10: GameLazyMetadata
import org.bukkit.metadata.LazyMetadataValue; //导入依赖的package包/类
public GameLazyMetadata(GameBase game, LazyMetadataValue.CacheStrategy cacheStrategy, Callable<Object> lazyValue) {
super(game.fakePlugin, cacheStrategy, lazyValue);
}
开发者ID:Lactem,项目名称:GameDispenser,代码行数:4,代码来源:GameLazyMetadata.java
示例11: makeValue
import org.bukkit.metadata.LazyMetadataValue; //导入依赖的package包/类
public static MetadataValue makeValue(Object data) {
return new LazyMetadataValue(StoaPlugin.getInst(), new MetaCallable(data));
}
开发者ID:DemigodsRPG,项目名称:Stoa,代码行数:4,代码来源:BukkitMetaUtil.java
示例12: LazyMetadataValue
import org.bukkit.metadata.LazyMetadataValue; //导入依赖的package包/类
public LazyMetadataValue(Plugin owningPlugin, Callable<Object> lazyValue) {
super(owningPlugin);
}
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:LazyMetadataValue.java
注:本文中的org.bukkit.metadata.LazyMetadataValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论