Compiling + javadoc fixes

This commit is contained in:
samo_lego 2020-10-15 21:47:28 +02:00
parent 75461b37dd
commit 9cc25f9eeb
3 changed files with 47 additions and 11 deletions

View File

@ -5,12 +5,10 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import org.samo_lego.simpleauth.storage.PlayerCache;
import org.samo_lego.simpleauth.utils.PlayerAuth;
import static net.minecraft.server.command.CommandManager.literal;
import static org.samo_lego.simpleauth.SimpleAuth.config;
import static org.samo_lego.simpleauth.SimpleAuth.playerCacheMap;
public class LogoutCommand {
@ -23,13 +21,6 @@ public class LogoutCommand {
private static int logout(ServerCommandSource serverCommandSource) throws CommandSyntaxException {
ServerPlayerEntity player = serverCommandSource.getPlayer();
PlayerCache playerCache = playerCacheMap.get(((PlayerAuth) player).getFakeUuid());
playerCache.lastLocation.lastDim = String.valueOf(player.getEntityWorld().getRegistryKey().getValue());
playerCache.lastLocation.lastX = player.getX();
playerCache.lastLocation.lastY = player.getY();
playerCache.lastLocation.lastZ = player.getZ();
playerCache.lastLocation.yaw = player.yaw;
playerCache.lastLocation.pitch = player.pitch;
((PlayerAuth) player).setAuthenticated(false);
player.sendMessage(new LiteralText(config.lang.successfulLogout), false);

View File

@ -86,12 +86,12 @@ public class AuthConfig {
public boolean allowFalling = false;
/**
* Whether to tp player to spawn when joining (to hide coordinates)
* Whether to tp player to spawn when joining (to hide original player coordinates)
*/
public boolean spawnOnJoin = false;
/**
* Data for spawn (where deauthenticated players are teleported).
* Data for spawn (where deauthenticated players are teleported temporarily).
* @see <a href="https://github.com/samolego/SimpleAuth/wiki/Coordinate-Hiding" target="_blank">wiki</a>
*/
public static class WorldSpawn {

View File

@ -2,15 +2,60 @@ package org.samo_lego.simpleauth.utils;
import net.minecraft.text.Text;
/**
* PLayer authentication extension.
*/
public interface PlayerAuth {
/**
* Teleports player to spawn or last location that is recorded.
* Last location means the location before de-authentication.
*
* @param hide whether to teleport player to spawn (provided in config) or last recorded position
* @see <a href="https://samolego.github.io/SimpleAuth/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.html">See implementation</a>
*/
void hidePosition(boolean hide);
/**
* Converts player uuid, to ensure player with "nAmE" and "NamE" get same uuid.
* Both players are not allowed to play, since mod mimics Mojang behaviour.
* of not allowing accounts with same names but different capitalization.
*
* @return converted UUID as string
* @see <a href="https://samolego.github.io/SimpleAuth/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.html">See implementation</a>
*/
String getFakeUuid();
/**
* Sets the authentication status of the player.
*
* @param authenticated whether player should be authenticated
* @see <a href="https://samolego.github.io/SimpleAuth/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.html">See implementation</a>
*/
void setAuthenticated(boolean authenticated);
/**
* Checks whether player is authenticated.
*
* @return false if player is not authenticated, otherwise true.
* @see <a href="https://samolego.github.io/SimpleAuth/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.html">See implementation</a>
*/
boolean isAuthenticated();
/**
* Gets the text which tells the player
* to login or register, depending on account status.
*
* @return LiteralText with appropriate string (login or register)
* @see <a href="https://samolego.github.io/SimpleAuth/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.html">See implementation</a>
*/
Text getAuthMessage();
/**
* Checks whether player is a fake player (from CarpetMod).
*
* @return true if player is fake (can skip authentication process), otherwise false
* @see <a href="https://samolego.github.io/SimpleAuth/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.html">See implementation</a>
*/
boolean canSkipAuth();
}