mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-12-03 08:03:26 +01:00
8.12.0 release
This commit is contained in:
parent
5b16c3870d
commit
d478be13ea
@ -1,5 +1,7 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
## 8.11.1-SNAPSHOT
|
## 8.12.0
|
||||||
|
- Changed name of command /chestsort to /sort. You can still use /chestsort though.
|
||||||
|
- Fixed weird config updater problem on systems that don't properly support UTF-8 (like Windows)
|
||||||
- Improved help messages
|
- Improved help messages
|
||||||
- Huge code cleanup
|
- Huge code cleanup
|
||||||
- Improved performance by caching Reflection checks in the Minepacks hook
|
- Improved performance by caching Reflection checks in the Minepacks hook
|
||||||
|
4
pom.xml
4
pom.xml
@ -9,7 +9,7 @@
|
|||||||
<name>JeffChestSort</name>
|
<name>JeffChestSort</name>
|
||||||
<url>https://www.chestsort.de</url>
|
<url>https://www.chestsort.de</url>
|
||||||
<description>Automatically sorts your chests!</description>
|
<description>Automatically sorts your chests!</description>
|
||||||
<version>8.11.1-SNAPSHOT</version>
|
<version>8.12.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -132,7 +132,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.jeff_media</groupId>
|
<groupId>de.jeff_media</groupId>
|
||||||
<artifactId>PluginUpdateChecker</artifactId>
|
<artifactId>PluginUpdateChecker</artifactId>
|
||||||
<version>[1.2,</version>
|
<version>1.3.1</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -20,7 +20,7 @@ public class ChestSortChestSortCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(@NotNull CommandSender sender, Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, Command command, @NotNull String label, String[] args) {
|
||||||
|
|
||||||
// This command toggles automatic chest sorting for the player that runs the command
|
// This command toggles automatic chest sorting for the player that runs the command
|
||||||
if (!command.getName().equalsIgnoreCase("chestsort")) {
|
if (!command.getName().equalsIgnoreCase("sort")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package de.jeff_media.ChestSort;
|
package de.jeff_media.ChestSort;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.*;
|
||||||
import java.io.FileNotFoundException;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.io.FileWriter;
|
import java.nio.file.Files;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
@ -36,6 +35,12 @@ public class ChestSortConfigUpdater {
|
|||||||
plugin.getConfig().set("sorting-hotkeys.shift-right-click", plugin.getConfig().getBoolean("hotkeys.shift-right-click"));
|
plugin.getConfig().set("sorting-hotkeys.shift-right-click", plugin.getConfig().getBoolean("hotkeys.shift-right-click"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Files.deleteIfExists(new File(plugin.getDataFolder().getAbsolutePath()+File.separator+"config.old.yml").toPath());
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (plugin.debug)
|
if (plugin.debug)
|
||||||
plugin.getLogger().info("rename config.yml -> config.old.yml");
|
plugin.getLogger().info("rename config.yml -> config.old.yml");
|
||||||
Utils.renameFileInPluginDir(plugin, "config.yml", "config.old.yml");
|
Utils.renameFileInPluginDir(plugin, "config.yml", "config.old.yml");
|
||||||
@ -44,7 +49,7 @@ public class ChestSortConfigUpdater {
|
|||||||
plugin.saveDefaultConfig();
|
plugin.saveDefaultConfig();
|
||||||
|
|
||||||
File oldConfigFile = new File(plugin.getDataFolder().getAbsolutePath() + File.separator + "config.old.yml");
|
File oldConfigFile = new File(plugin.getDataFolder().getAbsolutePath() + File.separator + "config.old.yml");
|
||||||
FileConfiguration oldConfig = new YamlConfiguration();
|
FileConfiguration oldConfig = YamlConfiguration.loadConfiguration(oldConfigFile);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
oldConfig.load(oldConfigFile);
|
oldConfig.load(oldConfigFile);
|
||||||
@ -59,7 +64,7 @@ public class ChestSortConfigUpdater {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
Scanner scanner = new Scanner(
|
Scanner scanner = new Scanner(
|
||||||
new File(plugin.getDataFolder().getAbsolutePath() + File.separator + "config.yml"));
|
new File(plugin.getDataFolder().getAbsolutePath() + File.separator + "config.yml"),"UTF-8");
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
linesInDefaultConfig.add(scanner.nextLine() + "");
|
linesInDefaultConfig.add(scanner.nextLine() + "");
|
||||||
}
|
}
|
||||||
@ -117,10 +122,10 @@ public class ChestSortConfigUpdater {
|
|||||||
newLines.add(newline);
|
newLines.add(newline);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileWriter fw;
|
BufferedWriter fw;
|
||||||
String[] linesArray = newLines.toArray(new String[linesInDefaultConfig.size()]);
|
String[] linesArray = newLines.toArray(new String[linesInDefaultConfig.size()]);
|
||||||
try {
|
try {
|
||||||
fw = new FileWriter(plugin.getDataFolder().getAbsolutePath() + File.separator + "config.yml");
|
fw = Files.newBufferedWriter(new File(plugin.getDataFolder().getAbsolutePath(),"config.yml").toPath(), StandardCharsets.UTF_8);
|
||||||
for (String s : linesArray) {
|
for (String s : linesArray) {
|
||||||
fw.write(s + "\n");
|
fw.write(s + "\n");
|
||||||
}
|
}
|
||||||
|
@ -37,11 +37,6 @@ public class ChestSortListener implements Listener {
|
|||||||
|
|
||||||
plugin.permissionsHandler.addPermissions(event.getPlayer());
|
plugin.permissionsHandler.addPermissions(event.getPlayer());
|
||||||
|
|
||||||
// OPs will get an update notice if a new update is available
|
|
||||||
if (event.getPlayer().isOp()) {
|
|
||||||
plugin.updateChecker.sendUpdateMessage(event.getPlayer());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Put player into our perPlayerSettings map
|
// Put player into our perPlayerSettings map
|
||||||
plugin.registerPlayerIfNeeded(event.getPlayer());
|
plugin.registerPlayerIfNeeded(event.getPlayer());
|
||||||
|
|
||||||
@ -479,23 +474,27 @@ public class ChestSortListener implements Listener {
|
|||||||
== ChestSortPlayerSetting.DoubleClickType.LEFT_CLICK) {
|
== ChestSortPlayerSetting.DoubleClickType.LEFT_CLICK) {
|
||||||
// Left double click: put everything into destination
|
// Left double click: put everything into destination
|
||||||
plugin.organizer.stuffPlayerInventoryIntoAnother(p.getInventory(), e.getInventory(), false);
|
plugin.organizer.stuffPlayerInventoryIntoAnother(p.getInventory(), e.getInventory(), false);
|
||||||
|
plugin.organizer.sortInventory(e.getInventory());
|
||||||
} else {
|
} else {
|
||||||
// Left single click: put only matching items into destination
|
// Left single click: put only matching items into destination
|
||||||
plugin.organizer.stuffPlayerInventoryIntoAnother(p.getInventory(), e.getInventory(), true);
|
plugin.organizer.stuffPlayerInventoryIntoAnother(p.getInventory(), e.getInventory(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (e.isRightClick() && setting.rightClick) {
|
} else if (e.isRightClick() && setting.rightClick) {
|
||||||
if (setting.getCurrentDoubleClick(plugin, ChestSortPlayerSetting.DoubleClickType.RIGHT_CLICK)
|
if (setting.getCurrentDoubleClick(plugin, ChestSortPlayerSetting.DoubleClickType.RIGHT_CLICK)
|
||||||
== ChestSortPlayerSetting.DoubleClickType.RIGHT_CLICK) {
|
== ChestSortPlayerSetting.DoubleClickType.RIGHT_CLICK) {
|
||||||
// Right double click: put everything into player inventory
|
// Right double click: put everything into player inventory
|
||||||
plugin.organizer.stuffInventoryIntoAnother(e.getInventory(), p.getInventory(), e.getInventory(), false);
|
plugin.organizer.stuffInventoryIntoAnother(e.getInventory(), p.getInventory(), e.getInventory(), false);
|
||||||
|
plugin.organizer.sortInventory(p.getInventory(),9,35);
|
||||||
} else {
|
} else {
|
||||||
// Right single click: put only matching items into player inventory
|
// Right single click: put only matching items into player inventory
|
||||||
plugin.organizer.stuffInventoryIntoAnother(e.getInventory(), p.getInventory(), e.getInventory(), true);
|
plugin.organizer.stuffInventoryIntoAnother(e.getInventory(), p.getInventory(), e.getInventory(), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//plugin.organizer.sortInventory(e.getInventory());
|
//plugin.organizer.sortInventory(e.getInventory());
|
||||||
plugin.organizer.updateInventoryView(e.getInventory());
|
plugin.organizer.updateInventoryView(e.getInventory());
|
||||||
|
plugin.organizer.updateInventoryView(p.getInventory());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -510,6 +510,7 @@ public class ChestSortOrganizer {
|
|||||||
// duplication
|
// duplication
|
||||||
int currentSlot = startSlot;
|
int currentSlot = startSlot;
|
||||||
for (ItemStack item : tempInventory.getContents()) {
|
for (ItemStack item : tempInventory.getContents()) {
|
||||||
|
if(item==null) break; // TODO: If there is item loss, change break to continue (should not happen)
|
||||||
while (unsortableSlots.contains(currentSlot) && currentSlot < endSlot) {
|
while (unsortableSlots.contains(currentSlot) && currentSlot < endSlot) {
|
||||||
currentSlot++;
|
currentSlot++;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public class ChestSortPlugin extends JavaPlugin {
|
|||||||
String sortingMethod;
|
String sortingMethod;
|
||||||
ArrayList<String> disabledWorlds;
|
ArrayList<String> disabledWorlds;
|
||||||
ChestSortAPI api;
|
ChestSortAPI api;
|
||||||
final int currentConfigVersion = 33;
|
final int currentConfigVersion = 34;
|
||||||
boolean usingMatchingConfig = true;
|
boolean usingMatchingConfig = true;
|
||||||
protected boolean debug = false;
|
protected boolean debug = false;
|
||||||
boolean verbose = true;
|
boolean verbose = true;
|
||||||
@ -131,6 +131,7 @@ public class ChestSortPlugin extends JavaPlugin {
|
|||||||
// This saves the config.yml included in the .jar file, but it will not
|
// This saves the config.yml included in the .jar file, but it will not
|
||||||
// overwrite an existing config.yml
|
// overwrite an existing config.yml
|
||||||
this.saveDefaultConfig();
|
this.saveDefaultConfig();
|
||||||
|
reloadConfig();
|
||||||
|
|
||||||
// Load disabled-worlds. If it does not exist in the config, it returns null.
|
// Load disabled-worlds. If it does not exist in the config, it returns null.
|
||||||
// That's no problem
|
// That's no problem
|
||||||
@ -451,8 +452,8 @@ public class ChestSortPlugin extends JavaPlugin {
|
|||||||
getServer().getPluginManager().registerEvents(settingsGUI, this);
|
getServer().getPluginManager().registerEvents(settingsGUI, this);
|
||||||
ChestSortChestSortCommand chestsortCommandExecutor = new ChestSortChestSortCommand(this);
|
ChestSortChestSortCommand chestsortCommandExecutor = new ChestSortChestSortCommand(this);
|
||||||
ChestSortTabCompleter tabCompleter = new ChestSortTabCompleter();
|
ChestSortTabCompleter tabCompleter = new ChestSortTabCompleter();
|
||||||
this.getCommand("chestsort").setExecutor(chestsortCommandExecutor);
|
this.getCommand("sort").setExecutor(chestsortCommandExecutor);
|
||||||
this.getCommand("chestsort").setTabCompleter(tabCompleter);
|
this.getCommand("sort").setTabCompleter(tabCompleter);
|
||||||
ChestSortInvSortCommand invsortCommandExecutor = new ChestSortInvSortCommand(this);
|
ChestSortInvSortCommand invsortCommandExecutor = new ChestSortInvSortCommand(this);
|
||||||
this.getCommand("invsort").setExecutor(invsortCommandExecutor);
|
this.getCommand("invsort").setExecutor(invsortCommandExecutor);
|
||||||
this.getCommand("invsort").setTabCompleter(tabCompleter);
|
this.getCommand("invsort").setTabCompleter(tabCompleter);
|
||||||
|
@ -573,4 +573,4 @@ debug: false
|
|||||||
|
|
||||||
# Please DO NOT change the following line manually!
|
# Please DO NOT change the following line manually!
|
||||||
# It is used by the automatic config updater.
|
# It is used by the automatic config updater.
|
||||||
config-version: 33
|
config-version: 34
|
@ -1,6 +1,6 @@
|
|||||||
main: de.jeff_media.ChestSort.ChestSortPlugin
|
main: de.jeff_media.ChestSort.ChestSortPlugin
|
||||||
name: ChestSort
|
name: ChestSort
|
||||||
version: 8.11.1-SNAPSHOT
|
version: 8.12.0
|
||||||
api-version: "1.13"
|
api-version: "1.13"
|
||||||
description: Allows automatic chest sorting
|
description: Allows automatic chest sorting
|
||||||
author: mfnalex
|
author: mfnalex
|
||||||
@ -10,14 +10,14 @@ database: false
|
|||||||
loadbefore: [InvUnload]
|
loadbefore: [InvUnload]
|
||||||
softdepend: [CrackShot,InventoryPages,Minepacks]
|
softdepend: [CrackShot,InventoryPages,Minepacks]
|
||||||
commands:
|
commands:
|
||||||
chestsort:
|
sort:
|
||||||
description: Toggle automatic chest sorting.
|
description: Toggle automatic chest sorting.
|
||||||
usage: |
|
usage: |
|
||||||
/<command> -- Toggles automatic chest sorting
|
/<command> -- Toggles automatic chest sorting
|
||||||
/<command> on|off -- Enables/disabled automatic chest sorting
|
/<command> on|off -- Enables/disabled automatic chest sorting
|
||||||
/<command> hotkeys -- Opens hotkeys GUI to enable/disable hotkeys
|
/<command> hotkeys -- Opens hotkeys GUI to enable/disable hotkeys
|
||||||
/<command> reload -- Reloads config
|
/<command> reload -- Reloads config
|
||||||
aliases: sort
|
aliases: chestsort
|
||||||
permission: chestsort.use
|
permission: chestsort.use
|
||||||
invsort:
|
invsort:
|
||||||
description: Toggle automatic inventory sorting or sorts the player's inventory. When no option is specified, only the regular inventory (excluding the hotbar) is sorted.
|
description: Toggle automatic inventory sorting or sorts the player's inventory. When no option is specified, only the regular inventory (excluding the hotbar) is sorted.
|
||||||
|
Loading…
Reference in New Issue
Block a user