02-21-2012
Help with script that reads and writes java console Minecraft
Hi
I am looking for an easy way to lock game mode (0) for everyone included op on a Minecraft server. It can be a script that every time a player changes game to 1 the script changes back to 0. What the player writes is visible in the java console. I am not good at script programming and my guess is that this is easy for someone who is good script programming. The OS is OSX. I appreciate all help on this.
gamemode <playername> <0|1> Changes the game mode for playername to Survival (0) mode or Creative (1) mode.
Example player player1 writes to set gamemode 1:
gamemode player1 1
Example player player1 writes to set gamemode 0:
gamemode player1 0
I want gamemode to be set to 0 always so I am looking for something like:
Example player player1 writes to set gamemode 1:
gamemode player1 1
On the CONSOLE
2012-02-20 19:59:26 [INFO] player1 issued server command: gamemode player1 1
The script writes:
gamemode player1 0
On the CONSOLE
The script code for the test is something like this
if echo $line | grep -q 'gamemode'
if echo $line | grep -q ' 1'; then
echo $line | sed s/' 0'/' 1'/ >> stdin.commandlist
fi
fi
Minecraft Server is a java program which starts like this:
Java -Xmx2024M -Xms2024M -jar minecraft_server.jar nogui
174 recipes
27 achievements
2012-02-20 09:22:26 [INFO] Starting minecraft server version 1.1
2012-02-20 09:22:26 [INFO] Loading properties
2012-02-20 09:22:26 [INFO] Starting Minecraft server on 5.66.29.122:25565
2012-02-20 09:22:26 [INFO] Preparing level "world"
2012-02-20 09:22:26 [INFO] Default game type: 0
2012-02-20 09:22:27 [INFO] Preparing start region for level 0
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi everyone,
Ive got a quick question about the feasibility and any suggestions for a shell script. I can use sh or ksh, doesnt matter. Basically, Ive got an output file from a db2 command that looks like so:
SCHEMA NAME CARD LEAF ELEAF LVLS ISIZE NDEL KEYS F4 F5 ... (3 Replies)
Discussion started by: rdudejr
3 Replies
2. Programming
anybody knows the metod to clear the unix console? (1 Reply)
Discussion started by: iAlex
1 Replies
3. Shell Programming and Scripting
I would like to write shell/perl script which identifies the top unix processes that are performing high disk I/O's or/and writes
If any one knows the solution please help me?
-Swamy (0 Replies)
Discussion started by: avsswamy
0 Replies
4. UNIX for Advanced & Expert Users
Guys,
Is there any UNIX command that captures the 'Unix process which is performing high disk I/O reads and writes'.
can you help me in this?
-Swamy (6 Replies)
Discussion started by: avsswamy
6 Replies
5. Filesystems, Disks and Memory
Hi,
I am trying to find the reliability of 'vmstat -d' for showing the actual physical writes on sectors on hard disk.
Can anyone please tell me if the numbers in the "sectors" field under "read" or "write" headers show a count of the actual write commands sent to disk from the low level... (2 Replies)
Discussion started by: jake24
2 Replies
6. Filesystems, Disks and Memory
Hi All
I was wondering how the copying of vast amounts of data affected the overall lifespan of an HDD.
In my example, I'm copying approx 120GB (250,000) of files, once per hour from disk to another.
Is this likely to have a detrimental effect on the disk in terms of reads/writes etc?
... (2 Replies)
Discussion started by: huskie69
2 Replies
7. UNIX for Dummies Questions & Answers
I was analyzing the Disk read using hdparm utility.
This is what i got as a result.
# hdparm -t /dev/sda
/dev/sda:
Timing buffered disk reads: 108 MB in 3.04 seconds = 35.51 MB/sec
# hdparm -T /dev/sda
/dev/sda:
Timing cached reads: 3496 MB in 1.99 seconds = 1756.56 MB/sec... (1 Reply)
Discussion started by: pinga123
1 Replies
8. Shell Programming and Scripting
existing code
#!/bin/bash
SRC_DIR=/home/brian/mc/
DEST_DIR=/home/brian/mcbak/
SCREEN_SESSION=minecraft
BACKUP_LOG=/home/brian/mcbaklog
CHKBAK=$(rdiff-backup -v3 --verify ~/mcbak)
BAKSZ=$(du -sh ~/mcbak|awk 'FNR == 1 {print $1}')
WLDSZ=$(du -sh ~/mc/world/|awk 'FNR == 1 {print $1}')... (1 Reply)
Discussion started by: briandanielz
1 Replies
9. SCO
I installed the Java 1.4.2_19 JRE, SDK, and Mozilla plugin in SCO (OpenServer 5.0.7). However, every time I try and view the java console, the browser immediately closes. Likewise, if I navigate to a website that tries to load an applet, the browser immediately closes.
I've checked and... (1 Reply)
Discussion started by: jdsnatl
1 Replies
10. Windows & DOS: Issues & Discussions
my kids are on minecraft constantly. I want to restrict its use but it seems impossible since it runs on java. :eek:
They are using :mad: windows 7 :mad: but I'm asking this question on here since Java is platform independent (er right?):confused: Also this forum was very helpful with my AWK... (10 Replies)
Discussion started by: cmp260
10 Replies
script(1) User Commands script(1)
NAME
script - make record of a terminal session
SYNOPSIS
script [-a] [filename]
DESCRIPTION
The script utility makes a record of everything printed on your screen. The record is written to filename. If no file name is given, the
record is saved in the file typescript. See WARNINGS.
The script command forks and creates a sub-shell, according to the value of $SHELL, and records the text from this session. The script ends
when the forked shell exits or when Control-d is typed.
OPTIONS
The following option is supported:
-a Appends the session record to filename, rather than overwriting it.
NOTES
script places everything that appears on the screen in filename, including prompts.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|CSI |Enabled |
+-----------------------------+-----------------------------+
SEE ALSO
attributes(5)
WARNINGS
script can pose a security risk when used in directories that are writable by other users (for example, /tmp), especially when run by a
privileged user, that is, root. Be sure that typescript is not a link before running script.
SunOS 5.10 30 Jan 2004 script(1)