mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
Removed useless casts() from min/max calls
This commit is contained in:
parent
812424a619
commit
d26fcf7dee
@ -181,7 +181,7 @@ class MemoryManager{
|
||||
* Returns the allowed chunk radius based on the current memory usage.
|
||||
*/
|
||||
public function getViewDistance(int $distance) : int{
|
||||
return ($this->lowMemory and $this->lowMemChunkRadiusOverride > 0) ? (int) min($this->lowMemChunkRadiusOverride, $distance) : $distance;
|
||||
return ($this->lowMemory and $this->lowMemChunkRadiusOverride > 0) ? min($this->lowMemChunkRadiusOverride, $distance) : $distance;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1388,7 +1388,7 @@ class Server{
|
||||
$poolSize = max(1, (int) $poolSize);
|
||||
}
|
||||
|
||||
$this->asyncPool = new AsyncPool($this, $poolSize, (int) max(-1, (int) $this->getProperty("memory.async-worker-hard-limit", 256)), $this->autoloader, $this->logger);
|
||||
$this->asyncPool = new AsyncPool($this, $poolSize, max(-1, (int) $this->getProperty("memory.async-worker-hard-limit", 256)), $this->autoloader, $this->logger);
|
||||
|
||||
if($this->getProperty("network.batch-threshold", 256) >= 0){
|
||||
Network::$BATCH_THRESHOLD = (int) $this->getProperty("network.batch-threshold", 256);
|
||||
|
@ -82,7 +82,7 @@ class HelpCommand extends VanillaCommand{
|
||||
}
|
||||
ksort($commands, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
$commands = array_chunk($commands, $pageHeight);
|
||||
$pageNumber = (int) min(count($commands), $pageNumber);
|
||||
$pageNumber = min(count($commands), $pageNumber);
|
||||
if($pageNumber < 1){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
public function getXpDropAmount() : int{
|
||||
//this causes some XP to be lost on death when above level 1 (by design), dropping at most enough points for
|
||||
//about 7.5 levels of XP.
|
||||
return (int) min(100, 7 * $this->getXpLevel());
|
||||
return min(100, 7 * $this->getXpLevel());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,6 +75,6 @@ abstract class ExperienceUtils{
|
||||
|
||||
$x = Math::solveQuadratic($a, $b, $c - $xp);
|
||||
|
||||
return (float) max($x); //we're only interested in the positive solution
|
||||
return max($x); //we're only interested in the positive solution
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ class RCON{
|
||||
$this->server->getTickSleeper()->addNotifier($notifier, function() : void{
|
||||
$this->check();
|
||||
});
|
||||
$this->instance = new RCONInstance($this->socket, $password, (int) max(1, $maxClients), $this->server->getLogger(), $this->ipcThreadSocket, $notifier);
|
||||
$this->instance = new RCONInstance($this->socket, $password, max(1, $maxClients), $this->server->getLogger(), $this->ipcThreadSocket, $notifier);
|
||||
|
||||
socket_getsockname($this->socket, $addr, $port);
|
||||
$this->server->getLogger()->info("RCON running on $addr:$port");
|
||||
|
Loading…
x
Reference in New Issue
Block a user