zRivals Duels logozRivals Duels

Duels and protection

The snapshot and restore, the countdown, how duels end, Fight here, what is blocked during a duel, and the command blocker.

Once both players confirm, the plugin takes over. It saves each player exactly as they are, gives them the kit, counts down, lets them fight, and puts everything back afterwards. While all that happens, the duel is sealed off: no outside damage, no escaping by command or portal, and no smuggling kit items out.

A matrix of what duel players can and cannot do while starting, during the countdown, during the fight and during the winner delay.

How a duel starts

  1. The arena is reserved: a random free one, or the one chosen in the setup menu. With Fight here no arena is used.
  2. If there is a wager, both stakes are taken and saved, see Wagers and currencies.
  3. A snapshot of each player is saved to the database.
  4. Both players are teleported to their spawn, put in the duel game mode, and flight is turned off. With Fight here nobody is teleported, the spot each player stands on becomes their spawn.
  5. The kit is given, see below.
  6. The countdown runs, then the fight begins.

What the snapshot saves

  • inventory, armour and offhand
  • XP level and points
  • health, maximum health, food, saturation and exhaustion
  • location
  • potion effects
  • fire ticks, fall distance, game mode and flight

The location saved is where the player stood when the duel request was accepted, not where they were when the duel started. That is where return-to: PREVIOUS_LOCATION sends them, see Where players go afterwards.

What the kit does to the player

Their inventory is cleared and filled with the kit, every kit item is tagged with the duel, maximum health is set from the kit, health and food are filled, existing effects are cleared and the kit effects are added.

Countdown

During the countdown players can look around but cannot move from their spot, attack, take damage, use items, throw or shoot anything, or eat and drink.

Players are held still by lowering their movement speed and jump strength to zero for the countdown, not by teleporting them back on every step. Anti cheat plugins do not flag it. The freeze is lifted when the fight starts, when the duel ends, and on restore, shutdown and join. A player who somehow ends up more than 1.5 blocks from his spawn is held on the last spot the server accepted, and put back on the spawn if that spot is off as well.

The fight starts by placing both players on their spawn point again, so the server and the client agree on where everyone stands before the first hit.

countdown:
  # Seconds between each countdown step
  step-seconds: 1
  # Title fade in time in ticks
  fade-in: 0
  # Title stay time in ticks
  stay: 25
  # Title fade out time in ticks
  fade-out: 5
  # Titles and sounds shown one after another, the last step starts the fight
  steps:
    - title: "<red><bold>3"
      subtitle: ""
      sound: "block.note_block.pling"
      pitch: 0.8
    - title: "<gold><bold>2"
      subtitle: ""
      sound: "block.note_block.pling"
      pitch: 1.0
    - title: "<yellow><bold>1"
      subtitle: ""
      sound: "block.note_block.pling"
      pitch: 1.2
    - title: "<green><bold>FIGHT!"
      subtitle: ""
      sound: "entity.ender_dragon.growl"
      pitch: 1.0

Add, remove or change steps freely. Each step shows its title and subtitle and plays its sound, and the fight starts as the last step shows. Leave sound empty for a silent step.

Fight

Only the two duel players can hurt each other. Damage to or from anyone outside the duel is cancelled, and splash potions thrown by a duel player do not affect anyone else.

Other players can watch the fight in spectator mode without affecting it, see Spectating.

How a duel ends

EndingResult
A player diesThe other player wins
A player disconnects during the countdown or fightThe player who left loses
A player leaves the boundariesThey lose, or are pushed back, see Boundaries
/duel forfeit during the countdown or fightThe player who forfeits loses
The time limit runs outNo winner. Counts as a draw, no MMR change, wagers refunded
Staff run /duel admin end <player>No winner. No stats change, wagers refunded

Leaving, forfeiting or dropping out after the countdown started all count as a loss, with the MMR and wager going to the opponent. If a player leaves before the teleport, the start is simply cancelled and nothing changes.

