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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...