Skip to content

Commit

Permalink
Adds the "remove_essentials_home" mechanism (#405)
Browse files Browse the repository at this point in the history
* Adds the "remove_essentials_home" mechanism

Adds the "remove_essentials_home" mechanism.

* Update EssentialsPlayerProperties.java

* Update EssentialsPlayerProperties.java

* Update EssentialsPlayerProperties.java
  • Loading branch information
heypr committed Apr 24, 2023
1 parent b66fded commit 5db2ae1
Showing 1 changed file with 23 additions and 1 deletion.
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"
};

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);
}
}

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

0 comments on commit 5db2ae1

Please sign in to comment.