Plugin category: EXAMPLE Suggested name: no idea What I want: I want a plugin that logs whenever somebody begins to attack somebody, in order see who hits first during combat. Ideas for commands: No commands needed for this plugin. When I'd like it by: ASAP
failtolawl http://plugins.bukkit.org/?q=pvp+log&category=None Some of them also offer anti-combat relog
It's not very extensive. Could you expand on the idea a bit more. How would you read the data, would it put it in the console? You've said you don't need commands.
It would be the same as if somebody killed somebody, in would show up in the server log, as "player struck player". It's fine if it shows all of the combat in it too, that might be better than just the one person hitting first.
it will be done in about 1 hour I got to have a shower. (stay on and keep checking this post) almost done just testing it now. and debugging if have to EDIT by Moderator: merged posts, please use the edit button instead of double posting.
done: https://www.dropbox.com/s/7h44fqrulbuqnb1/PVPCombatLogger.jar Let me know what you think. Code: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.james137137.PVPCombatLogger; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Arrow; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.plugin.java.JavaPlugin; /** * * @author James */ public class PVPCombatLogger extends JavaPlugin { static Logger log = Bukkit.getLogger(); public void onEnable() { String version = Bukkit.getServer().getPluginManager().getPlugin(this.getName()).getDescription().getVersion(); log.log(Level.INFO, this.getName() + " : Version {0} enabled", version); getServer().getPluginManager().registerEvents(new PVPCombatLoggerListener(), this); } /** * @param args the command line arguments */ @Override public void onDisable() { log.log(Level.INFO, "{0}: disabled", this.getName()); } private static class PVPCombatLoggerListener implements Listener { public PVPCombatLoggerListener() { } @EventHandler public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) { if (event.getEntity()instanceof Player && event.getDamage() > 0) { Player player = (Player) event.getEntity(); String PlayerName = player.getName(); int damage = event.getDamage(); if (event.getDamager().getType().equals(EntityType.PLAYER)) { Player damager = ((Player) event.getDamager()); String damagerName = damager.getName(); log.log(Level.INFO, "[PVPCombatLogger]: {0} Attacked {1} causing a damage of: {2}", new Object[]{damagerName, PlayerName, damage}); } if (event.getDamager().getType().equals(EntityType.ARROW)) { Arrow thisArrow = (Arrow) event.getDamager(); if (thisArrow.getShooter() instanceof Player) { Player damager = (Player) thisArrow.getShooter(); String damagerName = damager.getName(); log.log(Level.INFO, "[PVPCombatLogger]: {0} shot {1} causing a damage of: {2}", new Object[]{damagerName, PlayerName, damage}); } } } } } } quite simple only took about 1 hour (the arrows were the hardest bit) EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Hey thanks a ton, I don't have anybody on my server ATM so I cannot test it yet, but I installed it, I thank you greatly for your time! Ok I got somebody to test it with me, absolutely amazing work. Even if it was simple, this helps me a bunch! EDIT by Moderator: merged posts, please use the edit button instead of double posting.
i created entitydamageevent added them to arraylist then i creted a delayed task to remove them from list and if they quit and there in the list it kills them and announces the combat logged.