Skip to content

Commit 34e57ed

Browse files
committed
v1.0.0
1 parent 9fc0504 commit 34e57ed

8 files changed

Lines changed: 332 additions & 2 deletions

File tree

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
!**/src/main/**/target/
4+
!**/src/test/**/target/
5+
.kotlin
6+
7+
### IntelliJ IDEA ###
8+
.idea/modules.xml
9+
.idea/jarRepositories.xml
10+
.idea/compiler.xml
11+
.idea/libraries/
12+
*.iws
13+
*.iml
14+
*.ipr
15+
16+
### Eclipse ###
17+
.apt_generated
18+
.classpath
19+
.factorypath
20+
.project
21+
.settings
22+
.springBeans
23+
.sts4-cache
24+
25+
### NetBeans ###
26+
/nbproject/private/
27+
/nbbuild/
28+
/dist/
29+
/nbdist/
30+
/.nb-gradle/
31+
build/
32+
!**/src/main/**/build/
33+
!**/src/test/**/build/
34+
35+
### VS Code ###
36+
.vscode/
37+
38+
### Mac OS ###
39+
.DS_Store

README.md

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,69 @@
1-
# profileUI
2-
ProfileUI For PowerNukkitX
1+
ProfileUI
2+
=========
3+
4+
**Description:** ProfileUI shows player information in a clean UI inside PowerNukkitX.
5+
6+
**Version:** 1.0.0
7+
8+
**Author:** Wenox
9+
10+
**Website:** https://pixelforgestudios.pages.dev/
11+
12+
**Features:**
13+
- **Player Profile UI:** Open a user-friendly UI to view player information.
14+
- **Simple Command:** One command to open the UI with an alias.
15+
- **Soft-dependencies:** Integrates with `EconomyAPI` and `LlamaEconomy` when available.
16+
17+
**Requirements:**
18+
- PowerNukkitX (API compatibility: `2.0.0` declared in `plugin.yml`).
19+
- Java & Maven (to build from source).
20+
21+
**Installation**
22+
- Download the compiled JAR and place it in your server's `plugins/` folder.
23+
- Restart the server or run a plugin reload command supported by your server.
24+
25+
**Usage**
26+
- **Command:** `profileui` — Opens the Profile UI for the player who runs it.
27+
- **Alias:** `pui`
28+
- **Usage:** `/profileui`
29+
- **Permission:** `profileui.permission`
30+
31+
Note: The command is implemented in `src/main/java/org/pixelforge/profileui/command/profileCommand.java`.
32+
33+
**API / Integration**
34+
- Public helper class: `org.pixelforge.profileui.API` (see `src/main/java/org/pixelforge/profileui/API.java`).
35+
- Soft-depends on `EconomyAPI` and `LlamaEconomy` (optional features enabled when present).
36+
37+
**Configuration**
38+
- This plugin does not ship with an external config by default. If you need custom behavior, consider extending the plugin or opening an issue.
39+
40+
**Development**
41+
- Clone the repo and run `mvn package`.
42+
- Ensure you use a JDK compatible with your Nukkit server and a matching Nukkit API version.
43+
44+
**License & Credits**
45+
- See the `LICENSE` file included in this repository.
46+
- Author: Wenox — Project site: https://pixelforgestudios.pages.dev/
47+
48+
**Support**
49+
- For issues or feature requests, open an issue on the repository or contact the author via the project website.
50+
51+
**Roadmap / Future Plans**
52+
53+
- **Configurable UI:** Allow server owners to customize which fields appear in the profile UI, order, labels, and visual options via a `config.yml`.
54+
- Implementation notes: provide a default `config.yml`, load settings in `Main`, and make `ProfileUI` read from the config.
55+
56+
- **Rank System Integration:** Add optional rank display and basic rank management hooks (support for existing rank plugins or built-in lightweight ranks).
57+
- Implementation notes: add hooks for common rank plugins (e.g., PurePerms) and an internal API to display rank name/icon in the UI.
58+
59+
- **Clan/Guild Support:** Show clan membership in the profile and provide clan-related actions (view clan, invite, leave) when supported.
60+
- Implementation notes: design a `ClanService` interface with adapters for popular clan plugins; fallback to disabled if none present.
61+
62+
- **Extended Economy Features:** Deeper integration with `EconomyAPI` and `LlamaEconomy` to show balances, transaction shortcuts, or donation links.
63+
64+
- **Permissions Granularity:** Add additional permission nodes for features (e.g., `profileui.view.others`, `profileui.clan.manage`).
65+
- **Localization:** Make all UI text localizable via language files.
66+
67+
- **Optional Database Support:** Add lightweight SQLite/MySQL support to persist extended profile data (notes, custom tags).
68+
69+
---

