-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
LotuxPunk
committed
Oct 16, 2018
1 parent
e288a43
commit 95b717b
Showing
4 changed files
with
48 additions
and
1 deletion.
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
33 changes: 33 additions & 0 deletions
33
src/main/java/com/vandendaelen/handles/event/CommonEvent.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,33 @@ | ||
package com.vandendaelen.handles.event; | ||
|
||
import com.vandendaelen.handles.utils.Reference; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.util.text.TextComponentString; | ||
import net.minecraft.util.text.TextFormatting; | ||
import net.minecraft.util.text.event.ClickEvent; | ||
import net.minecraft.util.text.event.HoverEvent; | ||
import net.minecraftforge.common.ForgeVersion; | ||
import net.minecraftforge.fml.common.Loader; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.fml.common.gameevent.PlayerEvent; | ||
|
||
@Mod.EventBusSubscriber(modid = Reference.MODID) | ||
public class CommonEvent { | ||
@SubscribeEvent | ||
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent e){ | ||
EntityPlayer player = e.player; | ||
if (!player.world.isRemote){ | ||
ForgeVersion.CheckResult version = ForgeVersion.getResult(Loader.instance().activeModContainer()); | ||
if (version.status == ForgeVersion.Status.OUTDATED){ | ||
TextComponentString url = new TextComponentString(TextFormatting.DARK_AQUA + TextFormatting.BOLD.toString() + "UPDATE"); | ||
url.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://minecraft.curseforge.com/projects/handles")); | ||
url.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString("Open link"))); | ||
|
||
player.sendMessage(new TextComponentString(TextFormatting.DARK_RED + "[Handles] : ").appendSibling(url)); | ||
String changes = String.valueOf(version.changes).replace("{" + version.target + "=", "").replace("}", ""); | ||
player.sendMessage(new TextComponentString(TextFormatting.DARK_AQUA + "Changelog: " + TextFormatting.AQUA + changes)); | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"homepage": "https://minecraft.curseforge.com/projects/k9-mod", | ||
"promos": { | ||
"1.12.2-latest": "1.12.2-1.1.2.0", | ||
"1.12.2-recommended": "1.12.2-1.1.2.0" | ||
}, | ||
"1.12.2": { | ||
"1.12.2-1.1.1.1": "First release, fix crash at launch", | ||
"1.12.2-1.1.2.0": "New methods, Forge Update Checker" | ||
} | ||
} |