diff options
author | syeyoung <cyong06@naver.com> | 2021-02-06 15:02:55 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-06 15:02:55 +0900 |
commit | 00ff33e33ee694845697f807760282c0ee22f3e5 (patch) | |
tree | 26b2160598de57aee0d1982c7e0172409b199342 /src/main/java/kr | |
parent | e7d6517b2e1fb4aa7a5993e53739006a3fca39c8 (diff) | |
download | Skyblock-Dungeons-Guide-00ff33e33ee694845697f807760282c0ee22f3e5.tar.gz Skyblock-Dungeons-Guide-00ff33e33ee694845697f807760282c0ee22f3e5.tar.bz2 Skyblock-Dungeons-Guide-00ff33e33ee694845697f807760282c0ee22f3e5.zip |
Bettuh cooldown and message
Diffstat (limited to 'src/main/java/kr')
3 files changed, 31 insertions, 2 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/e.java b/src/main/java/kr/syeyoung/dungeonsguide/e.java index a422c117..3666b4da 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/e.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/e.java @@ -10,10 +10,13 @@ import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.utils.AhUtils; import lombok.Getter; import net.minecraft.client.Minecraft; +import net.minecraft.command.ICommand; import net.minecraft.util.IChatComponent; import net.minecraftforge.client.ClientCommandHandler; +import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import org.apache.commons.io.IOUtils; @@ -25,6 +28,8 @@ import java.io.*; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; +import java.util.Map; +import java.util.Set; public class e implements c { @@ -55,7 +60,15 @@ public class e implements c { MinecraftForge.EVENT_BUS.register(new DungeonListener()); ClientCommandHandler.instance.registerCommand(commandDungeonsGuide = new CommandDungeonsGuide()); MinecraftForge.EVENT_BUS.register(commandDungeonsGuide); - ClientCommandHandler.instance.registerCommand(commandReparty = new CommandReparty()); + + commandReparty = new CommandReparty(); + if(!ClientCommandHandler.instance.getCommands().containsKey("rp")) { + ((Set<ICommand>) ObfuscationReflectionHelper.getPrivateValue(ClientCommandHandler.class, ClientCommandHandler.instance, "CommandSet")).add(commandReparty); + ((Map<String, ICommand>)ObfuscationReflectionHelper.getPrivateValue(ClientCommandHandler.class, ClientCommandHandler.instance, "CommandMap")).put("rp", commandReparty); + } + if (FeatureRegistry.ETC_REMOVE_REPARTY.isEnabled()) + ClientCommandHandler.instance.registerCommand(commandReparty); + MinecraftForge.EVENT_BUS.register(commandReparty); MinecraftForge.EVENT_BUS.register(new FeatureListener()); MinecraftForge.EVENT_BUS.register(new PacketListener()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index febb5e59..3db76f1d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -60,6 +60,7 @@ public class FeatureRegistry { public static final FeatureTooltipDungeonStat ETC_DUNGEONSTAT = register(new FeatureTooltipDungeonStat()); public static final FeatureTooltipPrice ETC_PRICE = register(new FeatureTooltipPrice()); public static final FeatureCooldownCounter ETC_COOLDOWN = register(new FeatureCooldownCounter()); + public static final SimpleFeature ETC_REMOVE_REPARTY = register(new SimpleFeature("ETC", "Remove Reparty Command From DG", "/rp will still work, Auto reparty will still work\nRequires Restart to get applied", "qol.noreparty")); public static final SimpleFeature FIX_SPIRIT_BOOTS = register(new SimpleFeature("fixes", "Spirit Boots Fixer", "Fix Spirit boots messing up with inventory", "fixes.spirit", true)); public static final FeatureDisableMessage FIX_MESSAGES = register(new FeatureDisableMessage()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java index 6547196c..ddad792e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java @@ -5,15 +5,19 @@ import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; +import kr.syeyoung.dungeonsguide.features.listener.GuiOpenListener; import kr.syeyoung.dungeonsguide.features.listener.TickListener; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.inventory.ContainerChest; +import net.minecraftforge.client.event.GuiOpenEvent; import org.lwjgl.opengl.GL11; import java.awt.*; -public class FeatureCooldownCounter extends GuiFeature implements DungeonQuitListener { +public class FeatureCooldownCounter extends GuiFeature implements DungeonQuitListener, GuiOpenListener { public FeatureCooldownCounter() { super("ETC", "Dungeon Cooldown Counter", "Counts 10 seconds after leaving dungeon", "qol.cooldown", true, getFontRenderer().getStringWidth("Cooldown: 10s "), getFontRenderer().FONT_HEIGHT); parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.white, "color")); @@ -44,4 +48,15 @@ public class FeatureCooldownCounter extends GuiFeature implements DungeonQuitLis public void onDungeonQuit() { leftDungeonTime = System.currentTimeMillis(); } + + @Override + public void onGuiOpen(GuiOpenEvent rendered) { + if (!(rendered.gui instanceof GuiChest)) return; + ContainerChest chest = (ContainerChest) ((GuiChest) rendered.gui).inventorySlots; + if (chest.getLowerChestInventory().getName().contains("On Cooldown!")) { + leftDungeonTime = System.currentTimeMillis(); + } else if (chest.getLowerChestInventory().getName().contains("Error")) { + leftDungeonTime = System.currentTimeMillis(); + } + } } |