After the fight

  • Death. Drops and dropped XP are cleared. The loser respawns where return-to sends them and gets their own inventory back. Totems of undying in a kit work normally, the plugin only acts on a real death.
  • Winner. Stays in the arena for winner-delay-seconds, cannot be hurt, and sees the victory title and sound. Then they are restored and sent where return-to says.
  • Results. Both players get the result in chat: winner, loser, kit, mode, and in ranked the MMR change and new MMR, plus the wager won, lost or refunded.
  • Commands. win-commands run for the winner and loss-commands for the loser, as console commands. Only when there is a winner.
duel:
  # Game mode players are put in for the fight
  game-mode: SURVIVAL
  # Longest a fight can last in seconds before it ends as a draw, 0 turns this off
  max-duration-seconds: 0
  # Seconds the winner stays in the arena after the fight
  winner-delay-seconds: 3
  # What happens when a player leaves the arena boundaries: FORFEIT (counts as a loss) or PUSH_BACK
  boundary-action: FORFEIT
  # Also treat going above or below the boundaries as leaving them, when false only the sides count
  boundary-check-height: false
  # Where players go after a duel: EXIT (the arena exit) or PREVIOUS_LOCATION (where each player stood when the duel was accepted)
  return-to: EXIT
  # Stop duel players from dropping items
  block-item-drops: true
  # Allow ender pearls when they land inside the arena boundaries
  allow-ender-pearls: true
  # Allow chorus fruit when it lands inside the arena boundaries
  allow-chorus-fruit: true
  # What to do with the death message of a duel death: KEEP, HIDE or REPLACE (text in the language file)
  death-message: REPLACE
  # Console commands run for the winner, tokens: %player% %opponent% %kit% %mode%
  win-commands: []
  # Console commands run for the loser, tokens: %player% %opponent% %kit% %mode%
  loss-commands: []
  # Broadcast ranked results to the whole server
  broadcast-ranked-results: false
KeyWhat it doesDefault
game-modeGame mode during the duelSURVIVAL
max-duration-secondsTime limit, then the duel ends as a draw. 0 means no limit0
winner-delay-secondsHow long the winner stays after the fight3
boundary-actionFORFEIT makes leaving the boundaries a loss. PUSH_BACK puts the player back insideFORFEIT
boundary-check-heighttrue also counts going above or below the boundaries as leaving them. false checks only the sidesfalse
return-toEXIT sends players to the arena exit. PREVIOUS_LOCATION sends each player back to where they stood when the duel was acceptedEXIT
block-item-dropstrue blocks drops for the whole duel. false allows drops during the fight onlytrue
allow-ender-pearlsPearls work during the fight when they land inside the boundariestrue
allow-chorus-fruitChorus fruit works during the fight when it lands inside the boundariestrue
death-messageKEEP the normal message, HIDE it, or REPLACE it with duel.death-message from the language fileREPLACE
win-commands, loss-commandsConsole commands. %player%, %opponent%, %kit% (the kit file name) and %mode% (ranked or unranked)empty
broadcast-ranked-resultsAnnounce every ranked result to the serverfalse

Boundaries

When a player walks out of the boundaries during the fight, boundary-action decides what happens:

  • FORFEIT ends the duel and the player who left loses.
  • PUSH_BACK keeps them on the last spot inside the arena, or puts them on their spawn if that spot was outside too. The "You cannot leave the arena" message is sent at most once every 2 seconds, so walking along a wall does not flood chat.

By default only the sides count. Jumping, falling or building up never counts as leaving. Set boundary-check-height: true to count the top and bottom as well, and set the boundary corners one at floor level and the other a few blocks higher, otherwise every jump leaves the arena. Ender pearl and chorus fruit landings are checked the same way.

Where players go afterwards

return-toWhere players goFallback
EXITThe arena exitThe location before the duel, when the arena has no exit
PREVIOUS_LOCATIONWhere each player stood when the duel request was acceptedThe arena exit, when that location's world is not loaded

