Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- open(LS, "ls -1 *.dat |");
- open(MAP, "> uuids.map");
- while($file = <LS>) {
- chomp $file;
- $cmd = "nbt2yaml $file > temp.yml";
- system($cmd);
- $file =~ /^(.+)\.dat/;
- $uuid = $1;
- open(DAT, "temp.yml");
- while($line = <DAT>) {
- chomp $line;
- if ($line =~ /Dimension: (\d+)/) {
- $dimension = $1;
- $nr_in_dim[$dimension]++;
- if ($dimension == 1) {
- $x = int($x + 0.5);
- $y = int($y + 0.5);
- $z = int($z + 0.5);
- print "Player [$name] is in the end at ($x, $y, $z)\n";
- print $uuid . "\n";
- }
- }
- elsif ($line =~ / Pos: /) {
- $line = <DAT>;
- $line =~ /\"([0-9\-\.]+)\"/;
- $x = $1;
- $line = <DAT>;
- $line =~ /\"([0-9\-\.]+)\"/;
- $y = $1;
- $line = <DAT>;
- $line =~ /\"([0-9\-\.]+)\"/;
- $z = $1;
- }
- elsif ($line =~ /lastKnownName: (.+)/) {
- $name = $1;
- print MAP "$uuid $name\n";
- }
- }
- close DAT;
- } # while
- close MAP;
- for($i=-1; $i <= 1; $i++) {
- print "Number in dimension [$i] = " . $nr_in_dim[$i] . "\n";
- } # for
- print "done\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement