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


Java Player.getUniqueId方法代码示例

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


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

示例1: onPlayerJoin

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
@Listener
public void onPlayerJoin(ClientConnectionEvent.Join event, @Root Player player) {
    if (!player.hasPermission("iplog.bypasslogging")) {
        final Storage storage = IPLog.getPlugin().getStorage();

        final InetAddress ip = player.getConnection().getAddress().getAddress();
        final UUID uuid = player.getUniqueId();
        final LocalDateTime time = LocalDateTime.now();

        if (storage.isPresent(ip, uuid)) {
            storage.updateConnection(ip, uuid, time);
        } else {
            storage.addConnection(ip, uuid, time);
        }
    }
}
 
开发者ID:ichorpowered,项目名称:iplog,代码行数:17,代码来源:JoinListener.java

示例2: createInventory

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
public Inventory createInventory(Player player)
{
    UUID uuid = player.getUniqueId();
    if (!inventories.containsKey(uuid))
    {
        VirtualChestEventListener listener = new VirtualChestEventListener(player);
        Inventory chestInventory = Inventory.builder().of(InventoryArchetypes.CHEST).withCarrier(player)
                .property(InventoryTitle.PROPERTY_NAME, new InventoryTitle(this.title))
                .property(InventoryDimension.PROPERTY_NAME, new InventoryDimension(9, this.height))
                .listener(ClickInventoryEvent.class, listener::fireClickEvent)
                .listener(InteractInventoryEvent.Open.class, listener::fireOpenEvent)
                .listener(InteractInventoryEvent.Close.class, listener::fireCloseEvent)
                .build(this.plugin);
        inventories.put(uuid, chestInventory);
        return chestInventory;
    }
    return inventories.get(uuid);
}
 
开发者ID:ustc-zzzz,项目名称:VirtualChest,代码行数:19,代码来源:VirtualChestInventory.java

示例3: LoadedRegion

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
public LoadedRegion(Region region, Player owner, ChunkType type) {
	this.epoch = Date.from(Instant.now());
	this.owner = owner.getUniqueId();
	this.id = UUID.randomUUID();
	this.region = region;
	this.type = type;
}
 
开发者ID:DevOnTheRocks,项目名称:StickyChunk,代码行数:8,代码来源:LoadedRegion.java

示例4: onPlayerJoin

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
@Listener
public void onPlayerJoin(ClientConnectionEvent.Join event)
		throws IOException, ClassNotFoundException, DataFormatException {
	@NonNull
	Player player = event.getTargetEntity();
	UUID uuid = player.getUniqueId();

	synchronized (waitingPlayers) {
		Task task = Task.builder()
				.execute(new WaitingForPreviousServerToFinish(player, Config.Values.Global.getMaxWait()))
				.intervalTicks(1).submit(InventorySync.getInstance());

		waitingPlayers.put(uuid, task);
	}
}
 
开发者ID:AuraDevelopmentTeam,项目名称:InvSync,代码行数:16,代码来源:PlayerEvents.java

示例5: onPlayerLeave

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
@Listener
public void onPlayerLeave(ClientConnectionEvent.Disconnect event) throws IOException {
	@NonNull
	Player player = event.getTargetEntity();
	UUID uuid = player.getUniqueId();

	savePlayer(player);

	synchronized (waitingPlayers) {
		if (waitingPlayers.containsKey(uuid)) {
			waitingPlayers.remove(uuid).cancel();
		}
	}
}
 
开发者ID:AuraDevelopmentTeam,项目名称:InvSync,代码行数:15,代码来源:PlayerEvents.java

示例6: getCommandSender

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
private CommandSender getCommandSender(CommandSource commandSource) {

        if (commandSource instanceof Player) {
            Player player = (Player) commandSource;

            UUID uuid = player.getUniqueId();
            ClanPlayerImpl clanPlayer = ClansImpl.getInstance().getClanPlayer(uuid);
            if (clanPlayer == null) {
                clanPlayer = ClansImpl.getInstance().createClanPlayer(uuid, player.getName());
            }

            return clanPlayer;
        }
        return null;
    }
 
开发者ID:iLefty,项目名称:mcClans,代码行数:16,代码来源:CommandManager.java

示例7: onBlockPlace

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
@Listener(order = Order.POST)
public void onBlockPlace(ChangeBlockEvent.Place e, @Root Player p) {
	long time = new Date().getTime();
	for (Transaction<BlockSnapshot> transaction : e.getTransactions()) {
		UUID id = p.getUniqueId();
		if (transaction.getOriginal().getState().getType() != BlockTypes.AIR) {
			db.addToQueue(new BlockQueueEntry(transaction.getOriginal(), ActionType.DESTROY, id.toString(), time));
		}
		db.addToQueue(new BlockQueueEntry(transaction.getFinal(), ActionType.PLACE, id.toString(), time));
	}
}
 
开发者ID:Karanum,项目名称:AdamantineShield,代码行数:12,代码来源:PlayerBlockChangeListener.java

示例8: VirtualChestEventListener

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
private VirtualChestEventListener(Player player)
{
    this.itemsInSlots = new TreeMap<>();
    this.parsedOpenAction = VirtualChestActionDispatcher.parseCommand(openActionCommand.orElse(""));
    this.parsedCloseAction = VirtualChestActionDispatcher.parseCommand(closeActionCommand.orElse(""));
    this.slotToListen = SlotIndex.lessThan(height * 9);
    this.playerUniqueId = player.getUniqueId();
}
 
开发者ID:ustc-zzzz,项目名称:VirtualChest,代码行数:9,代码来源:VirtualChestInventory.java

示例9: getUUID

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
@Override
protected UUID getUUID(Player player) {
    return player.getUniqueId();
}
 
开发者ID:games647,项目名称:Minefana,代码行数:5,代码来源:SpongePlayerCollector.java

示例10: PlayerWrapper

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
PlayerWrapper(Player player) {
    this.playerReference = new WeakReference<>(player);
    this.playerId = player.getUniqueId();
}
 
开发者ID:gabizou,项目名称:HappyTrails,代码行数:5,代码来源:PlayerWrapper.java

示例11: getSVPlayerData

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
private SVPlayerData getSVPlayerData(Player player) {
    UUID uuid = player.getUniqueId();
    uuidsvPlayerDataMap.putIfAbsent(uuid, new SVPlayerData());
    return uuidsvPlayerDataMap.get(uuid);
}
 
开发者ID:Icohedron,项目名称:SleepVote,代码行数:6,代码来源:SleepVoteManager.java

示例12: getAccountByPlayer

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
private UniqueAccount getAccountByPlayer(Player player)
{
    UUID uniqueId = player.getUniqueId();
    String message = "Unsupported account for uuid: " + uniqueId.toString();
    return economyService.getOrCreateAccount(uniqueId).orElseThrow(() -> new IllegalArgumentException(message));
}
 
开发者ID:ustc-zzzz,项目名称:VirtualChest,代码行数:7,代码来源:VirtualChestEconomyManager.java


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