MineReset ⛏ Refill mines with defined blocks and percentages

#Mine Reset

#Introduction :round_pushpin:
Fill mines (cuboid regions on your server) at a regular intervals automatically with percentages and blocks as you choose.

:link:Latest Release
:link:Releases
:link:Source Code

:link:DiscordHelp


#Languages


#Features :clipboard:

  • Supports multiple worlds
  • Use of blocks from mods
  • Smart Fill to prevent players needing to teleport on mine reset
  • Decimal percentages per block
  • Block placed random according to mine’s percentages
  • No cap on different blocks per mine
  • Easy in game setup
  • Reminder messages at configurable times with configurable message types
  • Refilling messages on refill with configurable message types
  • Move players inside on refill to defined location if Smart Fill not used
  • Per mine spawns
  • Groups of mines on different clocks
  • Reset mines at regular intervals with initial delay
  • List all mines and mine groups that exist with a command
  • Detailed info on a mine or mine group with a command
  • Check time until a specified mine refills automatically with a command
  • Clear entire mine with a command
  • Manual refill mine according to percentages with a command
  • Fill entire mine with specific block with a command
  • Clickable signs to refill mines at a threshold percentage
  • Detailed in game help for commands
  • Player specific message toggling to prevent spam
  • Configurable messages

##Planned :soon:

  • Better way to set up corners of mine (possible wand)

#Change log :new:

1.0.12 Download version API: 7.0.0-Snapshot & API: 6.0.0-Snapshot (API 5 should work with this version too)
Fixed the redefine mine command from resetting the fallback ore to stone
Fixed the details command showing the same point twice for mines
Added configuration for fade in, fade out and stay times for title messages
Added display names for mines (helps other languages)
Added update display name command
Released two separate jar files to support api 7 & api 6

1.0.11 Download version API: 7.0.0-Snapshot & API: 6.0.0-Snapshot (API 5 should work with this version too)
Fixed %mine% replacement text showing and not being replaced for player messages on automated single mine filling
Fixed spacing of time units
Released two separate jar files to support api 7 & api 6

1.0.10 Download version API: 7.0.0-Snapshot & API: 6.0.0-Snapshot (API 5 should work with this version too)
Enabled configuration of time units for time messages messages
Released two separate jar files to support api 7 & api 6

1.0.9 Download version API: 7.0.0-Snapshot & API: 6.0.0-Snapshot (API 5 should work with this version too)
Enabled configuration of messages via a new config file
Released two separate jar files to support api 7 & api 6

1.0.8 BETA2 Download version API: 7.0.0-Snapshot
Moved to SpongeForge API 7.0.0-Snapshot
Fixed message bugs and updated messages
Added feature to make signs that on click can fill mines if they are below a percentage full
Added command to change percentage mine fill signs function
Added personal toggle message command

1.0.7 Download version API: 5.0.0-Snapshot (also functions on API: 6.0.0)
Calculations on what blocks to be placed where moved to asynchronous thread (performance improvement)
No block placed if new block is the same as old block (performance improvement)
Filling now gives detailed message for each fill action reporting blocks changed and time taken

1.0.6 Download version API: 5.0.0-Snapshot (also functions on API: 6.0.0)
Moved to SpongeForge API 5.0.0-Snapshot (fixes mine filling issue due to api change)
Performance improvements
Improved filling messages
Fixed typos