The same location is used after a death, after the winner delay, on a server stop, and when a player rejoins after a disconnect or a crash mid fight. With PREVIOUS_LOCATION an arena does not need an exit to be ready, see Arenas.

A Fight here duel ignores return-to. Each player is put back on the spot where they stood when the duel started, and that spot is used for the loser's respawn and for crash recovery as well.

Example: give the winner a coin and log losses.

  win-commands:
    - "eco give %player% 100"
  loss-commands:
    - "say %player% lost a %mode% %kit% duel to %opponent%"

Fight here

Fight here lets two players duel right where they stand, without an arena. It is picked from the location button in the setup menu. Nobody is teleported, not at the start, not during the countdown and not when the fight begins.

The snapshot, the kit and its tags, the countdown freeze, the damage rules, the command blocker and every rule in What is blocked during a duel work exactly as in an arena. In match history the arena is shown as fight-here.

fight-here:
  # Let players pick Fight here in the setup menu to duel where they stand, without being teleported
  enabled: true
  # Most blocks the two players can be apart to pick Fight here
  max-distance: 15
  # Blocks the fight area reaches past the two players on every side, leaving it counts as leaving the boundaries
  border: 12
  # Allow Fight here inside a WorldGuard region with PvP turned off
  allow-in-no-pvp-regions: false
  # Worlds where Fight here cannot be used
  disabled-worlds: []
KeyWhat it doesDefault
enabledShows the Fight here button in the location menutrue
max-distanceHow many blocks apart the two players can stand15
borderThe fight area is a box around both players' spots, this many blocks bigger on every side. Leaving it follows duel.boundary-action, the same as leaving arena boundaries12
allow-in-no-pvp-regionsAllow Fight here where WorldGuard has pvp on deny. Only when this is on does the WorldGuard PvP bypass apply to a Fight here duelfalse
disabled-worldsWorld names where Fight here is never allowed, for example [world_nether, spawn]empty

Both players need zrivalsduels.fighthere, which everyone has by default, see Permissions.

When Fight here is refused

The Fight here button is locked, with the reason in its lore, when:

  • Fight here is turned off
  • the mode is Ranked, ranked duels are only fought in arenas
  • either player lacks zrivalsduels.fighthere
  • the players are in different worlds
  • the world is in disabled-worlds
  • the world has PvP turned off (Multiverse pvp: false, the pvp game rule, or pvp=false in server.properties), because the server drops every hit there before any plugin sees it
  • the players stand further apart than max-distance
  • either player stands inside the boundaries of any arena
  • WorldGuard has pvp on deny where either player stands, unless allow-in-no-pvp-regions is on

Every check runs again when both confirm. Right before the countdown the distance is checked once more, and if the two moved too far apart the duel is cancelled with a message.

Extra rules for Fight here

A Fight here duel happens in the normal world, so a few more things are blocked on top of the usual duel rules:

ActionRule
Dropping itemsAlways blocked, whatever block-item-drops says
Placing and breaking blocksAlways blocked, whatever the kit allows
FireNo fire from flint and steel, fire charges or flaming arrows
ExplosionsExplosions caused by the fighters break no blocks
ProjectilesCannot change blocks, for example lighting TNT with a flaming arrow or breaking decorated pots
Frost walkerMakes no ice
Farmland and pressure platesNo trampling, plates are not triggered
Using blocksDoors, trapdoors, gates, buttons, levers, beds, jukeboxes, lecterns, signs and similar blocks do nothing
Tools and items on blocksAxes, shovels, hoes, buckets, bone meal, dyes, spawn eggs, boats, minecarts and other items that change or place something on a block cannot be used on one. Eating, drinking, bows and ender pearls still work, even while looking at the ground
EntitiesNo interacting with villagers, allays, item frames, armour stands, animals or any other entity
RidingBlocked

Everything else, including the hits between the two players, works the same as in an arena.

Own gear duels

