mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Added Studio hotload command
- /iris studio hotload and its refresh alias reload the open Studio pack on Bukkit - Bukkit hotload refuses while Studio entry, pause or close is pending - Modded servers register the same hotload and refresh commands - Modded hotload reports busy while that Studio is already hotloading - Hotload messages and help entries are localized in every language file - Bukkit artifact verification reads the jar task output - Multiplexor takes the Bukkit artifact from the packedJar task - BukkitTestServer shares one-time registry setup across tests - Tests and a gameplay scenario cover both hotload commands
This commit is contained in:
1 parent
300ecbfc8b
commit
b3579e623a
37 files changed
+902
-52
No files matched your search
@@ -104,6 +104,7 @@ import java.util.function.Consumer;
|
||||
import art.arcane.iris.localization.IrisLanguage;
|
||||
import art.arcane.iris.localization.BukkitCommandMessages;
|
||||
import art.arcane.volmlib.util.localization.MessageArgument;
|
||||
import art.arcane.volmlib.util.localization.LanguageAudience;
|
||||
import art.arcane.iris.localization.BukkitCommandMessagesExtended;
|
||||
@Director(name = "studio", aliases = {"std", "s"}, description = "Studio Commands", descriptionKey = "iris.director.commandstudio.director.studio_commands")
|
||||
public class CommandStudio implements DirectorExecutor {
|
||||
@@ -203,6 +204,22 @@ public class CommandStudio implements DirectorExecutor {
|
||||
}));
|
||||
}
|
||||
|
||||
@Director(description = "Hotload the active Studio pack", descriptionKey = "iris.director.commandstudio.director.hotload_active_studio_pack", aliases = {"refresh"}, origin = DirectorOrigin.BOTH)
|
||||
public void hotload() {
|
||||
VolmitSender commandSender = sender();
|
||||
IrisProject project = Iris.service(StudioSVC.class).getActiveProject();
|
||||
PlatformChunkGenerator generator = project == null ? null : project.getActiveProvider();
|
||||
if (generator == null) {
|
||||
commandSender.sendMessage(IrisLanguage.text(BukkitCommandMessages.COMMAND_STUDIO_NO_OPEN_STUDIO_PROJECTS));
|
||||
return;
|
||||
}
|
||||
|
||||
UUID audience = LanguageAudience.current();
|
||||
commandSender.sendMessage(IrisLanguage.text(BukkitCommandMessages.COMMAND_STUDIO_HOTLOADING));
|
||||
generator.hotloadAsync().whenComplete((ignored, failure) ->
|
||||
LanguageAudience.run(audience, () -> sendHotloadResult(commandSender, failure)));
|
||||
}
|
||||
|
||||
@Director(description = "Toggle your Studio debug scoreboard", descriptionKey = "iris.director.commandstudio.director.toggle_your_studio_debug_scoreboard", aliases = {"board", "sidebar", "sb"}, origin = DirectorOrigin.PLAYER)
|
||||
public void scoreboard() {
|
||||
Player target = player();
|
||||
@@ -642,6 +659,16 @@ public class CommandStudio implements DirectorExecutor {
|
||||
sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STUDIO_DONE, MessageArgument.untrusted("value", report.getPath())));
|
||||
}
|
||||
|
||||
private void sendHotloadResult(VolmitSender commandSender, Throwable failure) {
|
||||
if (failure != null) {
|
||||
Iris.reportError(failure);
|
||||
commandSender.sendMessage(IrisLanguage.text(BukkitCommandMessages.COMMAND_STUDIO_HOTLOAD_FAILED,
|
||||
MessageArgument.untrusted("value", String.valueOf(failure.getMessage()))));
|
||||
return;
|
||||
}
|
||||
commandSender.sendMessage(IrisLanguage.text(BukkitCommandMessages.COMMAND_STUDIO_HOTLOADED));
|
||||
}
|
||||
|
||||
private PlatformChunkGenerator resolveProfileGenerator(IrisDimension dimension) {
|
||||
StudioSVC studioService = Iris.service(StudioSVC.class);
|
||||
if (studioService != null && studioService.isProjectOpen()) {
|
||||
|
||||
Reference in new issue
Block a user