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. |
|
| /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. |
|
| /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. |
|
| [/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
|
### 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.JoinParkourArenaCommand;
|
||||||
import net.knarcraft.minigames.command.parkour.JoinParkourArenaTabCompleter;
|
import net.knarcraft.minigames.command.parkour.JoinParkourArenaTabCompleter;
|
||||||
import net.knarcraft.minigames.command.parkour.ListParkourArenaCommand;
|
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.ParkourGroupListCommand;
|
||||||
import net.knarcraft.minigames.command.parkour.ParkourGroupSetCommand;
|
import net.knarcraft.minigames.command.parkour.ParkourGroupSetCommand;
|
||||||
import net.knarcraft.minigames.command.parkour.ParkourGroupSwapCommand;
|
import net.knarcraft.minigames.command.parkour.ParkourGroupSwapCommand;
|
||||||
@ -267,6 +268,7 @@ public final class MiniGames extends JavaPlugin {
|
|||||||
registerCommand("parkourGroupSet", new ParkourGroupSetCommand(), null);
|
registerCommand("parkourGroupSet", new ParkourGroupSetCommand(), null);
|
||||||
registerCommand("parkourGroupSwap", new ParkourGroupSwapCommand(), null);
|
registerCommand("parkourGroupSwap", new ParkourGroupSwapCommand(), null);
|
||||||
registerCommand("parkourGroupList", new ParkourGroupListCommand(), null);
|
registerCommand("parkourGroupList", new ParkourGroupListCommand(), null);
|
||||||
|
registerCommand("parkourCheckpoint", new ParkourCheckpointCommand(), null);
|
||||||
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||||
this.dropperRecordExpansion = new DropperRecordExpansion(this);
|
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("/mLeave");
|
||||||
allowedCommands.add("/dLeave");
|
allowedCommands.add("/dLeave");
|
||||||
allowedCommands.add("/pLeave");
|
allowedCommands.add("/pLeave");
|
||||||
|
allowedCommands.add("/parkourCheckpoint");
|
||||||
|
allowedCommands.add("/pCheckpoint");
|
||||||
|
allowedCommands.add("/pCheck");
|
||||||
|
|
||||||
String message = event.getMessage();
|
String message = event.getMessage();
|
||||||
if (!message.startsWith("/")) {
|
if (!message.startsWith("/")) {
|
||||||
|
@ -20,13 +20,12 @@ commands:
|
|||||||
- mleave
|
- mleave
|
||||||
- dleave
|
- dleave
|
||||||
- pleave
|
- pleave
|
||||||
permission: minigames.join
|
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
description: Used to leave the current dropper arena
|
description: Used to leave the current dropper arena
|
||||||
dropperGroupSet:
|
dropperGroupSet:
|
||||||
aliases:
|
aliases:
|
||||||
- dgset
|
- dgset
|
||||||
permission: minigames.edit
|
permission: minigames.edit.dropper
|
||||||
usage: |
|
usage: |
|
||||||
/<command> <arena> <group>
|
/<command> <arena> <group>
|
||||||
- The group will be created if it doesn't already exist
|
- The group will be created if it doesn't already exist
|
||||||
@ -35,7 +34,7 @@ commands:
|
|||||||
dropperGroupSwap:
|
dropperGroupSwap:
|
||||||
aliases:
|
aliases:
|
||||||
- dgswap
|
- dgswap
|
||||||
permission: minigames.edit
|
permission: minigames.edit.dropper
|
||||||
usage: |
|
usage: |
|
||||||
/<command> <arena1> <arena2>
|
/<command> <arena1> <arena2>
|
||||||
- The two arenas must be in the same group
|
- The two arenas must be in the same group
|
||||||
@ -43,7 +42,7 @@ commands:
|
|||||||
dropperGroupList:
|
dropperGroupList:
|
||||||
aliases:
|
aliases:
|
||||||
- dglist
|
- dglist
|
||||||
permission: minigames.edit
|
permission: minigames.edit.dropper
|
||||||
usage: |
|
usage: |
|
||||||
/<command> [group]
|
/<command> [group]
|
||||||
- Existing groups will be listed if used without an argument
|
- Existing groups will be listed if used without an argument
|
||||||
@ -52,13 +51,13 @@ commands:
|
|||||||
dropperList:
|
dropperList:
|
||||||
aliases:
|
aliases:
|
||||||
- dlist
|
- dlist
|
||||||
permission: minigames.join
|
permission: minigames.join.dropper
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
description: Used to list all current dropper arenas
|
description: Used to list all current dropper arenas
|
||||||
dropperJoin:
|
dropperJoin:
|
||||||
aliases:
|
aliases:
|
||||||
- djoin
|
- djoin
|
||||||
permission: minigames.join
|
permission: minigames.join.dropper
|
||||||
usage: |
|
usage: |
|
||||||
/<command> <arena> [mode]
|
/<command> <arena> [mode]
|
||||||
- Mode can be used to select challenge modes which can be played after beating the arena.
|
- Mode can be used to select challenge modes which can be played after beating the arena.
|
||||||
@ -68,7 +67,7 @@ commands:
|
|||||||
dropperCreate:
|
dropperCreate:
|
||||||
aliases:
|
aliases:
|
||||||
- dcreate
|
- dcreate
|
||||||
permission: minigames.create
|
permission: minigames.create.dropper
|
||||||
usage: |
|
usage: |
|
||||||
/<command> <arena> <property> [new value]
|
/<command> <arena> <property> [new value]
|
||||||
- Valid properties: name, spawnLocation, exitLocation, verticalVelocity, horizontalVelocity, winBlockType
|
- Valid properties: name, spawnLocation, exitLocation, verticalVelocity, horizontalVelocity, winBlockType
|
||||||
@ -76,13 +75,13 @@ commands:
|
|||||||
dropperEdit:
|
dropperEdit:
|
||||||
aliases:
|
aliases:
|
||||||
- dedit
|
- dedit
|
||||||
permission: minigames.edit
|
permission: minigames.edit.dropper
|
||||||
usage: /<command> (Details not finalized)
|
usage: /<command> (Details not finalized)
|
||||||
description: Used to edit an existing dropper arena
|
description: Used to edit an existing dropper arena
|
||||||
dropperRemove:
|
dropperRemove:
|
||||||
aliases:
|
aliases:
|
||||||
- dremove
|
- dremove
|
||||||
permission: minigames.remove
|
permission: minigames.remove.dropper
|
||||||
usage: /<command> <arena>
|
usage: /<command> <arena>
|
||||||
description: Used to remove an existing dropper arena
|
description: Used to remove an existing dropper arena
|
||||||
parkourGroupSet:
|
parkourGroupSet:
|
||||||
@ -97,7 +96,7 @@ commands:
|
|||||||
parkourGroupSwap:
|
parkourGroupSwap:
|
||||||
aliases:
|
aliases:
|
||||||
- pgswap
|
- pgswap
|
||||||
permission: minigames.edit
|
permission: minigames.edit.parkour
|
||||||
usage: |
|
usage: |
|
||||||
/<command> <arena1> <arena2>
|
/<command> <arena1> <arena2>
|
||||||
- The two arenas must be in the same group
|
- The two arenas must be in the same group
|
||||||
@ -105,7 +104,7 @@ commands:
|
|||||||
parkourGroupList:
|
parkourGroupList:
|
||||||
aliases:
|
aliases:
|
||||||
- pglist
|
- pglist
|
||||||
permission: minigames.edit
|
permission: minigames.edit.parkour
|
||||||
usage: |
|
usage: |
|
||||||
/<command> [group]
|
/<command> [group]
|
||||||
- Existing groups will be listed if used without an argument
|
- Existing groups will be listed if used without an argument
|
||||||
@ -114,13 +113,13 @@ commands:
|
|||||||
parkourList:
|
parkourList:
|
||||||
aliases:
|
aliases:
|
||||||
- plist
|
- plist
|
||||||
permission: minigames.join
|
permission: minigames.join.parkour
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
description: Used to list all current parkour arenas
|
description: Used to list all current parkour arenas
|
||||||
parkourJoin:
|
parkourJoin:
|
||||||
aliases:
|
aliases:
|
||||||
- pjoin
|
- pjoin
|
||||||
permission: minigames.join
|
permission: minigames.join.parkour
|
||||||
usage: |
|
usage: |
|
||||||
/<command> <arena> [mode]
|
/<command> <arena> [mode]
|
||||||
- Mode can be used to select challenge modes which can be played after beating the arena.
|
- Mode can be used to select challenge modes which can be played after beating the arena.
|
||||||
@ -129,7 +128,7 @@ commands:
|
|||||||
parkourCreate:
|
parkourCreate:
|
||||||
aliases:
|
aliases:
|
||||||
- pcreate
|
- pcreate
|
||||||
permission: minigames.create
|
permission: minigames.create.parkour
|
||||||
usage: |
|
usage: |
|
||||||
/<command> <arena> <property> [new value]
|
/<command> <arena> <property> [new value]
|
||||||
- Valid properties: name, spawnLocation, exitLocation, winBlockType, winLocation, checkpointAdd, checkpointClear, killPlaneBlocks
|
- Valid properties: name, spawnLocation, exitLocation, winBlockType, winLocation, checkpointAdd, checkpointClear, killPlaneBlocks
|
||||||
@ -137,15 +136,22 @@ commands:
|
|||||||
parkourEdit:
|
parkourEdit:
|
||||||
aliases:
|
aliases:
|
||||||
- pedit
|
- pedit
|
||||||
permission: minigames.edit
|
permission: minigames.edit.parkour
|
||||||
usage: /<command> (Details not finalized)
|
usage: /<command> (Details not finalized)
|
||||||
description: Used to edit an existing parkour arena
|
description: Used to edit an existing parkour arena
|
||||||
parkourRemove:
|
parkourRemove:
|
||||||
aliases:
|
aliases:
|
||||||
- dremove
|
- dremove
|
||||||
permission: minigames.remove
|
permission: minigames.remove.parkour
|
||||||
usage: /<command> <arena>
|
usage: /<command> <arena>
|
||||||
description: Used to remove an existing parkour 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:
|
permissions:
|
||||||
minigames.*:
|
minigames.*:
|
||||||
description: Gives all permissions
|
description: Gives all permissions
|
||||||
|
Loading…
Reference in New Issue
Block a user