Update to Minecraft 1.20 (#148)

This commit is contained in:
Adam
2023-06-10 11:06:41 -04:00
committed by GitHub
parent 70d20aceb6
commit cc7481fa9a
18 changed files with 64 additions and 1924 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2022 lishid. All rights reserved.
* Copyright (C) 2011-2023 lishid. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -161,6 +161,7 @@ public interface IOpenInv {
* @return the identifier
* @throws IllegalStateException if the server version is unsupported
*/
@Deprecated(forRemoval = true)
default @NotNull String getPlayerID(@NotNull OfflinePlayer offline) {
return offline.getUniqueId().toString();
}

View File

@@ -26,6 +26,7 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Chest;
import org.bukkit.entity.Cat;
import org.bukkit.entity.Player;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.util.BoundingBox;
import org.jetbrains.annotations.NotNull;
@@ -157,10 +158,21 @@ public interface IAnySilentContainer {
* @return true if the type is a supported container
*/
default boolean isAnySilentContainer(@NotNull BlockState blockState) {
return blockState instanceof org.bukkit.block.EnderChest
|| blockState instanceof org.bukkit.block.Chest
|| blockState instanceof org.bukkit.block.ShulkerBox
|| blockState instanceof org.bukkit.block.Barrel;
return blockState instanceof InventoryHolder holder && isAnySilentContainer(holder);
}
/**
* Check if the given {@link InventoryHolder} is a container which can be unblocked or silenced.
*
* @param holder the potential container
* @return true if the type is a supported container
*/
default boolean isAnySilentContainer(@NotNull InventoryHolder holder) {
return holder instanceof org.bukkit.block.EnderChest
|| holder instanceof org.bukkit.block.Chest
|| holder instanceof org.bukkit.block.DoubleChest
|| holder instanceof org.bukkit.block.ShulkerBox
|| holder instanceof org.bukkit.block.Barrel;
}
}