error fixes
This commit is contained in:
parent
d3cc9db29c
commit
79a771583e
@ -48,9 +48,13 @@ if (LOG_WRITE_CURRENT_FILE) {
|
|||||||
function logMessage($message) {
|
function logMessage($message) {
|
||||||
$message .= PHP_EOL;
|
$message .= PHP_EOL;
|
||||||
if (defined('LOG_CURRENT_FILE')) {
|
if (defined('LOG_CURRENT_FILE')) {
|
||||||
file_put_contents(LOG_CURRENT_FILE, $message, FILE_APPEND);
|
if(!file_put_contents(LOG_CURRENT_FILE, $message, FILE_APPEND)){
|
||||||
|
echo "Logfile not Write-able, please check your file Permissions";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!file_put_contents(LOG_FILE, $message, FILE_APPEND)){
|
||||||
|
echo "Logfile not Write-able, please check your file Permissions";
|
||||||
}
|
}
|
||||||
file_put_contents(LOG_FILE, $message, FILE_APPEND);
|
|
||||||
echo $message;
|
echo $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,9 +141,11 @@ class CommandManager implements CallbackListener {
|
|||||||
|
|
||||||
if ($command == 'admin') {
|
if ($command == 'admin') {
|
||||||
// Strip 'admin' keyword
|
// Strip 'admin' keyword
|
||||||
|
if (isset($commandArray[1])) {
|
||||||
$command = $commandArray[1];
|
$command = $commandArray[1];
|
||||||
unset($commandArray[1]);
|
unset($commandArray[1]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
unset($commandArray[0]);
|
unset($commandArray[0]);
|
||||||
|
|
||||||
// Compose uniformed message
|
// Compose uniformed message
|
||||||
|
@ -215,7 +215,7 @@ class Client
|
|||||||
while(strlen($contents) < 8){
|
while(strlen($contents) < 8){
|
||||||
$newContent = fread($this->socket, 8 - strlen($contents));
|
$newContent = fread($this->socket, 8 - strlen($contents));
|
||||||
//var_dump($contents, $newContent, strlen($contents));
|
//var_dump($contents, $newContent, strlen($contents));
|
||||||
if(strlen($newContent) == 0){
|
if(strlen($newContent) === false){
|
||||||
var_dump("deb1 transport error" . $contents);
|
var_dump("deb1 transport error" . $contents);
|
||||||
throw new FatalException('deb1 transport error - connection interrupted!' . $contents, FatalException::INTERRUPTED);
|
throw new FatalException('deb1 transport error - connection interrupted!' . $contents, FatalException::INTERRUPTED);
|
||||||
}
|
}
|
||||||
|
@ -86,9 +86,14 @@ class PlayerActions {
|
|||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_PLAYER);
|
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_PLAYER);
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
|
if ($e->getMessage() == 'There are too many players') {
|
||||||
|
$this->maniaControl->chat->sendError("Too many Spectators");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
|
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
|
||||||
$this->maniaControl->errorHandler->triggerDebugNotice("PlayerActions Debug Line 90: " . $e->getMessage());
|
$this->maniaControl->errorHandler->triggerDebugNotice("PlayerActions Debug Line 90: " . $e->getMessage());
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,13 +197,14 @@ class PlayerActions {
|
|||||||
if ($e->getMessage() == 'The player is not a spectator') {
|
if ($e->getMessage() == 'The player is not a spectator') {
|
||||||
$this->kickPlayer($adminLogin, $targetLogin, 'Disconnect');
|
$this->kickPlayer($adminLogin, $targetLogin, 'Disconnect');
|
||||||
$this->maniaControl->errorHandler->triggerDebugNotice("inaktiv spec player kicked " . $e->getMessage());
|
$this->maniaControl->errorHandler->triggerDebugNotice("inaktiv spec player kicked " . $e->getMessage());
|
||||||
}
|
} else {
|
||||||
$this->maniaControl->errorHandler->triggerDebugNotice("PlayerActions Debug Line 183: " . $e->getMessage());
|
$this->maniaControl->errorHandler->triggerDebugNotice("PlayerActions Debug Line 183: " . $e->getMessage());
|
||||||
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
|
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
|
||||||
//do nothing
|
//do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UnMute a Player
|
* UnMute a Player
|
||||||
|
@ -723,10 +723,12 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$this->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
|
$this->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
|
||||||
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
|
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
|
if ($e->getMessage() != 'Login unknown.') {
|
||||||
//do nothing
|
//do nothing
|
||||||
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
|
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
|
||||||
$this->maniaControl->errorHandler->triggerDebugNotice("PlayerList Debug Line 727: " . $e->getMessage());
|
$this->maniaControl->errorHandler->triggerDebugNotice("PlayerList Debug Line 727: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case self::ACTION_KICK_PLAYER_VOTE:
|
case self::ACTION_KICK_PLAYER_VOTE:
|
||||||
|
@ -196,7 +196,9 @@ class StatisticManager {
|
|||||||
case self::SPECIAL_STAT_KD_RATIO:
|
case self::SPECIAL_STAT_KD_RATIO:
|
||||||
$kills = $this->getStatsRanking(StatisticCollector::STAT_ON_KILL, $serverIndex);
|
$kills = $this->getStatsRanking(StatisticCollector::STAT_ON_KILL, $serverIndex);
|
||||||
$deaths = $this->getStatsRanking(StatisticCollector::STAT_ON_DEATH, $serverIndex);
|
$deaths = $this->getStatsRanking(StatisticCollector::STAT_ON_DEATH, $serverIndex);
|
||||||
|
if(!$kills || !$deaths){
|
||||||
|
return array();
|
||||||
|
}
|
||||||
foreach($deaths as $key => $death) {
|
foreach($deaths as $key => $death) {
|
||||||
if ($death == 0 || !isset($kills[$key])) {
|
if ($death == 0 || !isset($kills[$key])) {
|
||||||
continue;
|
continue;
|
||||||
@ -208,6 +210,9 @@ class StatisticManager {
|
|||||||
case self::SPECIAL_STAT_HITS_PH:
|
case self::SPECIAL_STAT_HITS_PH:
|
||||||
$hits = $this->getStatsRanking(StatisticCollector::STAT_ON_HIT, $serverIndex);
|
$hits = $this->getStatsRanking(StatisticCollector::STAT_ON_HIT, $serverIndex);
|
||||||
$times = $this->getStatsRanking(StatisticCollector::STAT_PLAYTIME, $serverIndex);
|
$times = $this->getStatsRanking(StatisticCollector::STAT_PLAYTIME, $serverIndex);
|
||||||
|
if(!$hits || !$times){
|
||||||
|
return array();
|
||||||
|
}
|
||||||
foreach($times as $key => $time) {
|
foreach($times as $key => $time) {
|
||||||
if ($time == 0 || !isset($hits[$key])) {
|
if ($time == 0 || !isset($hits[$key])) {
|
||||||
continue;
|
continue;
|
||||||
@ -219,6 +224,9 @@ class StatisticManager {
|
|||||||
case self::SPECIAL_STAT_ARROW_ACC:
|
case self::SPECIAL_STAT_ARROW_ACC:
|
||||||
$hits = $this->getStatsRanking(StatisticCollector::STAT_ARROW_HIT, $serverIndex);
|
$hits = $this->getStatsRanking(StatisticCollector::STAT_ARROW_HIT, $serverIndex);
|
||||||
$shots = $this->getStatsRanking(StatisticCollector::STAT_ARROW_SHOT, $serverIndex);
|
$shots = $this->getStatsRanking(StatisticCollector::STAT_ARROW_SHOT, $serverIndex);
|
||||||
|
if(!$hits || !$shots){
|
||||||
|
return array();
|
||||||
|
}
|
||||||
foreach($shots as $key => $shot) {
|
foreach($shots as $key => $shot) {
|
||||||
if ($shot == 0 || !isset($hits[$key])) {
|
if ($shot == 0 || !isset($hits[$key])) {
|
||||||
continue;
|
continue;
|
||||||
@ -230,6 +238,9 @@ class StatisticManager {
|
|||||||
case self::SPECIAL_STAT_LASER_ACC:
|
case self::SPECIAL_STAT_LASER_ACC:
|
||||||
$hits = $this->getStatsRanking(StatisticCollector::STAT_LASER_HIT, $serverIndex);
|
$hits = $this->getStatsRanking(StatisticCollector::STAT_LASER_HIT, $serverIndex);
|
||||||
$shots = $this->getStatsRanking(StatisticCollector::STAT_LASER_SHOT, $serverIndex);
|
$shots = $this->getStatsRanking(StatisticCollector::STAT_LASER_SHOT, $serverIndex);
|
||||||
|
if(!$hits || !$shots){
|
||||||
|
return array();
|
||||||
|
}
|
||||||
foreach($shots as $key => $shot) {
|
foreach($shots as $key => $shot) {
|
||||||
if ($shot == 0 || !isset($hits[$key])) {
|
if ($shot == 0 || !isset($hits[$key])) {
|
||||||
continue;
|
continue;
|
||||||
@ -241,6 +252,9 @@ class StatisticManager {
|
|||||||
case self::SPECIAL_STAT_ROCKET_ACC:
|
case self::SPECIAL_STAT_ROCKET_ACC:
|
||||||
$hits = $this->getStatsRanking(StatisticCollector::STAT_ROCKET_HIT, $serverIndex);
|
$hits = $this->getStatsRanking(StatisticCollector::STAT_ROCKET_HIT, $serverIndex);
|
||||||
$shots = $this->getStatsRanking(StatisticCollector::STAT_ROCKET_SHOT, $serverIndex);
|
$shots = $this->getStatsRanking(StatisticCollector::STAT_ROCKET_SHOT, $serverIndex);
|
||||||
|
if(!$hits || !$shots){
|
||||||
|
return array();
|
||||||
|
}
|
||||||
foreach($shots as $key => $shot) {
|
foreach($shots as $key => $shot) {
|
||||||
if ($shot == 0 || !isset($hits[$key])) {
|
if ($shot == 0 || !isset($hits[$key])) {
|
||||||
continue;
|
continue;
|
||||||
@ -252,6 +266,9 @@ class StatisticManager {
|
|||||||
case self::SPECIAL_STAT_NUCLEUS_ACC:
|
case self::SPECIAL_STAT_NUCLEUS_ACC:
|
||||||
$hits = $this->getStatsRanking(StatisticCollector::STAT_NUCLEUS_HIT, $serverIndex);
|
$hits = $this->getStatsRanking(StatisticCollector::STAT_NUCLEUS_HIT, $serverIndex);
|
||||||
$shots = $this->getStatsRanking(StatisticCollector::STAT_NUCLEUS_SHOT, $serverIndex);
|
$shots = $this->getStatsRanking(StatisticCollector::STAT_NUCLEUS_SHOT, $serverIndex);
|
||||||
|
if(!$hits || !$shots){
|
||||||
|
return array();
|
||||||
|
}
|
||||||
foreach($shots as $key => $shot) {
|
foreach($shots as $key => $shot) {
|
||||||
if ($shot == 0 || !isset($hits[$key])) {
|
if ($shot == 0 || !isset($hits[$key])) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -370,12 +370,14 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
try {
|
try {
|
||||||
$this->maniaControl->client->spectatorReleasePlayerSlot($player->login);
|
$this->maniaControl->client->spectatorReleasePlayerSlot($player->login);
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
|
if ($e->getMessage() != 'The player is not a spectator') {
|
||||||
$this->maniaControl->errorHandler->triggerDebugNotice("ChatMessagePlugin Debug Line " . $e->getLine() . ": " . $e->getMessage());
|
$this->maniaControl->errorHandler->triggerDebugNotice("ChatMessagePlugin Debug Line " . $e->getLine() . ": " . $e->getMessage());
|
||||||
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
|
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
|
||||||
//to nothing
|
//to nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a Player is in the PlayerList and returns the nickname if he is, can be called per login, pid or nickname or lj for
|
* Checks if a Player is in the PlayerList and returns the nickname if he is, can be called per login, pid or nickname or lj for
|
||||||
|
Loading…
x
Reference in New Issue
Block a user