net.minecraft.util.Session Java Examples
The following examples show how to use
net.minecraft.util.Session.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NameCommand.java From seppuku with GNU General Public License v3.0 | 6 votes |
@Override public void exec(String input) { if (!this.clamp(input, 2, 2)) { this.printUsage(); return; } final String[] split = input.split(" "); if(split[1].equalsIgnoreCase(Minecraft.getMinecraft().session.getUsername())) { Minecraft.getMinecraft().session = new Session(split[1], Minecraft.getMinecraft().session.getPlayerID(), Minecraft.getMinecraft().session.getToken(), "mojang"); Seppuku.INSTANCE.logChat("Set username to " + split[1]); }else{ Seppuku.INSTANCE.errorChat("Name must match"); } }
Example #2
Source File: GuiChangeName.java From LiquidBounce with GNU General Public License v3.0 | 6 votes |
@Override protected void actionPerformed(GuiButton button) throws IOException { switch(button.id) { case 0: mc.displayGuiScreen(prevGui); break; case 1: if(name.getText().isEmpty()) { status = "§cEnter a name!"; return; } if(!name.getText().equalsIgnoreCase(mc.getSession().getUsername())) { status = "§cJust change the upper and lower case!"; return; } mc.session = new Session(name.getText(), mc.getSession().getPlayerID(), mc.getSession().getToken(), mc.getSession().getSessionType().name()); LiquidBounce.eventManager.callEvent(new SessionEvent()); status = "§aChanged name to §7" + name.getText() + "§c."; prevGui.status = status; mc.displayGuiScreen(prevGui); break; } super.actionPerformed(button); }
Example #3
Source File: Utils.java From ClientBase with MIT License | 5 votes |
public static Session createSession(String username, String password, @NotNull Proxy proxy) throws Exception { YggdrasilAuthenticationService service = new YggdrasilAuthenticationService(proxy, ""); YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) service .createUserAuthentication(Agent.MINECRAFT); auth.setUsername(username); auth.setPassword(password); auth.logIn(); return new Session(auth.getSelectedProfile().getName(), auth.getSelectedProfile().getId().toString(), auth.getAuthenticatedToken(), "mojang"); }
Example #4
Source File: LoginCommand.java From ClientBase with MIT License | 5 votes |
@Override public void run(String alias, @NotNull String[] args) { if (args.length < 1) { throw new CommandException("Usage: ." + alias + " <username:password> or <username> <password>"); } String username; String password; if (args.length == 1) { if (!args[0].contains(":")) throw new CommandException("Usage: ." + alias + " <username:password> or <username> <password>"); String split[] = args[0].split(":"); if (split.length != 2) { throw new CommandException("Usage: ." + alias + " <username:password> or <username> <password>"); } username = split[0]; password = split[1]; } else { username = args[0]; password = args[1]; } try { Session session = Utils.createSession(username, password, Proxy.NO_PROXY); ((IMixinMinecraft) Minecraft.getMinecraft()).setSession(session); ChatUtils.success("Logged in. New IGN: " + session.getUsername()); } catch (Exception e) { throw new CommandException(e.getMessage()); } }
Example #5
Source File: SessionManager.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
public void login() { Session session = autotip.getMinecraft().getSession(); GameProfile profile = session.getProfile(); String uuid = profile.getId().toString().replace("-", ""); String serverHash = HashUtil.hash(uuid + HashUtil.getNextSalt()); int statusCode = authenticate(session.getToken(), uuid, serverHash); if (statusCode / 100 != 2) { messageUtil.send("&cError {} during authentication: Session servers down?", statusCode); return; } StatsRange all = autotip.getStatsManager().getAll(); LoginRequest request = LoginRequest.of(autotip, profile, serverHash, all.getTipsTotalInt()); long lastLogin = autotip.getEvent(EventClientConnection.class).getLastLogin(); long delay = lastLogin + 5000 - System.currentTimeMillis(); delay /= 1000; reply = taskManager.scheduleAndAwait(request::execute, (delay < 1) ? 1 : delay); if (reply == null || !reply.isSuccess()) { messageUtil.send("&cError during login: {}", reply == null ? "null" : reply.getCause()); return; } sessionKey = reply.getSessionKey(); loggedIn = true; long keepAlive = reply.getKeepAliveRate(); long tipWave = reply.getTipWaveRate(); taskManager.addRepeatingTask(TaskType.KEEP_ALIVE, this::keepAlive, keepAlive, keepAlive); taskManager.addRepeatingTask(TaskType.TIP_WAVE, this::tipWave, 0, tipWave); }
Example #6
Source File: AuthenticationHelper.java From malmo with MIT License | 5 votes |
public static boolean setPlayerName(Session currentSession, String newPlayerName) { if (currentSession.getUsername().equals(newPlayerName)) return true; // Create new session object: Session newSession = new Session(newPlayerName, currentSession.getPlayerID(), currentSession.getToken(), "mojang"/*currentSession.getSessionType().toString()*/); newSession.setProperties(new com.mojang.authlib.properties.PropertyMap()); // Prevents calls to the session service to get profile properties return setSession(newSession); }
Example #7
Source File: MixinGuiDisconnected.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
@Inject(method = "actionPerformed", at = @At("HEAD")) private void actionPerformed(GuiButton button, CallbackInfo callbackInfo) { switch (button.id) { case 1: ServerUtils.connectToLastServer(); break; case 3: if (!GuiTheAltening.Companion.getApiKey().isEmpty()) { final String apiKey = GuiTheAltening.Companion.getApiKey(); final TheAltening theAltening = new TheAltening(apiKey); try { final AccountData account = theAltening.getAccountData(); GuiAltManager.altService.switchService(AltService.EnumAltService.THEALTENING); final YggdrasilUserAuthentication yggdrasilUserAuthentication = new YggdrasilUserAuthentication(new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""), Agent.MINECRAFT); yggdrasilUserAuthentication.setUsername(account.getToken()); yggdrasilUserAuthentication.setPassword(LiquidBounce.CLIENT_NAME); yggdrasilUserAuthentication.logIn(); mc.session = new Session(yggdrasilUserAuthentication.getSelectedProfile().getName(), yggdrasilUserAuthentication.getSelectedProfile().getId().toString(), yggdrasilUserAuthentication.getAuthenticatedToken(), "mojang"); LiquidBounce.eventManager.callEvent(new SessionEvent()); ServerUtils.connectToLastServer(); break; } catch (final Throwable throwable) { ClientUtils.getLogger().error("Failed to login into random account from TheAltening.", throwable); } } final List<MinecraftAccount> accounts = LiquidBounce.fileManager.accountsConfig.getAccounts(); if (accounts.isEmpty()) break; final MinecraftAccount minecraftAccount = accounts.get(new Random().nextInt(accounts.size())); GuiAltManager.login(minecraftAccount); ServerUtils.connectToLastServer(); break; case 4: LoginUtils.loginCracked(RandomUtils.randomString(RandomUtils.nextInt(5, 16))); ServerUtils.connectToLastServer(); break; case 5: AntiForge.enabled = !AntiForge.enabled; forgeBypassButton.displayString = "Bypass AntiForge: " + (AntiForge.enabled ? "On" : "Off"); LiquidBounce.fileManager.saveConfig(LiquidBounce.fileManager.valuesConfig); break; } }
Example #8
Source File: MixinMinecraft.java From ClientBase with MIT License | 4 votes |
@Override public Session getSession() { return session; }
Example #9
Source File: MixinMinecraft.java From ClientBase with MIT License | 4 votes |
@Override public void setSession(Session session) { this.session = session; }
Example #10
Source File: WrapperSession.java From ClientBase with MIT License | 4 votes |
public WrapperSession(Session var1) { this.real = var1; }
Example #11
Source File: WrapperSession.java From ClientBase with MIT License | 4 votes |
public Session unwrap() { return this.real; }
Example #12
Source File: IMixinMinecraft.java From ClientBase with MIT License | votes |
Session getSession();
Example #13
Source File: IMixinMinecraft.java From ClientBase with MIT License | votes |
void setSession(Session session);