feat: revert either impl
This commit is contained in:
parent
6314fe81b6
commit
a1a0b04471
9 changed files with 47 additions and 63 deletions
|
@ -3,10 +3,8 @@ package net.artelnatif.nicko.impl;
|
|||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
import io.vavr.control.Either;
|
||||
import net.artelnatif.nicko.NickoBukkit;
|
||||
import net.artelnatif.nicko.disguise.NickoProfile;
|
||||
import net.artelnatif.nicko.i18n.I18NDict;
|
||||
import net.artelnatif.nicko.mojang.MojangSkin;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.network.chat.IChatBaseComponent;
|
||||
|
@ -84,7 +82,7 @@ public class v1_18_R2 implements Internals {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Either<String, Void> updateProfile(Player player, NickoProfile profile, boolean skinChange) {
|
||||
public void updateProfile(Player player, NickoProfile profile, boolean skinChange) {
|
||||
final CraftPlayer craftPlayer = (CraftPlayer) player;
|
||||
final EntityPlayer entityPlayer = craftPlayer.getHandle();
|
||||
Optional<MojangSkin> skin;
|
||||
|
@ -104,17 +102,14 @@ public class v1_18_R2 implements Internals {
|
|||
final PropertyMap properties = gameProfile.getProperties();
|
||||
properties.put("textures", new Property("textures", skin.get().value(), skin.get().signature()));
|
||||
updateSelf(player);
|
||||
return Either.right(null);
|
||||
} else {
|
||||
return Either.left(I18NDict.Error.SKIN_FAIL_MOJANG.getKey());
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return Either.left(I18NDict.Error.NAME_FAIL_MOJANG.getKey());
|
||||
return;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
return Either.left(I18NDict.Error.UNEXPECTED_ERROR.getKey());
|
||||
} catch (ExecutionException e) {
|
||||
return Either.left(I18NDict.Error.SKIN_FAIL_CACHE.getKey());
|
||||
} catch (IOException | ExecutionException e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,6 +125,5 @@ public class v1_18_R2 implements Internals {
|
|||
onlineEntityPlayer.b.a(add);
|
||||
});
|
||||
updateOthers(player);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue