Jump to content

Recommended Posts

  • Discord Moderator
Posted

I wanted a way to automatically include MystCraft ages into GroupManager's world permissions. I have seen an option for the GroupManager config.yml which would match any world name (specifically the "all_unnamed_worlds) in the Github source but haven't had any luck with that.

Enter inotify. The Linux kernel has the ability to watch files/directories for changes. I have written a script that watches two of these:

1) Watch the TekkitLite.jar file for "CLOSE_NOWRITE" which will throw an event if TekkitLite.jar was previously opened for reading (i.e. when the server starts) and was subsequently closed. On this event the monitoring script simply terminates itself.

2) Watch the "worlds" folder under GroupManger for the creation of new directories with the assumption that this would be a user entering a new age. The script will copy the files from an existing "good" world's permissions into the newly created directory and then push a "manload" command into the Tekkit server (running inside a "screen" session of course) to reload GroupManager's world permissions.

Simply execute the script in the background (i.e. "sh myst_inotify.sh &") from withing your launcher script directly before running the Java/Tekkit process.

The Script: (myst_inotify.sh)

#!/bin/sh

 

screen=/usr/bin/screen

scrname=minecraft

TEKKITDIR=$HOME/minecraft

 

TEKKITJAR=$TEKKITDIR/TekkitLite.jar

GMWORLDS=$TEKKITDIR/plugins/GroupManager/worlds

GOODPERMSDIR=$TEKKITDIR/plugins/GroupManager/worlds/overworld

MYPID=$$

 

inotifywait -m --format '%e %w %f' -e create -e close_nowrite "$TEKKITJAR" "$GMWORLDS" | while read event dir file; do

  FPTARGET=${dir}${file}

  if [ $event == "CREATE,ISDIR" ]; then

      cp "$GOODPERMSDIR"/* "$FPTARGET"

      $screen -d -r $scrname -p 0 -X stuff "$(printf '\r')"

      $screen -d -r $scrname -p 0 -X stuff "manload $(printf '\r')"

  fi

  if [ "$dir" == "$TEKKITJAR" ]; then

      kill -9 `pgrep -P $MYPID -n -x inotifywait`

  fi

done

  • 2 weeks later...
  • Discord Moderator
Posted

This is no longer required since the latest Essentials builds (which at least work with BukkitForge build 245 and server 0.6.1) now has a config option for "all_unnamed_worlds" which catches all the mystcraft dimensions.

Handy.

  • 4 months later...
Posted

Word for Thought. If a mystcraft age is loaded and you do the command /manload, that mystcraft world will be added to the worlds dir in the group manager's list of worlds. meaning it now has its own groups & users ymls. All that will equal that it is no longer mirrored with your "world" groups and users.

  • Discord Moderator
Posted

Wow, quite the necro post. Anyone still using GroupManager perms might want to check out just about any other solution. There are a ton available and they ALL work better.

Posted

Wow, quite the necro post. Anyone still using GroupManager perms might want to check out just about any other solution. There are a ton available and they ALL work better.

what ya mean

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...