本文整理匯總了Java中java.util.UUID.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java UUID.equals方法的具體用法?Java UUID.equals怎麽用?Java UUID.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.UUID
的用法示例。
在下文中一共展示了UUID.equals方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getRouteGuid
import java.util.UUID; //導入方法依賴的package包/類
private UUID getRouteGuid(String host, UUID domainGuid) {
Map<String, Object> urlVars = new HashMap<String, Object>();
String urlPath = "/v2";
urlPath = urlPath + "/routes?inline-relations-depth=0&q=host:{host}";
urlVars.put("host", host);
List<Map<String, Object>> allRoutes = getAllResources(urlPath, urlVars);
UUID routeGuid = null;
for (Map<String, Object> route : allRoutes) {
UUID routeSpace = CloudEntityResourceMapper.getEntityAttribute(route, "space_guid", UUID.class);
UUID routeDomain = CloudEntityResourceMapper.getEntityAttribute(route, "domain_guid", UUID.class);
if (sessionSpace.getMeta().getGuid().equals(routeSpace) && domainGuid.equals(routeDomain)) {
routeGuid = CloudEntityResourceMapper.getMeta(route).getGuid();
}
}
return routeGuid;
}
示例2: isTxAvailableToCommitOnOwnNode
import java.util.UUID; //導入方法依賴的package包/類
private boolean isTxAvailableToCommitOnOwnNode(TxInfo txInfo, Lazy<UUID, Set<Object>> availableTxsPerNode) {
Set<Object> sameNodeScope = availableTxsPerNode.get(txInfo.consumerId());
if (sameNodeScope.containsAll(txInfo.scope())) {
return true;
}
for (Map.Entry<UUID, Set<Object>> entry : availableTxsPerNode) {
UUID nodeId = entry.getKey();
Set<Object> nodeScope = entry.getValue();
if (!nodeId.equals(txInfo.consumerId()) && !Collections.disjoint(nodeScope, txInfo.scope())) {
return false;
}
}
return true;
}
示例3: syncPlayer
import java.util.UUID; //導入方法依賴的package包/類
private static void syncPlayer(MyPetPlayer mpPlayer) {
Slot petSlot = getMyPetSlot();
if (mpPlayer.isOnline() && mpPlayer.hasMyPet()) {
Player player = mpPlayer.getPlayer();
if (!InventoryManager.playerIsLoaded(player)) {
return;
}
Inventory inventory = InventoryManager.get(player).getInventory();
ItemStack currentPet = inventory.getItem(petSlot.getSlotId());
if (isMyPetItem(currentPet)) {
MyPet pet = mpPlayer.getMyPet();
UUID petUUID = UUID.fromString(ItemUtils.getTag(currentPet, MYPET_TAG));
if (petUUID.equals(pet.getUUID())) {
return;
}
} else {
inventory.setItem(petSlot.getSlotId(), petSlot.getCup());
}
MyPetApi.getMyPetManager().deactivateMyPet(mpPlayer, false);
}
}
示例4: onMyPetRemove
import java.util.UUID; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true)
public void onMyPetRemove(MyPetRemoveEvent event) {
Player player = event.getOwner().getPlayer();
if (!InventoryManager.playerIsLoaded(player)) {
return;
}
Inventory inventory = InventoryManager.get(player).getInventory();
Slot petSlot = getMyPetSlot();
ItemStack currentPetItem = inventory.getItem(petSlot.getSlotId());
if (isMyPetItem(currentPetItem)) {
UUID petUUID = UUID.fromString(ItemUtils.getTag(currentPetItem, MYPET_TAG));
if (petUUID.equals(event.getMyPet().getUUID())) {
inventory.setItem(petSlot.getSlotId(), petSlot.getCup());
}
}
}
示例5: event
import java.util.UUID; //導入方法依賴的package包/類
@Override
public void event(MT type, Object o)
{
switch (type)
{
case CHALLENGE_CHANGED:
case ENTRANT_CHANGED:
UUID challengeid = ChallengeGUI.state.getCurrentChallengeId();
Collection<UUID> exclude;
Collection<Entrant> reg;
if (!challengeid.equals(IdGenerator.nullid))
{
reg = Database.d.getEntrantsByEvent(ChallengeGUI.state.getCurrentEventId());
exclude = Database.d.getCarIdsByChallenge(challengeid);
}
else
{
reg = new Vector<Entrant>();
exclude = new Vector<UUID>();
}
makeTree(reg, exclude);
break;
}
}
示例6: onMyPetCall
import java.util.UUID; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true)
public void onMyPetCall(MyPetCallEvent event) {
Player player = event.getOwner().getPlayer();
if (!InventoryManager.playerIsLoaded(player)) {
return;
}
Inventory inventory = InventoryManager.get(player).getInventory();
ItemStack currentPet = inventory.getItem(getMyPetSlot().getSlotId());
boolean keepPet = true;
if (!isMyPetItem(currentPet)) {
keepPet = false;
} else {
UUID petUUID = UUID.fromString(ItemUtils.getTag(currentPet, MYPET_TAG));
if (!petUUID.equals(event.getMyPet().getUUID())) {
keepPet = false;
}
}
if (!keepPet) {
event.setCancelled(true);
MyPetApi.getMyPetManager().deactivateMyPet(event.getOwner(), true);
}
}
示例7: showTitle
import java.util.UUID; //導入方法依賴的package包/類
private void showTitle(Player player, Chunk newChunk) {
UUID newOwner = ClaimChunk.getInstance().getChunkHandler().getOwner(newChunk.getWorld(), newChunk.getX(), newChunk.getZ());
if (!newOwner.equals(player.getUniqueId())) {
PlayerHandler nh = ClaimChunk.getInstance().getPlayerHandler();
String newName = (nh.hasChunkName(newOwner)) ? nh.getChunkName(newOwner) : nh.getUsername(newOwner);
if (newName != null) {
String text = Utils.getMsg("chunkOwner").replaceAll(Pattern.quote("%%PLAYER%%"), newName);
Utils.toPlayer(player, Config.getColor("infoColor"), text);
}
} else {
Utils.toPlayer(player, Config.getColor("infoColor"), Utils.getMsg("chunkSelf"));
}
}
示例8: serialOf
import java.util.UUID; //導入方法依賴的package包/類
@Override
public OptionalLong serialOf(UUID l) {
// hilariously inefficient
for (Map.Entry<Long, Fact> e : store.entrySet()) {
if (l.equals(e.getValue().id())) {
return OptionalLong.of(e.getKey().longValue());
}
}
return OptionalLong.empty();
}
示例9: pickupItemEvent
import java.util.UUID; //導入方法依賴的package包/類
@EventHandler
public void pickupItemEvent(PlayerPickupItemEvent event) {
UUID iuuid = event.getItem().getUniqueId();
if (itemMapTime.containsKey(iuuid)) {
if (System.currentTimeMillis() - itemMapTime.get(iuuid) < 10000) {
UUID owneruuid = itemMapOwner.get(iuuid);
Player owner = plugin.getServer().getPlayer(owneruuid);
PlayerDataRPG pdo = plugin.getPD(owner);
PlayerDataRPG pd = plugin.getPD(event.getPlayer());
if (owneruuid == null || owneruuid.equals(event.getPlayer().getUniqueId()) || (pdo != null && pd != null && pd.party != null && pd.party != pdo.party && pd.party.isLootshareActive())) {
itemMapTime.remove(iuuid);
itemMapOwner.remove(iuuid);
return; // all good
} else {
event.setCancelled(true);
if (plugin.getPD(event.getPlayer()) != null && plugin.getPD(event.getPlayer()).getOption(SakiOption.ITEM_PROTECT)) {
if (playerMapMessaged.containsKey(event.getPlayer().getUniqueId()) && System.currentTimeMillis() - playerMapMessaged.get(event.getPlayer().getUniqueId()) < 5000) {
// dont spam msg
} else {
event.getPlayer().sendMessage(ChatColor.RED + " You can't pick up this item yet because of item protection!");
event.getPlayer().sendMessage(ChatColor.RED + " Monster drops are only lootable by the highest damage dealer for 10 seconds.");
event.getPlayer().sendMessage(ChatColor.RED + " Skill-related items are only lootable by the creator of the item for 10 seconds.");
playerMapMessaged.put(event.getPlayer().getUniqueId(), System.currentTimeMillis());
}
}
}
} else {
itemMapTime.remove(iuuid);
itemMapOwner.remove(iuuid);
}
}
}
示例10: getById
import java.util.UUID; //導入方法依賴的package包/類
@Override
public NemesisEntry getById(UUID id) {
if (id == null) {
return null;
}
for (NemesisEntry nemesis : nemeses) {
if (id.equals(nemesis.getId())) {
return nemesis;
}
}
return null;
}
示例11: knowsCharacteristic
import java.util.UUID; //導入方法依賴的package包/類
@Override
public boolean knowsCharacteristic(BluetoothGattCharacteristic characteristic) {
for (UUID uuid : getKnownCharacteristics()) {
if (uuid.equals(characteristic.getUuid()))
return true;
}
return false;
}
示例12: findWritableCharacteristic
import java.util.UUID; //導入方法依賴的package包/類
private BluetoothGattCharacteristic findWritableCharacteristic(BluetoothGattService service, UUID characteristicUUID, int writeType) {
try {
BluetoothGattCharacteristic characteristic = null;
// get write property
int writeProperty = BluetoothGattCharacteristic.PROPERTY_WRITE;
if (writeType == BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE) {
writeProperty = BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE;
}
List<BluetoothGattCharacteristic> characteristics = service.getCharacteristics();
for (BluetoothGattCharacteristic c : characteristics) {
if ((c.getProperties() & writeProperty) != 0 && characteristicUUID.equals(c.getUuid())) {
characteristic = c;
break;
}
}
// As a last resort, try and find ANY characteristic with this UUID, even if it doesn't have the correct properties
if (characteristic == null) {
characteristic = service.getCharacteristic(characteristicUUID);
}
return characteristic;
}catch (Exception e) {
Log.e(LOG_TAG, "Error on findWritableCharacteristic", e);
return null;
}
}
示例13: setOwner
import java.util.UUID; //導入方法依賴的package包/類
public boolean setOwner(UUID owner) {
if ((this.owner != null && !this.owner.equals(owner)) || (owner != null && !owner.equals(this.owner))) {
this.owner = owner;
if (worldObj != null && !worldObj.isRemote)
markDirty();
}
return true;
}
示例14: parseSchemeSpecificData
import java.util.UUID; //導入方法依賴的package包/類
/**
* Parses the scheme specific data from a PSSH atom. Version 0 and 1 PSSH atoms are supported.
* <p>
* The scheme specific data is only parsed if the data is a valid PSSH atom matching the given
* UUID, or if the data is a valid PSSH atom of any type in the case that the passed UUID is null.
*
* @param atom The atom to parse.
* @param uuid The required UUID of the PSSH atom, or null to accept any UUID.
* @return The parsed scheme specific data. Null if the input is not a valid PSSH atom, or if the
* PSSH atom has an unsupported version, or if the PSSH atom does not match the passed UUID.
*/
public static byte[] parseSchemeSpecificData(byte[] atom, UUID uuid) {
Pair<UUID, byte[]> parsedAtom = parsePsshAtom(atom);
if (parsedAtom == null) {
return null;
}
if (uuid != null && !uuid.equals(parsedAtom.first)) {
Log.w(TAG, "UUID mismatch. Expected: " + uuid + ", got: " + parsedAtom.first + ".");
return null;
}
return parsedAtom.second;
}
示例15: getNonPrivilegedMembers
import java.util.UUID; //導入方法依賴的package包/類
/**
* @return
* a Set of all members that are not mod or admin as OfflinePlayers
*/
public Collection<OfflinePlayer> getNonPrivilegedMembers() {
HashSet<OfflinePlayer> players = new HashSet<>();
for (UUID member : members.getUniqueIds()) {
if (!mods.contains(member) && !member.equals(admin)) {
players.add(Bukkit.getOfflinePlayer(member));
}
}
return players;
}