當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。