Merge branch 'temp_branch' into architectury

This commit is contained in:
NikitaCartes 2021-06-23 20:14:55 +03:00
commit 4aeb8210f8
No known key found for this signature in database
GPG Key ID: 3A5BAB26D767AA69
14 changed files with 66 additions and 45 deletions

View File

@ -11,9 +11,9 @@ loom {
dependencies { dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations // We depend on fabric loader here to use the fabric @Environment annotations
// Do NOT use other classes from fabric loader // Do NOT use other classes from fabric loader
modCompile "net.fabricmc:fabric-loader:${rootProject.loader_version}" modImplementation "net.fabricmc:fabric-loader:${rootProject.loader_version}"
modCompile("me.shedaniel:architectury:${rootProject.architectury_version}") { modImplementation ("me.shedaniel:architectury:${rootProject.architectury_version}") {
exclude(module: "fabric-api") exclude(module: "fabric-api")
} }
@ -35,5 +35,5 @@ dependencies {
} }
architectury { architectury {
common() common(false)
} }

View File

@ -94,7 +94,8 @@ public class AuthEventHandler {
// Tries to rescue player from nether portal // Tries to rescue player from nether portal
if(config.main.tryPortalRescue && player.getBlockState().getBlock().equals(Blocks.NETHER_PORTAL)) { //if(config.main.tryPortalRescue && player.getBlockState().getBlock().equals(Blocks.NETHER_PORTAL)) {
if(config.main.tryPortalRescue && player.getServerWorld().getBlockState(player.getBlockPos()).getBlock().equals(Blocks.NETHER_PORTAL)) {
BlockPos pos = player.getBlockPos(); BlockPos pos = player.getBlockPos();
// Teleporting player to the middle of the block // Teleporting player to the middle of the block
@ -117,8 +118,8 @@ public class AuthEventHandler {
if(playerCache.isAuthenticated) { if(playerCache.isAuthenticated) {
playerCache.lastIp = player.getIp(); playerCache.lastIp = player.getIp();
playerCache.wasInPortal = player.getBlockState().getBlock().equals(Blocks.NETHER_PORTAL); //playerCache.wasInPortal = player.getBlockState().getBlock().equals(Blocks.NETHER_PORTAL);
playerCache.wasInPortal = player.getServerWorld().getBlockState(player.getBlockPos()).getBlock().equals(Blocks.NETHER_PORTAL);
// Setting the session expire time // Setting the session expire time
if(config.main.sessionTimeoutTime != -1) if(config.main.sessionTimeoutTime != -1)
playerCache.validUntil = System.currentTimeMillis() + config.main.sessionTimeoutTime * 1000L; playerCache.validUntil = System.currentTimeMillis() + config.main.sessionTimeoutTime * 1000L;

View File

@ -3,6 +3,7 @@ package org.samo_lego.simpleauth.mixin;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket; import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.server.filter.TextStream;
import net.minecraft.server.network.ServerPlayNetworkHandler; import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
@ -21,7 +22,7 @@ public abstract class MixinServerPlayNetworkHandler {
public ServerPlayerEntity player; public ServerPlayerEntity player;
@Inject( @Inject(
method = "method_31286(Ljava/lang/String;)V", method = "method_31286(Lnet/minecraft/server/filter/TextStream$Message;)V",
at = @At( at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/server/network/ServerPlayerEntity;updateLastActionTime()V", target = "Lnet/minecraft/server/network/ServerPlayerEntity;updateLastActionTime()V",
@ -29,8 +30,8 @@ public abstract class MixinServerPlayNetworkHandler {
), ),
cancellable = true cancellable = true
) )
private void onPlayerChat(String message, CallbackInfo ci) { private void onPlayerChat(TextStream.Message message, CallbackInfo ci) {
ActionResult result = AuthEventHandler.onPlayerChat(this.player, message); ActionResult result = AuthEventHandler.onPlayerChat(this.player, message.getFiltered());
if (result == ActionResult.FAIL) { if (result == ActionResult.FAIL) {
ci.cancel(); ci.cancel();
} }
@ -67,7 +68,7 @@ public abstract class MixinServerPlayNetworkHandler {
ActionResult result = AuthEventHandler.onPlayerMove(player); ActionResult result = AuthEventHandler.onPlayerMove(player);
if (result == ActionResult.FAIL) { if (result == ActionResult.FAIL) {
// A bit ugly, I know. (we need to update player position) // A bit ugly, I know. (we need to update player position)
player.networkHandler.requestTeleport(player.getX(), player.getY(), player.getZ(), player.yaw, player.pitch); player.networkHandler.requestTeleport(player.getX(), player.getY(), player.getZ(), player.getYaw(0), player.getPitch(0));
ci.cancel(); ci.cancel();
} }
} }

View File

@ -52,8 +52,8 @@ public class MixinServerPlayerEntity implements PlayerAuth {
// Saving position // Saving position
cache.lastLocation.dimension = player.getServerWorld(); cache.lastLocation.dimension = player.getServerWorld();
cache.lastLocation.position = player.getPos(); cache.lastLocation.position = player.getPos();
cache.lastLocation.yaw = player.yaw; cache.lastLocation.yaw = player.getYaw(0);
cache.lastLocation.pitch = player.pitch; cache.lastLocation.pitch = player.getPitch(0);
// Teleports player to spawn // Teleports player to spawn
player.teleport( player.teleport(

View File

@ -24,10 +24,9 @@ public abstract class MixinSlot {
player.networkHandler.sendPacket( player.networkHandler.sendPacket(
new ScreenHandlerSlotUpdateS2CPacket( new ScreenHandlerSlotUpdateS2CPacket(
-2, -2,
player.inventory.selectedSlot, player.getInventory().selectedSlot,
player.inventory.getStack(player.inventory.selectedSlot)) player.getInventory().getStack(player.getInventory().selectedSlot))
); );
player.networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(-1, -1, player.inventory.getCursorStack()));
cir.setReturnValue(false); cir.setReturnValue(false);
} }
} }

View File

@ -94,10 +94,11 @@ public class PlayerCache {
// Setting position cache // Setting position cache
playerCache.lastLocation.dimension = player.getServerWorld(); playerCache.lastLocation.dimension = player.getServerWorld();
playerCache.lastLocation.position = player.getPos(); playerCache.lastLocation.position = player.getPos();
playerCache.lastLocation.yaw = player.yaw; playerCache.lastLocation.yaw = player.getYaw(0);
playerCache.lastLocation.pitch = player.pitch; playerCache.lastLocation.pitch = player.getPitch(0);
playerCache.wasInPortal = player.getBlockState().getBlock().equals(Blocks.NETHER_PORTAL); playerCache.wasInPortal = player.getServerWorld().getBlockState(player.getBlockPos()).getBlock().equals(Blocks.NETHER_PORTAL);
//playerCache.wasInPortal = player.getBlockState().getBlock().equals(Blocks.NETHER_PORTAL);
} }
return playerCache; return playerCache;

View File

@ -1,3 +1,4 @@
accessWidener v1 named accessWidener v1 named
accessible class net/minecraft/server/network/ServerLoginNetworkHandler$State accessible class net/minecraft/server/network/ServerLoginNetworkHandler$State
accessible field net/minecraft/entity/Entity yaw F

View File

@ -2,12 +2,12 @@
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G
# Fabric properties # Fabric properties
minecraft_version=1.16.5 minecraft_version=21w10a
yarn_mappings=1.16.5+build.3 yarn_mappings=21w10a+build.1
loader_version=0.11.1 loader_version=0.11.2
#Fabric api #Fabric api
fabric_version=0.29.4+1.16 fabric_version=0.28.5+1.15
# Forge # Forge
forge_version=36.0.4 forge_version=36.0.4

Binary file not shown.

View File

@ -1,6 +1,5 @@
#Thu Jun 04 11:39:28 CEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

4
gradlew vendored
View File

@ -72,7 +72,7 @@ case "`uname`" in
Darwin* ) Darwin* )
darwin=true darwin=true
;; ;;
MINGW* ) MSYS* | MINGW* )
msys=true msys=true
;; ;;
NONSTOP* ) NONSTOP* )
@ -82,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath

22
gradlew.bat vendored
View File

@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -64,28 +64,14 @@ echo location of your Java installation.
goto fail goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell

31
pt_br.json Normal file
View File

@ -0,0 +1,31 @@
{
"enterPassword": "§6Você precisa inserir sua senha!",
"enterNewPassword": "§4Você precisa inserir uma nova senha!",
"wrongPassword": "§4Senha incorreta!",
"matchPassword": "§6As senhas devem coincidir!",
"passwordUpdated": "§aSua senha foi atualizada com sucesso!",
"loginRequired": "§cVocê não está autenticado!\n§6Use /login para autenticar!",
"loginTriesExceeded": "§4Muitas tentativas de login.",
"globalPasswordSet": "§aSenha global definida com sucesso!",
"cannotChangePassword": "§cVocê não pode mudar a senha!",
"cannotUnregister": "§cVocê não pode remover essa conta!",
"notAuthenticated": "§cVocê não está autenticado!\n§6Tente com /login ou /register.",
"alreadyAuthenticated": "§6Você já está autenticado.",
"successfullyAuthenticated": "§aVocê foi autenticado.",
"successfulLogout": "§Desconectado com sucesso.",
"timeExpired": "§cTempo de autenticação expirado.",
"registerRequired": "§6Digite /register \u003csenha\u003e \u003csenha\u003e para reivindicar essa conta.",
"alreadyRegistered": "§6O nome dessa conta já está registrado!",
"registerSuccess": "§aVocê foi autenticado.",
"userdataDeleted": "§aDados do usuário deletados.",
"userdataUpdated": "§aDados do usuário atualizados.",
"accountDeleted": "§aSua conta foi deletada com sucesso!",
"configurationReloaded": "§aArquivo de configuração recarregado com sucesso.",
"maxPasswordChars": "§6A senha deve possuir até %d caracteres!",
"minPasswordChars": "§6A senha deve possuir pelo menos %d caracteres!",
"disallowedUsername": "§6Caracteres inválidos no nome de usuário! Expressão regular permitida: %s",
"playerAlreadyOnline": "§cO jogador %s já está online!",
"worldSpawnSet": "§aPonto de surgimento para login definido com sucesso.",
"corruptedPlayerData": "§cSeus dados estão provavelmente corrompidos. Por favor contate um administrador.",
"userNotRegistered": "§cEsse jogador não está registrado!"
}

View File

@ -13,6 +13,6 @@ pluginManagement {
include("common") include("common")
include("fabric") include("fabric")
include("forge") //include("forge")
rootProject.name = "simpleauth" rootProject.name = "simpleauth"