use of riskyken.armourersWorkshop.common.library.global.auth.PlushieSession in project Armourers-Workshop by RiskyKen.
the class GuiGlobalLibraryPanelSkinEdit method authenticateUser.
private boolean authenticateUser() {
GameProfile gameProfile = mc.thePlayer.getGameProfile();
PlushieSession plushieSession = PlushieAuth.PLUSHIE_SESSION;
if (!plushieSession.isAuthenticated()) {
JsonObject jsonObject = PlushieAuth.updateAccessToken(gameProfile.getName(), gameProfile.getId().toString());
plushieSession.authenticate(jsonObject);
}
if (!plushieSession.isAuthenticated()) {
ModLogger.log(Level.ERROR, "Authentication failed.");
return false;
}
return true;
}
use of riskyken.armourersWorkshop.common.library.global.auth.PlushieSession in project Armourers-Workshop by RiskyKen.
the class GuiGlobalLibraryPanelSkinEdit method deleteSkin.
public void deleteSkin() {
PlushieSession plushieSession = PlushieAuth.PLUSHIE_SESSION;
GuiGlobalLibrary globalLibrary = (GuiGlobalLibrary) parent;
int userId = plushieSession.getServerId();
String accessToken = plushieSession.getAccessToken();
int skinId = skinJson.get("id").getAsInt();
taskSkinEdit = GlobalSkinLibraryUtils.deleteSkin(globalLibrary.jsonDownloadExecutor, userId, accessToken, skinId);
}
use of riskyken.armourersWorkshop.common.library.global.auth.PlushieSession in project Armourers-Workshop by RiskyKen.
the class GuiGlobalLibraryPanelUpload method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) {
if (button == buttonUpload) {
GameProfile gameProfile = mc.thePlayer.getGameProfile();
PlushieSession plushieSession = PlushieAuth.PLUSHIE_SESSION;
if (!plushieSession.isAuthenticated()) {
JsonObject jsonObject = PlushieAuth.updateAccessToken(gameProfile.getName(), gameProfile.getId().toString());
plushieSession.authenticate(jsonObject);
}
if (!plushieSession.isAuthenticated()) {
ModLogger.log(Level.ERROR, "Authentication failed.");
return;
}
MessageClientGuiButton message = new MessageClientGuiButton((byte) 0);
PacketHandler.networkWrapper.sendToServer(message);
}
}
use of riskyken.armourersWorkshop.common.library.global.auth.PlushieSession in project Armourers-Workshop by RiskyKen.
the class GuiGlobalLibraryPanelUpload method uploadSkin.
public void uploadSkin(Skin skin) {
GameProfile gameProfile = mc.thePlayer.getGameProfile();
PlushieSession plushieSession = PlushieAuth.PLUSHIE_SESSION;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
SkinIOUtils.saveSkinToStream(outputStream, skin);
byte[] fileBytes = outputStream.toByteArray();
IOUtils.closeQuietly(outputStream);
taskSkinUpload = SkinUploader.uploadSkin(fileBytes, textName.getText().trim(), Integer.toString(plushieSession.getServerId()), textDescription.getText().trim(), plushieSession.getAccessToken());
}
use of riskyken.armourersWorkshop.common.library.global.auth.PlushieSession in project Armourers-Workshop by RiskyKen.
the class GuiGlobalLibraryPanelSkinEdit method updateSkin.
public void updateSkin() {
PlushieSession plushieSession = PlushieAuth.PLUSHIE_SESSION;
GuiGlobalLibrary globalLibrary = (GuiGlobalLibrary) parent;
int userId = plushieSession.getServerId();
String accessToken = plushieSession.getAccessToken();
int skinId = skinJson.get("id").getAsInt();
String name = textName.getText().trim();
String description = textDescription.getText().trim();
taskSkinEdit = GlobalSkinLibraryUtils.editSkin(globalLibrary.uploadExecutor, userId, accessToken, skinId, name, description);
}
Aggregations