Skip to content

Commit ce2bf3c

Browse files
committed
Take a crack at updating the deprecated code
1 parent 4f0dad7 commit ce2bf3c

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ repositories {
2020
}
2121

2222
dependencies {
23-
compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT")
24-
compileOnly("dev.plex:server:1.5-SNAPSHOT")
25-
implementation("com.comphenix.protocol:ProtocolLib:5.3.0-SNAPSHOT")
23+
compileOnly("io.papermc.paper:paper-api:1.21.7-R0.1-SNAPSHOT")
24+
compileOnly("dev.plex:server:1.5")
25+
implementation("com.comphenix.protocol:ProtocolLib:5.3.0")
2626
}
2727

2828
group = "dev.plex"
29-
version = "1.5-SNAPSHOT"
29+
version = "1.5"
3030
description = "Module-FalseOp"
3131

3232
java {

src/main/java/dev/plex/listener/PlayerListener.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import com.comphenix.protocol.ProtocolLibrary;
55
import com.comphenix.protocol.ProtocolManager;
66
import com.comphenix.protocol.events.*;
7+
import io.papermc.paper.datacomponent.DataComponentType;
8+
import io.papermc.paper.datacomponent.DataComponentTypes;
9+
import io.papermc.paper.datacomponent.item.ItemAdventurePredicate;
710
import org.bukkit.GameMode;
811
import org.bukkit.Location;
912
import org.bukkit.Material;
@@ -27,6 +30,8 @@ public class PlayerListener extends PlexListener
2730
{
2831
private final ProtocolManager protocolManager;
2932
private final PacketListener packetListener;
33+
public static final DataComponentType.Valued<ItemAdventurePredicate> CAN_PLACE_ON = valued("can_place_on");
34+
3035

3136
public PlayerListener()
3237
{
@@ -80,8 +85,8 @@ private void onBlock(PlayerInteractEvent event)
8085
ItemMeta meta = item.getItemMeta();
8186
if (meta != null)
8287
{
83-
canPlace = meta.getPlaceableKeys().contains(clicked.getType().getKey());
84-
canBreak = meta.getDestroyableKeys().contains(clicked.getType().getKey());
88+
canPlace = item.hasData(DataComponentTypes.CAN_PLACE_ON);
89+
canBreak = item.hasData(DataComponentTypes.CAN_BREAK);
8590
}
8691
}
8792
}

src/main/resources/module.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: Module-FalseOp
22
main: dev.plex.FalseOp
33
description: Make clients think they have OP!
4-
version: 1.5-SNAPSHOT
4+
version: 1.5

0 commit comments

Comments
 (0)