Skip to content

Commit

Permalink
Add: Warnings for hot reload
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Nov 14, 2024
1 parent 723c3cf commit 2f62c91
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main/java/xyz/nifeather/morph/MorphPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import xyz.nifeather.morph.misc.integrations.modelengine.ModelEngineHelper;
import xyz.nifeather.morph.misc.integrations.placeholderapi.PlaceholderIntegration;
import xyz.nifeather.morph.misc.integrations.residence.ResidenceEventProcessor;
import xyz.nifeather.morph.misc.skins.PlayerSkinProvider;
import xyz.nifeather.morph.network.multiInstance.MultiInstanceService;
import xyz.nifeather.morph.network.server.MorphClientHandler;
import xyz.nifeather.morph.skills.MorphSkillHandler;
Expand Down Expand Up @@ -96,7 +95,7 @@ public String getNameSpace()
private EntityProcessor entityProcessor;

private static final String noticeHeaderFooter = "- x - x - x - x - x - x - x - x - x - x - x - x -";
private void printStartupWarning(boolean critical, String... warnings)
private void printImportantWarning(boolean critical, String... warnings)
{
if (critical)
{
Expand Down Expand Up @@ -134,7 +133,7 @@ public void onEnable()
String[] compatVersions = new String[] { primaryVersion, "1.21" };
if (Arrays.stream(compatVersions).noneMatch(bukkitVersion::equals))
{
printStartupWarning(
printImportantWarning(
true,
"This version of Minecraft (%s) is not supported!".formatted(bukkitVersion),
"Please use %s instead!".formatted(primaryVersion)
Expand All @@ -146,7 +145,7 @@ public void onEnable()

if (!bukkitVersion.equals(primaryVersion))
{
printStartupWarning(
printImportantWarning(
false,
"Minecraft %s is not primary supported!".formatted(bukkitVersion),
"We suggest to use %s instead!".formatted(primaryVersion)
Expand Down Expand Up @@ -269,6 +268,15 @@ public void crash(Throwable t)
@Override
public void onDisable()
{
if (!getServer().isStopping())
{
printImportantWarning(true,
"HEY, THERE!",
"Are you doing a hot reload?",
"Note that FeatherMorph does NOT support doing such!",
"Before you open any issues, please do a FULL RESTART for your server! We will NOT provide any support after the hot reload!");
}

//调用super.onDisable后依赖管理器会被清空
//需要在调用前先把一些东西处理好
try
Expand Down

0 comments on commit 2f62c91

Please sign in to comment.