Convert project to maven

This commit is contained in:
Azzurite 2019-04-25 16:25:57 +02:00
parent 3a6458536e
commit 8b4808ce0f
27 changed files with 1931 additions and 1912 deletions

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="/home/alex/buildtools/Spigot/Spigot-API/target/spigot-api-1.13.2-R0.1-SNAPSHOT-shaded.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ChestSort</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding/config.yml=UTF-8

View File

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

60
pom.xml Normal file
View File

@ -0,0 +1,60 @@
<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>de.jeffclan</groupId>
<artifactId>JeffChestSort</artifactId>
<version>3.4</version>
<packaging>jar</packaging>
<name>JeffChestSort</name>
<url>https://www.spigotmc.org/resources/1-11-1-13-chestsort-api.59773/</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<finalName>ChestSort</finalName>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,60 +1,60 @@
package de.jeffclan.JeffChestSort; package de.jeffclan.JeffChestSort;
public class JeffChestSortCategory { public class JeffChestSortCategory {
// Represents a sorting category // Represents a sorting category
// Includes an array of strings called typeMatches // Includes an array of strings called typeMatches
// A typeMatch is like a regular expression, but it only supports * as // A typeMatch is like a regular expression, but it only supports * as
// placeholders // placeholders
// e.g. "DIRT" will match the typeMatch "dirt" // e.g. "DIRT" will match the typeMatch "dirt"
// "COARSE_DIRT" will not match the typeMatch "dirt" // "COARSE_DIRT" will not match the typeMatch "dirt"
// "COARSE_DIRT" will match the typeMatch "*dirt" // "COARSE_DIRT" will match the typeMatch "*dirt"
String name; String name;
String[] typeMatches; String[] typeMatches;
JeffChestSortCategory(String name, String[] typeMatches) { JeffChestSortCategory(String name, String[] typeMatches) {
this.name = name; this.name = name;
this.typeMatches = typeMatches; this.typeMatches = typeMatches;
} }
boolean matches(String itemname) { boolean matches(String itemname) {
boolean asteriskBefore = false; boolean asteriskBefore = false;
boolean asteriskAfter = false; boolean asteriskAfter = false;
for (String typeMatch : typeMatches) { for (String typeMatch : typeMatches) {
if (typeMatch.startsWith("*")) { if (typeMatch.startsWith("*")) {
asteriskBefore = true; asteriskBefore = true;
typeMatch = typeMatch.substring(1); typeMatch = typeMatch.substring(1);
} }
if (typeMatch.endsWith("*")) { if (typeMatch.endsWith("*")) {
asteriskAfter = true; asteriskAfter = true;
typeMatch = typeMatch.substring(0, typeMatch.length() - 1); typeMatch = typeMatch.substring(0, typeMatch.length() - 1);
} }
if (asteriskBefore == false && asteriskAfter == false) { if (asteriskBefore == false && asteriskAfter == false) {
if (itemname.equalsIgnoreCase(typeMatch)) { if (itemname.equalsIgnoreCase(typeMatch)) {
return true; return true;
} }
} else if (asteriskBefore == true && asteriskAfter == true) { } else if (asteriskBefore == true && asteriskAfter == true) {
if (itemname.contains(typeMatch)) { if (itemname.contains(typeMatch)) {
return true; return true;
} }
} else if (asteriskBefore == true && asteriskAfter == false) { } else if (asteriskBefore == true && asteriskAfter == false) {
if (itemname.endsWith(typeMatch)) { if (itemname.endsWith(typeMatch)) {
return true; return true;
} }
} else { } else {
if (itemname.startsWith(typeMatch)) { if (itemname.startsWith(typeMatch)) {
return true; return true;
} }
} }
} }
return false; return false;
} }
} }

View File

@ -1,48 +1,48 @@
package de.jeffclan.JeffChestSort; package de.jeffclan.JeffChestSort;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class JeffChestSortCommandExecutor implements CommandExecutor { public class JeffChestSortCommandExecutor implements CommandExecutor {
JeffChestSortPlugin plugin; JeffChestSortPlugin plugin;
JeffChestSortCommandExecutor(JeffChestSortPlugin plugin) { JeffChestSortCommandExecutor(JeffChestSortPlugin plugin) {
this.plugin = plugin; this.plugin = plugin;
} }
@Override @Override
public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) { public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) {
if (arg1.getName().equalsIgnoreCase("chestsort")) { if (arg1.getName().equalsIgnoreCase("chestsort")) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(plugin.messages.MSG_PLAYERSONLY); sender.sendMessage(plugin.messages.MSG_PLAYERSONLY);
return true; return true;
} }
Player p = (Player) sender; Player p = (Player) sender;
// fix for Spigot's stupid /reload function // fix for Spigot's stupid /reload function
plugin.listener.registerPlayerIfNeeded(p); plugin.listener.registerPlayerIfNeeded(p);
JeffChestSortPlayerSetting setting = plugin.PerPlayerSettings.get(p.getUniqueId().toString()); JeffChestSortPlayerSetting setting = plugin.PerPlayerSettings.get(p.getUniqueId().toString());
setting.sortingEnabled = !setting.sortingEnabled; setting.sortingEnabled = !setting.sortingEnabled;
setting.hasSeenMessage=true; setting.hasSeenMessage=true;
if (setting.sortingEnabled) { if (setting.sortingEnabled) {
p.sendMessage(plugin.messages.MSG_ACTIVATED); p.sendMessage(plugin.messages.MSG_ACTIVATED);
} else { } else {
p.sendMessage(plugin.messages.MSG_DEACTIVATED); p.sendMessage(plugin.messages.MSG_DEACTIVATED);
} }
return true; return true;
} }
return false; return false;
} }
} }

View File

@ -1,125 +1,125 @@
package de.jeffclan.JeffChestSort; package de.jeffclan.JeffChestSort;
import java.util.UUID; import java.util.UUID;
import java.io.File; import java.io.File;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.block.Chest; import org.bukkit.block.Chest;
import org.bukkit.block.DoubleChest; import org.bukkit.block.DoubleChest;
import org.bukkit.block.ShulkerBox; import org.bukkit.block.ShulkerBox;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
public class JeffChestSortListener implements Listener { public class JeffChestSortListener implements Listener {
JeffChestSortPlugin plugin; JeffChestSortPlugin plugin;
JeffChestSortListener(JeffChestSortPlugin plugin) { JeffChestSortListener(JeffChestSortPlugin plugin) {
this.plugin = plugin; this.plugin = plugin;
} }
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
//if (event.getPlayer().getName().equalsIgnoreCase("mfnalex")) { //if (event.getPlayer().getName().equalsIgnoreCase("mfnalex")) {
// plugin.debug = true; // plugin.debug = true;
//} //}
if (event.getPlayer().isOp()) { if (event.getPlayer().isOp()) {
plugin.updateChecker.sendUpdateMessage(event.getPlayer()); plugin.updateChecker.sendUpdateMessage(event.getPlayer());
} }
registerPlayerIfNeeded(event.getPlayer()); registerPlayerIfNeeded(event.getPlayer());
} }
void registerPlayerIfNeeded(Player p) { void registerPlayerIfNeeded(Player p) {
UUID uniqueId = p.getUniqueId(); UUID uniqueId = p.getUniqueId();
if (!plugin.PerPlayerSettings.containsKey(uniqueId.toString())) { if (!plugin.PerPlayerSettings.containsKey(uniqueId.toString())) {
File playerFile = new File(plugin.getDataFolder() + File.separator + "playerdata", File playerFile = new File(plugin.getDataFolder() + File.separator + "playerdata",
p.getUniqueId().toString() + ".yml"); p.getUniqueId().toString() + ".yml");
YamlConfiguration playerConfig = YamlConfiguration.loadConfiguration(playerFile); YamlConfiguration playerConfig = YamlConfiguration.loadConfiguration(playerFile);
boolean activeForThisPlayer; boolean activeForThisPlayer;
if (!playerFile.exists()) { if (!playerFile.exists()) {
activeForThisPlayer = plugin.getConfig().getBoolean("sorting-enabled-by-default"); activeForThisPlayer = plugin.getConfig().getBoolean("sorting-enabled-by-default");
} else { } else {
activeForThisPlayer = playerConfig.getBoolean("sortingEnabled"); activeForThisPlayer = playerConfig.getBoolean("sortingEnabled");
} }
JeffChestSortPlayerSetting newSettings = new JeffChestSortPlayerSetting(activeForThisPlayer); JeffChestSortPlayerSetting newSettings = new JeffChestSortPlayerSetting(activeForThisPlayer);
if (!plugin.getConfig().getBoolean("show-message-again-after-logout")) { if (!plugin.getConfig().getBoolean("show-message-again-after-logout")) {
newSettings.hasSeenMessage = playerConfig.getBoolean("hasSeenMessage"); newSettings.hasSeenMessage = playerConfig.getBoolean("hasSeenMessage");
} }
plugin.PerPlayerSettings.put(uniqueId.toString(), newSettings); plugin.PerPlayerSettings.put(uniqueId.toString(), newSettings);
} }
} }
@EventHandler @EventHandler
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
plugin.unregisterPlayer(event.getPlayer()); plugin.unregisterPlayer(event.getPlayer());
} }
@EventHandler @EventHandler
public void onInventoryClose(InventoryCloseEvent event) { public void onInventoryClose(InventoryCloseEvent event) {
if (!(event.getPlayer() instanceof Player)) { if (!(event.getPlayer() instanceof Player)) {
return; return;
} }
Player p = (Player) event.getPlayer(); Player p = (Player) event.getPlayer();
if (!p.hasPermission("chestsort.use")) { if (!p.hasPermission("chestsort.use")) {
return; return;
} }
if(plugin.disabledWorlds.contains(p.getWorld().getName().toLowerCase())) { if(plugin.disabledWorlds.contains(p.getWorld().getName().toLowerCase())) {
return; return;
} }
// Don't sort automatically when player is spectator or in adventure mode // Don't sort automatically when player is spectator or in adventure mode
if (p.getGameMode() == GameMode.SPECTATOR || p.getGameMode() == GameMode.ADVENTURE) { if (p.getGameMode() == GameMode.SPECTATOR || p.getGameMode() == GameMode.ADVENTURE) {
return; return;
} }
// Fixes exception when using /reload // Fixes exception when using /reload
registerPlayerIfNeeded(p); registerPlayerIfNeeded(p);
JeffChestSortPlayerSetting setting = plugin.PerPlayerSettings.get(p.getUniqueId().toString()); JeffChestSortPlayerSetting setting = plugin.PerPlayerSettings.get(p.getUniqueId().toString());
if (!(event.getInventory().getHolder() instanceof Chest) if (!(event.getInventory().getHolder() instanceof Chest)
&& !(event.getInventory().getHolder() instanceof DoubleChest) && !(event.getInventory().getHolder() instanceof DoubleChest)
&& !(event.getInventory().getHolder() instanceof ShulkerBox)) { && !(event.getInventory().getHolder() instanceof ShulkerBox)) {
return; return;
} }
if (!plugin.sortingEnabled(p)) { if (!plugin.sortingEnabled(p)) {
if (!setting.hasSeenMessage) { if (!setting.hasSeenMessage) {
setting.hasSeenMessage = true; setting.hasSeenMessage = true;
if (plugin.getConfig().getBoolean("show-message-when-using-chest")) { if (plugin.getConfig().getBoolean("show-message-when-using-chest")) {
p.sendMessage(plugin.messages.MSG_COMMANDMESSAGE); p.sendMessage(plugin.messages.MSG_COMMANDMESSAGE);
} }
} }
return; return;
} else { } else {
if (!setting.hasSeenMessage) { if (!setting.hasSeenMessage) {
setting.hasSeenMessage = true; setting.hasSeenMessage = true;
if (plugin.getConfig().getBoolean("show-message-when-using-chest-and-sorting-is-enabled")) { if (plugin.getConfig().getBoolean("show-message-when-using-chest-and-sorting-is-enabled")) {
p.sendMessage(plugin.messages.MSG_COMMANDMESSAGE2); p.sendMessage(plugin.messages.MSG_COMMANDMESSAGE2);
} }
} }
} }
plugin.organizer.sortInventory(event.getInventory()); plugin.organizer.sortInventory(event.getInventory());
} }
} }

