Help with script that reads and writes java console Minecraft


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with script that reads and writes java console Minecraft
# 1  
Old 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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Disable minecraft by disabling java

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

2. SCO

Mozilla crashing when viewing java console

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

3. Shell Programming and Scripting

two questions about incorporating fortune and java uptime into screen for a minecraft server

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

4. UNIX for Dummies Questions & Answers

Difference between buffered disk reads and cached reads?

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

5. Filesystems, Disks and Memory

Life span of HDD - maximum reads/writes etc

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

6. Filesystems, Disks and Memory

Does vmstat -d give a count of actual physical writes/reads done to/from hard disk?

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

7. UNIX for Advanced & Expert Users

identify the unix process performing high disk i/o reads and writes

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

8. Shell Programming and Scripting

identify the unix processes performing high disk i/o reads and writes

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

9. Programming

[JAVA] clear console

anybody knows the metod to clear the unix console? (1 Reply)
Discussion started by: iAlex
1 Replies

10. Shell Programming and Scripting

sh script that reads/writes based upon contents of a file

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
Login or Register to Ask a Question