perf: 重写部分代码
This commit is contained in:
@@ -3,7 +3,6 @@ package cn.hamster3.mc.plugin.core.bukkit.util;
|
||||
import cn.hamster3.mc.plugin.core.bukkit.listener.CallbackListener;
|
||||
import cn.hamster3.mc.plugin.core.common.data.DisplayMessage;
|
||||
import com.comphenix.protocol.utility.StreamSerializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@@ -281,13 +280,12 @@ public final class CoreBukkitUtils {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PotionEffect deserializePotionEffect(@NotNull JsonElement element) {
|
||||
JsonObject effectObject = element.getAsJsonObject();
|
||||
public static PotionEffect deserializePotionEffect(@NotNull JsonObject object) {
|
||||
//noinspection ConstantConditions
|
||||
return new PotionEffect(
|
||||
PotionEffectType.getByName(effectObject.get("type").getAsString()),
|
||||
effectObject.get("duration").getAsInt(),
|
||||
effectObject.get("amplifier").getAsInt()
|
||||
PotionEffectType.getByName(object.get("type").getAsString()),
|
||||
object.get("duration").getAsInt(),
|
||||
object.get("amplifier").getAsInt()
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,7 @@ public final class PotionEffectAdapter implements JsonSerializer<PotionEffect>,
|
||||
if (json.isJsonNull()) {
|
||||
return null;
|
||||
}
|
||||
return CoreBukkitUtils.deserializePotionEffect(json);
|
||||
return CoreBukkitUtils.deserializePotionEffect(json.getAsJsonObject());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user