MonsterMoon

MonsterMoon

In NetHack moon phases affect the environment – and with this plugin that can happen in Minecraft too!

With this small plugin you can:

  • Create custom size calendars and simple linear procedures for each of your worlds.
  • Calendar that has multiple of eight (8, 16, 24, ...) number of days can be linked to the moon phases.
  • Set difficulty levels, PVP, spawning, and run commands on per-day and per-world level.
  • Create a set of totally random events!
  • Create an once in a blue moon event, that happens both very rarely and very predictably (if you count the days...)

A simple example:

WorldName:                        # On this world
  day-begins: dawn                # days will change when the sun rises.

  commands-on-enable:
  - say MonsterMoon is now activated for world "WorldName"!

  commands-on-disable:
  - say Server level defaults are automatically restored!

  spawn-monsters: false           # In this world monsters do not spawn

  calendar:

    Monday:
      spawn-monsters: true        # Except on Mondays, and...

    Tuesday:                      # ... on Tuesdays there is 50 % 
      spawn-monsters: true false  # possibility of monsters.

    Wednesday: void               # World level defaults are
                                  # restored on Wednesday.
    Thursday:
      commands:
      - say This command is run when Thursday begins.

    Friday:
      pvp: true                   # Overdrives the server default.

    Saturday:
      day-begins: -3000           # Saturday begins earlier than usual.

    Sunday: void                  # Totally normal day.

Installation

Installation is done the usual way, just drop the MonsterMoon.jar into the plugins directory and /reload server plugins.

Configuration is done via the plugins/MonsterMoon/config.yml file. When you run MonsterMoon the first time it will create an example configuration file that you can edit.

Format of the config.yml

WorldName:         # Name of the world where the following rules apply:

  [properties]     # Default properties for this world. (See list below.)

  commands[-on-enable]:     # Commands that are executed when 
  - say MonsterMoon is on!  # MonsterMoon is being enabled.
  - tell Player1 Hello!

  commands-on-disable:      # Commands that are executed when 
  - tell Player1 Bye!       # MonsterMoon is being disabled.
  - say MonsterMoon is off!

  day-begins: midnight      # Time when day changes. (See values below.)

  day-order: universal      # Which order the following calendar
                            # days are applied. (See values below.)

  calendar:                 # This world has the following calendar days:

    Monday:                 # Name for this day
      [properties]          # Properties for this day. (See list below.)
      commands:             # Commands that are executed on this day.
      - say It's Monday.

    Tuesday:
      [properties]
      commands:
      - say It's Tuesday.

    [...]

Empty Days

You can create empty (nothing but default values) calendar days, but due to the YAML format each day must have some content. Use something like the following to create days that do not have any events:

  calendar:
    Monday: void
    Tuesday: still nothing             # (It does not actually matter 
    Wednesday: _                       # what is written here.)

Commands

With commands-on-enable (run when MonsterMoon plugin is enabled), commands-on-disable (run when MonsterMoon plugin is disabled) and daily commands (run when day begins) you can run either standard CraftBukkit commands, or control other plugins. Commands must be listed in YAML list notation even when there is only one command in the list. Also, do not use the forward slash (/) for the commands.

For example:

  SomeWorld:
    calendar:
      Monday:
        commands:
        - weather clear    # Weather is always clear on Mondays

      Tuesday:
        commands:
        - weather thunder  # It thunders on Tuesday!
        - bloodmoon next   # Schedule BloodMoon plugin for the next night
        - pluginmanager enable TinyTweak   # Use PluginManager plugin
                                           # to enable another plugin

Possible [properties] are

  difficulty:
    [Number]        # number in range [0..3]
    peaceful        # same as 0
    easy            # same as 1
    normal          # same as 2
    hard            # same as 3
    default         # use default value (for this world)
    server-default  # use default value (for this server)
    no-change       # preserve the current value

  spawn-monsters:
  spawn-animals:
  pvp:
    true            # property is active
    false           # property is not active
    default         # use default value (for this world)
    server-default  # use default value (for this server)
    no-change       # preserve the current value

These properties are set by per-world and per-day basis and will override the values set in the server.properties file.

Scope

If property is not defined for a calendar day, a world default value will be used instead. For example:

  SomeWorld:
    spawn-monsters: false    # Monsters do not usually spawn on SomeWorld
    calendar:

      Monday:
        spawn-monsters: true # Monsters will spawn on Monday

      Tuesday: void          # Monsters will NOT spawn on Tuesday,
                             # because SomeWorld default is false
      Wednesday: void

If you want properties to propagate you have to set either Tuesday or the world default to no-change. For example:

  SomeWorld:
    spawn-monsters: no-change  # Leave values as-is (use server default)
    calendar:

      Monday:
        spawn-monsters: true   # Monsters will spawn on Monday

      Tuesday: void            # Monsters will spawn on Tuesday!

      Wednesday: void

To randomize properties

You can randomize properties by introducing multiple possible values on the same line.

Example:

  spawn-monsters: no-change no-change false
                                    # There is 33.33% possibility
                                    # that monster spawning will cease.

Possible values for day-begins are

  day-begins:
    [Number]          # The actual time of day.
    midnight          # same as -6000
    sunrise           # same as 0
    midday            # same as 6000
    sunset            # same as 12000

Example:

  day-begins: 9000    # Day will change at 3 o'clock in the afternoon.

Technical details

Negative numbers are allowed because the actual time is calculated as a delta to the world.getFullTime(). This means that numbers over 24000 are also allowed.

Example:

  day-begins: 6000

  When Monday begins the time is:
    world.getFullTime() == 222000, world.getTime() == 6000

  Tuesday is now scheduled to begin at:
    (222000 - (222000 % 24000) + 24000) + 6000 == 246000
                                          ^ 'day-begins' delta

Possible values for day-order are

  day-order:
    universal      # The next day will be determined from the global time
    linear         # First day of the calendar is always executed first
    random         # Days follow each other in random order

Notes and Usage Ideas

  • To create a fixed "moon phase" calendar use day-order: universal with a calendar that has multiple of eight (8, 16, 24, ...) number of days.
  • To create a simple procedure that is guaranteed to proceed in a linear order use day-order: linear.
  • To create a random set of events use day-order: random.
  • In day-order: universal days are guaranteed to be a day long, but in linear and random mode days can actually be much shorter if you use the day-begins property creatively.

About /time

Using /time add or /time set throws MonsterMoon out of sync. You can either wait the problem to solve itself (it will), or fix it manually by stopping and restarting MonsterMoon calendar:

  • Stop MonsterMoon in world "WorldName": /monstermoon WorldName stop
  • Add some time: /time add 10000
  • Restart MonsterMoon in world "WorldName": /monstermoon WorldName start

Compatibility

Compiled with Oracle Java 1.7.0_21 against Bukkit 1.5.2-R0.1 API.

License

Public Domain (Creative Commons Zero)

Source Code

Included in the MonsterMoon.jar package.


Comments

  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes

About This Project

  • Project ID
    57367
  • Created
    May 14, 2013
  • Last Released File
    May 14, 2013
  • Total Downloads
    1,237
  • License

Categories

Members

Recent Files