pom.xml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.pixelforge.profileui</groupId>
8+
<artifactId>profileUI</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>21</maven.compiler.source>
13+
<maven.compiler.target>21</maven.compiler.target>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<repositories>
18+
<repository>
19+
<id>central</id>
20+
<url>https://repo.maven.apache.org/maven2/</url>
21+
</repository>
22+
<repository>
23+
<id>jitpack.io</id>
24+
<url>https://www.jitpack.io</url>
25+
</repository>
26+
<repository>
27+
<id>opencollab-repository-maven-releases</id>
28+
<name>Opencollab Repository releases</name>
29+
<url>https://repo.opencollab.dev/maven-releases</url>
30+
</repository>
31+
<repository>
32+
<id>opencollab-repository-maven-snapshots</id>
33+
<name>Opencollab Repository snapshots</name>
34+
<url>https://repo.opencollab.dev/maven-snapshots</url>
35+
</repository>
36+
<repository>
37+
<id>PowerNukkitX-releases</id>
38+
<name>PowerNukkitX Repository</name>
39+
<url>https://repo.powernukkitx.org/releases</url>
40+
</repository>
41+
</repositories>
42+
43+
<dependencies>
44+
<dependency>
45+
<groupId>org.powernukkitx</groupId>
46+
<artifactId>server</artifactId>
47+
<version>2.0.0-SNAPSHOT</version>
48+
<scope>provided</scope>
49+
</dependency>
50+
51+
<dependency>
52+
<groupId>net.lldv.llamaeconomy</groupId>
53+
<artifactId>LlamaEconomy</artifactId>
54+
<version>1.0.0-SNAPSHOT</version>
55+
<scope>system</scope>
56+
<systemPath>${project.basedir}/lib/LlamaEconomy-1.0.0.jar</systemPath>
57+
</dependency>
58+
59+
<dependency>
60+
<groupId>ayd1ndemirci.EconomyAPI</groupId>
61+
<artifactId>EconomyAPI</artifactId>
62+
<version>1.0.0-SNAPSHOT</version>
63+
<scope>system</scope>
64+
<systemPath>${project.basedir}/lib/EconomyAPI-1.0.0-SNAPSHOT.jar</systemPath>
65+
</dependency>
66+
67+
</dependencies>
68+
69+
<build>
70+
<plugins>
71+
<plugin>
72+
<groupId>org.apache.maven.plugins</groupId>
73+
<artifactId>maven-shade-plugin</artifactId>
74+
<version>3.4.1</version>
75+
<executions>
76+
<execution>
77+
<phase>package</phase>
78+
<goals>
79+
<goal>shade</goal>
80+
</goals>
81+
</execution>
82+
</executions>
83+
</plugin>
84+
</plugins>
85+
</build>
86+
87+
</project>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package org.pixelforge.profileui;
2+
3+
import cn.nukkit.Player;
4+
import erila.EconomyAPI.api.EconomyAPI;
5+
import net.lldv.llamaeconomy.LlamaEconomy;
6+
7+
import java.time.Instant;
8+
import java.time.ZoneId;
9+
import java.time.ZonedDateTime;
10+
import java.time.format.DateTimeFormatter;
11+
12+
public class API {
13+
14+
public static String getCoords(Player player) {
15+
int x = (int) player.getPosition().getX();
16+
int y = (int) player.getPosition().getY();
17+
int z = (int) player.getPosition().getZ();
18+
19+
return "§rPosition : §a" + x + " " + y + " " + z;
20+
}
21+
22+
public static String getFormattedFirstPlayedDate(Player player) {
23+
long firstPlayedSeconds = player.getFirstPlayed();
24+
long firstPlayedMillis = firstPlayedSeconds * 1000L;
25+
26+
Instant instant = Instant.ofEpochMilli(firstPlayedMillis);
27+
ZonedDateTime dateTime = instant.atZone(ZoneId.systemDefault());
28+
29+
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM d, yyyy HH:mm:ss");
30+
31+
return dateTime.format(formatter);
32+
}
33+
34+
public static int getMoney(Player player) {
35+
if (Main.instance.getServer().getPluginManager().getPlugin("LlamaEconomy") != null) {
36+
return (int) LlamaEconomy.getAPI().getMoney(player);
37+
}
38+
39+
if (Main.instance.getServer().getPluginManager().getPlugin("EconomyAPI") != null) {
40+
return EconomyAPI.getMoney(player.getName());
41+
}
42+
43+
return 0;
44+
}
45+
}
46+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package org.pixelforge.profileui;
2+
3+
import org.pixelforge.profileui.command.profileCommand;
4+
import cn.nukkit.plugin.PluginBase;
5+
6+
public class Main extends PluginBase {
7+
8+
public static Main instance;
9+
10+
@Override
11+
public void onEnable() {
12+
instance = this;
13+
getLogger().info("§aProfileUI Plugin Enabled");
14+
this.getServer().getCommandMap().register("profileui", new profileCommand());
15+
}
16+
17+
@Override
18+
public void onDisable() {
19+
getLogger().info("§cProfileUI Plugin Disabled");
20+
}
21+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package org.pixelforge.profileui.command;
2+
3+
import cn.nukkit.Player;
4+
import cn.nukkit.command.Command;
5+
import cn.nukkit.command.CommandSender;
6+
import org.pixelforge.profileui.form.ProfileUI;
7+
8+
public class profileCommand extends Command {
9+
10+
public profileCommand() {
11+
super("profileui", "Open Profile UI", "/profileui", new String[]{"pui"});
12+
this.setPermission("profileui.permission");
13+
}
14+
15+
@Override
16+
public boolean execute(CommandSender sender, String label, String[] args) {
17+
ProfileUI.openProfileUI((Player) sender);
18+
return true;
19+
}
20+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.pixelforge.profileui.form;
2+
3+
import cn.nukkit.Player;
4+
import cn.nukkit.form.element.simple.ButtonImage;
5+
import cn.nukkit.form.window.SimpleForm;
6+
import cn.nukkit.utils.TextFormat;
7+
import org.pixelforge.profileui.API;
8+
9+
import java.time.LocalDateTime;
10+
import java.time.format.DateTimeFormatter;
11+
12+
public class ProfileUI {
13+
14+
public static void openProfileUI(Player player) {
15+
String playerName = player.getName();
16+
int ping = player.getPing();
17+
int exp = player.getExperienceLevel();
18+
String cods = API.getCoords(player);
19+
double money = API.getMoney(player);
20+
String firstJoin = API.getFormattedFirstPlayedDate(player);
21+
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM d, yyyy HH:mm:ss");
22+
23+
String content = "This is your profile on the server:\n\n" +
24+
TextFormat.WHITE + LocalDateTime.now().format(formatter) + "\n" +
25+
TextFormat.WHITE + "Name : " + TextFormat.GREEN + playerName + "\n" +
26+
TextFormat.WHITE + "Money : " + TextFormat.GREEN + money + "\n" +
27+
TextFormat.WHITE + "Ping : " + TextFormat.GREEN + ping + "\n" +
28+
TextFormat.WHITE + "Experience : " + TextFormat.GREEN + exp + "\n" +
29+
TextFormat.WHITE + cods + "\n" +
30+
TextFormat.WHITE + "First Join : " + TextFormat.GREEN + firstJoin;
31+
32+
SimpleForm form = new SimpleForm("§l§cYOUR PROFILE", content)
33+
.addButton("§l§cEXIT", ButtonImage.Type.PATH.of("textures/blocks/barrier"));
34+
form.send(player);
35+
}
36+
}

src/main/resources/plugin.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: ProfileUI
2+
main: org.pixelforge.profileui.Main
3+
version: "1.0.0"
4+
api: [ "2.0.0" ]
5+
author: Wenox
6+
7+
description: ProfileUI show player information in a UI.
8+
website: https://pixelforgestudios.pages.dev/
9+
softdepend: ["EconomyAPI", "LlamaEconomy"]
10+
11+
permissions:
12+
profileui.permission:
13+
description: Allows a player to open the Profile UI
14+
default: op

0 commit comments

Comments
 (0)