Skip to content

Commit

Permalink
Added stop_sound player mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
mergu committed Aug 6, 2017
1 parent 89769dc commit ff210c5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions plugin/src/main/java/net/aufdemrand/denizen/objects/dPlayer.java
Expand Up @@ -3043,6 +3043,31 @@ else if (split.length > 1) {
}
}

// <--[mechanism]
// @object dPlayer
// @name stop_sound
// @input Element
// @description
// Stops all sounds of the specified type for the player.
// Valid types are AMBIENT, BLOCKS, HOSTILE, MASTER, MUSIC,
// NEUTRAL, PLAYERS, RECORDS, VOICE, and WEATHER
// If no sound type is specified, all types will be stopped.
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1)
&& mechanism.matches("stop_sound")) {
if (!mechanism.hasValue()) {
getPlayerEntity().stopSound("");
}
else {
try {
getPlayerEntity().stopSound("", SoundCategory.valueOf(value.asString().toUpperCase()));
}
catch (Exception e) {
dB.echoError("Invalid SoundCategory. Must specify a valid name.");
}
}
}

// <--[mechanism]
// @object dPlayer
// @name action_bar
Expand Down

0 comments on commit ff210c5

Please sign in to comment.