mirror of
https://github.com/SunNetservers/MiniGames.git
synced 2024-12-05 00:43:15 +01:00
Adds a command for returning to checkpoint by forcing a loss #28
This commit is contained in:
parent
fc1902e86a
commit
0704e138ec
@ -57,6 +57,7 @@ The only permission normal players will need is `minigames.join` which is set to
|
||||
| /parkourGroupSet | /pgset | \<arena> \<group> | Puts the given arena in the given group. Use "none" to remove an existing group. |
|
||||
| /parkourGroupList | /pglist | \[group] | Lists groups, or the stages of a group if a group is specified. |
|
||||
| [/parkourGroupSwap](#droppergroupswap) | /pgswap | \<arena1> \<arena2> | Swaps the two arenas in the group's ordered list. |
|
||||
| /parkourCheckpoint | /pcheck | | Triggers a teleportation to your previous checkpoint. |
|
||||
|
||||
### Command explanation dropper
|
||||
|
||||
|
@ -39,6 +39,7 @@ import net.knarcraft.minigames.command.parkour.EditParkourArenaTabCompleter;
|
||||
import net.knarcraft.minigames.command.parkour.JoinParkourArenaCommand;
|
||||
import net.knarcraft.minigames.command.parkour.JoinParkourArenaTabCompleter;
|
||||
import net.knarcraft.minigames.command.parkour.ListParkourArenaCommand;
|
||||
import net.knarcraft.minigames.command.parkour.ParkourCheckpointCommand;
|
||||
import net.knarcraft.minigames.command.parkour.ParkourGroupListCommand;
|
||||
import net.knarcraft.minigames.command.parkour.ParkourGroupSetCommand;
|
||||
import net.knarcraft.minigames.command.parkour.ParkourGroupSwapCommand;
|
||||
@ -267,6 +268,7 @@ public final class MiniGames extends JavaPlugin {
|
||||
registerCommand("parkourGroupSet", new ParkourGroupSetCommand(), null);
|
||||
registerCommand("parkourGroupSwap", new ParkourGroupSwapCommand(), null);
|
||||
registerCommand("parkourGroupList", new ParkourGroupListCommand(), null);
|
||||
registerCommand("parkourCheckpoint", new ParkourCheckpointCommand(), null);
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
this.dropperRecordExpansion = new DropperRecordExpansion(this);
|
||||
|
@ -0,0 +1,44 @@
|
||||
package net.knarcraft.minigames.command.parkour;
|
||||
|
||||
import net.knarcraft.minigames.MiniGames;
|
||||
import net.knarcraft.minigames.arena.ArenaSession;
|
||||
import net.knarcraft.minigames.arena.parkour.ParkourArenaSession;
|
||||
import net.knarcraft.minigames.config.Message;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The command for returning to the previous checkpoint
|
||||
*/
|
||||
public class ParkourCheckpointCommand implements TabExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||
@NotNull String[] strings) {
|
||||
if (!(commandSender instanceof Player player)) {
|
||||
commandSender.sendMessage(Message.ERROR_PLAYER_ONLY.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
ArenaSession session = MiniGames.getInstance().getSession(player.getUniqueId());
|
||||
if (session instanceof ParkourArenaSession) {
|
||||
session.triggerLoss();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||
@NotNull String[] strings) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
@ -29,6 +29,9 @@ public class CommandListener implements Listener {
|
||||
allowedCommands.add("/mLeave");
|
||||
allowedCommands.add("/dLeave");
|
||||
allowedCommands.add("/pLeave");
|
||||
allowedCommands.add("/parkourCheckpoint");
|
||||
allowedCommands.add("/pCheckpoint");
|
||||
allowedCommands.add("/pCheck");
|
||||
|
||||
String message = event.getMessage();
|
||||
if (!message.startsWith("/")) {
|
||||
|
@ -20,13 +20,12 @@ commands:
|
||||
- mleave
|
||||
- dleave
|
||||
- pleave
|
||||
permission: minigames.join
|
||||
usage: /<command>
|
||||
description: Used to leave the current dropper arena
|
||||
dropperGroupSet:
|
||||
aliases:
|
||||
- dgset
|
||||
permission: minigames.edit
|
||||
permission: minigames.edit.dropper
|
||||
usage: |
|
||||
/<command> <arena> <group>
|
||||
- The group will be created if it doesn't already exist
|
||||
@ -35,7 +34,7 @@ commands:
|
||||
dropperGroupSwap:
|
||||
aliases:
|
||||
- dgswap
|
||||
permission: minigames.edit
|
||||
permission: minigames.edit.dropper
|
||||
usage: |
|
||||
/<command> <arena1> <arena2>
|
||||
- The two arenas must be in the same group
|
||||
@ -43,7 +42,7 @@ commands:
|
||||
dropperGroupList:
|
||||
aliases:
|
||||
- dglist
|
||||
permission: minigames.edit
|
||||
permission: minigames.edit.dropper
|
||||
usage: |
|
||||
/<command> [group]
|
||||
- Existing groups will be listed if used without an argument
|
||||
@ -52,13 +51,13 @@ commands:
|
||||
dropperList:
|
||||
aliases:
|
||||
- dlist
|
||||
permission: minigames.join
|
||||
permission: minigames.join.dropper
|
||||
usage: /<command>
|
||||
description: Used to list all current dropper arenas
|
||||
dropperJoin:
|
||||
aliases:
|
||||
- djoin
|
||||
permission: minigames.join
|
||||
permission: minigames.join.dropper
|
||||
usage: |
|
||||
/<command> <arena> [mode]
|
||||
- Mode can be used to select challenge modes which can be played after beating the arena.
|
||||
@ -68,7 +67,7 @@ commands:
|
||||
dropperCreate:
|
||||
aliases:
|
||||
- dcreate
|
||||
permission: minigames.create
|
||||
permission: minigames.create.dropper
|
||||
usage: |
|
||||
/<command> <arena> <property> [new value]
|
||||
- Valid properties: name, spawnLocation, exitLocation, verticalVelocity, horizontalVelocity, winBlockType
|
||||
@ -76,13 +75,13 @@ commands:
|
||||
dropperEdit:
|
||||
aliases:
|
||||
- dedit
|
||||
permission: minigames.edit
|
||||
permission: minigames.edit.dropper
|
||||
usage: /<command> (Details not finalized)
|
||||
description: Used to edit an existing dropper arena
|
||||
dropperRemove:
|
||||
aliases:
|
||||
- dremove
|
||||
permission: minigames.remove
|
||||
permission: minigames.remove.dropper
|
||||
usage: /<command> <arena>
|
||||
description: Used to remove an existing dropper arena
|
||||
parkourGroupSet:
|
||||
@ -97,7 +96,7 @@ commands:
|
||||
parkourGroupSwap:
|
||||
aliases:
|
||||
- pgswap
|
||||
permission: minigames.edit
|
||||
permission: minigames.edit.parkour
|
||||
usage: |
|
||||
/<command> <arena1> <arena2>
|
||||
- The two arenas must be in the same group
|
||||
@ -105,7 +104,7 @@ commands:
|
||||
parkourGroupList:
|
||||
aliases:
|
||||
- pglist
|
||||
permission: minigames.edit
|
||||
permission: minigames.edit.parkour
|
||||
usage: |
|
||||
/<command> [group]
|
||||
- Existing groups will be listed if used without an argument
|
||||
@ -114,13 +113,13 @@ commands:
|
||||
parkourList:
|
||||
aliases:
|
||||
- plist
|
||||
permission: minigames.join
|
||||
permission: minigames.join.parkour
|
||||
usage: /<command>
|
||||
description: Used to list all current parkour arenas
|
||||
parkourJoin:
|
||||
aliases:
|
||||
- pjoin
|
||||
permission: minigames.join
|
||||
permission: minigames.join.parkour
|
||||
usage: |
|
||||
/<command> <arena> [mode]
|
||||
- Mode can be used to select challenge modes which can be played after beating the arena.
|
||||
@ -129,7 +128,7 @@ commands:
|
||||
parkourCreate:
|
||||
aliases:
|
||||
- pcreate
|
||||
permission: minigames.create
|
||||
permission: minigames.create.parkour
|
||||
usage: |
|
||||
/<command> <arena> <property> [new value]
|
||||
- Valid properties: name, spawnLocation, exitLocation, winBlockType, winLocation, checkpointAdd, checkpointClear, killPlaneBlocks
|
||||
@ -137,15 +136,22 @@ commands:
|
||||
parkourEdit:
|
||||
aliases:
|
||||
- pedit
|
||||
permission: minigames.edit
|
||||
permission: minigames.edit.parkour
|
||||
usage: /<command> (Details not finalized)
|
||||
description: Used to edit an existing parkour arena
|
||||
parkourRemove:
|
||||
aliases:
|
||||
- dremove
|
||||
permission: minigames.remove
|
||||
permission: minigames.remove.parkour
|
||||
usage: /<command> <arena>
|
||||
description: Used to remove an existing parkour arena
|
||||
parkourCheckpoint:
|
||||
aliases:
|
||||
- pcheckpoint
|
||||
- pcheck
|
||||
permission: minigames.join.parkour
|
||||
usage: /<command>
|
||||
description: Used to teleport to the previous checkpoint while in a parkour arena
|
||||
permissions:
|
||||
minigames.*:
|
||||
description: Gives all permissions
|
||||
|
Loading…
Reference in New Issue
Block a user