This repository has been archived by the owner on Aug 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d94e8c
commit 3cfcd01
Showing
17 changed files
with
2,067 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/bin/ | ||
/target/ | ||
/.settings/ | ||
|
||
.classpath | ||
.project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,37 @@ | ||
sthorses | ||
# stHorses | ||
[](https://ts-mc.net/jenkins/job/sthorses/) | ||
|
||
## About | ||
stHorses allows you to transport your horses by turning them into items. This lets you easily use them to get where you want to go, and them safely keep them with you until you need them again. | ||
|
||
## Usage | ||
Using stHorses is extremely simple! All you need is a horse with a saddle (or a llama with a carpet). Simply left-click the saddle while it's equipped to the horse, and the horse will be put stored in that saddle. To respawn the horse, just right-click while holding the saddle. | ||
|
||
## Features | ||
* Horses that are stored have are stored exactly as they were. This includes all stats such as speed, jump height, and health | ||
* No database, everything is stored in the item's lore | ||
* Supports all types of horses, including the new llamas, skeleton, and zombie horses | ||
* Easily see a horses stats such as max health, speed, and jump height in blocks | ||
* This plugin is under 30KB, and won't harm your server's performance | ||
* Doesn't require an update when Spigot updates (Unlike some other similar plugins). Compatible with 1.11+ | ||
|
||
## Handy Links | ||
* [Spigot Page](https://www.spigotmc.org/resources/sthorses.13879/) | ||
* [Wiki](https://github.com/ShepherdJerred/sthorses/wiki) | ||
* [Releases/Downloads](https://github.com/ShepherdJerred/sthorses/releases) | ||
* [Development Builds](https://ts-mc.net/jenkins/job/sthorses/) | ||
|
||
|
||
*A saddle holding a horse* | ||
|
||
 | ||
|
||
|
||
Graph of servers using this plugin | ||
|
||
 | ||
|
||
|
||
Consider supporting me on [Patreon](https://www.patreon.com/shepherdjerred)! All my projects are free and open source, and a lot of time goes into making them. Any amount helps. | ||
|
||
[](https://www.patreon.com/shepherdjerred) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<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>com.shepherdjerred</groupId> | ||
<artifactId>stHorses</artifactId> | ||
<version>2.1.1-SNAPSHOT</version> | ||
<name>stHorses</name> | ||
<url>https://github.com/ShepherdJerred/stHorses</url> | ||
<description>Horse storing plugin for the Spigot API</description> | ||
|
||
<organization> | ||
<name>Jerred Shepherd (RiotShielder)</name> | ||
<url>http://shepherdjerred.com/</url> | ||
</organization> | ||
|
||
<distributionManagement> | ||
<repository> | ||
<id>thestorm-releases</id> | ||
<name>Releases</name> | ||
<url>http://ts-mc.net:8085/nexus/content/repositories/releases</url> | ||
</repository> | ||
<snapshotRepository> | ||
<id>thestorm-snapshots</id> | ||
<name>Snapshots</name> | ||
<url>http://ts-mc.net:8085/nexus/content/repositories/snapshots</url> | ||
</snapshotRepository> | ||
</distributionManagement> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
<includes> | ||
<include>plugin.yml</include> | ||
</includes> | ||
</resource> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>false</filtering> | ||
<includes> | ||
<include>config.yml</include> | ||
<include>messages.yml</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>2.4.2</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<minimizeJar>true</minimizeJar> | ||
<artifactSet> | ||
<excludes> | ||
<exclude>org.spigotmc:spigot-api</exclude> | ||
</excludes> | ||
</artifactSet> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<repositories> | ||
<repository> | ||
<id>spigot-repo</id> | ||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.spigotmc</groupId> | ||
<artifactId>spigot-api</artifactId> | ||
<version>${spgiot.api.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<properties> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<spgiot.api.version>1.11.2-R0.1-SNAPSHOT</spgiot.api.version> | ||
</properties> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
package com.shepherdjerred.sthorses; | ||
|
||
import com.shepherdjerred.sthorses.files.ConfigHelper; | ||
import com.shepherdjerred.sthorses.listeners.PlaceListener; | ||
import com.shepherdjerred.sthorses.listeners.StoreListener; | ||
import com.shepherdjerred.sthorses.metrics.MetricsLite; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
import java.io.IOException; | ||
|
||
|
||
public class Main extends JavaPlugin { | ||
|
||
// Provide instance of Main class | ||
private static Main instance; | ||
|
||
public Main() { | ||
instance = this; | ||
} | ||
|
||
public static Main getInstance() { | ||
return instance; | ||
} | ||
|
||
@Override | ||
public void onEnable() { | ||
|
||
ConfigHelper.loadConfigs(); | ||
|
||
// Register events | ||
getServer().getPluginManager().registerEvents(new StoreListener(), this); | ||
getServer().getPluginManager().registerEvents(new PlaceListener(), this); | ||
|
||
// Setup Metrics | ||
try { | ||
MetricsLite metrics = new MetricsLite(this); | ||
metrics.start(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/shepherdjerred/sthorses/files/ConfigHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.shepherdjerred.sthorses.files; | ||
|
||
import com.shepherdjerred.sthorses.Main; | ||
import org.bukkit.configuration.file.YamlConfiguration; | ||
|
||
public class ConfigHelper { | ||
|
||
@SuppressWarnings("deprecation") | ||
public static void loadConfigs() { | ||
|
||
Main.getInstance().saveDefaultConfig(); | ||
Main.getInstance().getConfig().setDefaults(YamlConfiguration.loadConfiguration(Main.getInstance().getResource("config.yml"))); | ||
Main.getInstance().getConfig().options().copyDefaults(true); | ||
Main.getInstance().saveConfig(); | ||
|
||
FileManager.getInstance().loadFiles(); | ||
|
||
} | ||
|
||
} |
106 changes: 106 additions & 0 deletions
106
src/main/java/com/shepherdjerred/sthorses/files/FileManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package com.shepherdjerred.sthorses.files; | ||
|
||
import com.shepherdjerred.sthorses.Main; | ||
import org.bukkit.configuration.file.FileConfiguration; | ||
import org.bukkit.configuration.file.YamlConfiguration; | ||
|
||
import java.io.*; | ||
|
||
public class FileManager { | ||
|
||
private static FileManager instance; | ||
public FileConfiguration messages; | ||
private File messagesFile; | ||
|
||
|
||
private FileManager() { | ||
instance = this; | ||
} | ||
|
||
public static FileManager getInstance() { | ||
if (instance == null) { | ||
instance = new FileManager(); | ||
} | ||
return instance; | ||
} | ||
|
||
// Load/reload files | ||
@SuppressWarnings("deprecation") | ||
void loadFiles() { | ||
|
||
messagesFile = new File(Main.getInstance().getDataFolder(), "messages.yml"); | ||
|
||
if (!messagesFile.exists()) { | ||
|
||
messagesFile.getParentFile().mkdirs(); | ||
copy(Main.getInstance().getResource("messages.yml"), messagesFile); | ||
|
||
} | ||
|
||
messages = new YamlConfiguration(); | ||
|
||
try { | ||
|
||
messages.load(messagesFile); | ||
|
||
messages.setDefaults(YamlConfiguration.loadConfiguration(Main.getInstance().getResource("messages.yml"))); | ||
messages.options().copyDefaults(true); | ||
saveFiles(FileName.MESSAGES); | ||
|
||
} catch (Exception e) { | ||
|
||
e.printStackTrace(); | ||
|
||
} | ||
|
||
} | ||
|
||
// Save files | ||
private void saveFiles(FileName file) { | ||
try { | ||
|
||
switch (file) { | ||
|
||
case MESSAGES: | ||
messages.save(messagesFile); | ||
break; | ||
|
||
} | ||
|
||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
// Copy default files | ||
private void copy(InputStream in, File file) { | ||
|
||
try { | ||
|
||
OutputStream out = new FileOutputStream(file); | ||
byte[] buf = new byte[1024]; | ||
int len; | ||
|
||
while ((len = in.read(buf)) > 0) { | ||
|
||
out.write(buf, 0, len); | ||
|
||
} | ||
|
||
out.close(); | ||
in.close(); | ||
|
||
} catch (Exception e) { | ||
|
||
e.printStackTrace(); | ||
|
||
} | ||
|
||
} | ||
|
||
public enum FileName { | ||
|
||
MESSAGES | ||
|
||
} | ||
} |
Oops, something went wrong.