mirror of
https://github.com/SunNetservers/MiniGames.git
synced 2024-12-05 00:43:15 +01:00
Adds a lot of empty classes with todos
Adds commands and permissions to plugin.yml Uses the Spigot API instead of the Paper API Reduces the Java version to 16, just in case. Adds a lot of empty classes to show the intended plugin structure.
This commit is contained in:
parent
e1bff97f12
commit
0a8669263a
14
pom.xml
14
pom.xml
@ -13,7 +13,7 @@
|
||||
|
||||
<description>A plugin for dropper mini-games</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<java.version>16</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
@ -55,19 +55,15 @@
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc-repo</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.19.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
@ -13,13 +13,23 @@ public final class Dropper extends JavaPlugin {
|
||||
// Remember to cancel the event so they don't die.
|
||||
//TODO: Make a listener for whether someone in an arena is about to hit a block (for cobwebs or similar). Use
|
||||
// another check in the listener to check if a player is hitting water -> do whatever should be done when winning.
|
||||
|
||||
//TODO: Arena settings: Spawn (where players are teleported to), Velocity (the downwards speed added to players.
|
||||
// Might need a scheduler to maintain the speed), Stage (a numeric integer. if set, only allow access if the
|
||||
// previous stage has been cleared), A configurable reward of some sort?
|
||||
// previous stage has been cleared), A configurable reward of some sort?, A name (just for easy differentiation),
|
||||
// possibly a leave location to make sure pressure plates won't create an infinite loop
|
||||
|
||||
//TODO: Add a command for joining a specific arena. Only teleport if the stage check succeeds (The server can
|
||||
// use something like https://www.spigotmc.org/resources/commandblocks.62720/ for immersion)
|
||||
//TODO: Store various information about players' performance, and hook into PlaceholderAPI
|
||||
//TODO: Implement optional time trial/least deaths game-mode somehow
|
||||
|
||||
//TODO: Possibly implement an optional queue mode, which only allows one player inside one dropper arena at any
|
||||
// time (to prevent players from pushing each-other)
|
||||
|
||||
|
||||
//TODO: Register event listeners
|
||||
//TODO: Register commands
|
||||
}
|
||||
|
||||
@Override
|
||||
|
35
src/main/java/net/knarcraft/dropper/arena/DropperArena.java
Normal file
35
src/main/java/net/knarcraft/dropper/arena/DropperArena.java
Normal file
@ -0,0 +1,35 @@
|
||||
package net.knarcraft.dropper.arena;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class DropperArena {
|
||||
|
||||
/**
|
||||
* A name used when listing this arena. Only used for differentiation.
|
||||
*/
|
||||
private String arenaName;
|
||||
|
||||
/**
|
||||
* The location players are teleported to when joining this arena.
|
||||
*/
|
||||
private Location spawnLocation;
|
||||
|
||||
/**
|
||||
* The location players will be sent to when they win or lose the arena. If not set, their entry location should be
|
||||
* used instead.
|
||||
*/
|
||||
private Location exitLocation;
|
||||
|
||||
/**
|
||||
* The velocity in the y-direction to apply to all players in this arena.
|
||||
*/
|
||||
private double playerVelocity;
|
||||
|
||||
/**
|
||||
* The stage number of this arena. If not null, the previous stage number must be cleared before access.
|
||||
*/
|
||||
private Integer stage;
|
||||
|
||||
//TODO: Add the appropriate getters/setters and other methods
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package net.knarcraft.dropper.arena;
|
||||
|
||||
public class DropperArenaHandler {
|
||||
|
||||
//TODO: Use this class to keep track of all created arenas. Saving and loading arenas is this class's responsibility
|
||||
//TODO: Keep track of which players are in which arenas (should possibly be its own class, depending on complexity)
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package net.knarcraft.dropper.command;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CreateArenaCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||
@NotNull String[] strings) {
|
||||
//TODO: Implement command behavior
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package net.knarcraft.dropper.command;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EditArenaCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||
@NotNull String[] strings) {
|
||||
//TODO: Implement command behavior
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package net.knarcraft.dropper.command;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class JoinArenaCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||
@NotNull String[] strings) {
|
||||
//TODO: Implement command behavior
|
||||
//TODO: Remember to check if the player is already in an arena first!
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package net.knarcraft.dropper.command;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class LeaveArenaCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||
@NotNull String[] strings) {
|
||||
//TODO: Implement command behavior
|
||||
//TODO: If the player isn't currently in an arena, just display an error message
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package net.knarcraft.dropper.command;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class RemoveArenaCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||
@NotNull String[] strings) {
|
||||
//TODO: Implement command behavior
|
||||
//TODO: Make sure to kick players if the arena is currently in use
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package net.knarcraft.dropper.listener;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
public class DamageListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDamage(EntityDamageEvent event) {
|
||||
if (event.getEntityType() != EntityType.PLAYER) {
|
||||
return;
|
||||
}
|
||||
|
||||
//TODO: Check if the player is in the arena (return if not)
|
||||
//TODO: Cancel the event to prevent the player from taking damage or dying
|
||||
//TODO: Kick the player from the arena
|
||||
//TODO: Teleport the player to the location they entered the arena from, or to the spawn
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package net.knarcraft.dropper.listener;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class MoveListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
//TODO: Return if player is not in an arena
|
||||
//TODO: If the player is moving to a block of water, register the win, and teleport the player out
|
||||
//TODO: If the player is about to hit a non-water and non-air block (within a margin of about 1/16 of a block
|
||||
// in the y-direction), treat that the same as @see{DamageListener#onPlayerDamage}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package net.knarcraft.dropper.listener;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
|
||||
public class PlayerLeaveListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLeave(PlayerQuitEvent event) {
|
||||
//TODO: If in an arena, kick the player.
|
||||
//TODO: Teleport the player away from the arena. It might only be possible to teleport the player when they join
|
||||
// again.
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||
//TODO: Treat this the same as onPlayerLeave if the player is in an arena. If the player doesn't change worlds,
|
||||
// it should be safe to immediately teleport the player to the arena's exit.
|
||||
}
|
||||
|
||||
}
|
@ -3,3 +3,52 @@ version: '${project.version}'
|
||||
main: net.knarcraft.dropper.Dropper
|
||||
api-version: 1.19
|
||||
description: A plugin for dropper mini-games
|
||||
|
||||
commands:
|
||||
dropperlist:
|
||||
permission: dropper.join
|
||||
usage: /<command>
|
||||
description: Used to list all current dropper arenas
|
||||
dropperjoin:
|
||||
permission: dropper.join
|
||||
usage: |
|
||||
/<command> <arena> [mode]
|
||||
Mode can be used to select challenge modes which can be played after beating the arena.
|
||||
deaths = A least-deaths competitive game-mode
|
||||
time = A shortest-time competitive game-mode
|
||||
description: Used to join a dropper arena
|
||||
dropperleave:
|
||||
permission: dropper.join
|
||||
usage: /<command>
|
||||
description: Used to leave the current dropper arena
|
||||
droppercreate:
|
||||
permission: dropper.create
|
||||
usage: /<command> (Details not finalized)
|
||||
description: Used to create a new dropper arena
|
||||
dropperedit:
|
||||
permission: dropper.edit
|
||||
usage: /<command> (Details not finalized)
|
||||
description: Used to edit an existing dropper arena
|
||||
dropperremove:
|
||||
permission: dropper.remove
|
||||
usage: /<command> <arena>
|
||||
description: Used to remove an existing dropper arena
|
||||
permissions:
|
||||
dropper.admin:
|
||||
children:
|
||||
- dropper.join
|
||||
- dropper.create
|
||||
- dropper.edit
|
||||
- dropper.remove
|
||||
dropper.join:
|
||||
description: Allows a player to participate in dropper arenas
|
||||
default: true
|
||||
dropper.create:
|
||||
description: Allows a player to create a new dropper arena
|
||||
default: op
|
||||
dropper.edit:
|
||||
description: Allows a player to edit an existing dropper arena
|
||||
default: op
|
||||
dropper.remove:
|
||||
description: Allows a player to remove a dropper arena
|
||||
default: op
|
Loading…
Reference in New Issue
Block a user