DriftTeams
Teams with a bank, a chest and a level.
Teams for Paper and Folia 26.3: a team menu, owner/manager/member roles, team and ally chat, named team homes, a shared ender chest, a team bank, alliances, friendly fire, twelve team colours, stats, team XP and levels, a leaderboard, staff tools and importers for BetterTeams and UltimateClans. Part of DriftSuite.
Features
- Team menu:
/teamopens a menu with team info, members, homes, the ender chest, the bank, allies, stats, the leaderboard and settings. Without a team it opens a menu to make one, see invites or join an open team. - Members: invite, accept, deny, join open teams, kick, leave, promote, demote, transfer and disband (with a confirm pop-up). In the members menu, left-click promotes, right-click demotes and shift-click kicks.
- Roles: Owner, Manager and Member. config.yml lists what managers and members may do.
- Team chat and ally chat:
/teamchat(/tc) and/allychat(/achat) send one message, or switch your chat to that channel when typed on their own. Staff can spy on both. - Team homes: as many named homes as the team's limit allows, with a warmup that moving cancels, and no teleporting during DriftCombat combat.
- Shared ender chest: one chest for the whole team. Only one player can have it open at a time, on any server. It grows with team levels.
- Team bank: deposit and withdraw with quick buttons, a custom amount or a command, with a full log. Works with Vault, XP levels or a DriftEconomy currency.
- Alliances: a team asks, the other team asks back (or accepts in the menu) and they're allies. Ally limits come from permissions and levels.
- Friendly fire: off by default for new teams. Arrows, potions, lingering clouds and TNT count as the player behind them. Allies can only hurt each other when both teams allow it. With DriftCombat, a blocked hit doesn't put anyone in combat.
- Settings menu: twelve team colours, display name, tag, friendly fire, ally friendly fire and open or invite-only.
- Stats: kills, deaths, mobs killed, blocks broken and placed, playtime and the bank. Creative and spectator players don't count, nor do kills of teammates or allies.
- Team XP and levels: activities give XP; levels unlock member slots, homes, allies and ender chest rows.
- Leaderboard: ranks teams by any stat, with a menu that switches stat.
- Claim box: the bank and ender chest of a disbanded team, and any payout that couldn't be handed over, wait
in
/team claims. - Staff tools: delete, inspect, check a player, end an alliance, open any team's ender chest, import.
- Vanish aware: vanished players count as offline. They can't be invited and aren't suggested.
Requirements
- Paper or Folia 26.3 (Leaf works), Java 25.
- Optional: PlaceholderAPI, Vault (or DriftEconomy) for the bank, DriftCombat, DriftStaff.
- Storage is H2 (
data/database.mv.dbin the plugin folder) unless you set MySQL or MariaDB.
Getting started
- Put
DriftTeams-<version>.jarinplugins/and start the server. It works without any changes: its files are written toplugins/DriftTeams/and its own data toplugins/DriftTeams/data/(see Folder layout). - Make a team with
/team create <name> <tag>and invite someone with/team invite <player>. /teamopens the team menu: members, homes, bank, ender chest, allies, stats and settings.- Coming from BetterTeams or UltimateClans?
/teamadmin import betterteams(see Importing).
Commands
| Command | What it does |
|---|---|
/team | Opens the team menu (or the no-team menu) |
/team create <name> <tag> | Makes a team |
/team invite <player> | Invites a player |
/team accept [team] / /team deny [team] | Answers an invite |
/team join <team> | Joins an open team |
/team kick <player> | Removes a member |
/team leave | Leaves the team |
/team promote <player> / /team demote <player> | Changes a member's role |
/team transfer <player> | Gives the team to another member |
/team disband | Deletes the team (asks first) |
/team home [name] | Teleports to a team home (several homes open a menu) |
/team sethome <name> / /team delhome <name> | Sets or deletes a team home |
/team ally add <team> / remove <team> / list | Alliances |
/team enderchest (/team ec) | Opens the shared ender chest |
/team bank [deposit|withdraw <amount>] | The team bank |
/team claims | Items and money waiting for you |
/team chat [message] | Same as /teamchat |
/team stats [team] | Team stats |
/team leaderboard [stat] (/team top) | The top teams |
/team settings | Team settings |
/team info [team] | Team info in chat |
/team help | Every team command (click one to fill it in) |
/teamchat [message] (/tc) | Team chat; /teamchat spy for staff |
/allychat [message] (/achat) | Ally chat; /allychat spy for staff |
/teamadmin inspect <team> | Everything about a team |
/teamadmin check <player> | A player's team and role |
/teamadmin delete <team> | Deletes a team |
/teamadmin unally <team> <team> | Ends an alliance |
/teamadmin ec <player|team> | Opens a team's ender chest |
/teamadmin import <betterteams|ultimateclans> | Brings teams over |
/teamadmin reload | Reloads every file and says how many problems it found |
/teamadmin version | Shows the version |
/teamadmin help | The staff commands (click one to fill it in) |
/teamadmin also answers to /driftteams, and /team to /teams. /team takes over vanilla's /team
command; vanilla's stays usable as /minecraft:team. Every name and alias can be changed in commands.yml.
Permissions
| Permission | Default | What it allows |
|---|---|---|
driftteams.create | everyone | Making a team |
driftteams.member.<n> | Owner's teams can have n members (highest wins) | |
driftteams.home.<n> | Owner's teams can have n homes | |
driftteams.ally.<n> | Owner's teams can have n allies | |
driftteams.home.bypass-warmup | op | Teleport to team homes straight away |
driftteams.spy.teamchat | op | /teamchat spy |
driftteams.spy.allychat | op | /allychat spy |
driftteams.admin | op | Every /teamadmin command |
Without the limit permissions, limits: in config.yml is used. Levels add to them.
Roles
Owners can do everything. config.yml lists what managers and members may do with these actions: invite,
kick, promote, demote, home, sethome, delhome, ally, settings, bank-deposit, bank-withdraw,
enderchest. Kicking, promoting and demoting only work on players below your own role.
Turning features on and off
At the top of config.yml:
| Switch | What it turns on |
|---|---|
homes | Team homes |
enderchest | The shared ender chest |
bank | The team bank |
allies | Alliances and ally chat |
chat | Team and ally chat (restart) |
friendly-fire-protection | Blocking hits between teammates and allies |
settings | The settings menu |
stats | Counting stats |
levels | Team XP, levels and level bonuses |
leaderboard | The leaderboard |
placeholders | PlaceholderAPI placeholders (restart) |
Settings
Everything in config.yml has a note above it. The main sections:
names,tags,blocked-words,display-name: what team names and tags may look like.create.cost: what making a team costs.new-teams: colour, open, friendly fire and ally friendly fire for new teams.limits,roles: members, homes and allies, and what each role may do.bank: economy (vault,xpor a DriftEconomy currency), minimum, maximum balance and quick amounts.enderchest: starting rows and whether it can be opened in combat.homes: warmup and blocked worlds.stats,xp,levels: what's counted, what gives XP and what each level unlocks.storage: H2, MySQL or MariaDB.
Can't be exploited
- Bank: a deposit takes the player's money first and then adds it with one UPDATE; if that fails the money
goes back. A withdrawal takes it out of the bank with one conditional UPDATE (
bank >= amount), so only one of two withdrawals racing for the last coins can win, and only then pays the player. A payout that can't be made (player left, economy said no) goes to the claim box. - Ender chest: one editor at a time on any server, through a lock row in the database. Closing saves the items and lets go of the lock in the same UPDATE. Closing and reopening quickly is safe because every database job runs in order on one thread. Kicked or leaving players have it closed and saved. A crashed server's locks run out after two minutes.
- Claim box: each claim is a row deleted before it's handed out, so it can only be claimed once. Items are only claimed with room in the inventory; anything that still doesn't fit goes back in the box, never on the ground.
- Disbanding: paying the bank and boxing up the ender chest happen in the same transaction that deletes the team. It won't go ahead while someone has the chest open (it's closed first).
- One action at a time: each player has a single slot for team actions, so double clicks can't do anything twice.
- Joining: the members table is keyed by player, so a player can only be in one team, and the member limit is checked inside the joining transaction.
- Locked menus: nothing can be taken out of any menu except the ender chest.
- Stats: creative and spectator players don't count.
PlaceholderAPI
| Placeholder | Shows |
|---|---|
%driftteams_has_team% | true or false |
%driftteams_name% / _display / _tag | Name, display name, tag |
%driftteams_color% | The team colour as hex, like #38bdf8 |
%driftteams_tag_colored% | The tag in its colour, as MiniMessage |
%driftteams_role% | Owner, Manager or Member |
%driftteams_level% / _xp | Level and XP |
%driftteams_members% / _online / _owner | Members, online members, owner |
%driftteams_bank% / _allies | Bank balance, number of allies |
%driftteams_<stat>% | Any stat: kills, deaths, mobs, blocks_broken, blocks_placed, playtime, money |
%driftteams_top_<stat>_<n>% | Name of the team ranked n (add _tag or _value) |
For DriftChat or DriftTAB: <color:%driftteams_color%>[%driftteams_tag%]</color>. Players without a team get
placeholders.no-team (empty by default).
Developer API
com.itskoazt.driftteams.api.DriftTeamsAPI, all static and safe from any thread:
DriftTeamsAPI.sameTeam(a, b); // UUIDs or Players
DriftTeamsAPI.allied(a, b);
DriftTeamsAPI.friendly(a, b); // teammates or allies
TeamInfo team = DriftTeamsAPI.teamOf(uuid); // null without a team
DriftTeamsAPI.team("TAG"); // by name or tag
DriftTeamsAPI.friendlyFireBlocked(attacker, victim);
TeamInfo is a record: id, name, tag, displayName, color, owner, members, level. The class can also be called by
reflection, so a plugin doesn't need DriftTeams to build.
Importing
/teamadmin import betterteamsreadsplugins/BetterTeams/teamInfo/*.yml: names, tags, colours, open and pvp, banks, members and ranks (OWNER, ADMIN as manager, DEFAULT as member), the home and warps as team homes, allies and ender chests./teamadmin import ultimateclanslooks through UltimateClans' YAML files or SQLite database inplugins/UltimateClansfor clans (name, tag, leader, bank) and their members. Clans kept in MySQL can't be read.
Teams whose name is already used and players already in a team are skipped. Tags that clash get a number. The other plugin's files aren't changed. Every line of the result is shown and logged.
Configuration files
| File | What's in it |
|---|---|
config.yml | Feature switches and every setting above |
commands.yml | Names, aliases, permissions and on/off for each command |
messages.yml | Every message (MiniMessage), the prefix and prefix-enabled |
menus.yml | Every menu's title, size, slots and items |
Every file starts with a boxed header saying how to apply changes, is split into sections, and has a note above
every option saying what it does, its unit and the values it takes. The prefix is DRIFTTEAMS in bold solid sky
blue (#38bdf8), followed by a dark grey ».
When you update, new options are added with their notes and everything you changed is kept. When the notes
themselves change, each file is rebuilt once with the new notes and your values written back in; the old file is
kept in data/backups/. Messages you never changed get the new default wording. Your levels and xp sections
are kept exactly as you wrote them.
Mistakes in the files
A value DriftTeams can't use never stops the plugin. The console says which file and option, what was wrong and what is used instead, for example:
[DriftTeams] config.yml: new-teams.color "skyblue" isn't a hex colour like "#38bdf8", using "#38bdf8"
/teamadmin reload tells you how many problems it found, so you know to look.
Folder layout
plugins/DriftTeams/
config.yml settings, starting with the features: switches
messages.yml every message
menus.yml every menu
commands.yml command names, aliases and permissions
data/ the plugin's own files, no need to open them
database.mv.db teams, members, homes, banks, ender chests, stats (H2 storage)
backups/ old copies of files DriftTeams replaced
*.version which version of each file you have
Older versions kept data.mv.db and the .version markers next to config.yml. They are moved into data/
the first time the new version starts (one console line per file), and nothing is overwritten or deleted.