feat: mojangapi throttle support

This commit is contained in:
aro 2022-12-31 12:22:26 +01:00
parent cb34b448de
commit 549c243cb7
11 changed files with 76 additions and 61 deletions

View file

@ -5,7 +5,7 @@ import com.mojang.authlib.properties.Property;
import com.mojang.authlib.properties.PropertyMap;
import net.artelnatif.nicko.NickoBukkit;
import net.artelnatif.nicko.disguise.NickoProfile;
import net.artelnatif.nicko.disguise.UpdateResult;
import net.artelnatif.nicko.disguise.ActionResult;
import net.artelnatif.nicko.i18n.I18NDict;
import net.artelnatif.nicko.mojang.MojangSkin;
import net.minecraft.network.chat.IChatBaseComponent;
@ -86,7 +86,7 @@ public class v1_19_R1 implements Internals {
}
@Override
public UpdateResult updateProfile(Player player, NickoProfile profile, boolean skinChange) {
public ActionResult updateProfile(Player player, NickoProfile profile, boolean skinChange) {
final CraftPlayer craftPlayer = (CraftPlayer) player;
final EntityPlayer entityPlayer = craftPlayer.getHandle();
final boolean changeOnlyName = profile.getSkin() != null && !profile.getSkin().equalsIgnoreCase(player.getName());
@ -109,15 +109,15 @@ public class v1_19_R1 implements Internals {
properties.put("textures", new Property("textures", skin.get().value(), skin.get().signature()));
updateSelf(player);
} else {
return new UpdateResult(I18NDict.Error.SKIN_FAIL_MOJANG);
return new ActionResult(I18NDict.Error.SKIN_FAIL_MOJANG);
}
} else {
return new UpdateResult(I18NDict.Error.NAME_FAIL_MOJANG);
return new ActionResult(I18NDict.Error.NAME_FAIL_MOJANG);
}
} catch (ExecutionException e) {
return new UpdateResult(I18NDict.Error.SKIN_FAIL_CACHE);
return new ActionResult(I18NDict.Error.SKIN_FAIL_CACHE);
} catch (IOException e) {
return new UpdateResult(I18NDict.Error.NAME_FAIL_MOJANG);
return new ActionResult(I18NDict.Error.NAME_FAIL_MOJANG);
}
}
@ -137,6 +137,6 @@ public class v1_19_R1 implements Internals {
onlineEntityPlayer.b.a(add);
});
updateOthers(player);
return new UpdateResult();
return new ActionResult();
}
}