DuelEnhancer-OG skeleton
This commit is contained in:
1 parent
b681ddd778
commit
95911605e3
6 files changed
+29
-162
No files matched your search
@@ -1,6 +1,10 @@
|
||||
# Buy-OG
|
||||
# DuelEnhancer-OG
|
||||
|
||||
A chat-based drop-in replacement for CraftingStore's /buy GUI built for [TrueOG](https://trueog.net/).
|
||||
An extension to [Duels](https://github.com/Realizedd/Duels) by [Realizedd](https://github.com/Realizedd) made for https://trueog.net.
|
||||
|
||||
Features:
|
||||
|
||||
- When a Duel spectator is put into survival mode (presumably by worldguard), they will be removed from spectating the match and teleported back to their original location.
|
||||
|
||||
Gradle Version: 8.1.1
|
||||
|
||||
@@ -8,4 +12,4 @@ Java Version: 17
|
||||
|
||||
Minecraft API: 1.18.2
|
||||
|
||||
Buy-OG is public domain software released under the terms of [The Unlicense](https://github.com/NotAlexNoyle/Buy-OG/blob/main/LICENSE).
|
||||
DuelEnhancer-OG is public domain software released under the terms of [The Unlicense](https://github.com/NotAlexNoyle/DuelEnhancer-OG/blob/main/LICENSE).
|
||||
+12
-3
@@ -6,7 +6,7 @@ plugins {
|
||||
|
||||
}
|
||||
|
||||
group = 'net.trueog.buy-og' // Declare bundle identifier.
|
||||
group = 'net.trueog.duelenhancer-og' // Declare bundle identifier.
|
||||
version = '1.0'
|
||||
|
||||
def apiVersion = "1.18.2" // Declare minecraft server target version.
|
||||
@@ -35,7 +35,15 @@ repositories {
|
||||
|
||||
maven {
|
||||
|
||||
url "https://repo.purpurmc.org/snapshots" // Get purpur API from purpur maven repository.
|
||||
name "purpur-repo" // Declare a name for the Purpur repository.
|
||||
url "https://repo.purpurmc.org/snapshots" // Get Purpur API from PurpurMC's Maven repository.
|
||||
|
||||
}
|
||||
|
||||
maven {
|
||||
|
||||
name 'jitpack-repo' // Declare a name for the Jitpack repository.
|
||||
url 'https://jitpack.io' // Import Jitpack repository for Duels API.
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +51,8 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
|
||||
compileOnly "org.purpurmc.purpur:purpur-api:1.18.2-R0.1-SNAPSHOT" // Declare purpur API version to be packaged.
|
||||
compileOnly "org.purpurmc.purpur:purpur-api:1.18.2-R0.1-SNAPSHOT" // Build the Purpur API.
|
||||
compileOnly 'com.github.Realizedd.Duels:duels-api:3.5.1' // Build the Duels API.
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
rootProject.name = "Buy-OG"
|
||||
rootProject.name = "DuelEnhancer-OG"
|
||||
@@ -1,143 +0,0 @@
|
||||
package plugin;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
|
||||
// Initialize command manager class.
|
||||
public class CommandManager implements CommandExecutor {
|
||||
|
||||
// Create instance of class for command runner.
|
||||
private static CommandManager instance;
|
||||
|
||||
// Constructor for main class to get instance from.
|
||||
public static CommandManager getInstance() {
|
||||
|
||||
return instance;
|
||||
|
||||
}
|
||||
|
||||
// Declare a new command.
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
|
||||
// If the command matches our criteria, do this...
|
||||
if (cmd.getName().equalsIgnoreCase("buy")) {
|
||||
|
||||
// If the command executor is a player, do this...
|
||||
if (sender instanceof Player) {
|
||||
|
||||
// Cast the sender to a player object safely.
|
||||
Player player = (Player) sender;
|
||||
|
||||
// If the player did not provide any arguments, do this...
|
||||
if (args.length == 0) {
|
||||
|
||||
// Send the available ranks to the user.
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&5&l-=-=-=-=- &2&lTrue&4&lOG &B&lDonation Store: &5&l-=-=-=-=-"));
|
||||
player.sendMessage("");
|
||||
player.sendMessage("Each donor rank requires the rank before it.");
|
||||
player.sendMessage("");
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&aRank Overview: &3&nhttps://shop.true-og.net"));
|
||||
player.sendMessage("");
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&f[OG] &7(&2$10 Once&7) &3&nhttps://true-og.net/og"));
|
||||
sendClickableMessage(player, "/buy og");
|
||||
player.sendMessage("");
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c[OG Pro] &7(&2$50 Once&7) &3&nhttps://true-og.net/og-pro"));
|
||||
sendClickableMessage(player, "/buy og-pro");
|
||||
player.sendMessage("");
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&4&l[OG Master] &7(&6$10 Monthly&7) &3&nhttps://true-og.net/og-master"));
|
||||
sendClickableMessage(player, "/buy og-master");
|
||||
|
||||
}
|
||||
// If the player provided one or more arguments, do this...
|
||||
else {
|
||||
|
||||
// If the OG text was clicked, do this...
|
||||
if (args[0].equalsIgnoreCase("og")) {
|
||||
|
||||
// Share the OG benefits with the user.
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&5&l-=-=-=-=- &2&lTrue&4&lOG &f&lOG Rank: &5&l-=-=-=-=-"));
|
||||
player.sendMessage("- Use /afk for an unlimited amount of time.");
|
||||
player.sendMessage("- Prominent white chat prefix");
|
||||
player.sendMessage("- Create unions with /union create.");
|
||||
player.sendMessage("- Invite people to unions with /union invite.");
|
||||
player.sendMessage("- Access to #donor-chat on Discord.");
|
||||
player.sendMessage("- 6 homes (temporary benefit until the implementation of our in-game home earning plugin).");
|
||||
player.sendMessage("- More TBA.");
|
||||
|
||||
}
|
||||
// If the OG Pro text was clicked, do this...
|
||||
else if (args[0].equalsIgnoreCase("og-pro")) {
|
||||
|
||||
// Share the OG Pro benefits with the user.
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&5&l-=-=-=-=- &2&lTrue&4&lOG &cOG Pro Rank: &5&l-=-=-=-=-"));
|
||||
player.sendMessage("- All OG Benefits.");
|
||||
player.sendMessage("- Rent up to 2 shops at the player market.");
|
||||
player.sendMessage("- Special chat formatting (bold, italics, magic, etc).");
|
||||
player.sendMessage("- Use color codes in chat, mail, unions, signs, anvils, and book titles.");
|
||||
player.sendMessage("- Edit written books with /book.");
|
||||
player.sendMessage("- Edit signs with /editsign.");
|
||||
player.sendMessage("- Wear hats with /hat.");
|
||||
player.sendMessage("- Sit anywhere with /sit.");
|
||||
player.sendMessage("- Access your ender chest anywhere with /echest.");
|
||||
player.sendMessage("- More TBA.");
|
||||
|
||||
}
|
||||
// If the OG Master text was clicked, do this...
|
||||
else if (args[0].equalsIgnoreCase("og-master")) {
|
||||
|
||||
// Share the OG Master benefits to the user.
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&5&l-=-=-=-=- &2&lTrue&4&lOG &4&lOG Master Rank: &5&l-=-=-=-=-"));
|
||||
player.sendMessage("- All OG and OG Pro Benefits.");
|
||||
player.sendMessage("- Rent up to 3 shops at the player market.");
|
||||
player.sendMessage("- World inspection with /co inspect.");
|
||||
player.sendMessage("- Return to last teleport destination with /back.");
|
||||
player.sendMessage("- Special mail, sign, and anvil formatting (strike-through, italics, magic, etc).");
|
||||
player.sendMessage("- More TBA.");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// If the command executor is not a player, do this...
|
||||
else {
|
||||
|
||||
// Deny console executions.
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "ERROR: The console cannot execute this command!"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Healthy exit status.
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
// Turns chat text into a command button.
|
||||
public void sendClickableMessage(Player player, String command) {
|
||||
|
||||
// Declare a TextComponent with contents.
|
||||
TextComponent clickableText = Component.text(ChatColor.translateAlternateColorCodes('&', "&B&lClick here to see the benefits!"));
|
||||
|
||||
// Style the clickable text.
|
||||
clickableText.color(NamedTextColor.AQUA).decoration(TextDecoration.BOLD, TextDecoration.State.TRUE);
|
||||
|
||||
// Create a click event on the chat text.
|
||||
clickableText = clickableText.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.RUN_COMMAND, command));
|
||||
|
||||
// Send the clickable text to the player.
|
||||
player.sendMessage(clickableText);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +1,19 @@
|
||||
package plugin;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import me.realized.duels.api.Duels;
|
||||
|
||||
// Extending this class is standard bukkit boilerplate for any plugin, or else the server software won't load the classes.
|
||||
public class BuyOG extends JavaPlugin {
|
||||
public class DuelEnhancerOG extends JavaPlugin {
|
||||
|
||||
// What to do when the plugin is run by the server.
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
||||
// Run command when plugin event is triggered.
|
||||
this.getCommand("buy").setExecutor(new CommandManager());
|
||||
Duels api = (Duels) Bukkit.getServer().getPluginManager().getPlugin("Duels");
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
name: Buy-OG
|
||||
name: DuelEnhancer-OG
|
||||
author: NotAlexNoyle
|
||||
description: A chat-based drop-in replacement for CraftingStore's /buy GUI
|
||||
website: https://github.com/NotAlexNoyle/Buy-OG/
|
||||
description: An extension to Duels by Realizedd made for TrueOG
|
||||
website: https://github.com/NotAlexNoyle/DuelEnhancer-OG/
|
||||
version: 1.0
|
||||
api-version: 1.18
|
||||
main: plugin.BuyOG
|
||||
|
||||
commands:
|
||||
buy:
|
||||
description: Purchase a rank on the TrueOG Store
|
||||
aliases: [rank, ranks, store]
|
||||
main: plugin.DuelEnhancerOG
|
||||
Reference in new issue
Block a user