View File

@ -1,30 +1,30 @@
package de.jeffclan.JeffChestSort; package de.jeffclan.JeffChestSort;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
public class JeffChestSortMessages { public class JeffChestSortMessages {
JeffChestSortPlugin plugin; JeffChestSortPlugin plugin;
final String MSG_ACTIVATED, MSG_DEACTIVATED, MSG_COMMANDMESSAGE, MSG_COMMANDMESSAGE2, MSG_PLAYERSONLY; final String MSG_ACTIVATED, MSG_DEACTIVATED, MSG_COMMANDMESSAGE, MSG_COMMANDMESSAGE2, MSG_PLAYERSONLY;
JeffChestSortMessages(JeffChestSortPlugin plugin) { JeffChestSortMessages(JeffChestSortPlugin plugin) {
this.plugin = plugin; this.plugin = plugin;
MSG_ACTIVATED = ChatColor.translateAlternateColorCodes('&', plugin.getConfig() MSG_ACTIVATED = ChatColor.translateAlternateColorCodes('&', plugin.getConfig()
.getString("message-sorting-enabled", "&7Automatic chest sorting has been &aenabled&7.&r")); .getString("message-sorting-enabled", "&7Automatic chest sorting has been &aenabled&7.&r"));
MSG_DEACTIVATED = ChatColor.translateAlternateColorCodes('&', plugin.getConfig() MSG_DEACTIVATED = ChatColor.translateAlternateColorCodes('&', plugin.getConfig()
.getString("message-sorting-disabled", "&7Automatic chest sorting has been &cdisabled&7.&r")); .getString("message-sorting-disabled", "&7Automatic chest sorting has been &cdisabled&7.&r"));
MSG_COMMANDMESSAGE = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString( MSG_COMMANDMESSAGE = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString(
"message-when-using-chest", "&7Hint: Type &6/chestsort&7 to enable automatic chest sorting.")); "message-when-using-chest", "&7Hint: Type &6/chestsort&7 to enable automatic chest sorting."));
MSG_COMMANDMESSAGE2 = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString( MSG_COMMANDMESSAGE2 = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString(
"message-when-using-chest2", "&7Hint: Type &6/chestsort&7 to disable automatic chest sorting.")); "message-when-using-chest2", "&7Hint: Type &6/chestsort&7 to disable automatic chest sorting."));
MSG_PLAYERSONLY = ChatColor.translateAlternateColorCodes('&', plugin.getConfig() MSG_PLAYERSONLY = ChatColor.translateAlternateColorCodes('&', plugin.getConfig()
.getString("message-error-players-only", "&cError: This command can only be run by players.&r")); .getString("message-error-players-only", "&cError: This command can only be run by players.&r"));
} }
} }

View File

