Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
vendor
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

33 changes: 0 additions & 33 deletions .idea/PMServerUI.iml

This file was deleted.

14 changes: 0 additions & 14 deletions .idea/discord.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

52 changes: 0 additions & 52 deletions .idea/php.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/phpspec.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/vcs.xml

This file was deleted.

2 changes: 1 addition & 1 deletion .poggit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/DavyCraft648/PMServerUI
--- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/Azvyl/PMServerUI
build-by-default: true
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2025 DavyCraft648
Copyright (c) 2026 Azvyl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ library that other plugins *include* in their code.
following command:

```bash
composer require davycraft648/pmserver-ui
composer require azvyl/pmserver-ui
```

After running the command, your `composer.json` file will be updated. You can inspect it to see the new dependency
Expand All @@ -42,7 +42,7 @@ library that other plugins *include* in their code.
{
"require": {
// other dependencies ...
"davycraft648/pmserver-ui": "^1.0"
"azvyl/pmserver-ui": "^2.0"
}
}
```
Expand All @@ -56,15 +56,15 @@ library that other plugins *include* in their code.
projects:
YourPlugin:
libs:
- src: DavyCraft648/PMServerUI/PMServerUI
version: ^1.0.2
- src: Azvyl/PMServerUI/PMServerUI
version: ^2.0.0
```

---

## Example Usage (For Developers)

See plugin example [here](https://github.com/DavyCraft648/PMServerUI-Example)
See plugin example [here](https://github.com/Azvyl/PMServerUI-Example)

---

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "davycraft648/pmserver-ui",
"name": "azvyl/pmserver-ui",
"description": "Integrate UI features available in the Script API to PocketMine-MP",
"type": "library",
"license": "MIT",
Expand All @@ -12,7 +12,7 @@
"extra": {
"virion": {
"spec": "3.0",
"namespace-root": "DavyCraft648\\PMServerUI"
"namespace-root": "Azvyl\\PMServerUI"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
<?php

/*
* PMServerUI
* https://github.com/DavyCraft648/PMServerUI
*
* Copyright (c) 2025 DavyCraft648
*
* Licensed under the MIT License.
* See LICENSE file in the project root for details.
*/

declare(strict_types=1);

namespace DavyCraft648\PMServerUI;
namespace Azvyl\PMServerUI;

use Azvyl\PMServerUI\ddui\DDUIManager;
use Azvyl\PMServerUI\ui\UIManager;
use pocketmine\plugin\Plugin;

final class PMServerUI{
Expand All @@ -23,19 +15,19 @@ private function __construct(){}
private static ?Plugin $plugin = null;
private static \PrefixedLogger $logger;
private static UIManager $uiManager;
public static bool $tl = false;
private static ?DDUIManager $dduiManager = null;

public static function register(Plugin $plugin, bool $tl = false): void{
public static function register(Plugin $plugin) : void{
if(self::$plugin instanceof Plugin){
throw new \InvalidArgumentException("{$plugin->getName()} tries to register PMServerUI that has been registered by " . self::$plugin->getName());
return;
}

self::$plugin = $plugin;
self::$logger = new \PrefixedLogger($plugin->getLogger(), "PMServerUI");
self::$uiManager = new UIManager($plugin);
self::$dduiManager = new DDUIManager($plugin);

//TODO: make options easier to configure.
self::$tl = $tl;
//crash on unhandled error.
//kick player sending malformed response.
//validate response length before performing json_decode.
Expand All @@ -44,20 +36,24 @@ public static function register(Plugin $plugin, bool $tl = false): void{
//disable player input.
//enforce string dropdown.

if(__NAMESPACE__ === "DavyCraft648\\PMServerUI"){
if(__NAMESPACE__ === "Azvyl\\PMServerUI"){
self::getLogger()->notice("It is recommended to shade virions, go to https://poggit.pmmp.io/virion to see virion documentation.");
}
}

public static function getPlugin(): Plugin{
public static function getPlugin() : Plugin{
return self::$plugin ?? throw new \LogicException("PMServerUI has not been registered");
}

public static function getLogger(): \PrefixedLogger{
public static function getLogger() : \PrefixedLogger{
return self::$logger ?? throw new \LogicException("PMServerUI has not been registered");
}

public static function getUIManager(): UIManager{
public static function getUIManager() : UIManager{
return self::$uiManager ?? throw new \LogicException("PMServerUI has not been registered");
}

public static function getDDUIManager() : DDUIManager{
return self::$dduiManager ?? throw new \LogicException("PMServerUI has not been registered");
}
}
Loading