1.0.5 Download version API: 4.0.3
Fixed default config for AirBlock list (You must remove all \")
Fixed default mine spawn setting on creating new mine

1.0.4 Download version API: 4.0.3
Added title message capabilities
Added message type for remind and reset messages now configurable
Added UpdateChatSettings command
Added system for per mine spawns
Removed SetSpawn command
Added AddSpawn command
Added RemoveSpawn command
Added UpdateSpawn command
Added ChangeSpawn command
Improved command filling of mines to include error message returns
Improved details / info command
Re-organised command files
Changed teleportation to allow unsafe teleportation

1.0.3 Download version API: 4.0.3
Added update fallback block command Added update group command Added Smart fill Added Smart fill setup command Added add new air block command Added remove air block command Improved info command output

1.0.2 Download version API: 4.0.3
Added list reminder times command
Added add new remind time command
Added remove remind time command
Added block info object replacing old double hash map for percentages
Added redefine mine command
Fixed more typos
Fixed help bug

1.0.1 Download version API: 4.0.3
Fixed light blue variants
Fixed typos

1.0.0 Download version API: 4.0.1
Initial release


#General backbone idea (how it works) :microscope:
On server startup a global clock begins. This clock ticks every second. Every second a calculation is done with each mine group to check time remaining until the mine resets. If that mine groups time remaining is equal to that of a timing in the remind time list of the config file a message will be sent to all players informing of a mine reset of all mines in that mine group in the time remaining. If that time remaining is 0 all the mines in the group will be filled according to each mines percentages and a message sent to all players and console of all mines reset. Any player who is inside a mine when that mine is being filled will be either be moved the the spawn point as set in the config if smart fill is not enabled and if smart fill is enabled will remain in the mine however the mine will not fill as usual around the player.

When a mine refills it will look at all the blocks for that mine and each percentage. The “fallback” block as set in the config is the default block and is default to stone. The plugin will find the percentage of all added ores and then assign the remainder to the fall back block so 100% of the mine has a block. Then for each block a random number will be generated and the plugin will work out what percentage range this number falls in and place that block. For example if I was to add iron ore at 20% to a mine with a fallback block of stone first the plugin would work out iron ore was at 20% so fall back block (in this case stone) would be 80%. Then the plugin would decide 0% to 20% it would place iron ore and 20% to 100% it would place stone. Then for each random it will find what range it is in and place that block. If the random was 1, 8, 15 or 19 iron would be placed. A random of 21, 84 and 100 would all place stone. This is all done in fractions of a second taking about 0.0000136 seconds per block (my mines of 22 000 blocks fill in sets of 4 and take 1.2 seconds, that is 88000 blocks).


#Quick start guide :package:

  1. Update the default spawn for if a player is in a mine when that mine resets. We will set it at 0.5 64 0.5 facing north in the world we are running the command in.
    command: /mine updatespawn Default 0.5 64 0.5 north :new: (Added in 1.0.4)
    command: /mine setspawn 0.5 64 0.5 north :no_entry_sign: (Removed in 1.0.4)

  2. Create a new mine group called “example” that resets every 30 minutes (1800 seconds) with clock starting 10 minutes (600 seconds) after server start. All mines in this group will reset 40 minutes after first server start and then reset every 30 minutes after that.
    command: /mine definegroup example 1800 600

  3. Create a new mine called “first” in the group “example” in the cuboid within 0 64 0 and 10 50 10 in the world player is currently in.
    command: /mine definemine example first 0 64 0 10 50 10
    (easy way to find coordinates of a block is to place a block at the corner, press f3 and find the block location located last in the list of the right hand side of screen)

  4. Add an ore to our new mine called “first” at 20%. Stand directly on top of the chosen block it and run the command.
    command: /mine addore first 20

  5. Now you can add the rest of your ores and use the other config commands as shown in the “Commands and permissions” section. You can test your handy work by filling the mine manually and looking at the result.
    /mine fill first


#Smart fill :new: (version 1.0.3)
Smart fill is the name I have given to a new idea to filling mines. Normally a mine is filled completely therefore any player inside must be moved. For players this reduces the immersion as they then need to return to the mines. Smart fill is a way around this. When smart fill is enabled and a mine resets it will check for players inside a mine. If a player is inside a mine it will not adjust any blocks within the smart fill radius of that player. Therefore any tunnels, torches etc. will be untouched and that small area will not be re-populated. This means the player will now not have to be teleported out of the mine and a mine reset will not affect the game-play for the player. There is also Smart fill only air setting. This setting improves smart fill further. On mine reset it will do all as before however now the region around the player will be checked. Any block space that is a gas, liquid or a block on the AirBlocks list in the config will be left untouched while all other blocks will be regenerated. Therefor a strip mined area will repopulate where blocks such as stone is however blocks such as torches will remain untouched similar to a world edit mask. Smart fill, Smart fill radius and Smart fill only air is all configured per mine allowing precise control.


#Message channels :new: (version 1.0.4)
There are 3 supported message channels that are configured in almost the same way to how Linux permissions work. The 3 channels can be selected individually or in any combination and are independantly configurable between RESET and REMINDER messages. The 3 channels are Chat, ActionBar and Title. The way message chanels are selected is via adition of the types values.

Chat channel has value of 1.
ActionBar channel has value of 2.
Title channel has a value of 4.

Set the value for your message type to the addition of the values of the chat channels you want. For example if you want ActionBar and Title you simply add 2 (ActionBar’s value) and 4 (Title’s value) to get a final value of 6. If you set your Reset messages to 6 in the config all messages about a mine reseting will only show to players in the ActionBar and Title chanels.

Note: All reset and reminder messages will show in console regardless of settings.


#Mine fill signs :new: (version 1.0.8)
Mine fill signs implement a feature for players to refill mines by right clicking signs. These signs when right clicked will check percentage filled of the given mine, if the percentage of the mine that is filled is below a preset percentage then that mine will reset. This allows players in extreme cases where the mine is rapidly depleted to refill the mine without staff help.

For this to work the given sign must have the text “[Mine]” on the first line. The second line must detail the name of the mine this sign will interact with. The final two lines are not checked and hence can be anything.


#Commands and permissions :computer:

Player Commands
Help command
Permission : minereset.help (Required for all other commands)
Usage: /mine help
Description: Use this command to list all the mine sub commands user has access to and how to use them

Time command
Permission: minereset.check.time
Usage: /mine time [mine]
Description: Check time remaining before mine resets

Toggle message settings command :new: (Added in 1.0.8)
Permission: minereset.player.togglemessagesettings
Usage: /mine togglemessagesettings
Description: Toggles your settings between receiving and blocking mine fill and reminder messages

List command
Permission: minereset.list
Usage: /mine list [groups|mines|spawns]
Description: List all groups or mines that exist

Details command
Permission: minereset.details
Usage: /mine info [group|mine|spawn] [name]
Description: Get all info on group or mine

General Admin Commands
Reload command
Permission: minereset.reload
Usage: /mine reload
Description: Reloads mine config file

Save command
Permission: minereset.save
Usage: /mine save
Description: Saves the mine config being used over one in folder

Clear command
Permission: minereset.clear
Usage: /mine clear [mine]
Description: Clear all block from a mine

Fill command
Permission: minereset.fill
Usage: /mine fill [mine]
Description: Fill a mine according to its blocks and percentages (manual reset)

FillBlock command
Permission: minereset.fillblock
Usage: /mine fillblock [mine]
Description: Fill a mine with the block you are currently standing on

Setup Commands
Added AddSpawn command :new: (Added in 1.0.4)
Permission: minereset.addspawn
Usage: /mine addspawn [x] [y] [z] [facing]
Description: Adds a new spawn point with the values listed

Added RemoveSpawn command :new: (Added in 1.0.4)
Permission: minereset.removespawn
Usage: /mine removespawn [spawn point]
Description: Removes the listed spawn point (To alter default spawn use "Default" other wise use the number of spawn)

Added UpdateSpawn command :new: (Added in 1.0.4)
Permission: minereset.updatespawn
Usage: /mine updatespawn [spawn point] [x] [y] [z] [facing]
Description: Updates the spawn information to the listed values (To alter default spawn use "Default" other wise use the number of spawn)

Added ChangeSpawn command :new: (Added in 1.0.4)
Permission: minereset.changespawn
Usage: /mine changespawn [mine] [spawn point]
Description: Set the listed mine to use the listed spawn point (To alter default spawn use "Default" other wise use the number of spawn)

SetSpawn command :no_entry_sign: (Removed in 1.0.4)
Permission: minereset.setspawn
Usage: /mine setspawn [x] [y] [z] [north|south|east|west]
Description: Use this command to save the spot players are sent to when they are in a mine on mine reset to the given X Y and Z coordinates with the facing as entered (player only will, use world player is currently in for spawn world)

DefineGroup command
Permission: minereset.define.group
Usage: /mine definegroup [group name] [reset time] [initial delay]
Description: Create a new mine group with name, reset time and initial delay as listed

UpdateGroup command :new: (Added in 1.0.3)
Permission: minereset.update.group
Usage: /mine updategroup [group name] [reset time] [initial delay]
Description: Updates an existing mine group with name, reset time and initial delay as listed

DeleteGroup command
Permission: minereset.delete.group
Usage: /mine deletegroup [group name] [safe|force]
Description: Deletes an existing mine group. If safe then deletion will fail if mine group has contents

DefineMine command
Permission: minereset.define.mine
Usage: /mine definemine [group] [mine name] [pos1x] [pos1y] [pos1z] [pos2x] [pos2y] [pos2z]
Description: Create a new mine in listed group with name and positions as listed using the coordinate values of the two opposite corners of a mine

RedefineMine command :new: (Added in 1.0.2)
Permission: minereset.redefine.mine
Usage: /mine redefinemine [group] [mine name] [pos1x] [pos1y] [pos1z] [pos2x] [pos2y] [pos2z]
Description: Redefine a mine to change its settings to listed group with name and positions as listed

UpdateDisplayName command :new: (Added in 1.0.12)
Permission: minereset.mine.updateDisplayName
Usage: /mine updatedisplayname [mine name] [new display name]
Description: Updates the display name of a mine

DeleteMine command
Permission: minereset.delete.mine
Usage: /mine deletemine [mine name]
Description: Delete the mine listed

AddOre command
Permission: minereset.mine.addore
Usage: /mine addore [mine] [percentage]
Description: Adds the block you are standing on to listed mine at listed percentage

UpdateOre command
Permission: minereset.mine.updateore
Usage: /mine updateore [mine] [percentage]
Description: Updates the block you are standing on in listed mine to listed percentage (percentage of 0 will remove the block from the mine)

ListReminders command :new: (Added in 1.0.2)
Permission: minereset.mine.listremindtime``
Usage: /mine listreminders
Description: List the times before a mine reset reminder messages are sent

AddRemindTime command :new: (Added in 1.0.2)
Permission: minereset.mine.addremindtime
Usage: /mine addremindtime [seconds]
Description: Add a time (in seconds) to send a reset reminder message before a mine reset

RemoveRemindTime command :new: (Added in 1.0.2)
Permission: minereset.mine.removeremindtime
Usage: /mine removeremindtime [seconds]
Description: Remove a time (in seconds) to send a reset reminder message before a mine reset

SetupSmartFill command :new: (Added in 1.0.3)
Permission: minereset.mine.setup.smartfill
Usage: /mine setupsmartfill [mine] [true|false(enabled)] [radius] [true|false(only air)]
Description: Changes the smart fill settings for the listed mine to the listed settings

AddAirBlock command :new: (Added in 1.0.3)
Permission: minereset.mine.addairblock
Usage: /mine addairblock
Description: Adds the block the player is standing on to the list of blocks that will not be modified when using SmartFill and SmartFillOnlyAir settings

RemoveAirBlock command :new: (Added in 1.0.3)
Permission: minereset.mine.removeairblock
Usage: /mine removeairblock
Description: Removes the block the player is standing on to the list of blocks that will not be modified when using SmartFill and SmartFillOnlyAir settings

UpdateChatSettings command :new: (Added in 1.0.4)
Permission: minereset.update.chatsettings
Usage: /mine updatechatsettings [FillingText|ReminderText] [setting]
Description: Changes the way messages of the listed type are sent to players

UpdateSignFillPercentage command :new: (Added in 1.0.8)
Permission: minereset.update.signfillpercentage
Usage: /mine updateSignFillPercentage [Percentage]
Description: Changes the percentage of blocks that are not air before the mine fill signs function


#Configuration :pencil:
It is advised to do most of the config in game as it can be touchy at times especially with the exact strings of the blocks to add as percentages. Please note however that to change the remind times it can only be done directly though editing the config file and reloading the config (this won’t change the timers on mines). It is also much easier to do some other actions like renaming a group or mine because it does not require deletion and then making from scratch with the new name in game. You may also want to copy item lists for mines as its easier then using the addore command for every block for every mine if you have many similar mines.

6 Likes

Great plugin works like a charm :smiley:

Great plugin! You just solved a problem I had with a map, saving me hours of pain and frustrated expletives. Thanks so much <3

No problem, glad you like it :smiley:

Released new version with “Smart fill”. If you intend to use Smart fill PLEASE read the smart fill information and new commands. On update all existing mines will have the smart fill settings added to the default setup. The default setup has smart fill disabled, radius at 3 and only air at disabled.

Works perfectly! Thank you for taking the time to work on it. :slight_smile:
Though if I may ask, is there a way to set specific mines spawns?

No way to add specific mine spawns. I can add this if you want but you should look at the Smart fill and then players will not need to be teleported!

I see I see, thank you for the reply.

I like the SmartFill, it’s nice! I will be using it on most of my mines. Especially the bigger ones.
If it wouldn’t be too much trouble though, I would ask to add it, yes… :slight_smile:

Another question for you though, is there a way to disable warning messages in chat “[_] is resetting now”? I like it, but if I have around 10 mines at different times, that’s going to get quite hectic.

I have been working on adding the per mine spawns. Just finishing up adding the new commands etc. The reason I didn’t do this initially was because in my case and most others I have seen most mines teleport players to the same area and having the same spawn allot of times is annoying. So to stop this I am adding a list of spawns and then a mine must be linked to a spawn so you don’t list the same spawn a bunch of times.

I will make a config option for mine reset and reminder messages to be moved between chat, action bar (where reminder shows at the moment just above hot bar), both and off.

Will probably have all those changes done and release the new version later tonight for you.

1 Like

Awesome!
That sounds great actually, thank you for continuing to work on it. You’re a huge help. :thumbsup:

Made all the changes, just bug fixing here and there and incorporating the new stuff into the existing info and list commands. Will relase tomorrow

1 Like

Released new version with per mine spawn configuration and configurable message channels for reset and reminder messages. This version contains config changes so it would be a good idea to backup your config before updating. Please report any bugs and read the new documentation.

Heyo. What sponge API was this originally made for? I’m on 5 right now and the new update seemed to push back errors with /mine fill a and it doesn’t seem to be filling mines.
(I’m on a fresh config too, I only had test mines until this version of MineReset was released)

I tested it on 4.2.0 When i get home i will look at it in the latest sponge version and see what errors occur.

1 Like

I am not having any issues myself on latest sponge for 1.10.2 . Can you give me any logs etc. and config of your setup.

For better comunication feel free to find me on discord, I setup a discord just for the plugin help - https://discord.gg/8Gfvwp5

Awesome, thank you for the reply. I’ll give it another try in a bit and contact you on discord if I run into any issues.

Released 1.0.5 to fix those slight issues. Issue was spawn on creating new mine was setting as “0” not “Default”.

Could you add a function to get the default ore spawning rates refill it automatically include ore from mods?

I am not sure I fully understand your question but you can already place blocks from mods in the mines. If that doesn’t answer your question could you elaborate so I can try and give a better answer

Excuse me. My meaning is I think if I want to use this plugin, I need to investigate the chance of a ore appearing at first. If I only use vanilla minecraft, it is easy to do. However, I installed some mods like Tinker construct whichl produces new ores in the world. It becomes pretty hard to know the chance of these ores appearing. Thereby, is it possible for you to add a function that the plugin can get the chances and reproduce these ores automatically. I appreciate this plugin very much, but I am wishing it can be easier.