@ -1,273 +1,273 @@
package de.jeffclan.JeffChestSort; package de.jeffclan.JeffChestSort;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Scanner; import java.util.Scanner;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class JeffChestSortOrganizer { public class JeffChestSortOrganizer {
/* /*
* DEPRECATED: THE FOLLOWING INFOS ARE OUTDATED * DEPRECATED: THE FOLLOWING INFOS ARE OUTDATED
* I HAVE REPLACED THE UUID CONNECTION WITH AN ARRAY THAT REFERS TO THE ACTUAL ITEMSTACK * I HAVE REPLACED THE UUID CONNECTION WITH AN ARRAY THAT REFERS TO THE ACTUAL ITEMSTACK
* Thoughts before implementing: * Thoughts before implementing:
* We create a string from each item that can be sorted. * We create a string from each item that can be sorted.
* We will omit certain parts of the name and put them behind the main name for sorting reasons. * We will omit certain parts of the name and put them behind the main name for sorting reasons.
* E.g. ACACIA_LOG -> LOG_ACACIA (so all LOGs are grouped) * E.g. ACACIA_LOG -> LOG_ACACIA (so all LOGs are grouped)
* Diamond, Gold, Iron, Stone, Wood does NOT have to be sorted, because they are already alphabetically in the right order * Diamond, Gold, Iron, Stone, Wood does NOT have to be sorted, because they are already alphabetically in the right order
* We identify the ItemStack by its hashcode, which is appended to the sorting string. * We identify the ItemStack by its hashcode, which is appended to the sorting string.
*/ */
JeffChestSortPlugin plugin; JeffChestSortPlugin plugin;
static final String[] colors = { "white", "orange", "magenta", "light_blue", "light_gray", "yellow", "lime", "pink", "gray", static final String[] colors = { "white", "orange", "magenta", "light_blue", "light_gray", "yellow", "lime", "pink", "gray",
"cyan", "purple", "blue", "brown", "green", "red", "black" }; "cyan", "purple", "blue", "brown", "green", "red", "black" };
static final String[] woodNames = { "acacia", "birch", "jungle", "oak", "spruce", "dark_oak" }; static final String[] woodNames = { "acacia", "birch", "jungle", "oak", "spruce", "dark_oak" };
ArrayList<JeffChestSortCategory> categories = new ArrayList<JeffChestSortCategory>(); ArrayList<JeffChestSortCategory> categories = new ArrayList<JeffChestSortCategory>();
JeffChestSortOrganizer(JeffChestSortPlugin plugin) { JeffChestSortOrganizer(JeffChestSortPlugin plugin) {
this.plugin = plugin; this.plugin = plugin;
// Load Categories // Load Categories
File categoriesFolder = new File(plugin.getDataFolder().getAbsolutePath() + File.separator + "categories" + File.separator); File categoriesFolder = new File(plugin.getDataFolder().getAbsolutePath() + File.separator + "categories" + File.separator);
File[] listOfCategoryFiles = categoriesFolder.listFiles(); File[] listOfCategoryFiles = categoriesFolder.listFiles();
for (File file : listOfCategoryFiles) { for (File file : listOfCategoryFiles) {
if (file.isFile()) { if (file.isFile()) {
String categoryName = file.getName().replaceFirst(".txt", ""); String categoryName = file.getName().replaceFirst(".txt", "");
try { try {
categories.add(new JeffChestSortCategory(categoryName,getArrayFromCategoryFile(file))); categories.add(new JeffChestSortCategory(categoryName,getArrayFromCategoryFile(file)));
if(plugin.verbose) { if(plugin.verbose) {
plugin.getLogger().info("Loaded category file "+file.getName()); plugin.getLogger().info("Loaded category file "+file.getName());
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
plugin.getLogger().warning("Could not load category file: "+file.getName()); plugin.getLogger().warning("Could not load category file: "+file.getName());
//e.printStackTrace(); //e.printStackTrace();
} }
} }
} }
} }
String[] getArrayFromCategoryFile(File file) throws FileNotFoundException { String[] getArrayFromCategoryFile(File file) throws FileNotFoundException {
Scanner sc = new Scanner(file); Scanner sc = new Scanner(file);
List<String> lines = new ArrayList<String>(); List<String> lines = new ArrayList<String>();
while (sc.hasNextLine()) { while (sc.hasNextLine()) {
//if(!sc.nextLine().startsWith("#")) { //if(!sc.nextLine().startsWith("#")) {
lines.add(sc.nextLine()); lines.add(sc.nextLine());
//} //}
} }
String[] arr = lines.toArray(new String[0]); String[] arr = lines.toArray(new String[0]);
sc.close(); sc.close();
return arr; return arr;
} }
String[] getTypeAndColor(String typeName) { String[] getTypeAndColor(String typeName) {
// [0] = TypeName // [0] = TypeName
// [1] = Color // [1] = Color
String myColor = "<none>"; String myColor = "<none>";
typeName = typeName.toLowerCase(); typeName = typeName.toLowerCase();
for (String color : colors) { for (String color : colors) {
if (typeName.startsWith(color)) { if (typeName.startsWith(color)) {
typeName = typeName.replaceFirst(color + "_", ""); typeName = typeName.replaceFirst(color + "_", "");
myColor = color; myColor = color;
} }
} }
for(String woodName : woodNames) { for(String woodName : woodNames) {
if(typeName.equals(woodName+"_wood")) { if(typeName.equals(woodName+"_wood")) {
typeName = "log_wood"; typeName = "log_wood";
myColor = woodName; myColor = woodName;
} }
else if(typeName.startsWith(woodName)) { else if(typeName.startsWith(woodName)) {
typeName = typeName.replaceFirst(woodName+"_", ""); typeName = typeName.replaceFirst(woodName+"_", "");
myColor = woodName; myColor = woodName;
} }
else if(typeName.equals("stripped_"+woodName+"_log")) { else if(typeName.equals("stripped_"+woodName+"_log")) {
//typeName = typeName.replaceFirst("stripped_"+woodName+"_", "stripped_"); //typeName = typeName.replaceFirst("stripped_"+woodName+"_", "stripped_");
typeName = "log_stripped"; typeName = "log_stripped";
myColor = woodName; myColor = woodName;
} else if(typeName.equals("stripped_"+woodName+"_wood")) { } else if(typeName.equals("stripped_"+woodName+"_wood")) {
typeName = "log_wood_stripped"; typeName = "log_wood_stripped";
myColor = woodName; myColor = woodName;
} }
} }
// Egg has to be put in front to group spawn eggs // Egg has to be put in front to group spawn eggs
// E.g. cow_spawn_egg -> egg_cow_spawn // E.g. cow_spawn_egg -> egg_cow_spawn
if(typeName.endsWith("_egg")) { if(typeName.endsWith("_egg")) {
typeName = typeName.replaceFirst("_egg", ""); typeName = typeName.replaceFirst("_egg", "");
typeName = "egg_" + typeName; typeName = "egg_" + typeName;
} }
// polished_andesite -> andesite_polished // polished_andesite -> andesite_polished
if(typeName.startsWith("polished_")) { if(typeName.startsWith("polished_")) {
typeName = typeName.replaceFirst("polished_", ""); typeName = typeName.replaceFirst("polished_", "");
typeName = typeName + "_polished"; typeName = typeName + "_polished";
} }
if(typeName.equalsIgnoreCase("wet_sponge")) { if(typeName.equalsIgnoreCase("wet_sponge")) {
typeName = "sponge_wet"; typeName = "sponge_wet";
} }
if(typeName.equalsIgnoreCase("carved_pumpkin")) { if(typeName.equalsIgnoreCase("carved_pumpkin")) {
typeName = "pumpkin_carved"; typeName = "pumpkin_carved";
} }
// Sort armor: helmet, chestplate, leggings, boots // Sort armor: helmet, chestplate, leggings, boots
if(typeName.endsWith("helmet")) { if(typeName.endsWith("helmet")) {
typeName = typeName.replaceFirst("helmet", "1_helmet"); typeName = typeName.replaceFirst("helmet", "1_helmet");
} else if(typeName.endsWith("chestplate")) { } else if(typeName.endsWith("chestplate")) {
typeName = typeName.replaceFirst("chestplate", "2_chestplate"); typeName = typeName.replaceFirst("chestplate", "2_chestplate");
} else if(typeName.endsWith("leggings")) { } else if(typeName.endsWith("leggings")) {
typeName = typeName.replaceFirst("leggings", "3_leggings"); typeName = typeName.replaceFirst("leggings", "3_leggings");
} else if(typeName.endsWith("boots")) { } else if(typeName.endsWith("boots")) {
typeName = typeName.replaceFirst("boots", "4_boots"); typeName = typeName.replaceFirst("boots", "4_boots");
} }
// Group horse armor // Group horse armor
if(typeName.endsWith("horse_armor")) { if(typeName.endsWith("horse_armor")) {
typeName = typeName.replaceFirst("_horse_armor", ""); typeName = typeName.replaceFirst("_horse_armor", "");
typeName = "horse_armor_" + typeName; typeName = "horse_armor_" + typeName;
} }
String[] typeAndColor = new String[2]; String[] typeAndColor = new String[2];
typeAndColor[0] = typeName; typeAndColor[0] = typeName;
typeAndColor[1] = myColor; typeAndColor[1] = myColor;
return typeAndColor; return typeAndColor;
} }
String getCategory(String typeName) { String getCategory(String typeName) {
typeName = typeName.toLowerCase(); typeName = typeName.toLowerCase();
for (JeffChestSortCategory cat : categories) { for (JeffChestSortCategory cat : categories) {
if (cat.matches(typeName)) { if (cat.matches(typeName)) {
return cat.name; return cat.name;
} }
} }
return "<none>"; return "<none>";
} }
String getSortableString(ItemStack item) { String getSortableString(ItemStack item) {
char blocksFirst; char blocksFirst;
char itemsFirst; char itemsFirst;
if (item.getType().isBlock()) { if (item.getType().isBlock()) {
blocksFirst = '!'; blocksFirst = '!';
itemsFirst = '#'; itemsFirst = '#';
} else { } else {
blocksFirst = '#'; blocksFirst = '#';
itemsFirst = '!'; itemsFirst = '!';
} }
String[] typeAndColor = getTypeAndColor(item.getType().name()); String[] typeAndColor = getTypeAndColor(item.getType().name());
String typeName = typeAndColor[0]; String typeName = typeAndColor[0];
String color = typeAndColor[1]; String color = typeAndColor[1];
String category = getCategory(item.getType().name()); String category = getCategory(item.getType().name());
String hashCode = String.valueOf(getBetterHash(item)); String hashCode = String.valueOf(getBetterHash(item));
String sortableString = plugin.sortingMethod.replaceAll("\\{itemsFirst\\}", String.valueOf(itemsFirst)); String sortableString = plugin.sortingMethod.replaceAll("\\{itemsFirst\\}", String.valueOf(itemsFirst));
sortableString = sortableString.replaceAll("\\{blocksFirst\\}", String.valueOf(blocksFirst)); sortableString = sortableString.replaceAll("\\{blocksFirst\\}", String.valueOf(blocksFirst));
sortableString = sortableString.replaceAll("\\{name\\}", typeName); sortableString = sortableString.replaceAll("\\{name\\}", typeName);
sortableString = sortableString.replaceAll("\\{color\\}", color); sortableString = sortableString.replaceAll("\\{color\\}", color);
sortableString = sortableString.replaceAll("\\{category\\}", category); sortableString = sortableString.replaceAll("\\{category\\}", category);
sortableString = sortableString + "," + hashCode; sortableString = sortableString + "," + hashCode;
return sortableString; return sortableString;
} }
void sortInventory(Inventory inv) { void sortInventory(Inventory inv) {
sortInventory(inv,0,inv.getSize()-1); sortInventory(inv,0,inv.getSize()-1);
} }
void sortInventory(Inventory inv,int startSlot, int endSlot) { void sortInventory(Inventory inv,int startSlot, int endSlot) {
// This has been optimized as of ChestSort 3.2. // This has been optimized as of ChestSort 3.2.
// The hashCode is just kept for legacy reasons, it is actually not needed. // The hashCode is just kept for legacy reasons, it is actually not needed.
if(plugin.debug) { if(plugin.debug) {
System.out.println(" "); System.out.println(" ");
System.out.println(" "); System.out.println(" ");
} }
// We copy the complete inventory into an array // We copy the complete inventory into an array
ItemStack[] items = inv.getContents(); ItemStack[] items = inv.getContents();
// Get rid of all stuff before startSlot and after endSlot // Get rid of all stuff before startSlot and after endSlot
for(int i = 0; i<startSlot;i++) { for(int i = 0; i<startSlot;i++) {
items[i] = null; items[i] = null;
} }
for(int i=endSlot+1;i<inv.getSize();i++) { for(int i=endSlot+1;i<inv.getSize();i++) {
items[i] = null; items[i] = null;
} }
// Remove the stuff that we took from the original inventory // Remove the stuff that we took from the original inventory
for(int i = startSlot; i<=endSlot;i++) { for(int i = startSlot; i<=endSlot;i++) {
inv.clear(i); inv.clear(i);
} }
// We don't want to have stacks of null // We don't want to have stacks of null
ArrayList<ItemStack> nonNullItemsList = new ArrayList<ItemStack>(); ArrayList<ItemStack> nonNullItemsList = new ArrayList<ItemStack>();
for(ItemStack item : items) { for(ItemStack item : items) {
if(item!=null) { if(item!=null) {
nonNullItemsList.add(item); nonNullItemsList.add(item);
} }
} }
// We don't need the copied inventory anymore // We don't need the copied inventory anymore
items=null; items=null;
// We need the list as array // We need the list as array
ItemStack[] nonNullItems = nonNullItemsList.toArray(new ItemStack[nonNullItemsList.size()]); ItemStack[] nonNullItems = nonNullItemsList.toArray(new ItemStack[nonNullItemsList.size()]);
// Sort the array with ItemStacks according to our sortable String // Sort the array with ItemStacks according to our sortable String
Arrays.sort(nonNullItems,new Comparator<ItemStack>(){ Arrays.sort(nonNullItems,new Comparator<ItemStack>(){
public int compare(ItemStack s1,ItemStack s2){ public int compare(ItemStack s1,ItemStack s2){
return(getSortableString(s1).compareTo(getSortableString(s2))); return(getSortableString(s1).compareTo(getSortableString(s2)));
}}); }});
// put everything back in a temporary inventory to combine ItemStacks even when using strict slot sorting // put everything back in a temporary inventory to combine ItemStacks even when using strict slot sorting
// Thanks to SnackMix for this idea! // Thanks to SnackMix for this idea!
Inventory tempInventory = Bukkit.createInventory(null, 54); //cannot be bigger than 54 as of 1.14 Inventory tempInventory = Bukkit.createInventory(null, 54); //cannot be bigger than 54 as of 1.14
for(ItemStack item : nonNullItems) { for(ItemStack item : nonNullItems) {
if(plugin.debug) System.out.println(getSortableString(item)); if(plugin.debug) System.out.println(getSortableString(item));
tempInventory.addItem(item); tempInventory.addItem(item);
} }
int currentSlot = startSlot; int currentSlot = startSlot;
for(ItemStack item : tempInventory.getContents()) { for(ItemStack item : tempInventory.getContents()) {
if(item==null) continue; if(item==null) continue;
inv.setItem(currentSlot, item); inv.setItem(currentSlot, item);
currentSlot++; currentSlot++;
} }
} }
private static int getBetterHash(ItemStack item) { private static int getBetterHash(ItemStack item) {
// I wanted to fix the skull problems here. Instead, I ended up not using the hashCode at all. // I wanted to fix the skull problems here. Instead, I ended up not using the hashCode at all.
// I still left this here because it is nice to see the hashcodes when debug is enabled // I still left this here because it is nice to see the hashcodes when debug is enabled
return item.hashCode(); return item.hashCode();
} }
} }

View File

@ -1,15 +1,15 @@
package de.jeffclan.JeffChestSort; package de.jeffclan.JeffChestSort;
public class JeffChestSortPlayerSetting { public class JeffChestSortPlayerSetting {
// Sorting enabled for this player? // Sorting enabled for this player?
boolean sortingEnabled; boolean sortingEnabled;
// Did we already show the message how to activate sorting? // Did we already show the message how to activate sorting?
boolean hasSeenMessage = false; boolean hasSeenMessage = false;
JeffChestSortPlayerSetting(boolean sortingEnabled) { JeffChestSortPlayerSetting(boolean sortingEnabled) {
this.sortingEnabled = sortingEnabled; this.sortingEnabled = sortingEnabled;
} }
} }

View File

@ -1,244 +1,244 @@
package de.jeffclan.JeffChestSort; package de.jeffclan.JeffChestSort;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import de.jeffclan.utils.Utils; import de.jeffclan.utils.Utils;
public class JeffChestSortPlugin extends JavaPlugin { public class JeffChestSortPlugin extends JavaPlugin {
Map<String, JeffChestSortPlayerSetting> PerPlayerSettings = new HashMap<String, JeffChestSortPlayerSetting>(); Map<String, JeffChestSortPlayerSetting> PerPlayerSettings = new HashMap<String, JeffChestSortPlayerSetting>();
JeffChestSortMessages messages; JeffChestSortMessages messages;
JeffChestSortOrganizer organizer; JeffChestSortOrganizer organizer;
JeffChestSortUpdateChecker updateChecker; JeffChestSortUpdateChecker updateChecker;
JeffChestSortListener listener; JeffChestSortListener listener;
String sortingMethod; String sortingMethod;
ArrayList<String> disabledWorlds; ArrayList<String> disabledWorlds;
int currentConfigVersion = 6; int currentConfigVersion = 6;
boolean usingMatchingConfig = true; boolean usingMatchingConfig = true;
boolean debug = false; boolean debug = false;
boolean verbose = true; 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) { public void sortInventory(Inventory inv) {
this.organizer.sortInventory(inv); this.organizer.sortInventory(inv);
} }
public void sortInventory(Inventory inv, int startSlot, int endSlot) { public void sortInventory(Inventory inv, int startSlot, int endSlot) {
this.organizer.sortInventory(inv,startSlot,endSlot); this.organizer.sortInventory(inv,startSlot,endSlot);
} }
void createConfig() { void createConfig() {
this.saveDefaultConfig(); this.saveDefaultConfig();
// Config version prior to 5? Then it must have been generated by ChestSort 1.x // Config version prior to 5? Then it must have been generated by ChestSort 1.x
if (getConfig().getInt("config-version", 0) < 5) { if (getConfig().getInt("config-version", 0) < 5) {
getLogger().warning("========================================================"); getLogger().warning("========================================================");
getLogger().warning("You are using a config file that has been generated"); getLogger().warning("You are using a config file that has been generated");
getLogger().warning("prior to ChestSort version 2.0.0."); getLogger().warning("prior to ChestSort version 2.0.0.");
getLogger().warning("To allow everyone to use the new features, your config"); getLogger().warning("To allow everyone to use the new features, your config");
getLogger().warning("has been renamed to config.old.yml and a new one has"); getLogger().warning("has been renamed to config.old.yml and a new one has");
getLogger().warning("been generated. Please examine the new config file to"); getLogger().warning("been generated. Please examine the new config file to");
getLogger().warning("see the new possibilities and adjust your settings."); getLogger().warning("see the new possibilities and adjust your settings.");
getLogger().warning("========================================================"); getLogger().warning("========================================================");
File configFile = new File(getDataFolder().getAbsolutePath() + File.separator + "config.yml"); File configFile = new File(getDataFolder().getAbsolutePath() + File.separator + "config.yml");
File oldConfigFile = new File(getDataFolder().getAbsolutePath() + File.separator + "config.old.yml"); File oldConfigFile = new File(getDataFolder().getAbsolutePath() + File.separator + "config.old.yml");
if (oldConfigFile.getAbsoluteFile().exists()) { if (oldConfigFile.getAbsoluteFile().exists()) {
oldConfigFile.getAbsoluteFile().delete(); oldConfigFile.getAbsoluteFile().delete();
} }
configFile.getAbsoluteFile().renameTo(oldConfigFile.getAbsoluteFile()); configFile.getAbsoluteFile().renameTo(oldConfigFile.getAbsoluteFile());
saveDefaultConfig(); saveDefaultConfig();
try { try {
getConfig().load(configFile.getAbsoluteFile()); getConfig().load(configFile.getAbsoluteFile());
} catch (IOException | InvalidConfigurationException e) { } catch (IOException | InvalidConfigurationException e) {
getLogger().warning("Could not load freshly generated config file!"); getLogger().warning("Could not load freshly generated config file!");
e.printStackTrace(); e.printStackTrace();
} }
} else if (getConfig().getInt("config-version", 0) != currentConfigVersion) { } else if (getConfig().getInt("config-version", 0) != currentConfigVersion) {
getLogger().warning("========================================================"); getLogger().warning("========================================================");
getLogger().warning("YOU ARE USING AN OLD CONFIG FILE!"); getLogger().warning("YOU ARE USING AN OLD CONFIG FILE!");
getLogger().warning("This is not a problem, as ChestSort will just use the"); getLogger().warning("This is not a problem, as ChestSort will just use the");
getLogger().warning("default settings for unset values. However, if you want"); getLogger().warning("default settings for unset values. However, if you want");
getLogger().warning("to configure the new options, please go to"); getLogger().warning("to configure the new options, please go to");
getLogger().warning("https://www.spigotmc.org/resources/1-13-chestsort.59773/"); getLogger().warning("https://www.spigotmc.org/resources/1-13-chestsort.59773/");
getLogger().warning("and replace your config.yml with the new one. You can"); getLogger().warning("and replace your config.yml with the new one. You can");
getLogger().warning("then insert your old changes into the new file."); getLogger().warning("then insert your old changes into the new file.");
getLogger().warning("========================================================"); getLogger().warning("========================================================");
usingMatchingConfig = false; usingMatchingConfig = false;
} }
File playerDataFolder = new File(getDataFolder().getPath() + File.separator + "playerdata"); File playerDataFolder = new File(getDataFolder().getPath() + File.separator + "playerdata");
if (!playerDataFolder.getAbsoluteFile().exists()) { if (!playerDataFolder.getAbsoluteFile().exists()) {
playerDataFolder.mkdir(); playerDataFolder.mkdir();
} }
File categoriesFolder = new File(getDataFolder().getPath() + File.separator + "categories"); File categoriesFolder = new File(getDataFolder().getPath() + File.separator + "categories");
if (!categoriesFolder.getAbsoluteFile().exists()) { if (!categoriesFolder.getAbsoluteFile().exists()) {
categoriesFolder.mkdir(); categoriesFolder.mkdir();
} }
getConfig().addDefault("sorting-enabled-by-default", false); getConfig().addDefault("sorting-enabled-by-default", false);
getConfig().addDefault("show-message-when-using-chest", true); getConfig().addDefault("show-message-when-using-chest", true);
getConfig().addDefault("show-message-when-using-chest-and-sorting-is-enabled", false); getConfig().addDefault("show-message-when-using-chest-and-sorting-is-enabled", false);
getConfig().addDefault("show-message-again-after-logout", true); getConfig().addDefault("show-message-again-after-logout", true);
getConfig().addDefault("sorting-method", "{category},{itemsFirst},{name},{color}"); getConfig().addDefault("sorting-method", "{category},{itemsFirst},{name},{color}");
getConfig().addDefault("check-for-updates", "true"); getConfig().addDefault("check-for-updates", "true");
getConfig().addDefault("auto-generate-category-files", true); getConfig().addDefault("auto-generate-category-files", true);
getConfig().addDefault("verbose", true); getConfig().addDefault("verbose", true);
disabledWorlds = (ArrayList<String>) getConfig().getStringList("disabled-worlds"); disabledWorlds = (ArrayList<String>) getConfig().getStringList("disabled-worlds");
} }
@Override @Override
public void onDisable() { public void onDisable() {
for (Player p : getServer().getOnlinePlayers()) { for (Player p : getServer().getOnlinePlayers()) {
unregisterPlayer(p); unregisterPlayer(p);
} }
} }
@Override @Override
public void onEnable() { public void onEnable() {
createConfig(); createConfig();
saveDefaultCategories(); saveDefaultCategories();
verbose = getConfig().getBoolean("verbose"); verbose = getConfig().getBoolean("verbose");
messages = new JeffChestSortMessages(this); messages = new JeffChestSortMessages(this);
organizer = new JeffChestSortOrganizer(this); organizer = new JeffChestSortOrganizer(this);
updateChecker = new JeffChestSortUpdateChecker(this); updateChecker = new JeffChestSortUpdateChecker(this);
listener = new JeffChestSortListener(this); listener = new JeffChestSortListener(this);
sortingMethod = getConfig().getString("sorting-method"); sortingMethod = getConfig().getString("sorting-method");
getServer().getPluginManager().registerEvents(listener, this); getServer().getPluginManager().registerEvents(listener, this);
JeffChestSortCommandExecutor commandExecutor = new JeffChestSortCommandExecutor(this); JeffChestSortCommandExecutor commandExecutor = new JeffChestSortCommandExecutor(this);
this.getCommand("chestsort").setExecutor(commandExecutor); this.getCommand("chestsort").setExecutor(commandExecutor);
if (verbose) { if (verbose) {
getLogger().info("Current sorting method: " + sortingMethod); getLogger().info("Current sorting method: " + sortingMethod);
getLogger().info("Sorting enabled by default: " + getConfig().getBoolean("sorting-enabled-by-default")); getLogger().info("Sorting enabled by default: " + getConfig().getBoolean("sorting-enabled-by-default"));
getLogger().info("Auto generate category files: " + getConfig().getBoolean("auto-generate-category-files")); getLogger().info("Auto generate category files: " + getConfig().getBoolean("auto-generate-category-files"));
getLogger().info("Check for updates: " + getConfig().getString("check-for-updates")); getLogger().info("Check for updates: " + getConfig().getString("check-for-updates"));
} }
if (getConfig().getString("check-for-updates", "true").equalsIgnoreCase("true")) { if (getConfig().getString("check-for-updates", "true").equalsIgnoreCase("true")) {
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
public void run() { public void run() {
updateChecker.checkForUpdate(); updateChecker.checkForUpdate();
} }
}, 0L, updateCheckInterval * 20); }, 0L, updateCheckInterval * 20);
} else if (getConfig().getString("check-for-updates", "true").equalsIgnoreCase("on-startup")) { } else if (getConfig().getString("check-for-updates", "true").equalsIgnoreCase("on-startup")) {
updateChecker.checkForUpdate(); updateChecker.checkForUpdate();
} }
Metrics metrics = new Metrics(this); Metrics metrics = new Metrics(this);
metrics.addCustomChart(new Metrics.SimplePie("sorting_method", () -> sortingMethod)); metrics.addCustomChart(new Metrics.SimplePie("sorting_method", () -> sortingMethod));
metrics.addCustomChart(new Metrics.SimplePie("config_version", metrics.addCustomChart(new Metrics.SimplePie("config_version",
() -> Integer.toString(getConfig().getInt("config-version", 0)))); () -> Integer.toString(getConfig().getInt("config-version", 0))));
metrics.addCustomChart( metrics.addCustomChart(
new Metrics.SimplePie("check_for_updates", () -> getConfig().getString("check-for-updates", "true"))); new Metrics.SimplePie("check_for_updates", () -> getConfig().getString("check-for-updates", "true")));
metrics.addCustomChart(new Metrics.SimplePie("show_message_when_using_chest", metrics.addCustomChart(new Metrics.SimplePie("show_message_when_using_chest",
() -> Boolean.toString(getConfig().getBoolean("show-message-when-using-chest")))); () -> Boolean.toString(getConfig().getBoolean("show-message-when-using-chest"))));
metrics.addCustomChart(new Metrics.SimplePie("show_message_when_using_chest_and_sorting_is_enabl", metrics.addCustomChart(new Metrics.SimplePie("show_message_when_using_chest_and_sorting_is_enabl",
() -> Boolean.toString(getConfig().getBoolean("show-message-when-using-chest-and-sorting-is-enabled")))); () -> Boolean.toString(getConfig().getBoolean("show-message-when-using-chest-and-sorting-is-enabled"))));
metrics.addCustomChart(new Metrics.SimplePie("show_message_again_after_logout", metrics.addCustomChart(new Metrics.SimplePie("show_message_again_after_logout",
() -> Boolean.toString(getConfig().getBoolean("show-message-again-after-logout")))); () -> Boolean.toString(getConfig().getBoolean("show-message-again-after-logout"))));
metrics.addCustomChart(new Metrics.SimplePie("sorting_enabled_by_default", metrics.addCustomChart(new Metrics.SimplePie("sorting_enabled_by_default",
() -> Boolean.toString(getConfig().getBoolean("sorting-enabled-by-default")))); () -> Boolean.toString(getConfig().getBoolean("sorting-enabled-by-default"))));
metrics.addCustomChart( metrics.addCustomChart(
new Metrics.SimplePie("using_matching_config_version", () -> Boolean.toString(usingMatchingConfig))); new Metrics.SimplePie("using_matching_config_version", () -> Boolean.toString(usingMatchingConfig)));
} }
private void saveDefaultCategories() { private void saveDefaultCategories() {
String[] defaultCategories = { "900-valuables", "910-tools", "920-combat", "930-brewing", "940-food", String[] defaultCategories = { "900-valuables", "910-tools", "920-combat", "930-brewing", "940-food",
"950-redstone", "960-wood", "970-stone", "980-plants", "981-corals" }; "950-redstone", "960-wood", "970-stone", "980-plants", "981-corals" };
if (getConfig().getBoolean("auto-generate-category-files", true) != true) { if (getConfig().getBoolean("auto-generate-category-files", true) != true) {
return; return;
} }
for (String category : defaultCategories) { for (String category : defaultCategories) {
FileOutputStream fopDefault = null; FileOutputStream fopDefault = null;
File fileDefault; File fileDefault;
try { try {
InputStream in = getClass() InputStream in = getClass()
.getResourceAsStream("/de/jeffclan/utils/categories/" + category + ".default.txt"); .getResourceAsStream("/categories/" + category + ".default.txt");
fileDefault = new File(getDataFolder().getAbsolutePath() + File.separator + "categories" fileDefault = new File(getDataFolder().getAbsolutePath() + File.separator + "categories"
+ File.separator + category + ".txt"); + File.separator + category + ".txt");
fopDefault = new FileOutputStream(fileDefault); fopDefault = new FileOutputStream(fileDefault);
// if file doesnt exists, then create it // if file doesnt exists, then create it
// if (!fileDefault.getAbsoluteFile().exists()) { // if (!fileDefault.getAbsoluteFile().exists()) {
fileDefault.createNewFile(); fileDefault.createNewFile();
// } // }
// get the content in bytes // get the content in bytes
byte[] contentInBytes = Utils.getBytes(in); byte[] contentInBytes = Utils.getBytes(in);
fopDefault.write(contentInBytes); fopDefault.write(contentInBytes);
fopDefault.flush(); fopDefault.flush();
fopDefault.close(); fopDefault.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
try { try {
if (fopDefault != null) { if (fopDefault != null) {
fopDefault.close(); fopDefault.close();
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
} }
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 // 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 // server ;) I am sometimes getting stacktraces although it is clearly stated that /reload is NOT
// supported. So, here is a quick fix // supported. So, here is a quick fix
if(PerPlayerSettings == null) { if(PerPlayerSettings == null) {
PerPlayerSettings = new HashMap<String, JeffChestSortPlayerSetting>(); PerPlayerSettings = new HashMap<String, JeffChestSortPlayerSetting>();
} }
listener.registerPlayerIfNeeded(p); listener.registerPlayerIfNeeded(p);
// End of quick fix // End of quick fix
return PerPlayerSettings.get(p.getUniqueId().toString()).sortingEnabled; return PerPlayerSettings.get(p.getUniqueId().toString()).sortingEnabled;
} }
void unregisterPlayer(Player p) { void unregisterPlayer(Player p) {
UUID uniqueId = p.getUniqueId(); UUID uniqueId = p.getUniqueId();
if (PerPlayerSettings.containsKey(uniqueId.toString())) { if (PerPlayerSettings.containsKey(uniqueId.toString())) {
JeffChestSortPlayerSetting setting = PerPlayerSettings.get(p.getUniqueId().toString()); JeffChestSortPlayerSetting setting = PerPlayerSettings.get(p.getUniqueId().toString());
File playerFile = new File(getDataFolder() + File.separator + "playerdata", File playerFile = new File(getDataFolder() + File.separator + "playerdata",
p.getUniqueId().toString() + ".yml"); p.getUniqueId().toString() + ".yml");
YamlConfiguration playerConfig = YamlConfiguration.loadConfiguration(playerFile); YamlConfiguration playerConfig = YamlConfiguration.loadConfiguration(playerFile);
playerConfig.set("sortingEnabled", setting.sortingEnabled); playerConfig.set("sortingEnabled", setting.sortingEnabled);
playerConfig.set("hasSeenMessage", setting.hasSeenMessage); playerConfig.set("hasSeenMessage", setting.hasSeenMessage);
try { try {
playerConfig.save(playerFile); playerConfig.save(playerFile);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
PerPlayerSettings.remove(uniqueId.toString()); PerPlayerSettings.remove(uniqueId.toString());
} }
} }
} }

View File

@ -1,70 +1,70 @@
package de.jeffclan.JeffChestSort; package de.jeffclan.JeffChestSort;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class JeffChestSortUpdateChecker { public class JeffChestSortUpdateChecker {
private JeffChestSortPlugin plugin; private JeffChestSortPlugin plugin;
JeffChestSortUpdateChecker(JeffChestSortPlugin plugin) { JeffChestSortUpdateChecker(JeffChestSortPlugin plugin) {
this.plugin = plugin; this.plugin = plugin;
} }
String latestVersionLink = "https://api.jeff-media.de/chestsort/chestsort-latest-version.txt"; String latestVersionLink = "https://api.jeff-media.de/chestsort/chestsort-latest-version.txt";
String downloadLink = "https://www.spigotmc.org/resources/1-13-chestsort.59773/"; String downloadLink = "https://www.spigotmc.org/resources/1-13-chestsort.59773/";
private String currentVersion = "undefined"; private String currentVersion = "undefined";
private String latestVersion = "undefined"; private String latestVersion = "undefined";
void sendUpdateMessage(Player p) { void sendUpdateMessage(Player p) {
if(!latestVersion.equals("undefined")) { if(!latestVersion.equals("undefined")) {
if (!currentVersion.equals(latestVersion)) { if (!currentVersion.equals(latestVersion)) {
p.sendMessage(ChatColor.GRAY + "There is a new version of " + ChatColor.GOLD + "ChestSort" + ChatColor.GRAY p.sendMessage(ChatColor.GRAY + "There is a new version of " + ChatColor.GOLD + "ChestSort" + ChatColor.GRAY
+ " available."); + " available.");
p.sendMessage(ChatColor.GRAY + "Please download at " + downloadLink); p.sendMessage(ChatColor.GRAY + "Please download at " + downloadLink);
} }
} }
} }
void checkForUpdate() { void checkForUpdate() {
plugin.getLogger().info("Checking for available updates..."); plugin.getLogger().info("Checking for available updates...");
try { try {
HttpURLConnection httpcon = (HttpURLConnection) new URL(latestVersionLink).openConnection(); HttpURLConnection httpcon = (HttpURLConnection) new URL(latestVersionLink).openConnection();
httpcon.addRequestProperty("User-Agent", "ChestSort/"+plugin.getDescription().getVersion()); httpcon.addRequestProperty("User-Agent", "ChestSort/"+plugin.getDescription().getVersion());
BufferedReader reader = new BufferedReader(new InputStreamReader(httpcon.getInputStream())); BufferedReader reader = new BufferedReader(new InputStreamReader(httpcon.getInputStream()));
String inputLine = reader.readLine().trim(); String inputLine = reader.readLine().trim();
latestVersion = inputLine; latestVersion = inputLine;
currentVersion = plugin.getDescription().getVersion().trim(); currentVersion = plugin.getDescription().getVersion().trim();
if (latestVersion.equals(currentVersion)) { if (latestVersion.equals(currentVersion)) {
plugin.getLogger().info("You are using the latest version of ChestSort."); plugin.getLogger().info("You are using the latest version of ChestSort.");
} else { } else {
plugin.getLogger().warning("========================================================"); plugin.getLogger().warning("========================================================");
plugin.getLogger().warning("There is a new version of ChestSort available!"); plugin.getLogger().warning("There is a new version of ChestSort available!");
plugin.getLogger().warning("Latest : " + inputLine); plugin.getLogger().warning("Latest : " + inputLine);
plugin.getLogger().warning("Current: " + currentVersion); plugin.getLogger().warning("Current: " + currentVersion);
plugin.getLogger().warning("Please update to the newest version. Download:"); plugin.getLogger().warning("Please update to the newest version. Download:");
plugin.getLogger().warning(downloadLink); plugin.getLogger().warning(downloadLink);
plugin.getLogger().warning("========================================================"); plugin.getLogger().warning("========================================================");
} }
reader.close(); reader.close();
} catch (Exception e) { } catch (Exception e) {
plugin.getLogger().warning("Could not check for updates."); plugin.getLogger().warning("Could not check for updates.");
} }
} }
} }

View File

@ -1,30 +1,30 @@
package de.jeffclan.utils; package de.jeffclan.utils;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
public class Utils { public class Utils {
public static byte[] getBytes(InputStream is) throws IOException { public static byte[] getBytes(InputStream is) throws IOException {
int len; int len;
int size = 1024; int size = 1024;
byte[] buf; byte[] buf;
if (is instanceof ByteArrayInputStream) { if (is instanceof ByteArrayInputStream) {
size = is.available(); size = is.available();
buf = new byte[size]; buf = new byte[size];
len = is.read(buf, 0, size); len = is.read(buf, 0, size);
} else { } else {
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream();
buf = new byte[size]; buf = new byte[size];
while ((len = is.read(buf, 0, size)) != -1) while ((len = is.read(buf, 0, size)) != -1)
bos.write(buf, 0, len); bos.write(buf, 0, len);
buf = bos.toByteArray(); buf = bos.toByteArray();
} }
return buf; return buf;
} }
} }

View File

@ -1,27 +1,27 @@
diamond diamond
emerald emerald
diamond_ore diamond_ore
emerald_ore emerald_ore
iron_ingot iron_ingot
iron_ore iron_ore
gold_ingot gold_ingot
gold_ore gold_ore
gold_block gold_block
diamond_block diamond_block
iron_block iron_block
lapis_lazuli lapis_lazuli
lapis_block lapis_block
obsidian obsidian
beacon beacon
conduit conduit
scute scute
elytra elytra
ender_pearl ender_pearl
ender_eye ender_eye
*_horse_armor *_horse_armor
music_disc_* music_disc_*
heart_of_the_sea heart_of_the_sea
nautilus_shell nautilus_shell
gold_nugget gold_nugget
iron_nugget iron_nugget
enchanted_book enchanted_book

View File

@ -1,10 +1,10 @@
*_pickaxe *_pickaxe
*_shovel *_shovel
*_hoe *_hoe
*_axe *_axe
flint_and_steel flint_and_steel
fishing_rod fishing_rod
compass compass
clock clock
shears shears
lead lead

View File

@ -1,13 +1,13 @@
turtle_helmet turtle_helmet
bow bow
arrow arrow
*_sword *_sword
*_helmet *_helmet
*_chestplate *_chestplate
*_leggings *_leggings
*_boots *_boots
spectral_arrow spectral_arrow
tipped_arrow tipped_arrow
shield shield
totem_of_undying totem_of_undying
trident trident

View File

@ -1,15 +1,15 @@
ghast_tear ghast_tear
potion potion
glass_bottle glass_bottle
fermented_spider_eye fermented_spider_eye
blaze_powder blaze_powder
magma_cream magma_cream
brewing_stand brewing_stand
cauldron cauldron
glistering_melon_slice glistering_melon_slice
golden_carrot golden_carrot
rabbit_foot rabbit_foot
dragon_breath dragon_breath
splash_potion splash_potion
lingering_potion lingering_potion
phantom_membrane phantom_membrane

View File

@ -1,30 +1,30 @@
apple apple
baked_potato baked_potato
beef beef
beetroot beetroot
beetroot_soup beetroot_soup
bread bread
mushroom_stew mushroom_stew
porkchop porkchop
cooked_porkchop cooked_porkchop
cod cod
salmon salmon
cooked_cod cooked_cod
cooked_salmon cooked_salmon
cake cake
cookie cookie
melon_slice melon_slice
dried_kelp dried_kelp
cooked_beef cooked_beef
chicken chicken
cooked_chicken cooked_chicken
carrot carrot
potato potato
pumpkin_pie pumpkin_pie
rabbit rabbit
cooked_rabbit cooked_rabbit
rabbit_stew rabbit_stew
mutton mutton
cooked_mutton cooked_mutton
wheat wheat
*_seeds *_seeds

View File

@ -1,23 +1,23 @@
dispenser dispenser
note_block note_block
sticky_piston sticky_piston
piston piston
tnt tnt
lever lever
*_pressure_plate *_pressure_plate
redstone redstone
*_button *_button
redstone_lamp redstone_lamp
redstone_torch redstone_torch
tripwire_hook tripwire_hook
trapped_chest trapped_chest
daylight_detector daylight_detector
redstone_block redstone_block
redstone_ore redstone_ore
hopper hopper
dropper dropper
iron_trapdoor iron_trapdoor
observer observer
iron_door iron_door
repeater repeater
comparator comparator

View File

@ -1,176 +1,176 @@
######################### #########################
##### ChestSort ##### ##### ChestSort #####
######################### #########################
# #
# Please note that players will need the chestsort.use permission # Please note that players will need the chestsort.use permission
# or have to be OP to be able to use automatic chest sorting. # or have to be OP to be able to use automatic chest sorting.
# #
# when set to false, new players will have to run /chestsort # when set to false, new players will have to run /chestsort
# once to enable automatic chest sorting. # once to enable automatic chest sorting.
sorting-enabled-by-default: false sorting-enabled-by-default: false
# when set to true, players with sorting DISABLED will be # when set to true, players with sorting DISABLED will be
# shown a message on how to enable automatic chest sorting # shown a message on how to enable automatic chest sorting
# when they use a chest for the first time. # when they use a chest for the first time.
# consider setting this to true when you disable sorting by default. # consider setting this to true when you disable sorting by default.
# see also -> message-when-using-chest # see also -> message-when-using-chest
show-message-when-using-chest: true show-message-when-using-chest: true
# when set to true, players with sorting ENABLED will be # when set to true, players with sorting ENABLED will be
# shown a message on how to disable automatic chest sorting # shown a message on how to disable automatic chest sorting
# when they use a chest for the first time. # when they use a chest for the first time.
# consider setting this to true when you enable sorting by default. # consider setting this to true when you enable sorting by default.
# see also -> message-when-using-chest2 # see also -> message-when-using-chest2
show-message-when-using-chest-and-sorting-is-enabled: false show-message-when-using-chest-and-sorting-is-enabled: false
# when set to true, the messages are shown again when a player # when set to true, the messages are shown again when a player
# logs out and back in and then uses a chest again. # logs out and back in and then uses a chest again.
show-message-again-after-logout: true show-message-again-after-logout: true
# to sort by category, we need category files. ChestSort comes # to sort by category, we need category files. ChestSort comes
# with a number of pregenerated category files, named # with a number of pregenerated category files, named
# 900-valuables.txt, 910-tools.txt, 920-combat.txt, ... # 900-valuables.txt, 910-tools.txt, 920-combat.txt, ...
# If you wish to edit those, you can disable the generation of these # If you wish to edit those, you can disable the generation of these
# files, because otherwise all your changes in the pregenerated # files, because otherwise all your changes in the pregenerated
# files will be overwritten on each server startup. # files will be overwritten on each server startup.
auto-generate-category-files: true auto-generate-category-files: true
# should we check for updates? # should we check for updates?
# when enabled, a message is printed in the console if a new # when enabled, a message is printed in the console if a new
# version has been found, and OPs will be notified when they # version has been found, and OPs will be notified when they
# join the server # join the server
# When set to true, we will check for updates on startup and every 24 hours # When set to true, we will check for updates on startup and every 24 hours
# When set to on-startup, we will only check on startup # When set to on-startup, we will only check on startup
# When set to false, don't check for updates # When set to false, don't check for updates
check-for-updates: true check-for-updates: true
# when set to true, show some verbose information on startup # when set to true, show some verbose information on startup
verbose: true verbose: true
######################### #########################
#### disabled worlds #### #### disabled worlds ####
######################### #########################
# You can disable ChestSort for certain worlds. Each world's name has to # You can disable ChestSort for certain worlds. Each world's name has to
# be on a separate line, starting with a hyphen and followed by a space # be on a separate line, starting with a hyphen and followed by a space
# Example: # Example:
# #
# disabled-worlds: # disabled-worlds:
# - world_nether # - world_nether
# - world_the_end # - world_the_end
disabled-worlds: disabled-worlds:
########################## ##########################
##### Sorting Method ##### ##### Sorting Method #####
########################## ##########################
# Advanced: how to sort things! See below for examples. # Advanced: how to sort things! See below for examples.
# Only change this if you know what you are doing. # Only change this if you know what you are doing.
# #
# Available variables: # Available variables:
# {category} order stuff by category as defined in plugins/ChestSort/categories/<category>.txt # {category} order stuff by category as defined in plugins/ChestSort/categories/<category>.txt
# {itemsFirst} put items before blocks # {itemsFirst} put items before blocks
# {blocksFirst} put blocks before items # {blocksFirst} put blocks before items
# {name} returns the name (e.g. DIRT, GRASS_BLOCK, BIRCH_LOG, DIAMOND_SWORD, ...) # {name} returns the name (e.g. DIRT, GRASS_BLOCK, BIRCH_LOG, DIAMOND_SWORD, ...)
# {color} returns the color, e.g. light_blue for wool. Empty if block/item is not dyeable # {color} returns the color, e.g. light_blue for wool. Empty if block/item is not dyeable
# #
# Warning: You must not use spaces and fields have to be separated by commas. # Warning: You must not use spaces and fields have to be separated by commas.
# #
# Examples: # Examples:
# sort by name and color: # sort by name and color:
# '{name},{color}' # '{name},{color}'
# #
# sort by name and color, but put items before blocks: # sort by name and color, but put items before blocks:
# '{itemsFirst},{name},{color}' # '{itemsFirst},{name},{color}'
# #
# sort by name and color, but put blocks before items: # sort by name and color, but put blocks before items:
# '{blocksFirst},{name},{color}' # '{blocksFirst},{name},{color}'
# #
# sort by category, then put items before blocks and sort by name and color # sort by category, then put items before blocks and sort by name and color
# '{category},{itemsFirst},{name},{color}' # '{category},{itemsFirst},{name},{color}'
# #
sorting-method: '{category},{itemsFirst},{name},{color}' sorting-method: '{category},{itemsFirst},{name},{color}'
######################### #########################
##### localization ###### ##### localization ######
######################### #########################
# Available color codes: # Available color codes:
# &0 Black &6 Gold &c Red # &0 Black &6 Gold &c Red
# &1 Dark Blue &7 Gray &d Light Purple # &1 Dark Blue &7 Gray &d Light Purple
# &2 Dark Green &8 Dark Gray &e Yellow # &2 Dark Green &8 Dark Gray &e Yellow
# &3 Dark Aqua &9 Blue &f White # &3 Dark Aqua &9 Blue &f White
# &4 Dark Red &a Green # &4 Dark Red &a Green
# &5 Dark Purple &b Aqua # &5 Dark Purple &b Aqua
# Available formatting codes: # Available formatting codes:
# &k Obfuscated &m Strikethrough # &k Obfuscated &m Strikethrough
# &l Bold &o Italic # &l Bold &o Italic
# &n Underline &r Reset # &n Underline &r Reset
##### English ##### English
message-when-using-chest: "&7Hint: Type &6/chestsort&7 to enable automatic chest sorting." message-when-using-chest: "&7Hint: Type &6/chestsort&7 to enable automatic chest sorting."
message-when-using-chest2: "&7Hint: Type &6/chestsort&7 to disable automatic chest sorting." message-when-using-chest2: "&7Hint: Type &6/chestsort&7 to disable automatic chest sorting."
message-sorting-disabled: "&7Automatic chest sorting has been &cdisabled&7." message-sorting-disabled: "&7Automatic chest sorting has been &cdisabled&7."
message-sorting-enabled: "&7Automatic chest sorting has been &aenabled&7." message-sorting-enabled: "&7Automatic chest sorting has been &aenabled&7."
message-error-players-only: "&cError: This command can only be run by players." message-error-players-only: "&cError: This command can only be run by players."
##### Chinese - Thanks to qsefthuopq for translating! -> https://www.spigotmc.org/members/qsefthuopq.339953/ ##### Chinese - Thanks to qsefthuopq for translating! -> https://www.spigotmc.org/members/qsefthuopq.339953/
#message-when-using-chest: "&7提示: 输入 &6/chestsort&7 来启用自动整理箱子." #message-when-using-chest: "&7提示: 输入 &6/chestsort&7 来启用自动整理箱子."
#message-when-using-chest2: "&7提示: 输入 &6/chestsort&7 来关闭自动整理箱子." #message-when-using-chest2: "&7提示: 输入 &6/chestsort&7 来关闭自动整理箱子."
#message-sorting-disabled: "&7自动整理箱子已 &c关闭&7." #message-sorting-disabled: "&7自动整理箱子已 &c关闭&7."
#message-sorting-enabled: "&7自动整理箱子已 &a启用&7." #message-sorting-enabled: "&7自动整理箱子已 &a启用&7."
#message-error-players-only: "&c错误: 指令只能由玩家运行." #message-error-players-only: "&c错误: 指令只能由玩家运行."
##### Traditional Chinese 繁體中文 ##### Traditional Chinese 繁體中文
#message-when-using-chest: "&7小提醒: 輸入 &6/chestsort&7 來開啟自動整理箱子" #message-when-using-chest: "&7小提醒: 輸入 &6/chestsort&7 來開啟自動整理箱子"
#message-when-using-chest2: "&7小提醒: 輸入 &6/chestsort&7 來關閉自動整理箱子" #message-when-using-chest2: "&7小提醒: 輸入 &6/chestsort&7 來關閉自動整理箱子"
#message-sorting-disabled: "&7自動整理箱子已 &c關閉&7" #message-sorting-disabled: "&7自動整理箱子已 &c關閉&7"
#message-sorting-enabled: "&7自動整理箱子已 &a開啟&7" #message-sorting-enabled: "&7自動整理箱子已 &a開啟&7"
#message-error-players-only: "&c錯誤: 這個指令只能由玩家使用" #message-error-players-only: "&c錯誤: 這個指令只能由玩家使用"
##### French - Thanks to automatizer for translating! -> https://www.spigotmc.org/members/automatizer.26188/ ##### French - Thanks to automatizer for translating! -> https://www.spigotmc.org/members/automatizer.26188/
#message-when-using-chest: "&7Astuce: Écris &6/chestsort&7 pour activer le classement automatique." #message-when-using-chest: "&7Astuce: Écris &6/chestsort&7 pour activer le classement automatique."
#message-when-using-chest2: "&7Astuce: Écris &6/chestsort&7 pour désactiver le classement automatique." #message-when-using-chest2: "&7Astuce: Écris &6/chestsort&7 pour désactiver le classement automatique."
#message-sorting-disabled: "&7Le classement automatique a été &cdésactivé&7." #message-sorting-disabled: "&7Le classement automatique a été &cdésactivé&7."
#message-sorting-enabled: "&7Le classement automatique a été &aactivé&7." #message-sorting-enabled: "&7Le classement automatique a été &aactivé&7."
#message-error-players-only: "&cErreur: Cette commande ne peut être utilisée que par des joueurs." #message-error-players-only: "&cErreur: Cette commande ne peut être utilisée que par des joueurs."
##### German ##### German
#message-when-using-chest: "&7Hinweis: Benutze &6/chestsort&7 um die automatische Kistensortierung zu aktivieren." #message-when-using-chest: "&7Hinweis: Benutze &6/chestsort&7 um die automatische Kistensortierung zu aktivieren."
#message-when-using-chest2: "&7Hinweis: Benutze &6/chestsort&7 um die automatische Kistensortierung zu deaktivieren." #message-when-using-chest2: "&7Hinweis: Benutze &6/chestsort&7 um die automatische Kistensortierung zu deaktivieren."
#message-sorting-disabled: "&7Automatische Kistensortierung &cdeaktiviert&7." #message-sorting-disabled: "&7Automatische Kistensortierung &cdeaktiviert&7."
#message-sorting-enabled: "&7Automatische Kistensortierung &aaktiviert&7." #message-sorting-enabled: "&7Automatische Kistensortierung &aaktiviert&7."
#message-error-players-only: "&cFehler: Dieser Befehl ist nur für Spieler verfügbar." #message-error-players-only: "&cFehler: Dieser Befehl ist nur für Spieler verfügbar."
##### Italian - Translated with Google. Please tell me if something is wrong :) ##### Italian - Translated with Google. Please tell me if something is wrong :)
#message-when-using-chest: "&7Nota: inserire &6/chestsort&7 per abilitare l'ordinamento automatico dei bauli." #message-when-using-chest: "&7Nota: inserire &6/chestsort&7 per abilitare l'ordinamento automatico dei bauli."
#message-when-using-chest2: "&7Nota: inserire &6/chestsort&7 per disabilitare l'ordinamento automatico dei bauli." #message-when-using-chest2: "&7Nota: inserire &6/chestsort&7 per disabilitare l'ordinamento automatico dei bauli."
#message-sorting-disabled: "&7L'ordinamento automatico dei bauli è stato &cdisattivato&7." #message-sorting-disabled: "&7L'ordinamento automatico dei bauli è stato &cdisattivato&7."
#message-sorting-enabled: "&7L'ordinamento automatico dei bauli è stato &aattivato&7." #message-sorting-enabled: "&7L'ordinamento automatico dei bauli è stato &aattivato&7."
#message-error-players-only: "&cErrore: questo comando è disponibile solo per i giocatori." #message-error-players-only: "&cErrore: questo comando è disponibile solo per i giocatori."
##### Japanese ##### Japanese
#message-when-using-chest: "&7ヒント: &6/chestsort&7 と入力して自動チェスト整理を有効にできます。" #message-when-using-chest: "&7ヒント: &6/chestsort&7 と入力して自動チェスト整理を有効にできます。"
#message-when-using-chest2: "&7ヒント: &6/chestsort&7 と入力すると自動チェスト整理を無効にできます。" #message-when-using-chest2: "&7ヒント: &6/chestsort&7 と入力すると自動チェスト整理を無効にできます。"
#message-sorting-disabled: "&7自動チェスト整理は現在 &cOFF&7です。" #message-sorting-disabled: "&7自動チェスト整理は現在 &cOFF&7です。"
#message-sorting-enabled: "&7自動チェスト整理は現在 &aON&7です。" #message-sorting-enabled: "&7自動チェスト整理は現在 &aON&7です。"
#message-error-players-only: "&cエラー: このコマンドはプレイヤーのみ実行できます。" #message-error-players-only: "&cエラー: このコマンドはプレイヤーのみ実行できます。"
##### Spanish - Thanks to Bers_ for translating! -> https://www.spigotmc.org/members/bers_.146126/ ##### Spanish - Thanks to Bers_ for translating! -> https://www.spigotmc.org/members/bers_.146126/
#message-when-using-chest: "&7Pista: Usa &6/chestsort&7 para activar el orden automático de los cofres." #message-when-using-chest: "&7Pista: Usa &6/chestsort&7 para activar el orden automático de los cofres."
#message-when-using-chest2: "&7Pista: Usa &6/chestsort&7 para desactivar el orden automático de los cofres." #message-when-using-chest2: "&7Pista: Usa &6/chestsort&7 para desactivar el orden automático de los cofres."
#message-sorting-disabled: "&7Orden automático de los cofres &cdesactivado&7." #message-sorting-disabled: "&7Orden automático de los cofres &cdesactivado&7."
#message-sorting-enabled: "&7Orden automático de los cofres &aactivado&7." #message-sorting-enabled: "&7Orden automático de los cofres &aactivado&7."
#message-error-players-only: "&cError: Este comando solo puede ser ejecutado por jugadores." #message-error-players-only: "&cError: Este comando solo puede ser ejecutado por jugadores."
######################### #########################
##### Done! ##### ##### Done! #####
######################### #########################
# please do not change the following line manually! # please do not change the following line manually!
config-version: 6 config-version: 6

View File

@ -1,20 +1,20 @@
main: de.jeffclan.JeffChestSort.JeffChestSortPlugin main: de.jeffclan.JeffChestSort.JeffChestSortPlugin
name: ChestSort name: ChestSort
version: 3.5 version: 3.5
api-version: 1.13 api-version: 1.13
description: Allows automatic chest sorting description: Allows automatic chest sorting
author: mfnalex author: mfnalex
website: https://www.spigotmc.org/resources/1-13-chestsort.59773/ website: https://www.spigotmc.org/resources/1-13-chestsort.59773/
prefix: ChestSort prefix: ChestSort
database: false database: false
loadbefore: loadbefore:
- InvUnload - InvUnload
commands: commands:
chestsort: chestsort:
description: Toggle automatic chest sorting description: Toggle automatic chest sorting
usage: /<command> usage: /<command>
aliases: sort aliases: sort
permission: chestsort.use permission: chestsort.use
permissions: permissions:
chestsort.use: chestsort.use:
description: Allows usage of automatic chest sorting description: Allows usage of automatic chest sorting