SpawnTag

Welcome!

Changes

If you've been using a version older than 1.2, you'll need to delete your config.txt and recreate your regions with an updated version of the plugin. The radius of the region was not persisting, but that has been corrected. Sorry about that.

Features

SpawnTag allows players to be "tagged" by others. When one player attacks another, they become "tagged," meaning that they will be unable to enter or more move within the spawn for 20 seconds. However, if they are tagged again before their time is up, the time will start over at 20 seconds!

The tag regions must be created via commands, specifying the world in which the region will exist. Soon, the plugin will allow a radius around the spawn to be specified as opposed to the default spawn radius.

Players are notified upon being tagged. They are also informed when they attempt to enter a spawn tag region. Once their timer is up, they receive a message telling them so.

Commands

/stspawncreate [world name] [radius] - Creates a region around the spawn of [world name] with a radius of [radius] blocks. By default, the radius will be the radius of the spawn.

/stspawndelete [world name] - Deletes the region around the spawn of [world name], if it exists.

Configuration/Installation

When you run your server for the first time with this plugin, it will create its own data folder. From there, when a region is created, a config.txt file will appear within the plugin's data folder (/myserver/plugins/SpawnTag/config.txt).

Within this config file, the unique ID of the world in which the region exists is saved. Deleting a world will result in that world's ID being removed from the config file.

Once you've got a config file created and some data is stored within it, the plugin will load the saved regions when the server starts.

Issues

Some of the currently tested and theoretical issues include:

  • Players tagged within the spawn are unable to change where they're looking; they are effectively paralyzed.
  • While untested, players who attempt to enter the spawn while tagged may become paralyzed on the edge of the spawn until they become "untagged."

Code

Because I'm unfamiliar with how this forum sets up repositories, here's a link to the github repository where I've uploaded the code.

Code Outline

  • Plugin is enabled -> Regions are loaded from the configuration file, instantiating SpawnTag regions from the unique IDs found within it.
  • Player is attacked -> If the attacker was also a player, a player tag event is spawned along with a tag timer object. The tag timer is a scheduled runnable which executes after approximately 20 seconds. The tag timer is canceled and replaced with a new one for the player if the player is tagged again before their timer ends.
  • Player moves -> If the player is tagged and their movement enters or is within a spawn tag region, their movement is cancelled.
  • Tag timer ends -> A tag timer end event is spawned. The player is now allowed to move freely about the spawn tag regions.

Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Members

Recent Files