8.0 update

This commit is contained in:
mfnalex 2020-05-20 22:46:58 +02:00
parent 7b1226a7a6
commit 8d470bd241
5 changed files with 29 additions and 21 deletions

View File

@ -6,7 +6,7 @@
<groupId>de.jeffclan</groupId>
<artifactId>JeffChestSort</artifactId>
<version>8.0-pre1</version>
<version>8.0</version>
<packaging>jar</packaging>
<name>JeffChestSort</name>

View File

@ -23,7 +23,12 @@ public class JeffChestSortAdditionalHotkeyListener implements Listener {
if(e.getClickedInventory()!=null) {
return;
}
if(e.getInventory().getType() != InventoryType.CHEST) {
if(e.getInventory().getType() != InventoryType.CHEST
&& e.getInventory().getType() != InventoryType.DISPENSER
&& e.getInventory().getType() != InventoryType.DROPPER
&& e.getInventory().getType() != InventoryType.ENDER_CHEST
&& e.getInventory().getType() != InventoryType.SHULKER_BOX
&& !e.getInventory().getHolder().getClass().toString().endsWith(".CraftBarrel")) {
return;
}
Player p = (Player) e.getWhoClicked();
@ -36,7 +41,7 @@ public class JeffChestSortAdditionalHotkeyListener implements Listener {
if(e.isLeftClick() && setting.leftClick) {
de.jeffclan.utils.InventoryHelper.stuffPlayerInventoryIntoAnother(p.getInventory(), e.getInventory());
} else if(e.isRightClick() && setting.rightClick) {
de.jeffclan.utils.InventoryHelper.stuffInventoryIntoAnother(e.getInventory(), p.getInventory());
de.jeffclan.utils.InventoryHelper.stuffInventoryIntoAnother(e.getInventory(), p.getInventory(),e.getInventory());
}
}

View File

@ -7,6 +7,7 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
@ -35,7 +36,7 @@ public class InventoryHelper {
}
}
public static void stuffInventoryIntoAnother(Inventory source, Inventory destination) {
public static void stuffInventoryIntoAnother(Inventory source, Inventory destination,Inventory origSource) {
ArrayList<ItemStack> leftovers = new ArrayList<ItemStack>();
@ -53,7 +54,7 @@ public class InventoryHelper {
}
}
source.addItem(leftovers.toArray(new ItemStack[leftovers.size()]));
origSource.addItem(leftovers.toArray(new ItemStack[leftovers.size()]));
updateInventoryView(destination);
updateInventoryView(source);
@ -61,13 +62,15 @@ public class InventoryHelper {
public static void stuffPlayerInventoryIntoAnother(PlayerInventory source,
Inventory destination) {
boolean destinationIsShulkerBox = destination.getType() == InventoryType.SHULKER_BOX;
Inventory temp = Bukkit.createInventory(null, maxInventorySize);
for(int i = playerInvStartSlot;i<=playerInvEndSlot;i++) {
if(source.getItem(i)==null) continue;
if(destinationIsShulkerBox && source.getItem(i).getType().name().endsWith("SHULKER_BOX")) continue;
temp.addItem(source.getItem(i));
source.clear(i);
}
stuffInventoryIntoAnother(temp,destination);
stuffInventoryIntoAnother(temp,destination,source);
}

View File

@ -226,7 +226,7 @@ message-gui-shift-click: "Shift + Click"
message-gui-double-click: "Double-Click"
message-gui-shift-right-click: "Shift + Right-Click"
message-gui-left-click: "Fill Chest (Left-Click)"
message-gui-right-click: "Load Chest (Right-Click)"
message-gui-right-click: "Empty Chest (Right-Click)"
##### English
#message-when-using-chest: "&7Hint: Type &6/chestsort&7 to enable automatic chest sorting."
@ -245,7 +245,7 @@ message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-double-click: "Double-Click"
#message-gui-shift-right-click: "Shift + Right-Click"
#message-gui-left-click: "Fill Chest (Left-Click)"
#message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-right-click: "Empty Chest (Right-Click)"
##### Chinese - Thanks to qsefthuopq and Aira-Sakuranomiya for translating!
##### Note: Some messages are still untranslated. Please send me your translation at SpigotMC
@ -265,7 +265,7 @@ message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-double-click: "双击"
#message-gui-shift-right-click: "Shift + 双击"
#message-gui-left-click: "Fill Chest (Left-Click)"
#message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-right-click: "Empty Chest (Right-Click)"
##### Chinese (Traditional) 繁體中文 - Thanks to Command1264 for translating!
##### Note: Some messages are still untranslated. Please send me your translation at SpigotMC
@ -285,7 +285,7 @@ message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-double-click: "雙擊左鍵"
#message-gui-shift-right-click: "Shift + 右鍵"
#message-gui-left-click: "Fill Chest (Left-Click)"
#message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-right-click: "Empty Chest (Right-Click)"
##### Dutch - Thanks to Xeyame for translating!
##### Note: Some messages are still untranslated. Please send me your translation at SpigotMC
@ -305,7 +305,7 @@ message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-double-click: "Double-Click"
#message-gui-shift-right-click: "Shift + Right-Click"
#message-gui-left-click: "Fill Chest (Left-Click)"
#message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-right-click: "Empty Chest (Right-Click)"
##### French / Français - Thanks to automatizer, demon57730 and FichdlMaa for translating!
##### Note: Some messages are still untranslated. Please send me your translation at SpigotMC
@ -325,7 +325,7 @@ message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-double-click: "Double-Clic"
#message-gui-shift-right-click: "Shift + Clic droit"
#message-gui-left-click: "Fill Chest (Left-Click)"
#message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-right-click: "Empty Chest (Right-Click)"
##### German
#message-when-using-chest: "&7Hinweis: Benutze &6/chestsort&7 um die automatische Kistensortierung zu aktivieren."
@ -364,7 +364,7 @@ message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-double-click: "Double-Click"
#message-gui-shift-right-click: "Shift + Right-Click"
#message-gui-left-click: "Fill Chest (Left-Click)"
#message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-right-click: "Empty Chest (Right-Click)"
##### Italian
##### Note: Some messages are still untranslated. Please send me your translation at SpigotMC
@ -384,7 +384,7 @@ message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-double-click: "Double-Click"
#message-gui-shift-right-click: "Shift + Right-Click"
#message-gui-left-click: "Fill Chest (Left-Click)"
#message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-right-click: "Empty Chest (Right-Click)"
##### Japanese
##### Note: Some messages are still untranslated. Please send me your translation at SpigotMC
@ -404,7 +404,7 @@ message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-double-click: "Double-Click"
#message-gui-shift-right-click: "Shift + Right-Click"
#message-gui-left-click: "Fill Chest (Left-Click)"
#message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-right-click: "Empty Chest (Right-Click)"
##### Korean (한국어) - Thanks to kf12 for translating!
##### Note: Some messages are still untranslated. Please send me your translation at SpigotMC
@ -424,7 +424,7 @@ message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-double-click: "더블 클릭"
#message-gui-shift-right-click: "쉬프트 + 우클릭"
#message-gui-left-click: "Fill Chest (Left-Click)"
#message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-right-click: "Empty Chest (Right-Click)"
##### Portuguese - Thanks to wildastral for translating!
##### Note: Some messages are still untranslated. Please send me your translation at SpigotMC
@ -444,7 +444,7 @@ message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-double-click: "Double-Click"
#message-gui-shift-right-click: "Shift + Right-Click"
#message-gui-left-click: "Fill Chest (Left-Click)"
#message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-right-click: "Empty Chest (Right-Click)"
##### Russian - Thanks to Gandon for translating!
##### Note: Some messages are still untranslated. Please send me your translation at SpigotMC
@ -464,7 +464,7 @@ message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-double-click: "Double-Click"
#message-gui-shift-right-click: "Shift + Right-Click"
#message-gui-left-click: "Fill Chest (Left-Click)"
#message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-right-click: "Empty Chest (Right-Click)"
##### Spanish - Thanks to Bers_ for translating!
##### Note: Some messages are still untranslated. Please send me your translation at SpigotMC
@ -484,7 +484,7 @@ message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-double-click: "Double-Click"
#message-gui-shift-right-click: "Shift + Right-Click"
#message-gui-left-click: "Fill Chest (Left-Click)"
#message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-right-click: "Empty Chest (Right-Click)"
##### Turkish - Thanks to bertek41 for translating!
##### Note: Some messages are still untranslated. Please send me your translation at SpigotMC
@ -504,7 +504,7 @@ message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-double-click: "Double-Click"
#message-gui-shift-right-click: "Shift + Right-Click"
#message-gui-left-click: "Fill Chest (Left-Click)"
#message-gui-right-click: "Load Chest (Right-Click)"
#message-gui-right-click: "Empty Chest (Right-Click)"
############################
##### Technical stuff! #####

View File

@ -1,6 +1,6 @@
main: de.jeffclan.JeffChestSort.JeffChestSortPlugin
name: ChestSort
version: 8.0-pre1
version: 8.0
api-version: 1.13
description: Allows automatic chest sorting
author: mfnalex