--- a/net/minecraft/world/item/DebugStickItem.java
+++ b/net/minecraft/world/item/DebugStickItem.java
@@ -1,3 +1,4 @@
+// mc-dev import
 package net.minecraft.world.item;
 
 import java.util.Collection;
@@ -21,6 +22,7 @@
 import net.minecraft.world.level.block.state.properties.Property;
 
 public class DebugStickItem extends Item {
+
     public DebugStickItem(Item.Properties settings) {
         super(settings);
     }
@@ -36,46 +38,52 @@
 
     @Override
     public InteractionResult useOn(UseOnContext context) {
-        Player player = context.getPlayer();
-        Level level = context.getLevel();
-        if (!level.isClientSide && player != null) {
-            BlockPos blockPos = context.getClickedPos();
-            if (!this.handleInteraction(player, level.getBlockState(blockPos), level, blockPos, true, context.getItemInHand())) {
+        Player entityhuman = context.getPlayer();
+        Level world = context.getLevel();
+
+        if (!world.isClientSide && entityhuman != null) {
+            BlockPos blockposition = context.getClickedPos();
+
+            if (!this.handleInteraction(entityhuman, world.getBlockState(blockposition), world, blockposition, true, context.getItemInHand())) {
                 return InteractionResult.FAIL;
             }
         }
 
-        return InteractionResult.sidedSuccess(level.isClientSide);
+        return InteractionResult.sidedSuccess(world.isClientSide);
     }
 
     public boolean handleInteraction(Player player, BlockState state, LevelAccessor world, BlockPos pos, boolean update, ItemStack stack) {
-        if (!player.canUseGameMasterBlocks()) {
+        if (!player.canUseGameMasterBlocks() && !(player.getAbilities().instabuild && player.getBukkitEntity().hasPermission("minecraft.debugstick")) && !player.getBukkitEntity().hasPermission("minecraft.debugstick.always")) { // Spigot
             return false;
         } else {
             Holder<Block> holder = state.getBlockHolder();
-            StateDefinition<Block, BlockState> stateDefinition = holder.value().getStateDefinition();
-            Collection<Property<?>> collection = stateDefinition.getProperties();
+            StateDefinition<Block, BlockState> blockstatelist = ((Block) holder.value()).getStateDefinition();
+            Collection<Property<?>> collection = blockstatelist.getProperties();
+
             if (collection.isEmpty()) {
-                message(player, Component.translatable(this.getDescriptionId() + ".empty", holder.getRegisteredName()));
+                DebugStickItem.message(player, Component.translatable(this.getDescriptionId() + ".empty", holder.getRegisteredName()));
                 return false;
             } else {
-                DebugStickState debugStickState = stack.get(DataComponents.DEBUG_STICK_STATE);
-                if (debugStickState == null) {
+                DebugStickState debugstickstate = (DebugStickState) stack.get(DataComponents.DEBUG_STICK_STATE);
+
+                if (debugstickstate == null) {
                     return false;
                 } else {
-                    Property<?> property = debugStickState.properties().get(holder);
+                    Property<?> iblockstate = (Property) debugstickstate.properties().get(holder);
+
                     if (update) {
-                        if (property == null) {
-                            property = collection.iterator().next();
+                        if (iblockstate == null) {
+                            iblockstate = (Property) collection.iterator().next();
                         }
 
-                        BlockState blockState = cycleState(state, property, player.isSecondaryUseActive());
-                        world.setBlock(pos, blockState, 18);
-                        message(player, Component.translatable(this.getDescriptionId() + ".update", property.getName(), getNameHelper(blockState, property)));
+                        BlockState iblockdata1 = DebugStickItem.cycleState(state, iblockstate, player.isSecondaryUseActive());
+
+                        world.setBlock(pos, iblockdata1, 18);
+                        DebugStickItem.message(player, Component.translatable(this.getDescriptionId() + ".update", iblockstate.getName(), DebugStickItem.getNameHelper(iblockdata1, iblockstate)));
                     } else {
-                        property = getRelative(collection, property, player.isSecondaryUseActive());
-                        stack.set(DataComponents.DEBUG_STICK_STATE, debugStickState.withProperty(holder, property));
-                        message(player, Component.translatable(this.getDescriptionId() + ".select", property.getName(), getNameHelper(state, property)));
+                        iblockstate = (Property) DebugStickItem.getRelative(collection, iblockstate, player.isSecondaryUseActive());
+                        stack.set(DataComponents.DEBUG_STICK_STATE, debugstickstate.withProperty(holder, iblockstate));
+                        DebugStickItem.message(player, Component.translatable(this.getDescriptionId() + ".select", iblockstate.getName(), DebugStickItem.getNameHelper(state, iblockstate)));
                     }
 
                     return true;
@@ -85,7 +93,7 @@
     }
 
     private static <T extends Comparable<T>> BlockState cycleState(BlockState state, Property<T> property, boolean inverse) {
-        return state.setValue(property, getRelative(property.getPossibleValues(), state.getValue(property), inverse));
+        return (BlockState) state.setValue(property, DebugStickItem.getRelative(property.getPossibleValues(), state.getValue(property), inverse)); // CraftBukkit - decompile error
     }
 
     private static <T> T getRelative(Iterable<T> elements, @Nullable T current, boolean inverse) {
@@ -93,7 +101,7 @@
     }
 
     private static void message(Player player, Component message) {
-        ((ServerPlayer)player).sendSystemMessage(message, true);
+        ((ServerPlayer) player).sendSystemMessage(message, true);
     }
 
     private static <T extends Comparable<T>> String getNameHelper(BlockState state, Property<T> property) {