When Own gear is chosen in the setup menu, no kit is given. Before the countdown both players are healed and fed (own-gear.heal-before-fight), their effects are removed (own-gear.clear-effects), and fire and fall distance are cleared.

  • The snapshot still saves XP, health, location, effects and game mode, but never the inventory. Restore, server stop and the join restore after a crash leave the inventory as it is, so nothing placed, dropped or used in the fight comes back twice.
  • Players can pick up their own arrows and items in the arena. Items from other duels stay blocked.
  • Block placing and breaking follow own-gear.allow-block-place and own-gear.allow-block-break, hunger and regeneration work as normal.
  • With loser-items: DROP the loser's whole inventory (storage, armour, offhand, cursor and crafting grid) is taken the moment a winner is decided. It is saved to data/own-gear-spoils.yml first, then given to the winner after their restore. If the winner is offline, they get it when they next join. A crash between the two cannot lose the items.
  • A death in an own gear duel keeps the inventory, nothing drops in the arena.
  • Ranked duels never use Own gear.

Restore

  • Every item tagged with the duel is removed from the player first, then the snapshot is put back exactly. Own gear duels keep the inventory as it is, see Own gear duels.
  • The saved snapshot is deleted only after the restore finished.
  • If the player is offline, the snapshot stays in the database and is applied the moment they next join, before they can do anything.
  • On every join, the inventory and ender chest are scanned and any leftover duel item is removed.

Server stop or crash

If the server stops during a duel, every running duel ends with no winner, online players are restored and sent where return-to says, and no MMR or stats change. Wagers stay held and are refunded on the next startup. After a crash, snapshots are restored when players join and held wagers are refunded on startup.

What is blocked during a duel

From the start of the duel until the player is restored:

ActionRule
Other duelsCannot send, accept or join another duel
Dropping itemsBlocked with block-item-drops: true, otherwise allowed during the fight only
Picking up itemsOnly items dropped inside their own duel
ContainersChests, ender chests and every inventory except their own are blocked, as are item frames and armour stands
TeleportsBlocked unless caused by the plugin. Ender pearls and chorus fruit work only during the fight and only when landing inside the boundaries. Once the fight is over, teleports by other plugins are cancelled without a message, the plugin's own restore teleport follows
Portals and bedsBlocked
Game mode and flightChanges by other plugins are blocked
Placing and breaking blocksOnly during the fight, only if the kit allows it, only inside the combat region. Buckets follow the same rule. Never in a Fight here duel
Paintings and item framesCannot be broken
Fishing rodsCannot pull a player into or out of a duel
MobsDo not target duel players
RidingNo mounting vehicles or animals
Arrows and tridentsOne that belongs to another duel cannot be picked up
Leaving the boundariesboundary-action decides, only the sides count unless boundary-check-height is on
CommandsThe command blocker, below
Hitting each otherAllowed during the fight. In a WorldGuard region with PvP off, see the bypass below

WorldGuard PvP bypass

An arena inside a WorldGuard region with the pvp flag on deny stops the two fighters hitting each other, the same as everyone else standing there. The bypass lets their hits and the knockback from them through without touching the region.

integrations:
  worldguard:
    allow-pvp-during-duels: true

It is on by default and only does anything when WorldGuard is installed. A hit is let through only when all of this is true:

  • The victim and the attacker are the two players of the same duel.
  • The countdown is over and the fight has started.
  • Neither of them is in the short invulnerable moment at the start of the fight or after a respawn.
  • Both stand inside the arena boundaries, by the same rule boundary-check-height sets.
  • The damage comes from the opponent himself or from a projectile he shot.
  • WorldGuard really has pvp on deny where one of the two stands.

In a Fight here duel the bypass only applies when fight-here.allow-in-no-pvp-regions is true, and the fight area takes the place of the arena boundaries in the checks above.

Anything else stays as it is. The flag is never changed, so spectators, players passing by and anyone outside the duel keep the region's protection, and the two fighters go back under it the moment the duel ends.

