File tree Expand file tree Collapse file tree 3 files changed +6
-14
lines changed
src/main/java/com/shanebeestudios/hg Expand file tree Collapse file tree 3 files changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -33,10 +33,8 @@ public static boolean isCursed(ItemStack itemStack) {
33
33
34
34
public static ItemStack getTrackingStick () {
35
35
ItemStack itemStack = ItemType .STICK .createItemStack ();
36
- ItemMeta itemMeta = itemStack .getItemMeta ();
37
- PersistentDataContainer pdc = itemMeta .getPersistentDataContainer ();
38
- pdc .set (Constants .TRACKING_STICK_KEY , PersistentDataType .BOOLEAN , true );
39
- itemStack .setItemMeta (itemMeta );
36
+ itemStack .editPersistentDataContainer (pdc ->
37
+ pdc .set (Constants .TRACKING_STICK_KEY , PersistentDataType .BOOLEAN , true ));
40
38
41
39
itemStack .setData (DataComponentTypes .ITEM_NAME , Util .getMini (LANG .item_tracking_stick_name ));
42
40
itemStack .setData (DataComponentTypes .MAX_STACK_SIZE , 1 );
Original file line number Diff line number Diff line change 4
4
import com .shanebeestudios .hg .api .gui .SpectatorGUI ;
5
5
import com .shanebeestudios .hg .api .util .Constants ;
6
6
import com .shanebeestudios .hg .plugin .HungerGames ;
7
+ import io .papermc .paper .persistence .PersistentDataContainerView ;
7
8
import org .bukkit .Material ;
8
9
import org .bukkit .entity .Player ;
9
10
import org .bukkit .event .EventHandler ;
12
13
import org .bukkit .event .player .PlayerInteractEvent ;
13
14
import org .bukkit .inventory .Inventory ;
14
15
import org .bukkit .inventory .ItemStack ;
15
- import org .bukkit .inventory .meta .ItemMeta ;
16
- import org .bukkit .persistence .PersistentDataContainer ;
17
16
import org .bukkit .persistence .PersistentDataType ;
18
17
19
18
public class GameCompassListener extends GameListenerBase {
@@ -57,10 +56,8 @@ private boolean isSpectatorCompass(PlayerInteractEvent event) {
57
56
58
57
ItemStack item = event .getItem ();
59
58
if (item == null || item .getType () != Material .COMPASS ) return false ;
60
- ItemMeta itemMeta = item .getItemMeta ();
61
- if (itemMeta == null ) return false ;
62
59
63
- PersistentDataContainer pdc = itemMeta .getPersistentDataContainer ();
60
+ PersistentDataContainerView pdc = item .getPersistentDataContainer ();
64
61
return pdc .has (Constants .SPECTATOR_COMPASS_KEY , PersistentDataType .BOOLEAN );
65
62
}
66
63
Original file line number Diff line number Diff line change 13
13
import org .bukkit .configuration .ConfigurationSection ;
14
14
import org .bukkit .configuration .file .YamlConfiguration ;
15
15
import org .bukkit .inventory .ItemStack ;
16
- import org .bukkit .persistence .PersistentDataContainer ;
17
16
import org .bukkit .persistence .PersistentDataType ;
18
17
import org .jetbrains .annotations .Nullable ;
19
18
@@ -116,10 +115,8 @@ public List<ItemStack> loadItems(ConfigurationSection config) {
116
115
public ItemStack getSpectatorCompass () {
117
116
ItemStack compass = new ItemStack (Material .COMPASS );
118
117
compass .setData (DataComponentTypes .ITEM_NAME , Util .getMini (this .lang .spectate_compass_name ));
119
- compass .editMeta (itemMeta -> {
120
- PersistentDataContainer pdc = itemMeta .getPersistentDataContainer ();
121
- pdc .set (Constants .SPECTATOR_COMPASS_KEY , PersistentDataType .BOOLEAN , true );
122
- });
118
+ compass .editPersistentDataContainer (pdc ->
119
+ pdc .set (Constants .SPECTATOR_COMPASS_KEY , PersistentDataType .BOOLEAN , true ));
123
120
return compass ;
124
121
}
125
122
You can’t perform that action at this time.
0 commit comments