-
Notifications
You must be signed in to change notification settings - Fork 72
Lock editing of individual armor stands #49
base: master
Are you sure you want to change the base?
Conversation
@@ -289,6 +319,27 @@ void cycleAxis(int i) { | |||
setAxis(Axis.values()[index]); | |||
} | |||
|
|||
void toggleLock(ArmorStand armorStand){ | |||
NamespacedKey key = new NamespacedKey(plugin, "locked"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't recreate NamespacedKey - it's good to keep it in one place
import java.util.UUID; | ||
import static jdk.nashorn.internal.objects.NativeObject.keys; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see it being used or even needed?
boolean isLocked(ArmorStand armorStand) { | ||
NamespacedKey key = new NamespacedKey(plugin, "locked"); | ||
PersistentDataContainer container = armorStand.getPersistentDataContainer(); | ||
return container.has(key, PersistentDataType.BYTE); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if duplicating this is needed. Can't the one used above be reused?
String asName = as.getCustomName(); | ||
boolean asNameVisible = as.isCustomNameVisible(); | ||
Bukkit.getScheduler().runTaskLater(plugin, () -> { | ||
as.setCustomName(asName); | ||
as.setCustomNameVisible(asNameVisible); | ||
}, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this trying to do? It seems to do nothing, unless I'm missing some Bukkit quirk?
No description provided.