-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(platform): add application platform
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
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
41 changes: 41 additions & 0 deletions
41
zmusic-core/src/main/java/me/zhenxin/zmusic/Application.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,41 @@ | ||
package me.zhenxin.zmusic; | ||
|
||
/** | ||
* 应用程序 | ||
* | ||
* @author 真心 | ||
* @since 2024/8/24 19:31 | ||
*/ | ||
public class Application { | ||
|
||
public static void main(String[] args) { | ||
System.out.println("这是一个 Minecraft 插件,请使用 Bukkit, BungeeCord 或 Velocity 来运行这个插件。"); | ||
System.out.println("This is Minecraft Plugin, Please use Bukkit, BungeeCord or Velocity to run this plugin."); | ||
System.out.println("按任意键打开 ZMusic 使用文档。"); | ||
System.out.println("Press any key to open ZMusic usage document."); | ||
|
||
String url = "https://zmusic.zhenxin.me"; | ||
try { | ||
System.in.read(); | ||
|
||
String os = System.getProperty("os.name").toLowerCase(); | ||
if (os.contains("win")) { | ||
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); | ||
} else if (os.contains("mac")) { | ||
Runtime.getRuntime().exec("open " + url); | ||
} else if (os.contains("nix") || os.contains("nux")) { | ||
String[] cmd = {"xdg-open", url}; | ||
Runtime.getRuntime().exec(cmd); | ||
} | ||
} catch (Exception e) { | ||
System.out.println("无法打开浏览器,请手动打开浏览器并访问 " + url); | ||
System.out.println("Can't open browser, Please open browser and visit " + url); | ||
System.out.println("按任意键退出。"); | ||
System.out.println("Press any key to exit."); | ||
try { | ||
System.in.read(); | ||
} catch (Exception ignored) { | ||
} | ||
} | ||
} | ||
} |