Multiple Features to improve ManiaControl usability (#234)

* ServerUIPropertiesMenu for Configurator to edit builtin UIProperties of MP

* fixed unregister-functions of CallbackManager

* Reducing menuItemHeight in Configurator to avoid overlapping of the menu items

* Fully rebuild the admins menu after a player rights changed

* Added function to FileUtil to improve realpath, so symbolic links can be resolved

* Fixed indentation

* Update FileUtil.php

Fixed error in case of an absolute path on Unix-like systems.

* New CallQueue which runs once inbetween the MC-loops

* Added important queued call to be executed earlier

* ErrorMethod made optional, as in some cases, there might be nothing to fail

* Clean up repository from unnecessary files

* Added easy installation script for DB on Unix-like systems

* Replaced deprecated is_real by is_float

* Add milliseconds with dot instead of double colon

* Resolved deprecated curly braces error

* gitignore all hidden files (except git and gitignore)

* Update MC-update-check-interval, so that a restart is not required

* Update gitignore to not ignore changes in MCTeam-Plugins

* Update gitignore again

* And another try

* fixed MasterAdmin //delrec, added personal /delrec-command with permission-setting

* Increase version number of local records plugin

* Add Permission to delete any record

* Reworked notifications of locals, removed private only, added private at rank

* Fix formatting

* Allow AuthenticationManager to store Plugin Permissions

* Method to check, if a named function call is already queued

* Added command disable feature

* Reset timer if DeltaTime updated, so it does not try to catch up missed timings

* Added private notification setting

* To reduce load of multiple records (especially in rounds), queue call chat notifications

* Added internal function to plugin manager to return plugin menu

* restore .idea codestyle files

* Update MC-Version number to 0.250
This commit is contained in:
axelalex2
2020-02-24 17:20:51 +01:00
committed by GitHub
parent 9252605be0
commit fa7ea9f4f3
18 changed files with 700 additions and 91 deletions

View File

@ -36,21 +36,22 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
* Constants
*/
const ID = 8;
const VERSION = 0.5;
const VERSION = 0.6;
const AUTHOR = 'MCTeam';
const NAME = 'Dedimania Plugin';
const MLID_DEDIMANIA = 'Dedimania.ManialinkId';
const SETTING_WIDGET_ENABLE = 'Enable Dedimania Widget';
const SETTING_WIDGET_TITLE = 'Widget Title';
const SETTING_WIDGET_POSX = 'Widget Position: X';
const SETTING_WIDGET_POSY = 'Widget Position: Y';
const SETTING_WIDGET_WIDTH = 'Widget Width';
const SETTING_WIDGET_LINE_COUNT = 'Widget Displayed Lines Count';
const SETTING_WIDGET_LINE_HEIGHT = 'Widget Line Height';
const SETTING_DEDIMANIA_CODE = '$l[http://dedimania.net/tm2stats/?do=register]Dedimania Code for ';
const SETTING_NOTIFY_BEST_RECORDS = 'Notify Publicly only for the X Best Records';
const SETTING_MAX_RECORDS = 'Max Records, only increase if you bought a rank update from Dedimania!';
const SETTING_WIDGET_ENABLE = 'Enable Dedimania Widget';
const SETTING_WIDGET_TITLE = 'Widget Title';
const SETTING_WIDGET_POSX = 'Widget Position: X';
const SETTING_WIDGET_POSY = 'Widget Position: Y';
const SETTING_WIDGET_WIDTH = 'Widget Width';
const SETTING_WIDGET_LINE_COUNT = 'Widget Displayed Lines Count';
const SETTING_WIDGET_LINE_HEIGHT = 'Widget Line Height';
const SETTING_DEDIMANIA_CODE = '$l[http://dedimania.net/tm2stats/?do=register]Dedimania Code for ';
const SETTING_NOTIFY_BEST_RECORDS_PUBLIC = 'Notify Publicly only for the X Best Records';
const SETTING_NOTIFY_BEST_RECORDS_PRIVATE = 'Notify Privately only for the X Best Records';
const SETTING_MAX_RECORDS = 'Max Records, only increase if you bought a rank update from Dedimania!';
const CB_DEDIMANIA_CHANGED = 'Dedimania.Changed';
const CB_DEDIMANIA_UPDATED = 'Dedimania.Updated';
@ -103,7 +104,8 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_WIDTH, 40);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_LINE_HEIGHT, 4);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_LINE_COUNT, 12);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_NOTIFY_BEST_RECORDS, 30);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_NOTIFY_BEST_RECORDS_PRIVATE, 30);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_NOTIFY_BEST_RECORDS_PUBLIC, 15);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAX_RECORDS, 30);
// Callbacks
@ -361,8 +363,6 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_DEDIMANIA_CHANGED, $newRecord);
$notifyOnlyBestRecords = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_NOTIFY_BEST_RECORDS);
// Announce record
if ($oldRecord->nullRecord || $newRecord->rank < $oldRecord->rank) {
// Gained rank
@ -372,21 +372,22 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$improvement = 'improved the';
}
if ($newRecord->rank <= $notifyOnlyBestRecords) {
$notifyOnlyBestRecordsPrivate = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_NOTIFY_BEST_RECORDS_PRIVATE);
$notifyOnlyBestRecordsPublic = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_NOTIFY_BEST_RECORDS_PUBLIC);
if ($newRecord->rank <= $notifyOnlyBestRecordsPublic) {
$notifyName = $player->nickname;
} else {
} elseif ($newRecord->rank <= $notifyOnlyBestRecordsPrivate) {
$notifyName = 'You';
}
$message = '$390$<$fff' . $notifyName . '$> ' . $improvement . ' $<$ff0' . $newRecord->rank . '.$> Dedimania Record: $<$fff' . Formatter::formatTime($newRecord->best) . '$>';
if (!$oldRecord->nullRecord) {
$message .= ' ($<$ff0' . $oldRecord->rank . '.$> $<$fff-' . Formatter::formatTime(($oldRecord->best - $recTime)) . '$>)';
}
if ($newRecord->rank <= $notifyOnlyBestRecords) {
if ($newRecord->rank <= $notifyOnlyBestRecordsPublic) {
$this->maniaControl->getChat()->sendInformation($message . '!');
} else {
} elseif ($newRecord->rank <= $notifyOnlyBestRecordsPrivate) {
$this->maniaControl->getChat()->sendInformation($message . '!', $player);
}