Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds the "remove_essentials_home" mechanism #405

Merged
merged 4 commits into from
Apr 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static EssentialsPlayerProperties getFrom(ObjectTag object) {
};

public static final String[] handledMechs = new String[] {
"is_afk", "god_mode", "is_muted", "socialspy", "vanish", "essentials_ignore"
"is_afk", "god_mode", "is_muted", "socialspy", "vanish", "essentials_ignore", "remove_essentials_home"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very old legacy code, you don't have to fix it in this PR but it'd be helpful to update to modern format per DenizenScript/Denizen#2355

};

public EssentialsPlayerProperties(PlayerTag player) {
Expand Down Expand Up @@ -301,6 +301,28 @@ public void adjust(Mechanism mechanism) {
}
}

// <--[mechanism]
// @object PlayerTag
// @name remove_essentials_home
// @input ElementTag
// @plugin Depenizen, Essentials
// @description
// Removes the player's Essentials home that matches the specified name.
// -->
if (mechanism.matches("remove_essentials_home")) {
try {
if (getUser().hasHome(mechanism.getValue().toString())) {
getUser().delHome(mechanism.getValue().toString());
}
else {
mechanism.echoError("Invalid home name specified!");
}
}
catch (Exception e) {
Debug.echoError(e);
mcmonkey4eva marked this conversation as resolved.
Show resolved Hide resolved
}
}

// <--[mechanism]
// @object PlayerTag
// @name socialspy
Expand Down