Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #101 from rettichlp/hotfix
Browse files Browse the repository at this point in the history
hotfix
  • Loading branch information
rettichlp committed Aug 4, 2022
2 parents 98e4073 + ed87275 commit 10b755b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'idea'
apply plugin: 'maven-publish'

version = '1.1.0'
version = '1.1.1'
group = 'com.rettichlp' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'UnicacityAddon'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
*/
public class UnicacityAddon extends LabyModAddon {

public static final String VERSION = "1.1.0";
public static final String VERSION = "1.1.1";
public static final Minecraft MINECRAFT = Minecraft.getMinecraft();
public static final LabyMod LABYMOD = LabyMod.getInstance();
public static UnicacityAddon ADDON;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
public class ACallCommand extends CommandBase {

final Timer timer = new Timer();
public static boolean isActive;

@Override @Nonnull public String getName() {
return "acall";
Expand All @@ -47,6 +48,7 @@ public class ACallCommand extends CommandBase {
.of("Syntax: " + getUsage(sender)).color(ColorCode.GRAY).advance()
.createComponent());

isActive = true;
p.sendChatMessage("/nummer " + args[0]);

timer.schedule(new TimerTask() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
public class ASMSCommand extends CommandBase {

final Timer timer = new Timer();
public static boolean isActive;

@Override @Nonnull public String getName() {
return "asms";
Expand All @@ -48,6 +49,7 @@ public class ASMSCommand extends CommandBase {
.of("Syntax: " + getUsage(sender)).color(ColorCode.GRAY).advance()
.createComponent());

isActive = true;
p.sendChatMessage("/nummer " + args[0]);

timer.schedule(new TimerTask() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.rettichlp.UnicacityAddon.base.abstraction.AbstractionLayer;
import com.rettichlp.UnicacityAddon.base.text.PatternHandler;
import com.rettichlp.UnicacityAddon.commands.ACallCommand;
import com.rettichlp.UnicacityAddon.commands.ASMSCommand;
import net.minecraft.client.Minecraft;
import net.minecraft.inventory.ContainerChest;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
Expand Down Expand Up @@ -57,7 +59,10 @@ public void onClientChatReceived(ClientChatReceivedEvent e) {
Matcher numberMatcher = PatternHandler.NUMBER_PATTERN.matcher(msg);
if (numberMatcher.find()) {
lastCheckedNumber = Integer.parseInt(numberMatcher.group(1));
e.setCanceled(true);
if (ACallCommand.isActive || ASMSCommand.isActive) {
e.setCanceled(true);
ACallCommand.isActive = ASMSCommand.isActive = false;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import org.lwjgl.input.Keyboard;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
* @author RettichLP
* @see <a href="https://github.com/paulzhng/UCUtils/blob/master/src/main/java/de/fuzzlemann/ucutils/events/AlternateScreenshotEventHandler.java">UCUtils by paulzhng</a>
*/
public class ScreenshotEventHandler {

private static long lastScreenshot;

@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent e) {
handleScreenshot();
Expand All @@ -36,7 +40,8 @@ public void onKeyboardInput(GuiScreenEvent.KeyboardInputEvent e) {
}

private void handleScreenshot() {
if (!KeyBindRegistry.addonScreenshot.isPressed()) return;
if (!Keyboard.isKeyDown(KeyBindRegistry.addonScreenshot.getKeyCode())) return;
if (System.currentTimeMillis() - lastScreenshot < TimeUnit.SECONDS.toMillis(1)) return;

try {
File newImageFile = FileManager.getNewImageFile();
Expand All @@ -57,6 +62,8 @@ private void handleScreenshot() {
} catch (IOException e) {
throw new RuntimeException(e);
}

lastScreenshot = System.currentTimeMillis();
}

private void uploadScreenshot(File screenshotFile) {
Expand Down

0 comments on commit 10b755b

Please sign in to comment.