1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Minor tweaks

Co-authored-by: TheBusyBiscuit <TheBusyBiscuit@users.noreply.github.com>
This commit is contained in:
svr333 2022-01-02 15:17:45 +01:00 committed by GitHub
parent ef8e84a350
commit 7f8ef8be84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,8 +50,7 @@ public class MiddleClickListener implements Listener {
} }
// find the actual slimefun item the user is looking at // find the actual slimefun item the user is looking at
String id = BlockStorage.checkID(b); SlimefunItem sfItem = BlockStorage.check(b);
SlimefunItem sfItem = SlimefunItem.getById(id);
// vanilla block -> ignore // vanilla block -> ignore
if (sfItem == null) { if (sfItem == null) {
@ -59,10 +58,10 @@ public class MiddleClickListener implements Listener {
} }
/* /*
* Before giving the item to the user, check if you can swap * Before giving the item to the user, check if you can swap
* to the item instead (user already has item in hotbar). * to the item instead (user already has item in hotbar).
* This is sometimes bypassed by the client itself (not fixable though). * This is sometimes bypassed by the client itself (not fixable though).
*/ */
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
SlimefunItem hotbarItem = SlimefunItem.getByItem(player.getInventory().getItem(i)); SlimefunItem hotbarItem = SlimefunItem.getByItem(player.getInventory().getItem(i));
if (hotbarItem != null && hotbarItem.getId() == sfItem.getId()) { if (hotbarItem != null && hotbarItem.getId() == sfItem.getId()) {