Skip to content

Commit

Permalink
fix: Active-Commands first-join
Browse files Browse the repository at this point in the history
The first-join trigger/executor was being ignored for Active-Commands defined in the config.yml.

Proper function is now restored, first-join will only execute once per-world.
  • Loading branch information
RockinChaos committed Sep 11, 2024
1 parent 8e510a6 commit 1475481
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/me/RockinChaos/itemjoin/item/ItemUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -979,9 +979,10 @@ public void triggerCommands(final Player player, TriggerType triggerRef) {
final HashMap<Executor, String> commandMap = this.getCommandMap(commands);
for (Executor executor : commandMap.keySet()) {
final String formatCommand = StringUtils.translateLayout(commandMap.get(executor), player);
final DataObject dataObject = ((trigger.equals(TriggerType.FIRST_JOIN) || executor.equals(Executor.FIRSTJOIN)) ? (DataObject) ItemJoin.getCore().getSQL().getData(new DataObject(Table.FIRST_COMMANDS, PlayerHandler.getPlayerID(player), player.getWorld().getName(), formatCommand)) : null);
final boolean isFirstJoin = trigger.equals(TriggerType.FIRST_JOIN) || executor.equals(Executor.FIRSTJOIN);
final DataObject dataObject = (isFirstJoin ? (DataObject) ItemJoin.getCore().getSQL().getData(new DataObject(Table.FIRST_COMMANDS, PlayerHandler.getPlayerID(player), player.getWorld().getName(), formatCommand)) : null);
if (dataObject == null) {
if (trigger.equals(TriggerType.FIRST_JOIN)) {
if (isFirstJoin) {
ItemJoin.getCore().getSQL().saveData(new DataObject(Table.FIRST_COMMANDS, PlayerHandler.getPlayerID(player), player.getWorld().getName(), formatCommand));
}
if (executor.equals(Executor.DEFAULT) || executor.equals(Executor.CONSOLE) || executor.equals(Executor.FIRSTJOIN)) {
Expand Down

0 comments on commit 1475481

Please sign in to comment.