Skip to content
This repository was archived by the owner on Jul 19, 2021. It is now read-only.

Lock editing of individual armor stands #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dege16
Copy link

@dege16 dege16 commented Jun 18, 2021

No description provided.

@@ -289,6 +319,27 @@ void cycleAxis(int i) {
setAxis(Axis.values()[index]);
}

void toggleLock(ArmorStand armorStand){
NamespacedKey key = new NamespacedKey(plugin, "locked");
Copy link
Contributor

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;
Copy link
Contributor

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?

Comment on lines 213 to 217
boolean isLocked(ArmorStand armorStand) {
NamespacedKey key = new NamespacedKey(plugin, "locked");
PersistentDataContainer container = armorStand.getPersistentDataContainer();
return container.has(key, PersistentDataType.BYTE);
}
Copy link
Contributor

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?

Comment on lines +114 to +119
String asName = as.getCustomName();
boolean asNameVisible = as.isCustomNameVisible();
Bukkit.getScheduler().runTaskLater(plugin, () -> {
as.setCustomName(asName);
as.setCustomNameVisible(asNameVisible);
}, 1);
Copy link
Contributor

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants