Plugin Name: RedeemVelocity
Version: 1.0.0
Author: MinerBomb
Platform: Velocity Proxy (Minecraft)
Overview
RedeemVelocity is a robust and user-friendly plugin designed for Velocity-powered Minecraft servers. It allows server administrators to create and manage redeemable codes that grant players temporary permissions groups via LuckPerms. Whether you're running a promotional event, rewarding loyal players, or managing in-game perks, RedeemVelocity provides a seamless way to handle these rewards efficiently.
Key Features
- Create Redeem Codes: Generate unique 6-digit codes that grant players specified LuckPerms groups for a limited time and usage count.
- Use Redeem Codes: Players can redeem codes to receive temporary group permissions, enhancing their in-game experience.
- List Active Codes: View all currently active redeem codes along with their details such as associated group, usage limits, and expiration status.
- Remove Redeem Codes: Administrators can revoke existing codes, preventing further usage.
- Ban Players from Redeeming: Restrict specific players from using redeem codes, ensuring controlled distribution of rewards.
- Permission-Based Access: Each command and subcommand is protected with specific permissions, ensuring only authorized personnel can execute sensitive actions.
- Tab Completion: Enhance user experience with intuitive tab completions for commands and arguments.
Commands and Usage
RedeemVelocity introduces a primary command /redeem with several subcommands to manage redeem codes effectively. Below is a detailed breakdown of each subcommand:
- Create a Redeem Code
/redeem create <lp-group> <time> <usage>
- Description: Generates a new 6-digit redeem code.
- Parameters:
- <lp-group>: The LuckPerms group to assign to the player upon redemption (e.g., vip, mvp).
- <time>: Duration for which the group will be active (formats supported: s for seconds, m for minutes, d for days, mo for months, y for years; e.g., 10s, 5m, 2d).
- <usage>: Maximum number of times the code can be used.
- Example:
/redeem create vip 7d 100
Creates a code that grants the vip group for 7 days, usable up to 100 times.
- Use a Redeem Code
/redeem use <6-digit-code>
- Description: Allows players to redeem a code to receive the associated group permissions.
- Parameters:
- <6-digit-code>: The unique code provided by the administrator.
- Example:
/redeem use 123456
Redeems the code 123456 for the player.
- List All Active Redeem Codes
/redeem list
- Description: Displays all currently active redeem codes along with their details.
- Permissions Required: redeemvelo.list
- Example:
/redeem list
Shows a list of all active redeem codes.
- Remove a Redeem Code
/redeem remove <6-digit-code>
- Description: Deletes a specific redeem code, preventing any further use.
- Parameters:
- <6-digit-code>: The unique code to be removed.
- Permissions Required: redeemvelo.remove
- Example:
/redeem remove 123456
Removes the code 123456 from the active list.
- Ban a Player from Using Redeem Codes
/redeem ban <player>
- Description: Prevents a specified player from using any redeem codes.
- Parameters:
- <player>: The username of the player to be banned.
- Permissions Required: redeemvelo.ban
- Example:
/redeem ban PlayerName
Bans PlayerName from using redeem codes.
Permissions
To ensure secure and controlled access, RedeemVelocity utilizes the following permission nodes:
- Create Redeem Codes: redeemvelo.create
- Use Redeem Codes: Available to all players (ensure appropriate permissions settings if needed)
- List Redeem Codes: redeemvelo.list
- Remove Redeem Codes: redeemvelo.remove
- Ban Players from Redeeming: redeemvelo.ban
Administrators should assign these permissions using their preferred permissions management plugin to control access effectively.
How It Works
- Creating Codes: Administrators use the /redeem create command to generate a unique 6-digit code associated with a specific LuckPerms group, duration, and usage limit. These codes are stored in-memory, ensuring quick access and management.
- Redeeming Codes: Players execute the /redeem use command followed by the 6-digit code. If the code is valid, not expired, and hasn't exceeded its usage limit, the player is granted the specified group for the defined duration. The plugin interfaces with LuckPerms to handle group assignments seamlessly.
- Managing Codes: Administrators can view all active codes using /redeem list, remove unwanted codes with /redeem remove, and ban players from using codes via /redeem ban.
- Security and Restrictions: The plugin ensures that only authorized users can manage redeem codes through permission checks. Additionally, banned players are prevented from redeeming any codes, maintaining control over reward distribution.
Technical Details
- Code Generation: Utilizes a random number generator to create secure 6-digit codes, minimizing the risk of duplication and unauthorized access.
- Time Parsing: Supports flexible time formats (s, m, d, mo, y) to cater to various duration requirements, converting them accurately into milliseconds for backend processing.
- Concurrency: Employs thread-safe data structures like ConcurrentHashMap and synchronized sets to manage redeem codes and banned players, ensuring stability in high-traffic environments.
- Event Handling: Registers commands during the proxy initialization phase, ensuring that all functionalities are ready for use as soon as the server starts.
Installation and Setup
- Download the Plugin:
- Obtain the RedeemVelocity plugin JAR file from the official repository or release page.
- Install Dependencies:
- Ensure that your Velocity server has LuckPerms installed and properly configured, as RedeemVelocity integrates with it for group management.
- Add the Plugin:
- Place the RedeemVelocity JAR file into the plugins directory of your Velocity server.
- Configure Permissions:
- Use your preferred permissions management plugin to assign the necessary permission nodes to administrators and other staff members.
- Restart the Server:
- Restart your Velocity proxy to load the plugin. Upon successful initialization, the /redeem command will be available for use.
Conclusion
RedeemVelocity offers a comprehensive solution for managing redeemable codes on Velocity-powered Minecraft servers. With its intuitive commands, secure permissions, and seamless integration with LuckPerms, it empowers server administrators to reward players effectively and maintain control over in-game group assignments. Whether for promotions, events, or player recognition, RedeemVelocity is an essential tool for enhancing player engagement and server management.
Support & Contributions:
For support, updates, or to contribute to RedeemVelocity, please visit the
Lavapixel Discord or contact the author on discord: @zqsk
https://discord.gg/gepJ6SkFBQ