CONFIGURATION (config.yml)
When the plugin starts, it will create its configuration file, config.yml in its configuration directory, MobSwitch, if it does not already exist. The plugin will never modify an existing config.yml even when new configuration options are added to the plugin. (This is so that any helpful comments that an administrator has added to config.yml are not lost as Spigot's API for modifying configuration does not preserve comments.) Even so, the plugin will create/overwrite a config.example.yml every time it starts. An administrator should never modify this file as changes will be routinely overwritten. This latter file serves as documentation of all configuration items that the current version of the plugin supports (and their default values if unspecified.)
Controlling Use Through Permissions
The plugin itself does not attempt to implement strong control over use of mob switches using permissions. Instead, for situations in which more control is desired, the plugin can be configured to be activated only using a custom, uncraftable, block instead of the default respawn anchor item. Once this is done, the server administrator could use other resources to control the creation and distribution of these custom activation blocks.
If you wish to strongly control who can create mob switches then you will want to choose an activation item (the item placed in the item frame) that cannot be gathered or crafted from the world through normal means. In this case, you can set the activation item to a serialized ItemStack specification in the config.yml. Below is an example that forces the use of an eye of ender with a specific descriptive "lore" and plugin-specific NBT data. The plugin-specific NBT data can be added with the
/mobswitch item mark command. Once the custom item configuration has been added to config.yml and the plugin reloaded, use the
/mobswitch item give command to get this block in-game. The use of the give command itself is controlled with the mobswitch.command.give permission.
Code (Text):
activationItem:
==: org.bukkit.inventory.ItemStack
v: 2730
type: RESPAWN_ANCHOR
meta:
==: ItemMeta
meta-type: UNSPECIFIC
display-name: '"mobswitch activator"'
lore:
- '{"text":"activates one smart item sorter","color":"yellow","italic":false}'
PublicBukkitValues:
mobswitch:valid: 1i
NOTE: The above example was generated on Spigot 1.17. The serialized form can change with each Spigot version and may necessarily be different in other servers.
Although the activationItem configuration item can be created and edited by hand, it is not recommended. Instead, the admin should create the item in-game using other plugins to edit the item name and lore as desired. The "
/mobswitch item mark" command can also be used to add additional NBT data to the item that cannot easily be manipulated by other plugins. Once the item has been completed as desired, use the "
/mobswitch item show" command to generate and display the necessary
org.bukkit.inventory.ItemStack value for the activationItem configuration. The admin can then copy and paste the generated value into config.yml and reload the plugin.
COMMANDS and PERMISSIONS
All commands are implemented as sub-commands of the /mobswitch command.
permission:
mobswitch.commands.use
This command does nothing without further arguments. However, a player must have the required permission to use any mobswitch commands and for the command to show up in the player's available command list.
Code (Text):
/mobswitch item give
permission:
mobswitch.command.item-give
This command gives the player one of the activation items defined in the configuration file that must be placed in the item frame to create a smart item sorter.
Code (Text):
/mobswitch item mark
permission:
mobswitch.command.item-mark
This command adds MobSwitch-specific metadata to the item in hand to essentially create a unique item. Useful when ops construct custom activation items for use with the plugin.
Code (Text):
/mobswitch item show
permission:
mobswitch.command.item-show
This command displays in the player's chat the serialized form of the item in-hand. This serialized form is suitable for including in the plugin's configuration file to redefine the activation item.
Code (Text):
/mobswitch reload
permission:
mobswitch.command.reload
This command directs the plugin to reload its configuration from disk and perform a new search for active mob switches.
Code (Text):
/mobswitch show
permission:
mobswitch.command.show
This command displays in the player's chat all known mob switches (that is, those in loaded chunks).