Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Add faction filter to ToggleShoutCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
rettichlp committed Sep 13, 2023
1 parent 065a507 commit 74ef3f3
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.rettichlp.unicacityaddon.UnicacityAddon;
import com.rettichlp.unicacityaddon.base.AddonPlayer;
import com.rettichlp.unicacityaddon.base.builder.TabCompletionBuilder;
import com.rettichlp.unicacityaddon.base.enums.faction.Faction;
import com.rettichlp.unicacityaddon.base.registry.UnicacityCommand;
import com.rettichlp.unicacityaddon.base.registry.annotation.UCCommand;

Expand All @@ -24,13 +25,18 @@ public ToggleShoutCommand(UnicacityAddon unicacityAddon, UCCommand ucCommand) {
@Override
public boolean execute(String[] arguments) {
AddonPlayer p = this.unicacityAddon.player();
p.setShouting(!p.isShouting());

boolean isCivilian = p.getFaction().equals(Faction.NULL);
p.setShouting(!p.isShouting() && !isCivilian);

if (p.isShouting()) {
p.sendInfoMessage("Ab sofort schreist du jede Nachricht.");
} else if (isCivilian){
p.sendInfoMessage("Diese Funktion ist nur für Fraktionsmitglieder verfügbar.");
} else {
p.sendInfoMessage("Ab sofort redest du wieder normal.");
}

return true;
}

Expand Down

0 comments on commit 74ef3f3

Please sign in to comment.