Skip to content

Commit

Permalink
Version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
totemo committed Jun 19, 2016
1 parent 94e77b6 commit 74abf6d
Show file tree
Hide file tree
Showing 9 changed files with 837 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Eclipse
.classpath
.project
.settings
classes
bin

80 changes: 79 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,80 @@
# VehicleControl
VehicleControl
==============
Automatically break boats and minecarts.


Features
--------
The features of `VehicleControl` are a superset of equivalent, active
features that were removed from [`KitchenSink`](https://github.com/NerdNu/KitchenSink).
The option to remove special carts (chest, furnace and hopper carts) was not
implemented as it is no longer used on an nerd.nu servers.

* Optionally break carts and boats when the player exits them.
* Break empty passenger mincarts and boats after they have existed for a
configurable amount of time, with the option to drop each as an item or not.
* Optionally break passenger carts containing configured mob types.
* Optionally exempt from breaking passenger carts containing configured mob
types that have been named.


Principle
---------
Vehicles are scanned periodically and tagged with metadata if they must be
broken in the future. The metadata records whether the vehicle was empty when
tagged, and the system time stamp when the vehicle should break. Vehicles
that aren't eligible to break don't get tagged.

When the plugin re-scans a vehicle that is already tagged, it checks the
metadata:

* If the vehicle was tagged while empty, but is now occupied by a vulnerable
mob, then it gets an extension to the time limit for vehicles with
vulnerable passengers.
* If the vehicle was tagged as empty or with a vulnerable mob but is
now occupied by an invulnerable entity (e.g. a player) then the metadata
is cleared.
* If the metadata matches the passenger (or lack thereof) and has reached its
expiry time, the vehicle breaks, and drops if configured to do so.

Since vehicles must be scanned at least twice before they can be dropped,
configured time limits represent the minimum time that the vehicle will exist
in its current state. It will generally last a little longer before breaking,
depending on the phase of the scan task.

In the case of boats, the scanning process only considers the primary passenger.


Configuration
-------------

| Setting | Description |
| :--- | :--- |
| `debug.config` | If true, loaded configuration settings are logged. |
| `debug.overhead` | If true, log the time taken to run the scanning task. |
| `debug.break-vehicle` | If true, log breaking of vehicles. |
| `debug.exempt-vehicle` | If true, log vehicles that are exempt from breaking when they are scanned. |
| `scan.period-seconds` | The period, in seconds, between scans for vehicles. |
| `scan.worlds` | The list of names of worlds that are scanned for vehicles. |
| `vehicles.remove-on-exit` | If true, remove carts and boats when the player exits. They will not drop as an item; they simply vanish. |
| `vehicles.drop-item` | If true, vehicles drop as an item when broken as part of the scanning process. Otherwise, they simply vanish. |
| `vehicles.break-empty` | If true, break boats or passenger carts that are empty. |
| `vehicles.break-empty-seconds` | The minimum period, in seconds, that an empty vehicle can persist before breaking. |
| `vehicles.break-with-passenger` | If true, break vehicles with passengers of specified types. |
| `vehicles.break-with-passenger-seconds` | The minimum period, in seconds, that a vehicle with a mob passenger can persist before it is broken automatically. |
| `vehicles.break-with-passenger-types` | Types of passengers that are vulnerable to their vehicle breaking. |
| `vehicles.exempt-with-named-passenger` | If true, protect vehicles with passengers of specified types if the passengers are named. |
| `vehicles.exempt-with-named-passenger-types` | Types of otherwise vulnerable passengers that are exempted from their vehicle breaking if they have been named. This setting carves out exemptions from the list of mob types in `vehicles.break-with-passenger-types`. That is, it is only necessary to exempt a mob type here if it has been previously explicitly listed as vulnerable. |


Commands
--------

* `/vehiclecontrol reload` - Reload the configuration.


Permissions
-----------

* `vehiclecontrol.admin` - Permission to run `/vehiclecontrol reload`.

34 changes: 34 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
debug:
configuration: false
overhead: true
break-vehicle: false
exempt-vehicle: false

# Settings affecting the scan for vehicles (boats and carts).
scan:
period-seconds: 310
worlds:
- world
- world_nether
- world_the_end

# Settings that apply to boats and carts.
vehicles:
# Remove the vehicle when the player exits.
remove-on-exit: false

drop-item: true
break-empty: true
break-empty-seconds: 300

# Break vehicles with specific passenger mob types.
break-with-passenger: false
break-with-passenger-seconds: 900
break-with-passenger-types:
- VILLAGER

# Exempt (from breaking) vehicles with passenger mobs of these types if the
# mobs are named.
exempt-with-named-passenger: true
exempt-with-named-passenger-types: []

19 changes: 19 additions & 0 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: ${project.name}
version: ${project.version}
author: totemo
authors: [totemo]
description: ${project.description}
website: ${project.url}
main: nu.nerd.vc.VehicleControl

permissions:
vehiclecontrol.admin:
description: Permission to administer the plugin.
default: op

commands:
vehiclecontrol:
description: ${project.name} administrative command.
permission: vehiclecontrol.admin
usage: |
/<command> reload: Reload the configuration.
71 changes: 71 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>nu.nerd</groupId>
<name>VehicleControl</name>
<artifactId>${project.name}</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<description>Automatically break boats and minecarts.</description>
<url>https://github.com/NerdNu/${project.name}</url>
<scm>
<connection>scm:git:git://github.com/NerdNu/${project.name}.git</connection>
<url>https://github.com/NerdNu/${project.name}</url>
<developerConnection>scm:git:git://github.com/NerdNu/${project.name}.git</developerConnection>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.9-R0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<defaultGoal>clean package</defaultGoal>
<sourceDirectory>${basedir}/src</sourceDirectory>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>${basedir}</directory>
<includes>
<include>plugin.yml</include>
<include>config.yml</include>
</includes>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.1</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
<finalName>${project.artifactId}-${project.version}</finalName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Loading

0 comments on commit 74abf6d

Please sign in to comment.