mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-11-26 20:48:12 +01:00
7.5 update, Closes #62
This commit is contained in:
parent
720c7e60d4
commit
1334437fef
@ -1,6 +1,8 @@
|
||||
# Changelog
|
||||
## 8.5
|
||||
- Prevent Right-Click-Hotkey from putting items in the hotbar
|
||||
- Fixed InventoryPages support: when using &f at the beginning of button names, it was not detected by ChestSort as button
|
||||
- Fixed possible problems with Spigot versions prior to 1.11
|
||||
- Updated French, Chinese and Chinese (Traditional) translation
|
||||
|
||||
## 8.4
|
||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>de.jeffclan</groupId>
|
||||
<artifactId>JeffChestSort</artifactId>
|
||||
<version>8.4</version>
|
||||
<version>8.5</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>JeffChestSort</name>
|
||||
|
@ -36,7 +36,7 @@ public class JeffChestSortAdditionalHotkeyListener implements Listener {
|
||||
&& e.getInventory().getType() != InventoryType.DISPENSER
|
||||
&& e.getInventory().getType() != InventoryType.DROPPER
|
||||
&& e.getInventory().getType() != InventoryType.ENDER_CHEST
|
||||
&& e.getInventory().getType() != InventoryType.SHULKER_BOX
|
||||
&& !e.getInventory().getType().name().equalsIgnoreCase("SHULKER_BOX")
|
||||
&& (e.getInventory().getHolder() == null || !e.getInventory().getHolder().getClass().toString().endsWith(".CraftBarrel"))) {
|
||||
return;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public class JeffChestSortListener implements Listener {
|
||||
private boolean belongsToChestLikeBlock(Inventory inventory) {
|
||||
|
||||
// Check by InventoryType
|
||||
if (inventory.getType() == InventoryType.ENDER_CHEST || inventory.getType() == InventoryType.SHULKER_BOX) {
|
||||
if (inventory.getType() == InventoryType.ENDER_CHEST || inventory.getType().name().equalsIgnoreCase("SHULKER_BOX")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -538,23 +539,39 @@ public class JeffChestSortOrganizer {
|
||||
|
||||
public void stuffInventoryIntoAnother(Inventory source, Inventory destination,Inventory origSource) {
|
||||
|
||||
Material placeholderMaterial = Material.DIRT;
|
||||
ItemStack[] hotbarStuff = new ItemStack[9];
|
||||
boolean destinationIsPlayerInventory = true;
|
||||
if(destination.getHolder()==null || !(destination.getHolder() instanceof Player) || destination.getType() != InventoryType.PLAYER) {
|
||||
destinationIsPlayerInventory = false;
|
||||
}
|
||||
if(destinationIsPlayerInventory) {
|
||||
for(int i = 0; i<9;i++) {
|
||||
hotbarStuff[i] = destination.getItem(i);
|
||||
destination.setItem(i, new ItemStack(placeholderMaterial,64));
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> leftovers = new ArrayList<ItemStack>();
|
||||
|
||||
for(int i = 0;i<source.getSize();i++) {
|
||||
|
||||
ItemStack current = source.getItem(i);
|
||||
|
||||
if(current == null) continue;
|
||||
|
||||
source.clear(i);
|
||||
HashMap<Integer,ItemStack> currentLeftovers = destination.addItem(current);
|
||||
|
||||
|
||||
for(ItemStack currentLeftover : currentLeftovers.values()) {
|
||||
leftovers.add(currentLeftover);
|
||||
}
|
||||
}
|
||||
|
||||
origSource.addItem(leftovers.toArray(new ItemStack[leftovers.size()]));
|
||||
if(destinationIsPlayerInventory) { for(int i=0;i<9;i++) {
|
||||
destination.setItem(i, hotbarStuff[i]);
|
||||
}
|
||||
}
|
||||
updateInventoryView(destination);
|
||||
updateInventoryView(source);
|
||||
|
||||
@ -562,7 +579,7 @@ public class JeffChestSortOrganizer {
|
||||
|
||||
public void stuffPlayerInventoryIntoAnother(PlayerInventory source,
|
||||
Inventory destination) {
|
||||
boolean destinationIsShulkerBox = destination.getType() == InventoryType.SHULKER_BOX;
|
||||
boolean destinationIsShulkerBox = destination.getType().name().equalsIgnoreCase("SHULKER_BOX");
|
||||
Inventory temp = Bukkit.createInventory(null, maxInventorySize);
|
||||
for(int i = playerInvStartSlot;i<=playerInvEndSlot;i++) {
|
||||
if(source.getItem(i)==null) continue;
|
||||
|
@ -1,6 +1,6 @@
|
||||
main: de.jeffclan.JeffChestSort.JeffChestSortPlugin
|
||||
name: ChestSort
|
||||
version: 8.4
|
||||
version: 8.5
|
||||
api-version: 1.13
|
||||
description: Allows automatic chest sorting
|
||||
author: mfnalex
|
||||
|
Loading…
Reference in New Issue
Block a user