Skip to content

Commit

Permalink
Now version 1.1. Added vanilla-like taming, more configuration, Plugi…
Browse files Browse the repository at this point in the history
…n-Metrics functionality (with shading). Updated readme.
  • Loading branch information
EasyMFnE committed May 4, 2014
1 parent 78bdf88 commit 3fe58a3
Show file tree
Hide file tree
Showing 11 changed files with 250 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@

# temp files
*~
/dependency-reduced-pom.xml
8 changes: 6 additions & 2 deletions CHANGES.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[2014-05-03] v1.0
- Initial re-release
[2014-05-04] v1.1
- Added MetricsLite functionality (see mcstats.org)
- Added vanilla-like taming
- Added independent configuration toggles for all features

[2014-05-03] v1.0
- Initial re-release
24 changes: 24 additions & 0 deletions METRICS-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright 2011-2014 Tyler Blair. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those of the
authors and contributors and should not be interpreted as representing official policies,
either expressed or implied, of anybody else.
40 changes: 30 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,44 @@
DeadHorses
==========
# DeadHorses

Allow players to tame and ride undead horses!
Allow players to tame and ride undead horses! (Skeleton horses and Zombie horses)

Permissions
-----------
Supports two different modes of taming:
vanilla-like and feeding. Vanilla-like taming lets users mount the dead horse in an
attempt to tame it, following the same rules as regular horses. Food-based taming
allows users to feed dead horses in an attempt to tame them. Foods and their
respective chances of taming are defined in the configuration.

Additionally, this plugin supports the leashing of ndead horses and the aging of
dead horses via feeding. The chance to age a baby dead horse is the same as the
chance to tame it (with the food item) as defined in the configuration.

*Note: This plugin does not affect natural mob spawning, and is best used with some
other plugin that allows dead horses to spawn in some way. The `/deadhorses summon` command will spawn one of each horse, but is primarily meant for administrative testing and not for users.*

## Permissions
deadhorses.admin - Grants access to reload and user node
deadhorses.user - Allows players to use the plugin

Commands
--------
## Commands
/deadhorses reload - Reload configuration from disk
/deadhorses summon - Summon dead horses for testing

Configuration
-------------
## Configuration

### General
Default configuration has all set to 'true'. Settings default to 'false' if undefined.

feeding-can-age: (Boolean, whether feeding can turn baby dead horses to adults)
leashing: (Boolean, whether users can attach leashes to dead horses)
taming:
vanilla-like: (Boolean, whether users can attempt to tame dead horses by mounting)
food-based: (Boolean, whether users can attempt to tame dead horses by feeding)

### Food
Each variant of dead horse has its own food list (from org.bukkit.Material)
Foods can be defined with data values like: `'golden_apple:1': 100.0`
Foods map to chance-to-tame odds, in percent (0.0-100.0)
Default config.yml:
Defaults:

skeleton_horse:
spider_eye: 2.5
Expand Down
33 changes: 32 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.easymfne.plugins</groupId>
<artifactId>DeadHorses</artifactId>
<version>1.0</version>
<version>1.1</version>
<name>${project.artifactId}</name>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
Expand Down Expand Up @@ -46,6 +46,27 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<artifactSet>
<includes>
<include>org.mcstats.bukkit:metrics-lite</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
Expand All @@ -58,6 +79,10 @@
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
<repository>
<id>Plugin Metrics</id>
<url>http://repo.mcstats.org/content/repositories/public</url>
</repository>
</repositories>
<dependencies>
<dependency>
Expand All @@ -73,6 +98,12 @@
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mcstats.bukkit</groupId>
<artifactId>metrics-lite</artifactId>
<version>R7</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/net/easymfne/deadhorses/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,33 @@ public boolean isFood(Horse.Variant variant, ItemStack item) {
return false;
}

/**
* @return Whether users can make baby dead horses age by feeding them.
*/
public boolean isFoodAgingEnabled() {
return plugin.getConfig().getBoolean("feeding-can-age", false);
}

/**
* @return Whether users can attempt to tame dead horses by feeding them.
*/
public boolean isFoodTamingEnabled() {
return plugin.getConfig().getBoolean("taming.food-based", false);
}

/**
* @return Whether users can attach leashes to dead horses.
*/
public boolean isLeashingEnabled() {
return plugin.getConfig().getBoolean("leashing", false);
}

/**
* @return Whether users can attempt to tame dead horses by riding them,
* like in vanilla Minecraft.
*/
public boolean isVanillaTamingEnabled() {
return plugin.getConfig().getBoolean("taming.vanilla-like", false);
}

}
18 changes: 18 additions & 0 deletions src/main/java/net/easymfne/deadhorses/DeadHorses.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
package net.easymfne.deadhorses;

import java.io.File;
import java.io.IOException;
import java.util.Calendar;
import java.util.logging.Level;

import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;
import org.mcstats.MetricsLite;

/**
* Main plugin class, responsible for its own setup, logging, reloading, and
Expand Down Expand Up @@ -112,6 +114,7 @@ public void onEnable() {
config = new Config(this);
deadHorsesCommand = new DeadHorsesCommand(this);
playerListener = new PlayerListener(this);
startMetrics();
fancyLog("=== ENABLE COMPLETE ("
+ (Calendar.getInstance().getTimeInMillis() - start)
+ "ms) ===");
Expand All @@ -130,4 +133,19 @@ public void reload() {
+ "ms) ===");
}

/**
* If possible, instantiate Metrics and connect with mcstats.org
*/
private void startMetrics() {
MetricsLite metrics;
try {
metrics = new MetricsLite(this);
if (metrics.start()) {
fancyLog("Metrics enabled.");
}
} catch (IOException e) {
fancyLog(Level.WARNING, "Metrics exception: " + e.getMessage());
}
}

}
7 changes: 6 additions & 1 deletion src/main/java/net/easymfne/deadhorses/DeadHorsesCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ public boolean onCommand(CommandSender sender, Command command,
Horse horse = (Horse) player.getWorld().spawnEntity(
player.getLocation(), EntityType.HORSE);
horse.setVariant(variant);
horse.setBaby();
if (plugin.getPluginConfig().isFoodAgingEnabled()) {
horse.setBaby();
}
else {
horse.setAdult();
}
}
sender.sendMessage("Dead horses have been summoned.");
return true;
Expand Down

0 comments on commit 3fe58a3

Please sign in to comment.