mcwrapper 1.6.6 → 1.6.7pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mcwrapper (1.6.2)
4
+ mcwrapper (1.6.7pre)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,4 +1,4 @@
1
1
  module MCWrapper
2
2
  # VERSION = `#{ MCWRAPPER } --version`.split(/\s/).last
3
- VERSION = '1.6.6'
3
+ VERSION = '1.6.7pre'
4
4
  end
@@ -6,7 +6,7 @@
6
6
  # https://github.com/spikegrobstein/mcwrapper
7
7
  ##
8
8
 
9
- MCWRAPPER_VERSION="1.6.6"
9
+ MCWRAPPER_VERSION="1.6.7pre"
10
10
 
11
11
  #### Exit Codes
12
12
 
@@ -452,31 +452,45 @@ function remove_pipe {
452
452
 
453
453
  # write the PID file and start'er up!
454
454
  # don't start if we're already running.
455
+ # if FOREGROUND is defined, then start in foreground
456
+ # otherwise, ensure that pipe is created and start in background
455
457
  function start_minecraft {
456
458
  if check_is_running; then
457
459
  echo "Server is already running. Exiting..." >&2
458
460
  exit $EXIT_SERVER_ALREADY_RUNNING
459
461
  fi
460
462
 
461
- set_up_pipe
462
-
463
463
  # now we go to the minecraft_server directory and start the server in a background process
464
464
  # need to go to the directory to make sure that the Minecraft server puts the files in the right place (it puts them in the CWD)
465
465
  pushd $MINECRAFT_SERVER_DIR_PATH &> /dev/null
466
- read_command | $MINECRAFT_SERVER_CMD &> /dev/null &
467
466
 
468
- create_pid $!
467
+ if [[ -z "$FOREGROUND" ]]; then
468
+ set_up_pipe
469
+ start_minecraft_in_background
469
470
 
470
- # sleep for one second to make sure that the process actually started properly.
471
- sleep 1
471
+ create_pid $!
472
472
 
473
- # verify that minecraft server actually started.
474
- if ! check_is_running; then
475
- echo "Could not start Minecraft Server." >&2
476
- exit $EXIT_SERVER_CANNOT_START
473
+ # sleep for one second to make sure that the process actually started properly.
474
+ sleep 1
475
+
476
+ # verify that minecraft server actually started.
477
+ if ! check_is_running; then
478
+ echo "Could not start Minecraft Server." >&2
479
+ exit $EXIT_SERVER_CANNOT_START
480
+ fi
481
+ else
482
+ start_minecraft_in_foreground
477
483
  fi
478
484
  }
479
485
 
486
+ function start_minecraft_in_background {
487
+ read_command | $MINECRAFT_SERVER_CMD &> /dev/null &
488
+ }
489
+
490
+ function start_minecraft_in_foreground {
491
+ $MINECRAFT_SERVER_CMD
492
+ }
493
+
480
494
  # stops the minecraft server by sending it the 'stop' command via the FIFO
481
495
  function stop_minecraft {
482
496
  # if $BACKUP_ON_EXIT is non-zero length, then backup the world before exiting.
@@ -1077,11 +1091,18 @@ case $ACTION in
1077
1091
  ;;
1078
1092
  start )
1079
1093
  sanity_check
1080
- echo -n "Starting minecraft... "
1094
+ echo -n "Starting minecraft... "
1081
1095
  start_minecraft
1082
1096
  echo "Done."
1083
1097
  exit $EXIT_SUCCESS
1084
1098
  ;;
1099
+ start-foreground )
1100
+ sanity_check
1101
+ echo "Starting minecraft in the foreground..."
1102
+ FOREGROUND=1
1103
+ start_minecraft
1104
+ exit $?
1105
+ ;;
1085
1106
  stop )
1086
1107
  sanity_check
1087
1108
  echo -n "Stopping minecraft... "
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcwrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.6
5
- prerelease:
4
+ version: 1.6.7pre
5
+ prerelease: 5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Spike Grobstein
@@ -46,9 +46,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
46
46
  required_rubygems_version: !ruby/object:Gem::Requirement
47
47
  none: false
48
48
  requirements:
49
- - - ! '>='
49
+ - - ! '>'
50
50
  - !ruby/object:Gem::Version
51
- version: '0'
51
+ version: 1.3.1
52
52
  requirements: []
53
53
  rubyforge_project:
54
54
  rubygems_version: 1.8.24