Assorted event updates. Created new McMMOPlayerRepairEvent for when a

repair is completed.
This commit is contained in:
GJ
2012-03-26 23:01:51 -04:00
parent 6a8737547f
commit 2d3b01ba34
19 changed files with 143 additions and 85 deletions

View File

@ -10,7 +10,6 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.event.player.PlayerAnimationEvent;
import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.Users;
@ -21,6 +20,7 @@ import com.gmail.nossr50.config.LoadTreasures;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
import org.getspout.spoutapi.sound.SoundEffect;
@ -134,7 +134,7 @@ public class Excavation {
Skills.abilityDurabilityLoss(player.getItemInHand(), LoadProperties.abilityDurabilityLoss);
if (!block.hasMetadata("mcmmoPlacedBlock")) {
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
Bukkit.getPluginManager().callEvent(armswing);
Excavation.excavationProcCheck(block, player);

View File

@ -11,7 +11,6 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.getspout.spoutapi.sound.SoundEffect;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.event.player.PlayerAnimationEvent;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
@ -20,6 +19,7 @@ import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
public class Mining {
@ -217,7 +217,7 @@ public class Mining {
Material type = block.getType();
int tier = m.getTier(player.getItemInHand());
int durabilityLoss = LoadProperties.abilityDurabilityLoss;
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
switch (type) {
case OBSIDIAN:

View File

@ -4,6 +4,7 @@ import java.util.Map;
import java.util.Random;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
@ -21,6 +22,7 @@ import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.events.McMMOPlayerRepairEvent;
import com.gmail.nossr50.locale.mcLocale;
public class Repair {
@ -437,7 +439,11 @@ public class Repair {
addEnchants(player, is);
}
is.setDurability(getRepairAmount(is, player));
short repairAmount = getRepairAmount(is, player);
is.setDurability(repairAmount);
McMMOPlayerRepairEvent event = new McMMOPlayerRepairEvent(player, is, repairAmount);
Bukkit.getPluginManager().callEvent(event);
}
/**

View File

@ -10,7 +10,6 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Tree;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.Bukkit;
import com.gmail.nossr50.Combat;
@ -20,6 +19,7 @@ import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.spout.SpoutSounds;
@ -306,7 +306,7 @@ public class WoodCutting {
* @param block Block being broken
*/
public static void leafBlower(Player player, Block block) {
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
Bukkit.getPluginManager().callEvent(armswing);
if (LoadProperties.woodcuttingrequiresaxe) {