mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-27 02:58:03 +01:00
The start of the great whitespace cleanup.
This commit is contained in:
parent
e822515403
commit
6733eb93f2
@ -1,22 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of mcMMO.
|
* Copyright (C) 2012 Matt 'The Yeti' Burnett & mcMMO Development
|
||||||
|
* Copyright (C) 2010-2011 'nossr50'
|
||||||
mcMMO is free software: you can redistribute it and/or modify
|
*
|
||||||
it under the terms of the GNU General Public License as published by
|
* This program is free software: you can redistribute it and/or modify
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
* it under the terms of the GNU General Public License as published by
|
||||||
(at your option) any later version.
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
mcMMO is distributed in the hope that it will be useful,
|
*
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* This program is distributed in the hope that it will be useful,
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
GNU General Public License for more details.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License
|
*
|
||||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
@ -45,33 +48,30 @@ public class Combat
|
|||||||
if (event.getDamage() == 0 || event.getEntity().isDead())
|
if (event.getDamage() == 0 || event.getEntity().isDead())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Declare Things
|
|
||||||
Entity damager = event.getDamager();
|
Entity damager = event.getDamager();
|
||||||
LivingEntity target = (LivingEntity) event.getEntity();
|
LivingEntity target = (LivingEntity) event.getEntity();
|
||||||
int damage = event.getDamage();
|
int damage = event.getDamage();
|
||||||
|
EntityType damagerType = damager.getType();
|
||||||
|
EntityType targetType = target.getType();
|
||||||
|
|
||||||
/*
|
switch (damagerType)
|
||||||
* PLAYER VERSUS ENTITIES
|
|
||||||
*/
|
|
||||||
if(damager instanceof Player)
|
|
||||||
{
|
{
|
||||||
|
case PLAYER:
|
||||||
Player attacker = (Player) event.getDamager();
|
Player attacker = (Player) event.getDamager();
|
||||||
ItemStack itemInHand = attacker.getItemInHand();
|
ItemStack itemInHand = attacker.getItemInHand();
|
||||||
PlayerProfile PPa = Users.getProfile(attacker);
|
PlayerProfile PPa = Users.getProfile(attacker);
|
||||||
|
|
||||||
//If there are any abilities to activate
|
|
||||||
combatAbilityChecks(attacker, PPa);
|
combatAbilityChecks(attacker, PPa);
|
||||||
|
|
||||||
//Damage modifiers and proc checks
|
|
||||||
if (m.isSwords(itemInHand) && mcPermissions.getInstance().swords(attacker))
|
if (m.isSwords(itemInHand) && mcPermissions.getInstance().swords(attacker))
|
||||||
{
|
{
|
||||||
if(!pluginx.misc.bleedTracker.contains(target)) //Bleed
|
if (!pluginx.misc.bleedTracker.contains(target))
|
||||||
Swords.bleedCheck(attacker, target, pluginx);
|
Swords.bleedCheck(attacker, target, pluginx);
|
||||||
|
|
||||||
if (PPa.getSerratedStrikesMode())
|
if (PPa.getSerratedStrikesMode())
|
||||||
Swords.applySerratedStrikes(attacker, event, pluginx);
|
Swords.applySerratedStrikes(attacker, event, pluginx);
|
||||||
|
|
||||||
if(target instanceof Player)
|
if (targetType.equals(EntityType.PLAYER))
|
||||||
PvPExperienceGain(attacker, PPa, (Player) target, damage, SkillType.SWORDS);
|
PvPExperienceGain(attacker, PPa, (Player) target, damage, SkillType.SWORDS);
|
||||||
else if (!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
else if (!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
||||||
PvEExperienceGain(attacker, PPa, target, damage, SkillType.SWORDS);
|
PvEExperienceGain(attacker, PPa, target, damage, SkillType.SWORDS);
|
||||||
@ -79,90 +79,73 @@ public class Combat
|
|||||||
else if (m.isAxes(itemInHand) && mcPermissions.getInstance().axes(attacker))
|
else if (m.isAxes(itemInHand) && mcPermissions.getInstance().axes(attacker))
|
||||||
{
|
{
|
||||||
Axes.axesBonus(attacker, event);
|
Axes.axesBonus(attacker, event);
|
||||||
|
Axes.axeCriticalCheck(attacker, event, pluginx);
|
||||||
Axes.axeCriticalCheck(attacker, event, pluginx); //Critical hit
|
|
||||||
|
|
||||||
//Impact
|
|
||||||
Axes.impact(attacker, target, event);
|
Axes.impact(attacker, target, event);
|
||||||
|
|
||||||
if (PPa.getSkullSplitterMode())
|
if (PPa.getSkullSplitterMode())
|
||||||
Axes.applyAoeDamage(attacker, event, pluginx);
|
Axes.applyAoeDamage(attacker, event, pluginx);
|
||||||
|
|
||||||
if(target instanceof Player)
|
if (targetType.equals(EntityType.PLAYER))
|
||||||
PvPExperienceGain(attacker, PPa, (Player) target, event.getDamage(), SkillType.AXES);
|
PvPExperienceGain(attacker, PPa, (Player) target, event.getDamage(), SkillType.AXES); //use getDamage because damage is modified in earlier functions
|
||||||
else if (!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
else if (!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
||||||
PvEExperienceGain(attacker, PPa, target, event.getDamage(), SkillType.AXES);
|
PvEExperienceGain(attacker, PPa, target, event.getDamage(), SkillType.AXES); //use getDamage because damage is modified in earlier functions
|
||||||
}
|
}
|
||||||
else if(itemInHand.getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker)) //Unarmed
|
else if (itemInHand.getType().equals(Material.AIR) && mcPermissions.getInstance().unarmed(attacker))
|
||||||
{
|
{
|
||||||
Unarmed.unarmedBonus(attacker, event);
|
Unarmed.unarmedBonus(attacker, event);
|
||||||
|
|
||||||
if (PPa.getBerserkMode())
|
if (PPa.getBerserkMode())
|
||||||
event.setDamage(event.getDamage() + (event.getDamage() / 2));
|
event.setDamage(damage + (damage / 2));
|
||||||
|
|
||||||
if(target instanceof Player)
|
if (targetType.equals(EntityType.PLAYER))
|
||||||
Unarmed.disarmProcCheck(attacker, (Player) target); //Disarm
|
{
|
||||||
|
Unarmed.disarmProcCheck(attacker, (Player) target);
|
||||||
if(target instanceof Player)
|
PvPExperienceGain(attacker, PPa, (Player) target, event.getDamage(), SkillType.UNARMED); //use getDamage because damage is modified in earlier functions
|
||||||
PvPExperienceGain(attacker, PPa, (Player) target, event.getDamage(), SkillType.UNARMED);
|
|
||||||
else if(!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
|
||||||
PvEExperienceGain(attacker, PPa, target, event.getDamage(), SkillType.UNARMED);
|
|
||||||
}
|
}
|
||||||
|
else if (!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
||||||
//Player use bone on wolf.
|
PvEExperienceGain(attacker, PPa, target, event.getDamage(), SkillType.UNARMED); //use getDamage because damage is modified in earlier functions
|
||||||
else if(target instanceof Wolf)
|
}
|
||||||
|
else if (itemInHand.getType().equals(Material.BONE) && mcPermissions.getInstance().taming(attacker) && targetType.equals(EntityType.WOLF))
|
||||||
{
|
{
|
||||||
Wolf wolf = (Wolf) target;
|
Wolf wolf = (Wolf) target;
|
||||||
|
String message = "Combat.BeastLore" + " ";
|
||||||
if(itemInHand.getTypeId() == 352 && mcPermissions.getInstance().taming(attacker))
|
int health = wolf.getHealth();
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if(wolf.isTamed())
|
|
||||||
attacker.sendMessage(mcLocale.getString("Combat.BeastLore")+" "+
|
|
||||||
mcLocale.getString("Combat.BeastLoreOwner", new Object[] {Taming.getOwnerName(wolf)})+" "+
|
|
||||||
mcLocale.getString("Combat.BeastLoreHealthWolfTamed", new Object[] {wolf.getHealth()}));
|
|
||||||
else
|
|
||||||
attacker.sendMessage(mcLocale.getString("Combat.BeastLore")+" "+
|
|
||||||
mcLocale.getString("Combat.BeastLoreHealthWolf", new Object[] {wolf.getHealth()}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
if (wolf.isTamed())
|
||||||
* TAMING (WOLVES VERSUS ENTITIES)
|
{
|
||||||
*/
|
message.concat(mcLocale.getString("Combat.BeastLoreOwner", new Object[] {Taming.getOwnerName(wolf)}) + " ");
|
||||||
else if(damager instanceof Wolf)
|
message.concat(mcLocale.getString("Combat.BeastLoreHealthWolfTamed", new Object[] {health}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
message.concat(mcLocale.getString("Combat.BeastLoreHealthWolf", new Object[] {health}));
|
||||||
|
|
||||||
|
attacker.sendMessage(message);
|
||||||
|
}
|
||||||
|
case WOLF:
|
||||||
{
|
{
|
||||||
Wolf wolf = (Wolf) damager;
|
Wolf wolf = (Wolf) damager;
|
||||||
|
|
||||||
if (wolf.isTamed() && (wolf.getOwner() instanceof Player))
|
if (wolf.isTamed() && wolf.getOwner() instanceof Player)
|
||||||
{
|
{
|
||||||
Player master = (Player) wolf.getOwner();
|
Player master = (Player) wolf.getOwner();
|
||||||
PlayerProfile PPo = Users.getProfile(master);
|
PlayerProfile PPo = Users.getProfile(master);
|
||||||
|
|
||||||
if (mcPermissions.getInstance().taming(master))
|
if (mcPermissions.getInstance().taming(master))
|
||||||
{
|
{
|
||||||
//Fast Food Service
|
|
||||||
Taming.fastFoodService(PPo, wolf, event);
|
Taming.fastFoodService(PPo, wolf, event);
|
||||||
|
|
||||||
//Sharpened Claws
|
|
||||||
Taming.sharpenedClaws(PPo, event);
|
Taming.sharpenedClaws(PPo, event);
|
||||||
|
|
||||||
//Gore
|
|
||||||
Taming.gore(PPo, event, master, pluginx);
|
Taming.gore(PPo, event, master, pluginx);
|
||||||
|
|
||||||
//Reward XP
|
|
||||||
Taming.rewardXp(event, pluginx, master);
|
Taming.rewardXp(event, pluginx, master);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Another offensive check for Archery
|
case ARROW:
|
||||||
else if(damager instanceof Arrow)
|
|
||||||
archeryCheck((EntityDamageByEntityEvent)event, pluginx);
|
archeryCheck((EntityDamageByEntityEvent)event, pluginx);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
if (targetType.equals(EntityType.PLAYER))
|
||||||
* DEFENSIVE CHECKS
|
|
||||||
*/
|
|
||||||
if(target instanceof Player)
|
|
||||||
{
|
{
|
||||||
Swords.counterAttackChecks(event);
|
Swords.counterAttackChecks(event);
|
||||||
Acrobatics.dodgeChecks(event);
|
Acrobatics.dodgeChecks(event);
|
||||||
|
Loading…
Reference in New Issue
Block a user