Sponsored Content
Top Forums Shell Programming and Scripting Help with script that reads and writes java console Minecraft Post 302600426 by MyMorris on Tuesday 21st of February 2012 05:28:40 AM
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
 

10 More Discussions You Might Find Interesting

1. 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

2. Programming

[JAVA] clear console

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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
MANCALA(6)							   Games Manual 							MANCALA(6)

NAME
mancala - simple board game for human player and computer SYNOPSIS
mancala level-top level-bottom number-of-stones xmancala [-stones N] mancala-text DESCRIPTION
This manual page documents briefly the mancala and xmancala commands. This manual page was written for the Debian GNU/Linux distribution because the original program does not have a manual page. mancala runs the game in the console, while xmancala is a fancy X-interface. mancala-text is a shell script to run mancala in a console from the Debian menu system. When run as xmancala the program has no options, and should be self-explanatory. Built in buttons and sliders control the difficulty level (default 4), and bring up the rules of the game. The console version, mancala, has no access to the rules, and the difficulty level can only be set on the command line (see below). When it is your turn to play, you enter the letter of the cell that you want to move the stones from, A to F (case insensitive). The rules are contained in the file /usr/share/doc/mancala/RULES. OPTIONS
When run as mancala, the program normally takes two arguments, level-top and level-bottom, one of which should be 0 to represent the human player (you), and the other should be in the range 1 to 9, to represent the skill level of the computer player. The first argument repre- sents the top player, who starts. Alternatively, you can give a single argument or two non-zero arguments, to watch the computer playing itself, or two zero arguments, to play against another human player on the same console. For the console version, you can add a third argument to specify the number of stones per hole. For xmancala you can specify the number of stones per hole using the -stones N argument. On Debian systems, the shell script mancala-text is provided to facilitate running mancala in a console, from the Debian menu system. This script will run mancala with a difficulty level of 4, and will pause when the game is finished, to enable the player to view the final screen. SEE ALSO
<http//en.wikipedia.org/wiki/Mancala> AUTHOR
This manual page was written by Andrew Gray <ajpg@debian.org> for the Debian GNU/Linux system (but may be used by others). 13 March 2001 MANCALA(6)
All times are GMT -4. The time now is 09:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy