diff --git a/common/build.gradle b/common/build.gradle index 100124e..ed644dd 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -11,9 +11,9 @@ loom { dependencies { // We depend on fabric loader here to use the fabric @Environment annotations // 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") } @@ -35,5 +35,5 @@ dependencies { } architectury { - common() + common(false) } \ No newline at end of file diff --git a/common/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java b/common/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java index 77e7b31..9832886 100644 --- a/common/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java +++ b/common/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java @@ -94,7 +94,8 @@ public class AuthEventHandler { // 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(); // Teleporting player to the middle of the block @@ -117,8 +118,8 @@ public class AuthEventHandler { if(playerCache.isAuthenticated) { 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 if(config.main.sessionTimeoutTime != -1) playerCache.validUntil = System.currentTimeMillis() + config.main.sessionTimeoutTime * 1000L; diff --git a/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayNetworkHandler.java b/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayNetworkHandler.java index 6901442..23bc51d 100644 --- a/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayNetworkHandler.java +++ b/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayNetworkHandler.java @@ -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.PlayerActionC2SPacket; 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.ServerPlayerEntity; import net.minecraft.util.ActionResult; @@ -21,7 +22,7 @@ public abstract class MixinServerPlayNetworkHandler { public ServerPlayerEntity player; @Inject( - method = "method_31286(Ljava/lang/String;)V", + method = "method_31286(Lnet/minecraft/server/filter/TextStream$Message;)V", at = @At( value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;updateLastActionTime()V", @@ -29,8 +30,8 @@ public abstract class MixinServerPlayNetworkHandler { ), cancellable = true ) - private void onPlayerChat(String message, CallbackInfo ci) { - ActionResult result = AuthEventHandler.onPlayerChat(this.player, message); + private void onPlayerChat(TextStream.Message message, CallbackInfo ci) { + ActionResult result = AuthEventHandler.onPlayerChat(this.player, message.getFiltered()); if (result == ActionResult.FAIL) { ci.cancel(); } @@ -67,7 +68,7 @@ public abstract class MixinServerPlayNetworkHandler { ActionResult result = AuthEventHandler.onPlayerMove(player); if (result == ActionResult.FAIL) { // 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(); } } diff --git a/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayerEntity.java b/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayerEntity.java index ea979cc..267a510 100644 --- a/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayerEntity.java +++ b/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayerEntity.java @@ -52,8 +52,8 @@ public class MixinServerPlayerEntity implements PlayerAuth { // Saving position cache.lastLocation.dimension = player.getServerWorld(); cache.lastLocation.position = player.getPos(); - cache.lastLocation.yaw = player.yaw; - cache.lastLocation.pitch = player.pitch; + cache.lastLocation.yaw = player.getYaw(0); + cache.lastLocation.pitch = player.getPitch(0); // Teleports player to spawn player.teleport( diff --git a/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinSlot.java b/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinSlot.java index 2fad4df..7c47c6f 100644 --- a/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinSlot.java +++ b/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinSlot.java @@ -24,10 +24,9 @@ public abstract class MixinSlot { player.networkHandler.sendPacket( new ScreenHandlerSlotUpdateS2CPacket( -2, - player.inventory.selectedSlot, - player.inventory.getStack(player.inventory.selectedSlot)) + player.getInventory().selectedSlot, + player.getInventory().getStack(player.getInventory().selectedSlot)) ); - player.networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(-1, -1, player.inventory.getCursorStack())); cir.setReturnValue(false); } } diff --git a/common/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java b/common/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java index 7986772..35552e8 100644 --- a/common/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java +++ b/common/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java @@ -94,10 +94,11 @@ public class PlayerCache { // Setting position cache playerCache.lastLocation.dimension = player.getServerWorld(); playerCache.lastLocation.position = player.getPos(); - playerCache.lastLocation.yaw = player.yaw; - playerCache.lastLocation.pitch = player.pitch; + playerCache.lastLocation.yaw = player.getYaw(0); + 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; diff --git a/common/src/main/resources/simpleauth.accesswidener b/common/src/main/resources/simpleauth.accesswidener index 3e8d38c..350b56c 100644 --- a/common/src/main/resources/simpleauth.accesswidener +++ b/common/src/main/resources/simpleauth.accesswidener @@ -1,3 +1,4 @@ accessWidener v1 named accessible class net/minecraft/server/network/ServerLoginNetworkHandler$State +accessible field net/minecraft/entity/Entity yaw F diff --git a/gradle.properties b/gradle.properties index 0cc7dbb..b7dcf67 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,12 +2,12 @@ org.gradle.jvmargs=-Xmx1G # Fabric properties -minecraft_version=1.16.5 -yarn_mappings=1.16.5+build.3 -loader_version=0.11.1 +minecraft_version=21w10a +yarn_mappings=21w10a+build.1 +loader_version=0.11.2 #Fabric api -fabric_version=0.29.4+1.16 +fabric_version=0.28.5+1.15 # Forge forge_version=36.0.4 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 62d4c05..7454180 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 99fd715..69a9715 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 2fe81a7..744e882 100644 --- a/gradlew +++ b/gradlew @@ -72,7 +72,7 @@ case "`uname`" in Darwin* ) darwin=true ;; - MINGW* ) + MSYS* | MINGW* ) msys=true ;; NONSTOP* ) @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index 62bd9b9..107acd3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. 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_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,28 +64,14 @@ echo location of your Java installation. 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 @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @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 @rem End local scope for the variables with windows NT shell diff --git a/pt_br.json b/pt_br.json new file mode 100644 index 0000000..7cc3c9f --- /dev/null +++ b/pt_br.json @@ -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!" +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 1c3fbe9..cb71945 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,6 +13,6 @@ pluginManagement { include("common") include("fabric") -include("forge") +//include("forge") rootProject.name = "simpleauth" \ No newline at end of file