From 21ec99c3e45e4557e228d026c148207b1227c14b Mon Sep 17 00:00:00 2001 From: syeyoung Date: Wed, 11 Aug 2021 15:43:43 +0900 Subject: - X Started playing skyblock alarm - Better Scrollbar - Modal Message - Inviting Friends in discord --- .../commands/CommandDungeonsGuide.java | 10 +- .../discord/inviteViewer/PartyJoinRequest.java | 1 - .../impl/discord/invteTooltip/MTooltipInvite.java | 128 +++++++++++++++++++++ .../invteTooltip/MTooltipInviteElement.java | 109 ++++++++++++++++++ .../impl/discord/onlinealarm/PlayingDGAlarm.java | 3 +- .../features/impl/etc/FeaturePenguins.java | 1 - .../party/customgui/FeatureCustomPartyFinder.java | 5 +- .../impl/party/customgui/PanelPartyFinder.java | 20 +++- .../party/customgui/PanelPartyFinderSettings.java | 58 ++++++++-- .../party/customgui/PanelPartyListElement.java | 8 +- .../java/kr/syeyoung/dungeonsguide/gui/MPanel.java | 2 +- .../dungeonsguide/gui/elements/MButton.java | 25 ++-- .../syeyoung/dungeonsguide/gui/elements/MList.java | 6 +- .../dungeonsguide/gui/elements/MModal.java | 15 ++- .../gui/elements/MModalConfirmation.java | 1 - .../dungeonsguide/gui/elements/MModalMessage.java | 77 +++++++++++++ .../dungeonsguide/gui/elements/MScrollBar.java | 73 +++++++----- .../gui/elements/MScrollablePanel.java | 6 +- .../dungeonsguide/rpc/RichPresenceManager.java | 2 - 19 files changed, 480 insertions(+), 70 deletions(-) create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInvite.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInviteElement.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalMessage.java (limited to 'src/main/java/kr/syeyoung/dungeonsguide') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java index d7759f92..85fa3d3f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java @@ -19,7 +19,10 @@ package kr.syeyoung.dungeonsguide.commands; import com.google.gson.JsonObject; +import com.sun.jna.Pointer; import kr.syeyoung.dungeonsguide.DungeonsGuide; +import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityActionType; +import kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct.IDiscordOverlayManager; import kr.syeyoung.dungeonsguide.rpc.JDiscordRelation; import kr.syeyoung.dungeonsguide.rpc.RichPresenceManager; import kr.syeyoung.dungeonsguide.SkyblockStatus; @@ -539,9 +542,10 @@ public class CommandDungeonsGuide extends CommandBase { System.out.println(stringBuilder.toString()); System.out.println(stringBuilder2.toString()); } else if (args[0].equals("IDKTEST")) { - for (Map.Entry longJDiscordRelationEntry : RichPresenceManager.INSTANCE.getRelationMap().entrySet()) { - System.out.println(longJDiscordRelationEntry.getValue()); - } + IDiscordOverlayManager iDiscordOverlayManager = RichPresenceManager.INSTANCE.getIDiscordCore().GetOverlayManager.getOverlayManager(RichPresenceManager.INSTANCE.getIDiscordCore()); + iDiscordOverlayManager.OpenActivityInvite.openActivityInvite(iDiscordOverlayManager, EDiscordActivityActionType.DiscordActivityActionType_Join, Pointer.NULL, (callbackData, result) -> { + + }); } else{ sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui")); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyJoinRequest.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyJoinRequest.java index b95da68a..de025698 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyJoinRequest.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyJoinRequest.java @@ -35,7 +35,6 @@ public class PartyJoinRequest { username = GameSDK.readString(discordUser.username); discriminator = GameSDK.readString(discordUser.discriminator); avatar = GameSDK.readString(discordUser.avatar); - System.out.println(username+"/"+discriminator+"/"+avatar); } private String username, discriminator, avatar; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInvite.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInvite.java new file mode 100644 index 00000000..253d0256 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInvite.java @@ -0,0 +1,128 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package kr.syeyoung.dungeonsguide.features.impl.discord.invteTooltip; + +import com.sun.jna.Pointer; +import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityActionType; +import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordRelationshipType; +import kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct.IDiscordActivityManager; +import kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct.IDiscordCore; +import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.gui.elements.*; +import kr.syeyoung.dungeonsguide.rpc.JDiscordRelation; +import kr.syeyoung.dungeonsguide.rpc.RichPresenceManager; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.GlStateManager; + +import java.awt.*; +import java.util.HashSet; +import java.util.Set; + +public class MTooltipInvite extends MModal { + private MScrollablePanel mScrollablePanel; + private MList list; + private MTextField search; + private MButton close; + private Set invited = new HashSet<>(); + public MTooltipInvite() { + setTitle("Invite Discord Friend"); + mScrollablePanel = new MScrollablePanel(1); + mScrollablePanel.setHideScrollBarWhenNotNecessary(true); + add(mScrollablePanel); + + list = new MList() { + @Override + public void resize(int parentWidth, int parentHeight) { + setSize(new Dimension(parentWidth, 9999)); + realignChildren(); + } + }; + list.setGap(1); + list.setDrawLine(true); + list.setGapLineColor(RenderUtils.blendAlpha(0x141414, 0.13f)); + mScrollablePanel.add(list); + mScrollablePanel.getScrollBarY().setWidth(5); + + search = new MTextField() { + @Override + public void edit(String str) { + super.edit(str); resetListContent(); + } + }; + search.setPlaceHolder("Search..."); + add(search); + + close = new MButton(); + close.setText("X"); + close.setBackground( RenderUtils.blendAlpha(0x141414, 0.20f)); + close.setHover( RenderUtils.blendAlpha(0x141414, 0.25f)); + close.setClicked( RenderUtils.blendAlpha(0x141414, 0.24f)); + close.setOnActionPerformed(this::close); + addSuper(close); + resetListContent(); + } + + @Override + public void onBoundsUpdate() { + super.onBoundsUpdate(); + Dimension effDim = getModalContent().getSize(); + search.setBounds(new Rectangle(5,2,effDim.width-10, 15)); + mScrollablePanel.setBounds(new Rectangle(10,18,effDim.width-20, effDim.height-25)); + close.setBounds(new Rectangle(getModalContent().getBounds().x + effDim.width-15,getModalContent().getBounds().y - 16,15,15)); + } + + @Override + public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { + GlStateManager.pushMatrix(); + super.render(absMousex, absMousey, relMousex0, relMousey0, partialTicks, scissor); + GlStateManager.popMatrix(); + + Dimension modalSize = getModalSize(); + Dimension effDim = getEffectiveDimension(); + int x = (effDim.width-modalSize.width)/2; + int y = (effDim.height - modalSize.height)/2; + GlStateManager.translate(x,y, 0); + } + + private void resetListContent() { + for (MPanel childComponent : list.getChildComponents()) { + list.remove(childComponent); + } + + String searchTxt = search.getText().trim().toLowerCase(); + for (JDiscordRelation value : RichPresenceManager.INSTANCE.getRelationMap().values()) { +// if (value.getDiscordActivity().getApplicationId() != 816298079732498473L) continue; + if (value.getDiscordRelationshipType() == EDiscordRelationshipType.DiscordRelationshipType_Blocked) continue; + if (!searchTxt.isEmpty() && !(value.getDiscordUser().getUsername().toLowerCase().contains(searchTxt))) continue; + list.add(new MTooltipInviteElement(value, invited.contains(value.getDiscordUser().getId()), this::invite)); + } + setBounds(getBounds()); + } + + public void invite(long id) { + invited.add(id); + IDiscordCore iDiscordCore = RichPresenceManager.INSTANCE.getIDiscordCore(); + IDiscordActivityManager iDiscordActivityManager = iDiscordCore.GetActivityManager.getActivityManager(iDiscordCore); + iDiscordActivityManager.SendInvite.sendInvite(iDiscordActivityManager, new DiscordSnowflake(id), EDiscordActivityActionType.DiscordActivityActionType_Join, "Dungeons Guide RPC Invite TESt", Pointer.NULL, (callbackData, result) -> { + System.out.println("Discord returned "+result+" For inviting "+id); + }); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInviteElement.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInviteElement.java new file mode 100644 index 00000000..4445f5a6 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInviteElement.java @@ -0,0 +1,109 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package kr.syeyoung.dungeonsguide.features.impl.discord.invteTooltip; + +import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.features.impl.discord.inviteViewer.ImageTexture; +import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.gui.elements.MButton; +import kr.syeyoung.dungeonsguide.rpc.JDiscordRelation; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.GlStateManager; + +import java.awt.*; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.function.Consumer; + +public class MTooltipInviteElement extends MPanel { + private JDiscordRelation relation; + private MButton invite; + public MTooltipInviteElement(JDiscordRelation jDiscordRelation, boolean invited, Consumer inviteCallback) { + this.relation = jDiscordRelation; + this.invite = new MButton(); + if (!invited) { + invite.setText("Invite"); + invite.setRoundness(2); + invite.setBorder(0xFF02EE67); + invite.setHover(RenderUtils.blendAlpha(0x141414, 0.2f)); + invite.setBackground(RenderUtils.blendAlpha(0x141414, 0.17f)); + invite.setForeground(new Color(0xFF02EE67)); + + invite.setOnActionPerformed(() -> { + if (invite.isEnabled()) + inviteCallback.accept(jDiscordRelation.getDiscordUser().getId()); + + invite.setText("Sent"); + invite.setRoundness(2); + invite.setHover(0); invite.setBorder(0); + invite.setBackground(0); invite.setDisabled(0); invite.setEnabled(false); + invite.setForeground(new Color(0xFF02EE67)); + }); + } else { + invite.setText("Sent"); + invite.setRoundness(2); + invite.setHover(0); + invite.setBackground(0); invite.setDisabled(0); invite.setEnabled(false); + invite.setForeground(new Color(0xFF02EE67)); + } + + add(invite); + } + + @Override + public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { + if (lastAbsClip.contains(absMousex, absMousey) && getTooltipsOpen() == 0) { + RenderUtils.drawRoundedRectangle(0,0,bounds.width, bounds.height, 3, Math.PI/8, RenderUtils.blendAlpha(0x141414, 0.17f)); + GlStateManager.enableTexture2D(); + } + + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + if (!relation.getDiscordUser().getAvatar().isEmpty()){ + String avatar = "https://cdn.discordapp.com/avatars/"+Long.toUnsignedString(relation.getDiscordUser().getId())+"/"+relation.getDiscordUser().getAvatar()+"."+(relation.getDiscordUser().getAvatar().startsWith("a_") ? "gif":"png"); + Future loadedImageFuture = FeatureRegistry.DISCORD_ASKTOJOIN.loadImage(avatar); + ImageTexture loadedImage = null; + if (loadedImageFuture.isDone()) { + try { + loadedImage = loadedImageFuture.get(); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + } + } + if (loadedImage != null) { + loadedImage.drawFrameAndIncrement( 3,3,bounds.height-6,bounds.height-6); + } else { + Gui.drawRect(3, 3, bounds.height - 6, bounds.height-6, 0xFF4E4E4E); + } + } + fr.drawString(relation.getDiscordUser().getUsername()+"#"+relation.getDiscordUser().getDiscriminator(), bounds.height,(bounds.height-fr.FONT_HEIGHT)/2, -1); + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(100, 20); + } + + @Override + public void onBoundsUpdate() { + invite.setBounds(new Rectangle(bounds.width-53,2,50,bounds.height-4)); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/onlinealarm/PlayingDGAlarm.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/onlinealarm/PlayingDGAlarm.java index d003b165..4f071e51 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/onlinealarm/PlayingDGAlarm.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/onlinealarm/PlayingDGAlarm.java @@ -95,7 +95,6 @@ public class PlayingDGAlarm extends SimpleFeature implements DiscordUserUpdateLi public void renderRequest(PlayerOnline online, int x, int y, int width, int height) { GlStateManager.pushMatrix(); - online.setEnd(System.currentTimeMillis()+600000); GlStateManager.translate(x,y,0); Gui.drawRect(0, 0,width,height, 0xFF23272a); @@ -154,7 +153,7 @@ public class PlayingDGAlarm extends SimpleFeature implements DiscordUserUpdateLi public void onDiscordUserUpdate(DiscordUserUpdateEvent event) { JDiscordRelation prev = event.getPrev(), current = event.getCurrent(); if (!isDisplayable(prev) && isDisplayable(current)) { - notif.add(new PlayerOnline(current, System.currentTimeMillis()+600000)); + notif.add(new PlayerOnline(current, System.currentTimeMillis()+3000)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java index 076fc0ce..f00a34d8 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java @@ -67,7 +67,6 @@ public class FeaturePenguins extends SimpleFeature implements PlayerRenderListen } @Override public void onTextureStitch(TextureStitchEvent event) { - System.out.println("STICH!"); if (event instanceof TextureStitchEvent.Pre) { objModel = null; ResourceLocation modelResourceLocation = new ResourceLocation("dungeonsguide:models/penguin.obj"); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java index 7a06911f..5e14fb13 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java @@ -36,7 +36,10 @@ public class FeatureCustomPartyFinder extends SimpleFeature implements GuiOpenLi @Getter @Setter - private String whitelist = "", blacklist = "", highlight =""; + private String whitelist = "", blacklist = "", highlight ="", blacklistClass = ""; + @Getter + @Setter + private int minimumCata; GuiCustomPartyFinder guiCustomPartyFinder; @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java index e699b99c..b73a2024 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java @@ -21,8 +21,10 @@ package kr.syeyoung.dungeonsguide.features.impl.party.customgui; import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfigV2; import kr.syeyoung.dungeonsguide.events.WindowUpdateEvent; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.features.impl.discord.invteTooltip.MTooltipInvite; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.*; +import kr.syeyoung.dungeonsguide.party.PartyManager; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import net.minecraft.client.Minecraft; @@ -58,7 +60,7 @@ public class PanelPartyFinder extends MPanel { private MButton previous; private MButton next; - private MButton settings; + private MButton settings, discordInvite; private int page = 1; private Map panelPartyListElementMap = new HashMap<>(); @@ -111,6 +113,21 @@ public class PanelPartyFinder extends MPanel { guiConfigV2.getRootConfigPanel().setCurrentPageAndPushHistory("ROOT."+ FeatureRegistry.PARTYKICKER_CUSTOM.getCategory()); Minecraft.getMinecraft().displayGuiScreen(guiConfigV2); }); + discordInvite = new MButton(); + discordInvite.setText("Invite Discord Friends"); + discordInvite.setOnActionPerformed(() -> { + if (PartyManager.INSTANCE.isAllowAskToJoin()) { + MTooltipInvite mTooltipInvite = new MTooltipInvite(); + mTooltipInvite.setScale( new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor()); + mTooltipInvite.open(this); + } else { + MModalMessage mTooltipInvite = new MModalMessage("Error", "You need to have Ask To Join Enabled to use this feature. Run /dg atj to enable ask to join", () -> {}); + mTooltipInvite.setScale( new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor()); + mTooltipInvite.open(this); + } + }); + discordInvite.setBackground(RenderUtils.blendAlpha(0xFF141414, 0.05f)); + add(discordInvite); add(settings); navigation = new MPanelScaledGUI() { @Override @@ -150,6 +167,7 @@ public class PanelPartyFinder extends MPanel { scrollablePanel.setBounds(new Rectangle(0, navigation.getBounds().y+navigation.getBounds().height, 3*bounds.width/5, bounds.height - (navigation.getBounds().y+navigation.getBounds().height))); goBack.setBounds(new Rectangle(0,0, fr.FONT_HEIGHT*2+20, fr.FONT_HEIGHT*2+20)); settings.setBounds(new Rectangle(bounds.width - 75, 0, 75, fr.FONT_HEIGHT*2+20)); + discordInvite.setBounds(new Rectangle(bounds.width-275, 0, 200, fr.FONT_HEIGHT*2+20)); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java index 509ee5c5..0d132648 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java @@ -21,6 +21,7 @@ package kr.syeyoung.dungeonsguide.features.impl.party.customgui; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.*; +import kr.syeyoung.dungeonsguide.utils.TextUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; @@ -36,14 +37,17 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumChatFormatting; import java.awt.*; +import java.util.HashSet; import java.util.List; +import java.util.Set; public class PanelPartyFinderSettings extends MPanelScaledGUI { private PanelPartyFinder panelPartyFinder; private MButton refresh = new MButton(), createNew = new MButton(), settings = new MButton(); - private MPassiveLabelAndElement filterCantjoin, filterWhitelistNote, filterBlacklistNote, plaeHighlightNote; private MToggleButton filterCantjoinButton; - private MTextField filterWhitelist, filterBlacklist, highlightNote; + private MPassiveLabelAndElement filterCantjoin, filterWhitelistNote, filterBlacklistNote, plaeHighlightNote, cataLv,blacklistClass; private MToggleButton filterCantjoinButton; + private MTextField filterWhitelist, filterBlacklist, highlightNote, blacklistClassTxt; + private MIntegerSelectionButton integerSelection; @Getter @Setter boolean delistable = false; @@ -98,21 +102,42 @@ public class PanelPartyFinderSettings extends MPanelScaledGUI { FeatureRegistry.PARTYKICKER_CUSTOM.setHighlight(str); } }; + blacklistClassTxt = new MTextField() { + @Override + public void edit(String str) { + super.edit(str); + FeatureRegistry.PARTYKICKER_CUSTOM.setBlacklistClass(str); + panelPartyFinder.onChestUpdate(null); + } + }; filterWhitelist.setText(FeatureRegistry.PARTYKICKER_CUSTOM.getWhitelist()); filterBlacklist.setText(FeatureRegistry.PARTYKICKER_CUSTOM.getBlacklist()); highlightNote.setText(FeatureRegistry.PARTYKICKER_CUSTOM.getHighlight()); + blacklistClassTxt.setText(FeatureRegistry.PARTYKICKER_CUSTOM.getBlacklistClass()); filterWhitelistNote = new MPassiveLabelAndElement("Whitelist Note", filterWhitelist); filterBlacklistNote = new MPassiveLabelAndElement("Blacklist Note", filterBlacklist); plaeHighlightNote = new MPassiveLabelAndElement("Highlight Note", highlightNote); + blacklistClass = new MPassiveLabelAndElement("Blacklist Class", blacklistClassTxt); filterWhitelistNote.setDivideRatio(0.5); filterBlacklistNote.setDivideRatio(0.5); plaeHighlightNote.setDivideRatio(0.5); + blacklistClass.setDivideRatio(0.5); add(filterWhitelistNote); add(filterBlacklistNote); add(plaeHighlightNote); + add(blacklistClass); + } + { + integerSelection = new MIntegerSelectionButton(FeatureRegistry.PARTYKICKER_CUSTOM.getMinimumCata()); + integerSelection.setOnUpdate(() -> { + FeatureRegistry.PARTYKICKER_CUSTOM.setMinimumCata(integerSelection.getData()); + panelPartyFinder.onChestUpdate(null); + }); + cataLv = new MPassiveLabelAndElement("Minimum Cata Lv", integerSelection); + cataLv.setDivideRatio(0.5); add(cataLv); } } @@ -197,18 +222,25 @@ public class PanelPartyFinderSettings extends MPanelScaledGUI { @Override public void onBoundsUpdate() { Dimension bounds = getEffectiveDimension(); - refresh.setBounds(new Rectangle(5,5,(bounds.width-10)/2,20)); - createNew.setBounds(new Rectangle(bounds.width/2,5,(bounds.width-10)/2,20)); - filterCantjoin.setBounds(new Rectangle(5,30,bounds.width-10,20)); - filterWhitelistNote.setBounds(new Rectangle(5,55,bounds.width-10,20)); - filterBlacklistNote.setBounds(new Rectangle(5,80,bounds.width-10,20)); - plaeHighlightNote.setBounds(new Rectangle(5,105,bounds.width-10,20)); - settings.setBounds(new Rectangle(5,130,bounds.width-10,20)); + refresh.setBounds(new Rectangle(5,5,(bounds.width-10)/2,15)); + createNew.setBounds(new Rectangle(bounds.width/2,5,(bounds.width-10)/2,15)); + filterCantjoin.setBounds(new Rectangle(5,22,bounds.width-10,15)); + filterWhitelistNote.setBounds(new Rectangle(5,39,bounds.width-10,15)); + filterBlacklistNote.setBounds(new Rectangle(5,56,bounds.width-10,15)); + plaeHighlightNote.setBounds(new Rectangle(5,73,bounds.width-10,15)); + cataLv.setBounds(new Rectangle(5,90,bounds.width-10,15)); + blacklistClass.setBounds(new Rectangle(5,107,bounds.width-10,15)); + settings.setBounds(new Rectangle(5,124,bounds.width-10,15)); } public boolean filter(ItemStack itemStack) { NBTTagCompound stackTagCompound = itemStack.getTagCompound(); String note = ""; + int dLV = 0; + Set invalidClasses = new HashSet<>(); + for (String s : blacklistClassTxt.getText().split(",")) { + invalidClasses.add(s.toLowerCase()); + } if (stackTagCompound.hasKey("display", 10)) { NBTTagCompound nbttagcompound = stackTagCompound.getCompoundTag("display"); @@ -221,9 +253,17 @@ public class PanelPartyFinderSettings extends MPanelScaledGUI { if (str.startsWith("§7§7Note:")) { note = str.substring(12); } + if (str.startsWith("§7Dungeon Level Required: §b")) { + dLV = Integer.parseInt(str.substring(28)); + } + if (str.startsWith(" ") && str.contains(":")) { + String clazz = TextUtils.stripColor(str).trim().split(" ")[1]; + if (invalidClasses.contains(clazz.toLowerCase())) return false; + } } } } + if (integerSelection.getData() >dLV) return false; if (!filterBlacklist.getText().isEmpty() && note.toLowerCase().contains(filterBlacklist.getText().toLowerCase())) return false; if (!filterWhitelist.getText().isEmpty() && !note.toLowerCase().contains(filterWhitelist.getText().toLowerCase())) return false; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java index f347c5d0..ba38c15e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java @@ -106,7 +106,7 @@ public class PanelPartyListElement extends MPanel { if (cantjoin) {} else if (clicked) { color = RenderUtils.blendAlpha(0x141414, 0.10f); - } else if (lastAbsClip.contains(absMousex, absMousey)) { + } else if (lastAbsClip.contains(absMousex, absMousey) && (getTooltipsOpen() == 0 || (mTooltip != null && mTooltip.isOpen()))) { color = RenderUtils.blendAlpha(0x141414, 0.12f); } if (cantjoin) {} @@ -150,7 +150,7 @@ public class PanelPartyListElement extends MPanel { fr.drawString(sideNote, 0,0,-1); GlStateManager.popMatrix(); - if (lastAbsClip.contains(absMousex, absMousey) && (mTooltip == null || !mTooltip.isOpen())) { + if (lastAbsClip.contains(absMousex, absMousey) && (mTooltip == null || !mTooltip.isOpen()) && getTooltipsOpen() == 0) { if (mTooltip != null) mTooltip.close(); List list = itemStack.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); for (int i = 0; i < list.size(); ++i) { @@ -183,7 +183,7 @@ public class PanelPartyListElement extends MPanel { boolean clicked = false; @Override public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (lastAbsClip.contains(absMouseX, absMouseY)) { + if (lastAbsClip.contains(absMouseX, absMouseY)&& (getTooltipsOpen() == 0 || (mTooltip != null && mTooltip.isOpen()))) { clicked = true; GuiChest chest = panelPartyFinder.getGuiCustomPartyFinder().getGuiChest(); @@ -198,7 +198,7 @@ public class PanelPartyListElement extends MPanel { @Override public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) { - if (lastAbsClip.contains(absMouseX, absMouseY)) { + if (lastAbsClip.contains(absMouseX, absMouseY) && (getTooltipsOpen() == 0 || (mTooltip != null && mTooltip.isOpen()))) { setCursor(EnumCursor.POINTING_HAND); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java index d7f3223f..d155b9d4 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java @@ -51,7 +51,7 @@ public class MPanel { @Setter protected MPanel parent; - private boolean debug = false; + private boolean debug; public void setBackgroundColor(Color c) { if (c == null) return; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java index 6f147472..1e9bcd0a 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java @@ -45,6 +45,7 @@ public class MButton extends MPanel { private int clicked = RenderUtils.blendAlpha(0xFF141414, 0.16f); private int border = 0x0; private int disabled =0xFF141414; + private int roundness = 0; private boolean enabled = true; @@ -55,19 +56,29 @@ public class MButton extends MPanel { Dimension bounds = getSize(); int bg = background; - if (getTooltipsOpen() > 0) { - } else if (!enabled) { + if (!enabled) { bg = disabled; + } else if (getTooltipsOpen() > 0) { } else if (isclicked) { bg = clicked; } else if (new Rectangle(new Point(0,0),bounds).contains(relMousex0, relMousey0)) { bg = hover; } - if (((border >> 24) & 0xFF) == 0) - Gui.drawRect(0,0,getBounds().width, getBounds().height, bg); - else { - Gui.drawRect(0, 0, getBounds().width, getBounds().height, border); - Gui.drawRect(1, 1, getBounds().width-1, getBounds().height-1, bg); + if (roundness == 0) { + if (((border >> 24) & 0xFF) == 0) + Gui.drawRect(0, 0, getBounds().width, getBounds().height, bg); + else { + Gui.drawRect(0, 0, getBounds().width, getBounds().height, border); + Gui.drawRect(1, 1, getBounds().width - 1, getBounds().height - 1, bg); + } + } else { + if (((border >> 24) & 0xFF) == 0) + RenderUtils.drawRoundedRectangle(0, 0, getBounds().width, getBounds().height, roundness, Math.PI/8, bg); + else { + RenderUtils.drawRoundedRectangle(0, 0, getBounds().width, getBounds().height, roundness, Math.PI/8, border); + RenderUtils.drawRoundedRectangle(1, 1, getBounds().width-2, getBounds().height-2, roundness, Math.PI/8, bg); + } + GlStateManager.enableTexture2D(); } FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj; int width = renderer.getStringWidth(getText()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java index 8823087e..cb755963 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java @@ -37,7 +37,8 @@ public class MList extends MPanel { realignChildren(); } - private final int gapLineColor = 0xFFFFFFFF; + @Getter @Setter + private int gapLineColor = 0xFFFFFFFF; public void realignChildren() { int y = 0; @@ -73,7 +74,8 @@ public class MList extends MPanel { for (int i = 1; i < getChildComponents().size(); i++) { MPanel panel = getChildComponents().get(i); Rectangle bound = panel.getBounds(); - Gui.drawRect(0, bound.y - gap, getBounds().width, bound.y, gapLineColor); + int top = bound.y - (int)Math.ceil(gap/2.0); + Gui.drawRect(0, top, getBounds().width, top + 1, gapLineColor); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModal.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModal.java index 71a13c93..be2c64d6 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModal.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModal.java @@ -30,6 +30,7 @@ import net.minecraft.client.renderer.GlStateManager; import java.awt.*; public class MModal extends MTooltip { + @Getter private MPanel modalContent = new MPanel(); @Getter @Setter @@ -50,8 +51,8 @@ public class MModal extends MTooltip { @Override - public void setBounds(Rectangle bounds) { - super.setBounds(bounds); + public void onBoundsUpdate() { + super.onBoundsUpdate(); Dimension effDim = getEffectiveDimension(); modalContent.setBounds(new Rectangle((effDim.width - modalSize.width)/2, (effDim.height - modalSize.height)/2 + 16, modalSize.width, modalSize.height-16)); @@ -64,15 +65,15 @@ public class MModal extends MTooltip { int x = (effDim.width-modalSize.width)/2; int y = (effDim.height - modalSize.height)/2; GlStateManager.translate(x,y, 0); - RenderUtils.drawRoundedRectangle(0,0,modalSize.width, modalSize.height, 10, Math.PI/8, RenderUtils.blendAlpha(0x141414, 0.20f)); + RenderUtils.drawRoundedRectangle(0,0,modalSize.width, modalSize.height, 3, Math.PI/8, RenderUtils.blendAlpha(0x141414, 0.20f)); Gui.drawRect(0,15, modalSize.width, 16, 0xFF02EE67); Gui.drawRect(0,16,modalSize.width, 26, RenderUtils.blendAlpha(0x141414, 0.1f)); - RenderUtils.drawRoundedRectangle(0,16,modalSize.width, modalSize.height-16, 10, Math.PI/8, RenderUtils.blendAlpha(0x141414, 0.1f)); + RenderUtils.drawRoundedRectangle(0,16,modalSize.width, modalSize.height-16, 3, Math.PI/8, RenderUtils.blendAlpha(0x141414, 0.1f)); GlStateManager.enableTexture2D(); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString(title, 10,(16-fr.FONT_HEIGHT)/2, -1); + fr.drawString(title, 5,(16-fr.FONT_HEIGHT)/2, -1); } @Override @@ -80,6 +81,10 @@ public class MModal extends MTooltip { modalContent.add(child); } + protected void addSuper(MPanel child) { + super.add(child); + } + @Override public void remove(MPanel panel) { modalContent.remove(panel); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalConfirmation.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalConfirmation.java index 238392ed..92f3b258 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalConfirmation.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalConfirmation.java @@ -67,7 +67,6 @@ public class MModalConfirmation extends MModal { @Override public void resize(int parentWidth, int parentHeight) { setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - System.out.println("Resized to "+parentWidth+"-"+parentHeight); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalMessage.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalMessage.java new file mode 100644 index 00000000..28d23d48 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalMessage.java @@ -0,0 +1,77 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package kr.syeyoung.dungeonsguide.gui.elements; + +import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import lombok.Getter; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class MModalMessage extends MModal { + private String content; + private Runnable callBackOk; + @Getter + private MButton yes; + public MModalMessage(String title, String content, Runnable callBackOk) { + super(); + setTitle(title); + this.content = content; + this.callBackOk = callBackOk; + this.yes = new MButton(); + yes.setText("Ok"); + yes.setOnActionPerformed(() -> { + close(); + if (callBackOk != null) callBackOk.run(); + }); + yes.setBackground(RenderUtils.blendAlpha(0x141414, 0.15f)); + yes.setHover(RenderUtils.blendAlpha(0x141414, 0.17f)); + + add(new MessageContent()); + } + + public class MessageContent extends MPanel { + public MessageContent() { + add(yes); + } + + @Override + public void resize(int parentWidth, int parentHeight) { + setBounds(new Rectangle(0,0,parentWidth, parentHeight)); + } + + @Override + public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { + GlStateManager.translate(5,5,0); + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + GL11.glDisable(GL11.GL_SCISSOR_TEST); + fr.drawSplitString(content, 0,0, MModalMessage.MessageContent.this.bounds.width-10, -1); + } + + @Override + public void setBounds(Rectangle bounds) { + super.setBounds(bounds); + yes.setBounds(new Rectangle(10,bounds.height-25,(bounds.width-20), 15)); + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java index 82e91dab..dbc30e7e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java @@ -43,34 +43,32 @@ public class MScrollBar extends MPanel { private int width = 10; public void setMax(int max) { + if (max < min) max = min; this.max = max; - current = MathHelper.clamp_int(current, min, max - thumbSize); - if (max - min < thumbSize) current = min; + current = MathHelper.clamp_int(current, min, max); if (onUpdate != null) onUpdate.run(); } public void setMin(int min) { + if (max < min) max = min; this.min = min; - current = MathHelper.clamp_int(current, min, max - thumbSize); - if (max - min < thumbSize) current = min; + current = MathHelper.clamp_int(current, min, max); if (onUpdate != null) onUpdate.run(); } public void setThumbSize(int thumbSize) { this.thumbSize = thumbSize; - current = MathHelper.clamp_int(current, min, max - thumbSize); - if (max - min < thumbSize) current = min; + current = MathHelper.clamp_int(current, min, max); if (onUpdate != null) onUpdate.run(); } public void addToCurrent(int dv) { int current2 = current + dv; - current = MathHelper.clamp_int(current2, min, max - thumbSize); - if (max - min < thumbSize) current = min; + current = MathHelper.clamp_int(current2, min, max); if (onUpdate != null) onUpdate.run(); } @@ -83,16 +81,16 @@ public class MScrollBar extends MPanel { @Getter @Setter private int background = RenderUtils.blendAlpha(0xFF141414, 0.04f), - thumb = RenderUtils.blendAlpha(0xFF141414, 0.08f), - thumbHover = RenderUtils.blendAlpha(0xFF141414, 0.09f), - thumbClick = RenderUtils.blendAlpha(0xFF141414, 0.14f); + thumb = RenderUtils.blendAlpha(0xFF141414, 0.14f), + thumbHover = RenderUtils.blendAlpha(0xFF141414, 0.15f), + thumbClick = RenderUtils.blendAlpha(0xFF141414, 0.20f); private Runnable onUpdate; public MScrollBar(int min, int max, int thumbSize, int current, Axis axis, Runnable onUpdate) { + if (max < min) max = min; this.min = min; this.min = max; this.thumbSize = thumbSize; this.current = current; this.axis = axis; - this.current = MathHelper.clamp_int(current, min, max - thumbSize); - if (max - min < thumbSize) this.current = min; + this.current = MathHelper.clamp_int(current, min, max); this.onUpdate = onUpdate; } @@ -106,13 +104,22 @@ public class MScrollBar extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { // RENDER SUPER NICE SCROLL BAR + int minimalThumbLen = 20; + Gui.drawRect(0,0,getBounds().width, getBounds().height, background); - double startPerc, endPerc; + int length = axis == Axis.X ? bounds.width :bounds.height; + int totalUnscaledLength = max-min + thumbSize; + double subPoint = ((double)max-min) * length / totalUnscaledLength; + if (length - subPoint < minimalThumbLen) { + subPoint = length - minimalThumbLen; + } + double thumbSize = length - subPoint; + + double startPt; if (max - min == 0) { - startPerc =0; endPerc = 1; + startPt =0; } else { - startPerc = (current - min)/((double)max - min); - endPerc = (current+thumbSize - min)/((double)max - min); + startPt = subPoint * (current - min)/((double)max - min); } int color = thumbHover; @@ -120,16 +127,14 @@ public class MScrollBar extends MPanel { if (grabbed) color = thumbClick; if (axis == Axis.X) { - int startX = (int) (startPerc * getBounds().width); - int endX = (int) (endPerc * getBounds().width); - endX = Math.max(endX, startX + 20); + int startX = (int) startPt; + int endX = (int) (startPt + thumbSize); Gui.drawRect(startX,0,endX,getBounds().height, color); lastThumbRect.x = startX; lastThumbRect.y = 0; lastThumbRect.width = endX - startX; lastThumbRect.height = getBounds().height; } else if (axis == Axis.Y) { - int startY = (int) (startPerc * getBounds().height); - int endY = (int) (endPerc * getBounds().height); - endY = Math.max(endY, startY + 20); + int startY = (int) startPt; + int endY = (int) (startPt + thumbSize); Gui.drawRect(0,startY,getBounds().width,endY, color); lastThumbRect.x = 0; lastThumbRect.y = startY; lastThumbRect.width = getBounds().width; lastThumbRect.height = endY - startY; @@ -153,21 +158,33 @@ public class MScrollBar extends MPanel { @Override public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) { if (!grabbed) return; + + int minimalThumbLen = 20; + + Gui.drawRect(0,0,getBounds().width, getBounds().height, background); + int length = axis == Axis.X ? bounds.width :bounds.height; + int totalUnscaledLength = max-min + thumbSize; + double subPoint = ((double)max-min) * length / totalUnscaledLength; + if (length - subPoint < minimalThumbLen) { + subPoint = length - minimalThumbLen; + } + double thumbSize = length - subPoint; + + + int dx = absMouseX - lastX, dy = absMouseY - lastY; lastX = absMouseX; lastY = absMouseY; int prevVal = current; - if (axis == Axis.Y) { - actualValue += dy * (max - min) / getBounds().height; + actualValue += dy * (max - min) / subPoint; } else if (axis == Axis.X) { - actualValue += dx * (max - min) / getBounds().width; + actualValue += dx * (max - min) / subPoint; } - current = MathHelper.clamp_int(actualValue, min, max - thumbSize); - if (max - min < thumbSize) current = min; + current = MathHelper.clamp_int(actualValue, min, max); if (onUpdate != null && prevVal != current) onUpdate.run(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java index d09b7c5a..d5f27227 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java @@ -125,9 +125,9 @@ public class MScrollablePanel extends MPanel { } contentAreaDim = new Rectangle(minX, minY, maxX - minX, maxY - minY); scrollBarX.setMin(contentAreaDim.x); - scrollBarX.setMax(contentAreaDim.x + contentAreaDim.width); + scrollBarX.setMax(contentAreaDim.x + contentAreaDim.width-scrollBarX.getThumbSize()); scrollBarY.setMin(contentAreaDim.y); - scrollBarY.setMax(contentAreaDim.y + contentAreaDim.height); + scrollBarY.setMax(contentAreaDim.y + contentAreaDim.height-scrollBarY.getThumbSize()); } @Override @@ -161,6 +161,8 @@ public class MScrollablePanel extends MPanel { scrollBarX.setThumbSize(viewPort.getBounds().width); scrollBarY.setThumbSize(viewPort.getBounds().height); + scrollBarX.setMax(contentAreaDim.x + contentAreaDim.width-scrollBarX.getThumbSize()); + scrollBarY.setMax(contentAreaDim.y + contentAreaDim.height-scrollBarY.getThumbSize()); evalulateContentArea(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/rpc/RichPresenceManager.java b/src/main/java/kr/syeyoung/dungeonsguide/rpc/RichPresenceManager.java index 23f8433d..523dbf2c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/rpc/RichPresenceManager.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/rpc/RichPresenceManager.java @@ -67,7 +67,6 @@ public class RichPresenceManager implements Runnable { public int setup() { System.out.println("SETUP!!! "+ iDiscordCore); if (iDiscordCore != null) { - System.out.println("DETROYED"); iDiscordCore.Destroy.destroy(iDiscordCore); activityManager = null; callbacks = null; relation_callbacks = null; relationMap.clear(); } @@ -123,7 +122,6 @@ public class RichPresenceManager implements Runnable { relation_callbacks.OnRelationshipUpdate = (p, rel) -> { JDiscordRelation jDiscordRelation = JDiscordRelation.fromJNA(rel); JDiscordRelation prev = relationMap.put(jDiscordRelation.getDiscordUser().getId(), jDiscordRelation); - System.out.println("Discord relation update!! "+jDiscordRelation); try { MinecraftForge.EVENT_BUS.post(new DiscordUserUpdateEvent(prev, jDiscordRelation)); } catch (Throwable t) { -- cgit