-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to only have copy chat when clicking ctrl
- Loading branch information
Showing
6 changed files
with
69 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...hatting/mixin/ChatPeekMixin_SkyHanni.java → .../mixin/compat/ChatPeekMixin_SkyHanni.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/org/polyfrost/chatting/mixin/compat/ChatTabsMixin_SkytilsCopyChat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.polyfrost.chatting.mixin.compat; | ||
|
||
import cc.polyfrost.oneconfig.utils.Notifications; | ||
import net.minecraft.client.gui.GuiScreen; | ||
import org.polyfrost.chatting.config.ChattingConfig; | ||
import org.spongepowered.asm.mixin.Dynamic; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Pseudo; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Pseudo | ||
@Mixin(targets = "gg.skytils.skytilsmod.features.impl.handlers.ChatTabs") | ||
public class ChatTabsMixin_SkytilsCopyChat { | ||
|
||
@Unique | ||
private static long chatting$lastNotify = System.currentTimeMillis(); | ||
|
||
@Dynamic("Skytils") | ||
@Redirect(method = "onAttemptCopy", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiScreen;isCtrlKeyDown()Z")) | ||
private boolean onAttemptCopy() { | ||
boolean isCtrlKeyDown = GuiScreen.isCtrlKeyDown(); | ||
if (!ChattingConfig.INSTANCE.getRightClickCopy() && isCtrlKeyDown) { | ||
if (System.currentTimeMillis() - chatting$lastNotify >= 1000) { | ||
Notifications.INSTANCE.send("Chatting", "Skytils' Copy Chat has been replaced by Chatting. You can configure this via OneConfig, by clicking the right shift key on your keyboard, or by typing /chatting in your chat."); | ||
chatting$lastNotify = System.currentTimeMillis(); | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
@Dynamic("Skytils") | ||
@Redirect(method = "onAttemptCopy", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiScreen;isShiftKeyDown()Z")) | ||
private boolean onAttemptCopyShift() { | ||
boolean isShiftKeyDown = GuiScreen.isShiftKeyDown(); | ||
if (!ChattingConfig.INSTANCE.getRightClickCopy() && isShiftKeyDown) { | ||
if (System.currentTimeMillis() - chatting$lastNotify >= 1000) { | ||
Notifications.INSTANCE.send("Chatting", "Skytils' Copy Chat has been replaced by Chatting. You can configure this via OneConfig, by clicking the right shift key on your keyboard, or by typing /chatting in your chat."); | ||
chatting$lastNotify = System.currentTimeMillis(); | ||
} | ||
} | ||
return false; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...xin/EssentialKeybindingRegistryMixin.java → ...pat/EssentialKeybindingRegistryMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters