Last active
August 23, 2023 08:29
-
-
Save ZiTAL/c56c757394be8acc0b37ebbb6d59f280 to your computer and use it in GitHub Desktop.
php: minecraft server log output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$file_name = 'latest.log'; | |
$f_mod = date('Y-m-d H:i:s', filemtime($file_name)); | |
$log_file = file_get_contents($file_name); | |
$lines = preg_split("/\n/", $log_file); | |
$log = ''; | |
foreach($lines as $line) | |
{ | |
// [22:41:42] [User Authenticator #7/INFO]: UUID of player arkkuso is aa1111a1-a1aa-1111-1a1a-aa11a1a111aa | |
$line = preg_replace("/UUID of player (.*?) is ([a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-)[a-z0-9]+/i", 'UUID of player $1 is $2************', $line); | |
// [22:41:42] [Server thread/INFO]: arkkuso[/111.111.111:11111] logged in with entity id 11111 at (108.5, 66.0, 9.5) | |
$line = preg_replace("/(.*?)(\[\/[0-9]+\.[0-9]+\.[0-9]+\.)[0-9]+(:[0-9]+\])/", '$1$2***$3', $line); | |
$log .= "{$line}\n"; | |
} | |
$output = " | |
<h1>Minecraft Server: Latest logs ({$f_mod})</h1> | |
<pre> | |
{$log} | |
</pre>"; | |
echo $output; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/systemd/system/minecraft.service | |
# systemctl daemon-reload | |
# systemctl start minecraft | |
[Unit] | |
Description=Minecraft Server | |
After=network.target | |
[Service] | |
WorkingDirectory=/home/projects/mc | |
User=pi | |
Group=pi | |
Restart=on-failure | |
RestartSec=5 | |
ExecStart=/usr/bin/java -Xms1G -Xmx2G -jar /home/projects/mc/server.1.20.1.jar nogui | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Minecraft server properties | |
#Tue Aug 15 14:56:24 CEST 2023 | |
allow-flight=false | |
allow-nether=true | |
broadcast-console-to-ops=true | |
broadcast-rcon-to-ops=true | |
difficulty=normal | |
enable-command-block=false | |
enable-jmx-monitoring=false | |
enable-query=false | |
enable-rcon=false | |
enable-status=true | |
enforce-secure-profile=true | |
enforce-whitelist=false | |
entity-broadcast-range-percentage=100 | |
force-gamemode=false | |
function-permission-level=2 | |
gamemode=survival | |
generate-structures=true | |
generator-settings={} | |
hardcore=false | |
hide-online-players=false | |
initial-disabled-packs= | |
initial-enabled-packs=vanilla | |
level-name=bermio | |
level-seed= | |
level-type=default | |
max-build-height=256 | |
max-chained-neighbor-updates=1000000 | |
max-players=16 | |
max-tick-time=60000 | |
max-world-size=29999984 | |
motd=Bermioko Minecraft Zerbitzaridxe | |
network-compression-threshold=256 | |
online-mode=true | |
op-permission-level=4 | |
player-idle-timeout=0 | |
prevent-proxy-connections=false | |
pvp=true | |
query.port=25565 | |
rate-limit=0 | |
rcon.password= | |
rcon.port=25575 | |
require-resource-pack=false | |
resource-pack= | |
resource-pack-prompt= | |
resource-pack-sha1= | |
server-ip= | |
server-port=25565 | |
simulation-distance=10 | |
snooper-enabled=true | |
spawn-animals=true | |
spawn-monsters=true | |
spawn-npcs=true | |
spawn-protection=16 | |
sync-chunk-writes=true | |
text-filtering-config= | |
use-native-transport=true | |
view-distance=10 | |
white-list=false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment