-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
67 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/me/machinemaker/papertweaks/cloud/dispatchers/FallbackCommandDispatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package me.machinemaker.papertweaks.cloud.dispatchers; | ||
|
||
import java.util.Locale; | ||
import java.util.UUID; | ||
import net.kyori.adventure.audience.Audience; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Entity; | ||
|
||
public class FallbackCommandDispatcher extends CommandDispatcher { | ||
|
||
private final UUID uuid; | ||
|
||
protected FallbackCommandDispatcher(final CommandSender bukkitCommandSender) { | ||
super(bukkitCommandSender); | ||
if (bukkitCommandSender instanceof final Entity entity) { | ||
this.uuid = entity.getUniqueId(); | ||
} else { | ||
this.uuid = UUID.randomUUID(); | ||
} | ||
} | ||
|
||
@Override | ||
public UUID getUUID() { | ||
return this.uuid; | ||
} | ||
|
||
@Override | ||
public Locale locale() { | ||
return Locale.US; | ||
} | ||
|
||
@Override | ||
public Audience audience() { | ||
return this.sender(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters