2019-07-10 06:34:10 +00:00
|
|
|
/*
|
2021-01-01 15:10:36 +00:00
|
|
|
* Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
|
2019-07-10 06:34:10 +00:00
|
|
|
*
|
2019-07-11 21:30:35 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
2019-07-10 06:34:10 +00:00
|
|
|
*
|
2019-07-11 21:30:35 +00:00
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
2019-07-10 06:34:10 +00:00
|
|
|
*
|
|
|
|
* @author GeyserMC
|
|
|
|
* @link https://github.com/GeyserMC/Geyser
|
|
|
|
*/
|
|
|
|
|
|
|
|
package org.geysermc.connector.network.session;
|
|
|
|
|
2019-08-06 02:09:45 +00:00
|
|
|
import com.github.steveice10.packetlib.packet.Packet;
|
2020-05-05 15:51:43 +00:00
|
|
|
import com.nukkitx.protocol.bedrock.BedrockPacket;
|
2019-12-21 17:35:48 +00:00
|
|
|
import org.geysermc.connector.network.session.auth.AuthData;
|
2021-11-21 18:36:42 +00:00
|
|
|
import org.geysermc.geyser.session.GeyserSessionImpl;
|
2019-07-10 06:34:10 +00:00
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
/**
|
|
|
|
* Deprecated, legacy code. Serves as a wrapper around
|
|
|
|
* the class used now.
|
|
|
|
*
|
|
|
|
* @deprecated legacy code
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public class GeyserSession {
|
2021-11-21 18:36:42 +00:00
|
|
|
private final GeyserSessionImpl handle;
|
2021-11-13 16:03:55 +00:00
|
|
|
|
2021-11-21 18:36:42 +00:00
|
|
|
public GeyserSession(GeyserSessionImpl handle) {
|
2021-11-20 21:34:30 +00:00
|
|
|
this.handle = handle;
|
2019-07-10 06:34:10 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public AuthData getAuthData() {
|
|
|
|
return new AuthData(this.handle.getAuthData());
|
2019-07-24 06:29:54 +00:00
|
|
|
}
|
2019-07-10 06:34:10 +00:00
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public boolean isMicrosoftAccount() {
|
|
|
|
return this.handle.isMicrosoftAccount();
|
2020-04-11 18:33:06 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public boolean isClosed() {
|
|
|
|
return this.handle.isClosed();
|
2019-07-24 06:29:54 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public String getRemoteAddress() {
|
|
|
|
return this.handle.getRemoteAddress();
|
2021-01-11 20:52:02 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public int getRemotePort() {
|
|
|
|
return this.handle.getRemotePort();
|
2021-01-11 20:52:02 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public int getRenderDistance() {
|
|
|
|
return this.handle.getRenderDistance();
|
2021-01-11 20:52:02 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public boolean isSentSpawnPacket() {
|
|
|
|
return this.handle.isSentSpawnPacket();
|
2019-07-10 06:34:10 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public boolean isLoggedIn() {
|
|
|
|
return this.handle.isLoggedIn();
|
2019-07-10 06:34:10 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public boolean isLoggingIn() {
|
|
|
|
return this.handle.isLoggingIn();
|
2019-07-10 06:34:10 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public boolean isSpawned() {
|
|
|
|
return this.handle.isSpawned();
|
2021-08-18 00:57:46 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public boolean isInteracting() {
|
|
|
|
return this.handle.isInteracting();
|
2021-08-18 00:57:46 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public boolean isCanFly() {
|
|
|
|
return this.handle.isCanFly();
|
2021-01-05 23:41:20 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public boolean isFlying() {
|
|
|
|
return this.handle.isFlying();
|
2019-07-10 06:34:10 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public void connect() {
|
|
|
|
this.handle.connect();
|
2020-11-20 19:56:39 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public void login() {
|
|
|
|
this.handle.login();
|
2021-04-12 16:42:42 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public void authenticate(String username) {
|
|
|
|
this.handle.authenticate(username);
|
2021-04-12 04:35:53 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public void authenticate(String username, String password) {
|
|
|
|
this.handle.authenticate(username, password);
|
2021-04-12 16:42:42 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public void authenticateWithMicrosoftCode() {
|
|
|
|
this.handle.authenticateWithMicrosoftCode();
|
2021-04-12 04:35:53 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public void disconnect(String reason) {
|
|
|
|
this.handle.disconnect(reason);
|
2021-03-17 15:15:57 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public void close() {
|
|
|
|
this.handle.close();
|
2019-07-22 00:52:20 +00:00
|
|
|
}
|
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public void executeInEventLoop(Runnable runnable) {
|
|
|
|
this.handle.executeInEventLoop(runnable);
|
|
|
|
}
|
2019-07-22 00:52:20 +00:00
|
|
|
|
2021-11-20 21:34:30 +00:00
|
|
|
public String getName() {
|
2021-11-21 18:36:42 +00:00
|
|
|
return this.handle.name();
|
2019-07-22 00:52:20 +00:00
|
|
|
}
|
|
|
|
|
2020-03-05 02:44:42 +00:00
|
|
|
public boolean isConsole() {
|
2021-11-20 21:34:30 +00:00
|
|
|
return this.handle.isConsole();
|
2019-07-22 00:52:20 +00:00
|
|
|
}
|
|
|
|
|
2021-07-08 02:44:53 +00:00
|
|
|
public String getLocale() {
|
2021-11-20 21:34:30 +00:00
|
|
|
return this.handle.getLocale();
|
2019-09-13 13:37:31 +00:00
|
|
|
}
|
|
|
|
|
2020-05-05 15:51:43 +00:00
|
|
|
public void sendUpstreamPacket(BedrockPacket packet) {
|
2021-11-20 21:34:30 +00:00
|
|
|
this.handle.sendUpstreamPacket(packet);
|
2020-05-05 15:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void sendUpstreamPacketImmediately(BedrockPacket packet) {
|
2021-11-20 21:34:30 +00:00
|
|
|
this.handle.sendUpstreamPacketImmediately(packet);
|
2020-05-05 15:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void sendDownstreamPacket(Packet packet) {
|
2021-11-20 21:34:30 +00:00
|
|
|
this.handle.sendDownstreamPacket(packet);
|
2020-08-08 22:41:12 +00:00
|
|
|
}
|
|
|
|
|
2021-10-31 01:57:54 +00:00
|
|
|
public boolean hasPermission(String permission) {
|
2021-11-20 21:34:30 +00:00
|
|
|
return this.handle.hasPermission(permission);
|
2020-08-08 22:41:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void sendAdventureSettings() {
|
2021-11-20 21:34:30 +00:00
|
|
|
this.handle.sendAdventureSettings();
|
2020-10-23 06:25:24 +00:00
|
|
|
}
|
2019-08-24 03:49:48 +00:00
|
|
|
}
|