mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-11-27 04:55:31 +01:00
added API
This commit is contained in:
parent
f44b548692
commit
5fd4a796db
@ -6,6 +6,6 @@
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="lib" path="J:/BuildTools/Spigot/Spigot-API/target/spigot-api-1.13-R0.1-SNAPSHOT-shaded.jar"/>
|
||||
<classpathentry kind="lib" path="P:/BuildTools/Spigot/Spigot-API/target/spigot-api-1.13.2-R0.1-SNAPSHOT-shaded.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -1,6 +1,6 @@
|
||||
main: de.jeffclan.JeffChestSort.JeffChestSortPlugin
|
||||
name: ChestSort
|
||||
version: 2.0.3
|
||||
version: 3.0
|
||||
api-version: 1.13
|
||||
description: Allows automatic chest sorting
|
||||
author: mfnalex
|
||||
|
@ -10,15 +10,15 @@ public class JeffChestSortCategory {
|
||||
// "COARSE_DIRT" will not match the typeMatch "dirt"
|
||||
// "COARSE_DIRT" will match the typeMatch "*dirt"
|
||||
|
||||
public String name;
|
||||
public String[] typeMatches;
|
||||
String name;
|
||||
String[] typeMatches;
|
||||
|
||||
public JeffChestSortCategory(String name, String[] typeMatches) {
|
||||
JeffChestSortCategory(String name, String[] typeMatches) {
|
||||
this.name = name;
|
||||
this.typeMatches = typeMatches;
|
||||
}
|
||||
|
||||
public boolean matches(String itemname) {
|
||||
boolean matches(String itemname) {
|
||||
|
||||
boolean asteriskBefore = false;
|
||||
boolean asteriskAfter = false;
|
||||
|
@ -18,18 +18,6 @@ public class JeffChestSortCommandExecutor implements CommandExecutor {
|
||||
|
||||
if (arg1.getName().equalsIgnoreCase("chestsort")) {
|
||||
|
||||
// if(arg3.length>0) {
|
||||
// if(arg3[0].equalsIgnoreCase("reload")) {
|
||||
// if(sender.hasPermission("chestsort.reload")) {
|
||||
// /* Reload Configuration */
|
||||
// plugin.getServer().getPluginManager().disablePlugin(plugin);
|
||||
// plugin.getServer().getPluginManager().enablePlugin(plugin);
|
||||
// sender.sendMessage(ChatColor.GOLD + "ChestSort " + ChatColor.GRAY + plugin.getDescription().getVersion() + " has been reloaded.");
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(plugin.messages.MSG_PLAYERSONLY);
|
||||
return true;
|
||||
|
@ -39,7 +39,7 @@ public class JeffChestSortListener implements Listener {
|
||||
|
||||
}
|
||||
|
||||
public void registerPlayerIfNeeded(Player p) {
|
||||
void registerPlayerIfNeeded(Player p) {
|
||||
UUID uniqueId = p.getUniqueId();
|
||||
if (!plugin.PerPlayerSettings.containsKey(uniqueId.toString())) {
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class JeffChestSortOrganizer {
|
||||
|
||||
ArrayList<JeffChestSortCategory> categories = new ArrayList<JeffChestSortCategory>();
|
||||
|
||||
public JeffChestSortOrganizer(JeffChestSortPlugin plugin) {
|
||||
JeffChestSortOrganizer(JeffChestSortPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
|
||||
@ -103,8 +103,6 @@ public class JeffChestSortOrganizer {
|
||||
}
|
||||
}
|
||||
|
||||
//Todo: the same for corals
|
||||
|
||||
// Egg has to be put in front to group spawn eggs
|
||||
// E.g. cow_spawn_egg -> egg_cow_spawn
|
||||
if(typeName.endsWith("_egg")) {
|
||||
@ -144,13 +142,6 @@ public class JeffChestSortOrganizer {
|
||||
typeName = "horse_armor_" + typeName;
|
||||
}
|
||||
|
||||
// Wool (sort by color)
|
||||
/*
|
||||
* if(typeName.endsWith("_wool")) {
|
||||
*
|
||||
* typeName = typeName.replaceFirst("_wool", ""); return "wool_" + typeName; } }
|
||||
*/
|
||||
|
||||
String[] typeAndColor = new String[2];
|
||||
typeAndColor[0] = typeName;
|
||||
typeAndColor[1] = myColor;
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import de.jeffclan.utils.Utils;
|
||||
@ -24,13 +25,16 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
JeffChestSortUpdateChecker updateChecker;
|
||||
JeffChestSortListener listener;
|
||||
String sortingMethod;
|
||||
private int currentConfigVersion = 5;
|
||||
private boolean usingMatchingConfig = true;
|
||||
int currentConfigVersion = 5;
|
||||
boolean usingMatchingConfig = true;
|
||||
boolean debug = false;
|
||||
boolean verbose = true;
|
||||
private long updateCheckInterval = 86400; // in seconds. We check on startup and every 24 hours (if you never
|
||||
// restart your server)
|
||||
private long updateCheckInterval = 86400; // in seconds. We check on startup and every 24 hours (if you never restart your server)
|
||||
|
||||
public void sortInventory(Inventory inv) {
|
||||
this.organizer.sortInventory(inv);
|
||||
}
|
||||
|
||||
void createConfig() {
|
||||
this.saveDefaultConfig();
|
||||
|
||||
@ -196,7 +200,7 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean sortingEnabled(Player p) {
|
||||
boolean sortingEnabled(Player p) {
|
||||
|
||||
// The following is for all the lazy server admins who use /reload instead of properly restarting their
|
||||
// server ;) I am sometimes getting stacktraces although it is clearly stated that /reload is NOT
|
||||
|
@ -12,7 +12,7 @@ public class JeffChestSortUpdateChecker {
|
||||
|
||||
private JeffChestSortPlugin plugin;
|
||||
|
||||
public JeffChestSortUpdateChecker(JeffChestSortPlugin plugin) {
|
||||
JeffChestSortUpdateChecker(JeffChestSortPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ public class JeffChestSortUpdateChecker {
|
||||
private String currentVersion = "undefined";
|
||||
private String latestVersion = "undefined";
|
||||
|
||||
public void sendUpdateMessage(Player p) {
|
||||
void sendUpdateMessage(Player p) {
|
||||
if(!latestVersion.equals("undefined")) {
|
||||
if (!currentVersion.equals(latestVersion)) {
|
||||
p.sendMessage(ChatColor.GRAY + "There is a new version of " + ChatColor.GOLD + "ChestSort" + ChatColor.GRAY
|
||||
@ -31,7 +31,7 @@ public class JeffChestSortUpdateChecker {
|
||||
}
|
||||
}
|
||||
|
||||
public void checkForUpdate() {
|
||||
void checkForUpdate() {
|
||||
|
||||
plugin.getLogger().info("Checking for available updates...");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user