📄
pasted-code-1794049480460.txt
txt
21 lines
▶
1. Combat tagging
- When a player hits another player, both become combat-tagged.
- Combat tag lasts 15 seconds.
- If either player gets hit again, their timer resets to 15 seconds.
- Players can safely log out once the timer expires.
2. Combat logging If a player disconnects while combat-tagged:
- They immediately die.
- They drop their inventory and equipment.
- Their death is handled like a normal Minecraft death.
3. Technical requirements Required Fabric
- Minecraft Java Edition.
- Must support Minecraft version 26.3.
- Must be compatible with our existing Fabric mods.
- Must work on the server.
-Must show the timer on screen
1. Custom death messages
Killed by a sword = Was slain by [Player name] using [Weapon name(If any)] Killed by an axe = Was slain with Swight Powers by [Player name] using [Weapon name(If any)] Killed by a mace = Was Wemmbu-ed by [Player name] using [Weapon name(If any)] Killed by a spear = Was Dol9hin-ed by [Player name] using [Weapon name(If any)] Killed by a shovel = Was ShovelPVP-ed by [Player name] using [Weapon name(If any)] Killed by a hoe = Was FARMER-ed?!? by [Player name] using [Weapon name(If any)] Killed by a trident = Was JadenMAN-ed by [Player name] using [Weapon name(If any)] Killed by a ender-crystal = Was Dr.COCONUT-ed by [Player name] Killed by /kill = Was Killed by the Op for reasons...
Killed by a TNT-minecart = Was TheoBaldTheBird-ed by [Player name] Killed by a mob = Was outplayed by [mob name] Drowned = HAS A SKILLISSUE (aka drowned) Fall damage = HAS A SKILLISSUE (aka fell of a cliff or smth) Doomed to fall = Was meanly pushed a high area by [Player name] Killed by Lava HAS A SKILLISSUE (aka became barbecue) Killed by Fire / burning = Was cooked alive Killed by Cactus = Was pricked to death Killed by Berry bush = Was defeated by a bush Killed by Sweet berry bush = Was outplayed by a bush Killed by Suffocation = Forgot how to breathe Killed by Void = Went on an adventure too far Killed by Elytra collision = Forgot how to fly Killed by Firework rocket = Had a rocket malfunction Killed by Lightning = Was struck by weird electric bolt thingy Killed by Explosion (TNT) = Was blown to bits Killed by Anvil = Was flattened by a block of solid iron (Anvil) Killed by Falling block = Was crushed by gravity Killed by Powder snow = Froze to death by powder?!
Killed by Starvation = Forgot to eat Killed by Thorns = Was defeated by their own aggression Killed by Wither = Was withered away Killed by Poison = Was poisoned Killed by Magic damage = Was Magic-ed (The death messages must appear for the entire server)
📄
pasted-code-1794049515986.txt
txt
49 lines
▶
1. Combat system
Your rules are clear:
- 15-second combat tag.
- Both players are tagged when they fight.
- Every new hit resets the timer.
- Players can log out safely when the timer reaches zero.
- Logging out during combat causes immediate death and item drops.
On-screen timer: I'd display something like:
IN COMBAT
15 seconds
You cannot safely log out!
The timer should count down every second and disappear when combat ends.
2. Custom death messages
Your list is excellent. I'd keep all of them, including the funny ones.
There are four details I'd add:
1. Combat logging: Add a special message:
[Player] tried to escape combat and died!
2. Mob names: Use the actual mob's name, including custom names if it has a name tag.
3. Player attribution: For deaths such as falling, TNT minecarts and end crystals, the mod must remember which player caused the death.
4. Weapon names: Display the actual weapon name, including custom item names where possible. If there is no weapon, leave that part out.
3. A few technical details to settle
Detail My recommendation
Timer display Action bar or boss bar
Death messages Visible to the entire server
Combat logging Special custom death message
Item drops Drop inventory and equipped armour
Death messages for ordinary deaths Use your custom messages
Compatibility Fabric, Minecraft 26.3
One particularly important detail: if someone gets knocked off a cliff and dies several seconds later, the mod needs to remember who knocked them off.
4. One rule I'd clarify
What happens if a third player joins an existing fight?
For example:
- Steve hits Alex.
- Steve and Alex are combat-tagged.
- Bob then hits Steve.
Should Bob also become combat-tagged for 15 seconds?
My recommendation is yes. Every player who damages or is damaged by another player should receive their own combat tag.
This is a Java server plugin project; your request needs a Fabric 26.3 mod, which Kodari supports.
Switch to Fabric 26.3
are you still going
Yes. This is a Fabric 26.3 project, so I’ll build the server-side mod here.
Add combat tagging, the countdown, and combat-log deaths.
Add the custom death messages and player attribution.
The combat timer and combat-logout handling are in place.
Custom death messages and attribution still need wiring. Your initialization rules prohibit editing the files just created; may I update them to finish the mod?
yes
I’ll wire the custom messages into vanilla’s death handling, then add attribution for falls and explosive entities where the responsible player can be identified.
Added the custom death messages, including the combat-logout message, weapon and mob names, and attribution for falls and player-placed crystals and TNT minecarts. Messages respect the showDeathMessages gamerule.
Vanilla poison cannot kill on its own, and vanilla has only one berry-bush damage type. Dispenser-placed explosives have no player placer to attribute. The changes have not yet been compiled or tested in-game.
ok can you compleate and then give me th file now
I’ll finish the fall-attribution handling and check the combat-logout path. Then you can compile and download the jar in Kodari.
The mod is ready to compile; it hasn’t yet been compiled or tested in-game.
To get the jar:
Click Compile in the top bar. On phone, tap ⋮ → Compile Project.
Click Compile in the window.
When it succeeds, click Download on the build or Download .jar in chat.
If the build fails, click Auto-fix in chat or Fix in the build window.
ok
When you’re ready, click Compile to build and download the jar.
Can you make it so that when you are in combat you can throw ender pearls but they don't teleport you
I’ll keep pearls throwable, but prevent teleportation if they were thrown during combat or land while you’re tagged. Normal pearls will still work outside combat.
Ender pearls can now be thrown during combat, but won’t teleport you if thrown or landed while combat-tagged. Pearls work normally outside combat.
This change hasn’t been tested in-game yet.
When you are not in combat they work normal
Yes. Pearls thrown and landed outside combat work normally. A pearl thrown during combat won’t teleport you, even if your tag expires before it lands.
package ai.kodari.combatguard;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
public class CombatGuard implements ModInitializer {
@Override
public void onInitialize() {
ExplosiveOwners.initialize();
ServerLivingEntityEvents.AFTER_DAMAGE.register((entity, source, baseDamage, damage, blocked) -> {
if (!blocked && damage > 0) {
CombatTags.tagHit(entity, source);
}
});
ServerLivingEntityEvents.ALLOW_DEATH.register((entity, source, damage) -> {
CombatTags.tagHit(entity, source);
return true;
});
ServerTickEvents.END_SERVER_TICK.register(CombatTags::tick);
ServerLifecycleEvents.SERVER_STOPPED.register(server -> CombatTags.clear());
}
}