Skip to content

Commit

Permalink
Merge pull request #87 from JEFF-Media-GbR/BestTool
Browse files Browse the repository at this point in the history
Fixed dirt randomly being affected by right click hotkey
  • Loading branch information
mfnalex committed Jul 14, 2020
2 parents 7340d45 + d461084 commit f935964
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 8.15.1
- Fixed dirt in containers being affected by the right-click hotkey even though the player had no dirt in his inventory

## 8.15.0
- Enabled left-click and right-click hotkey for 3rd party plugins implementing the ISortable interface from ChestSort's API (You only need this update if you use plugins depending on the ChestSortAPI)

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<name>ChestSort</name>
<url>https://www.chestsort.de</url>
<description>Automatically sorts your chests!</description>
<version>8.15.0</version>
<version>8.15.1</version>
<packaging>jar</packaging>

<properties>
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/de/jeff_media/ChestSort/ChestSortOrganizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@ public boolean isOversizedStack(ItemStack item) {

public void stuffInventoryIntoAnother(Inventory source, Inventory destination, Inventory origSource, boolean onlyMatchingStuff) {

Material placeholderMaterial = Material.DIRT;
ItemStack[] hotbarStuff = new ItemStack[9];
boolean destinationIsPlayerInventory = true;
if (destination.getHolder() == null || !(destination.getHolder() instanceof Player) || destination.getType() != InventoryType.PLAYER) {
Expand All @@ -565,7 +564,7 @@ public void stuffInventoryIntoAnother(Inventory source, Inventory destination, I
if (destinationIsPlayerInventory) {
for (int i = 0; i < 9; i++) {
hotbarStuff[i] = destination.getItem(i);
destination.setItem(i, new ItemStack(placeholderMaterial, 64));
destination.setItem(i, getPlaceholderBlock());
}
}

Expand Down Expand Up @@ -600,6 +599,11 @@ public void stuffInventoryIntoAnother(Inventory source, Inventory destination, I

}

// Used to temporarily fill the hotbar
private ItemStack getPlaceholderBlock() {
return new ItemStack(Material.BARRIER, 64);
}

public void stuffPlayerInventoryIntoAnother(PlayerInventory source,
Inventory destination, boolean onlyMatchingStuff) {
boolean destinationIsShulkerBox = destination.getType().name().equalsIgnoreCase("SHULKER_BOX");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/jeff_media/ChestSort/ChestSortPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
String sortingMethod;
ArrayList<String> disabledWorlds;
ChestSortAPIHandler api;
final int currentConfigVersion = 36;
final int currentConfigVersion = 37;
boolean usingMatchingConfig = true;
protected boolean debug = false;
boolean verbose = true;
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ sorting-hotkeys:
shift-right-click: true

# Additionally to sorting hotkeys, you can quickly unload your inventory into a chest and vice versa
# using left-click or richt-click outside of a chest's inventory.
# using left-click or right-click outside of a chest's inventory.
# A single click will only affect matching items (items that are already present in the other inventory)
# and a double click will try to store/take all items.
# Players can also enable/disable these shortcuts individually via /chestsort hotkeys
Expand Down Expand Up @@ -576,4 +576,4 @@ log: false

# Please DO NOT change the following line manually!
# It is used by the automatic config updater.
config-version: 36
config-version: 37
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
main: de.jeff_media.ChestSort.ChestSortPlugin
name: ChestSort
version: 8.15.0
version: 8.15.1
api-version: "1.13"
description: Allows automatic chest sorting
author: mfnalex
Expand Down

0 comments on commit f935964

Please sign in to comment.