Two things worth knowing:

  • Nothing else is let through. Blocks, containers and the rest of the region flags are untouched, and so is every other plugin that blocks damage, with one exception: if an anti cheat cancels a hit between the two fighters in a region that has pvp on deny, that hit is let through as well. Set allow-pvp-during-duels: false if you would rather the anti cheat always win.
  • With debug: true every let through hit and every let through knockback is written to the console.

SuperiorSkyblock2

SuperiorSkyblock2 blocks player hits on islands in several ways: the island PVP flag is off, visitors or coop players cannot take damage (visitors-damage, coop-damage), the spawn island has player damage off, or a player is still in the short PvP warm up after teleporting onto an island. Without help, a Fight here duel on an island deals no damage.

integrations:
  superiorskyblock:
    allow-pvp-during-duels: true

On by default, only used when SuperiorSkyblock2 is installed. A hit that SuperiorSkyblock2 cancelled is let through only when:

  • The victim and the attacker are the two players of the same duel and the fight has started.
  • Neither is in the invulnerable moment after the fight ends.
  • Both stand inside the arena boundaries, or the Fight here area.
  • The damage comes from the opponent or a projectile he shot.
  • SuperiorSkyblock2 itself says the hit is not allowed there.

Island settings are never changed. Visitors, island members and spectators keep the island's protection, and the two fighters go back under it the moment the duel ends.

The plugin's own teleports, such as putting a player back on their spot, the exit after the duel and spectating, are let through when SuperiorSkyblock2 cancels them on an island, for example on a locked island.

After a death

SuperiorSkyblock2 sends players to their island or spawn after a respawn (player-respawn in its config.yml). After a duel death the plugin restores the player on their exit, and for 3 seconds after that restore it cancels teleports by other plugins, so the player is not moved to their island home. The player does not see "You cannot teleport during a duel" for this, it happens quietly.

With debug: true, every let through hit and teleport, and every blocked respawn teleport, is written to the console.

Command blocker

Stops players escaping a duel with /spawn, /home, /tpa and friends.

How a typed command like essentials ehome is matched, with the namespace stripped, the real command and its aliases looked up, and the result compared with the blocked list.
command-blocker:
  # BLACKLIST blocks the commands below, WHITELIST allows only the commands below
  mode: BLACKLIST
  # Commands to block or allow while in a duel, aliases are matched too
  commands:
    - spawn
    - home
    - tpa
    # and the rest of the default list
  # Duel subcommands players can always use while in a duel
  allowed-duel-subcommands:
    - forfeit
    - help

How a typed command is matched:

  1. The namespace is stripped. /essentials:spawn is checked as spawn.
  2. Aliases are resolved. The typed word is looked up in the server's command list, and the real command name and all of its aliases are checked. So listing home also catches /ehome when that is an alias of the same command.
  3. Whole words, from the start. shop blocks /shop, /shop sell and /shop buy. A multi word entry like shop sell blocks only /shop sell.
  4. Upper or lower case does not matter.
KeyWhat it doesDefault
modeBLACKLIST blocks the listed commands. WHITELIST blocks everything except the listed commandsBLACKLIST
commandsThe list. Namespaces and a leading / in entries are fine34 common commands
allowed-duel-subcommands/duel subcommands that keep working. Use the ids from commands.yml, so a renamed subcommand still matches. Every other /duel subcommand is blockedforfeit, help

/duel forfeit always works, even if you remove it from the list.

The default list is: spawn, home, homes, sethome, tpa, tpaccept, tpahere, tpyes, tp, back, warp, warps, rtp, wild, shop, hdv, ah, auction, auctionhouse, sell, trade, ec, enderchest, pv, vault, kit, kits, fly, gamemode, gm, heal, feed, repair, hat.

zrivalsduels.bypass.commands skips the blocker. Nobody has it by default, operators included. If a blocked command still works, check whether your permissions plugin gives that player * or zrivalsduels.*.

On this page