forked from Clones/Controlify
➕ Add toast to notify of reach-around policy
This commit is contained in:
@ -13,6 +13,7 @@ import dev.isxander.controlify.debug.DebugProperties;
|
|||||||
import dev.isxander.controlify.gui.screen.ControllerCalibrationScreen;
|
import dev.isxander.controlify.gui.screen.ControllerCalibrationScreen;
|
||||||
import dev.isxander.controlify.gui.screen.SDLOnboardingScreen;
|
import dev.isxander.controlify.gui.screen.SDLOnboardingScreen;
|
||||||
import dev.isxander.controlify.reacharound.ReachAroundHandler;
|
import dev.isxander.controlify.reacharound.ReachAroundHandler;
|
||||||
|
import dev.isxander.controlify.reacharound.ReachAroundMode;
|
||||||
import dev.isxander.controlify.screenop.ScreenProcessorProvider;
|
import dev.isxander.controlify.screenop.ScreenProcessorProvider;
|
||||||
import dev.isxander.controlify.config.ControlifyConfig;
|
import dev.isxander.controlify.config.ControlifyConfig;
|
||||||
import dev.isxander.controlify.controller.hid.ControllerHIDService;
|
import dev.isxander.controlify.controller.hid.ControllerHIDService;
|
||||||
@ -234,6 +235,14 @@ public class Controlify implements ControlifyApi {
|
|||||||
ClientPlayNetworking.registerGlobalReceiver(ReachAroundPolicyPacket.TYPE, (packet, player, sender) -> {
|
ClientPlayNetworking.registerGlobalReceiver(ReachAroundPolicyPacket.TYPE, (packet, player, sender) -> {
|
||||||
Log.LOGGER.info("Connected server specified reach around policy is {}.", packet.allowed() ? "ALLOWED" : "DISALLOWED");
|
Log.LOGGER.info("Connected server specified reach around policy is {}.", packet.allowed() ? "ALLOWED" : "DISALLOWED");
|
||||||
ReachAroundHandler.reachAroundPolicy = packet.allowed();
|
ReachAroundHandler.reachAroundPolicy = packet.allowed();
|
||||||
|
|
||||||
|
if (config().globalSettings().reachAround == ReachAroundMode.EVERYWHERE && !packet.allowed()) {
|
||||||
|
ToastUtils.sendToast(
|
||||||
|
Component.translatable("controlify.toast.reach_around_disallowed.title"),
|
||||||
|
Component.translatable("controlify.toast.reach_around_disallowed.description"),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> {
|
ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> {
|
||||||
DebugLog.log("Disconnected from server, resetting reach around policy");
|
DebugLog.log("Disconnected from server, resetting reach around policy");
|
||||||
|
@ -154,6 +154,8 @@
|
|||||||
"controlify.toast.low_battery.message": "Your controller '%s' is low on battery. Please charge it soon.",
|
"controlify.toast.low_battery.message": "Your controller '%s' is low on battery. Please charge it soon.",
|
||||||
"controlify.toast.setup_in_config.title": "Controllers found!",
|
"controlify.toast.setup_in_config.title": "Controllers found!",
|
||||||
"controlify.toast.setup_in_config.description": "To use with Controlify, go to %s -> %s -> %s.",
|
"controlify.toast.setup_in_config.description": "To use with Controlify, go to %s -> %s -> %s.",
|
||||||
|
"controlify.toast.reach_around_disallowed.title": "Reach-around prohibited",
|
||||||
|
"controlify.toast.reach_around_disallowed.description": "This server has prohibited the use of reach-around block placement that you have enabled.",
|
||||||
|
|
||||||
"controlify.sdl2_onboarding.title": "Controlify Native Library",
|
"controlify.sdl2_onboarding.title": "Controlify Native Library",
|
||||||
"controlify.sdl2_onboarding.message": "Many features in Controlify require an extra library that needs to be downloaded for your system. If you do not download this library, you will lose access to many features such as: controller vibration, gyroscope control, better controller identification. This is a seamless process and will only take a few seconds. If you choose no, you may change your mind later in Controlify settings, but you won't have access to these features in the meantime.",
|
"controlify.sdl2_onboarding.message": "Many features in Controlify require an extra library that needs to be downloaded for your system. If you do not download this library, you will lose access to many features such as: controller vibration, gyroscope control, better controller identification. This is a seamless process and will only take a few seconds. If you choose no, you may change your mind later in Controlify settings, but you won't have access to these features in the meantime.",
|
||||||
|
Reference in New Issue
Block a user