aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2020-12-18 11:20:18 -0500
committerMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2020-12-18 11:20:18 -0500
commit5805888e0c1dea9602122595cf74b35bf90d696d (patch)
treed6e2f5b8092db542cf01f467a7af5d6c7042d3bb
parent9aad7c40eb5fe681f05d995645122a1c33c7088a (diff)
downloadSkyblockMod-5805888e0c1dea9602122595cf74b35bf90d696d.tar.gz
SkyblockMod-5805888e0c1dea9602122595cf74b35bf90d696d.tar.bz2
SkyblockMod-5805888e0c1dea9602122595cf74b35bf90d696d.zip
Add a first launch message
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java29
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java7
2 files changed, 34 insertions, 2 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java
index 529c392..2035784 100644
--- a/src/main/java/me/Danker/DankersSkyblockMod.java
+++ b/src/main/java/me/Danker/DankersSkyblockMod.java
@@ -26,6 +26,7 @@ import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.event.ClickEvent;
import net.minecraft.event.ClickEvent.Action;
+import net.minecraft.event.HoverEvent;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.Container;
@@ -104,6 +105,7 @@ public class DankersSkyblockMod
static Entity livid = null;
public static double cakeTime;
public static double nextBonzoUse = 0;
+ public static boolean firstLaunch = false;
public static final ResourceLocation CAKE_ICON = new ResourceLocation("dsm", "icons/cake.png");
public static final ResourceLocation BONZO_ICON = new ResourceLocation("dsm", "icons/bonzo.png");
@@ -323,6 +325,33 @@ public class DankersSkyblockMod
// Update checker
@SubscribeEvent
public void onJoin(EntityJoinWorldEvent event) {
+
+ if (firstLaunch) {
+ firstLaunch = false;
+ ConfigHandler.writeBooleanConfig("misc", "firstLaunch", false);
+
+ IChatComponent chatComponent = new ChatComponentText(
+ EnumChatFormatting.GOLD + "Thank you for downloading Danker's Skyblock Mod.\n" +
+ "To get started, run the command " + EnumChatFormatting.GOLD + "/dsm" + EnumChatFormatting.RESET + " to view all the mod features."
+ );
+ chatComponent.setChatStyle(chatComponent.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText("Click to open the DSM menu."))).setChatClickEvent(new ClickEvent(Action.RUN_COMMAND, "/dsm")));
+
+ new Thread(()->{
+ while (true) {
+ if (Minecraft.getMinecraft().thePlayer == null) {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ continue;
+ }
+ Minecraft.getMinecraft().thePlayer.addChatMessage(chatComponent);
+ break;
+ }
+ }).start();
+ }
+
if (!updateChecked) {
updateChecked = true;
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index e09ccba..2822738 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -385,7 +385,9 @@ public class ConfigHandler {
if (!hasKey("misc", "skill50Time")) writeIntConfig("misc", "skill50Time", 3);
if (!hasKey("misc", "cakeTime")) writeDoubleConfig("misc", "cakeTime", 0);
if (!hasKey("misc", "showSkillTracker")) writeBooleanConfig("misc", "showSkillTracker", false);
-
+ if (!hasKey("misc", "firstLaunch")) writeBooleanConfig("misc", "firstLaunch", true);
+
+
ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft());
int height = scaled.getScaledHeight();
if (!hasKey("locations", "coordsX")) writeIntConfig("locations", "coordsX", 5);
@@ -666,7 +668,8 @@ public class ConfigHandler {
DankersSkyblockMod.SKILL_TIME = getInt("misc", "skill50Time") * 20;
DankersSkyblockMod.cakeTime = getDouble("misc", "cakeTime");
DankersSkyblockMod.showSkillTracker = getBoolean("misc", "showSkillTracker");
-
+ DankersSkyblockMod.firstLaunch = getBoolean("misc", "firstLaunch");
+
MoveCommand.coordsXY[0] = getInt("locations", "coordsX");
MoveCommand.coordsXY[1] = getInt("locations", "coordsY");
MoveCommand.displayXY[0] = getInt("locations", "displayX");