PlayerCommonAssets class
Пакет: com.hypixel.hytale.server.core.asset.common
Файл: com/hypixel/hytale/server/core/asset/common/PlayerCommonAssets.java
Поля (3)
| Модификаторы | Тип | Имя |
|---|---|---|
|
Set |
var2 |
|
Iterator |
var7 |
|
String |
var8 |
Методы (5)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
throw new |
RuntimeExceptionthrow new RuntimeException("Still had hashes: " + var2) |
|
|
for for(Asset var5 : var1) |
|
|
for for(Asset var6 : var1) |
|
|
if if(var1 != null) |
public |
void |
sentvoid sent(@Nullable Asset[] var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.common;
class="kw">import com.hypixel.hytale.protocol.Asset;
class="kw">import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
class="kw">import java.util.HashSet;
class="kw">import java.util.Iterator;
class="kw">import java.util.Map;
class="kw">import java.util.Set;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class PlayerCommonAssets {
@Nonnull
class="kw">private class="kw">final Map<String, String> assetMissing = new Object2ObjectOpenHashMap();
@Nonnull
class="kw">private class="kw">final Map<String, String> assetSent;
class="kw">public PlayerCommonAssets(@Nonnull Asset[] var1) {
for (Asset var5 : var1) {
this.assetMissing.put(var5.hash, var5.name);
}
this.assetSent = new Object2ObjectOpenHashMap();
}
class="kw">public void sent(@Nullable Asset[] var1) {
Set var2 = new HashSet<>();
if (var1 != null) {
for (Asset var6 : var1) {
var2.add(var6.hash);
}
}
Iterator var7 = this.assetMissing.keySet().iterator();
while (var7.hasNext()) {
String var8 = var7.next();
if (var2.contains(var8)) {
var7.remove();
var2.remove(var8);
}
}
if (!var2.isEmpty()) {
throw new RuntimeException("Still had hashes: " + var2);
}
this.assetSent.putAll(this.assetMissing);
this.assetMissing.clear();
}
}