mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 22:16:34 +00:00
Add /tpall
This commit is contained in:
1 parent
32f05de853
commit
0bfd990dee
4 files changed
+46
No files matched your search
@@ -33,6 +33,7 @@ public enum BukkitCommandType {
|
|||||||
RTP_COMMAND(new RtpCommand(BukkitHuskHomes.getInstance())),
|
RTP_COMMAND(new RtpCommand(BukkitHuskHomes.getInstance())),
|
||||||
TP_IGNORE_COMMAND(new TpIgnoreCommand(BukkitHuskHomes.getInstance())),
|
TP_IGNORE_COMMAND(new TpIgnoreCommand(BukkitHuskHomes.getInstance())),
|
||||||
TP_OFFLINE_COMMAND(new TpOfflineCommand(BukkitHuskHomes.getInstance())),
|
TP_OFFLINE_COMMAND(new TpOfflineCommand(BukkitHuskHomes.getInstance())),
|
||||||
|
TP_ALL_COMMAND(new TpAllCommand(BukkitHuskHomes.getInstance())),
|
||||||
SPAWN_COMMAND(new SpawnCommand(BukkitHuskHomes.getInstance())),
|
SPAWN_COMMAND(new SpawnCommand(BukkitHuskHomes.getInstance())),
|
||||||
SET_SPAWN_COMMAND(new SetSpawnCommand(BukkitHuskHomes.getInstance())),
|
SET_SPAWN_COMMAND(new SetSpawnCommand(BukkitHuskHomes.getInstance())),
|
||||||
BACK_COMMAND(new BackCommand(BukkitHuskHomes.getInstance()));
|
BACK_COMMAND(new BackCommand(BukkitHuskHomes.getInstance()));
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ commands:
|
|||||||
usage: /tpignore
|
usage: /tpignore
|
||||||
tpoffline:
|
tpoffline:
|
||||||
usage: /tpoffline <player>
|
usage: /tpoffline <player>
|
||||||
|
tpall:
|
||||||
|
usage: /tpall [page]
|
||||||
spawn:
|
spawn:
|
||||||
usage: /spawn
|
usage: /spawn
|
||||||
setspawn:
|
setspawn:
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package net.william278.huskhomes.command;
|
||||||
|
|
||||||
|
import net.william278.huskhomes.HuskHomes;
|
||||||
|
import net.william278.huskhomes.player.OnlineUser;
|
||||||
|
import net.william278.huskhomes.util.Permission;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TpAllCommand extends CommandBase {
|
||||||
|
|
||||||
|
protected TpAllCommand(@NotNull HuskHomes implementor) {
|
||||||
|
super("tpall", Permission.COMMAND_TPALL, implementor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
|
||||||
|
// Update cached players
|
||||||
|
plugin.getCache().updateOnlinePlayerList(plugin, onlineUser);
|
||||||
|
|
||||||
|
// Determine players to teleport
|
||||||
|
final List<String> players = plugin.getCache().players.stream()
|
||||||
|
.filter(userName -> !userName.equals(onlineUser.username)).toList();
|
||||||
|
if (players.isEmpty()) {
|
||||||
|
plugin.getLocales().getLocale("error_no_players_online").ifPresent(onlineUser::sendMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Teleport every player
|
||||||
|
players.forEach(playerName -> plugin.getTeleportManager()
|
||||||
|
.teleportPlayerByName(playerName, onlineUser.getPosition(), onlineUser));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -120,6 +120,14 @@ public enum Permission {
|
|||||||
* Lets the user tp to where a user logged out ({@code /tpoffline [player_name]})
|
* Lets the user tp to where a user logged out ({@code /tpoffline [player_name]})
|
||||||
*/
|
*/
|
||||||
COMMAND_TPOFFLINE("huskhomes.command.tpoffline", DefaultAccess.OPERATORS),
|
COMMAND_TPOFFLINE("huskhomes.command.tpoffline", DefaultAccess.OPERATORS),
|
||||||
|
/**
|
||||||
|
* Lets the user teleport everyone to their position ({@code /tpall})
|
||||||
|
*/
|
||||||
|
COMMAND_TPALL("huskhomes.command.tpall", DefaultAccess.OPERATORS),
|
||||||
|
/**
|
||||||
|
* Lets the user send a teleport request asking everyone to teleport to them ({@code /tpaall})
|
||||||
|
*/
|
||||||
|
COMMAND_TPAALL("huskhomes.command.tpaall", DefaultAccess.OPERATORS),
|
||||||
/**
|
/**
|
||||||
* Lets the user randomly teleport in the world they are in ({@code /rtp})
|
* Lets the user randomly teleport in the world they are in ({@code /rtp})
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in new issue
Block a user