Cleaner TamingSummon initialization/checks

This commit is contained in:
nossr50 2019-09-19 19:29:27 -07:00
parent 43d60b6a7d
commit 3aa896cfc9
2 changed files with 10 additions and 59 deletions

View File

@ -811,23 +811,8 @@ public class PlayerListener implements Listener {
} }
/* CALL OF THE WILD CHECKS */ /* CALL OF THE WILD CHECKS */
Material type = heldItem.getType();
TamingManager tamingManager = mcMMOPlayer.getTamingManager(); TamingManager tamingManager = mcMMOPlayer.getTamingManager();
tamingManager.processCallOfTheWild();
switch(type) {
case
}
if (type == ) {
tamingManager.summonWolf();
}
else if (type == Config.getInstance().getTamingCOTWMaterial(CallOfTheWildType.CAT.getConfigEntityTypeEntry())) {
tamingManager.summonOcelot();
}
else if (type == Config.getInstance().getTamingCOTWMaterial(CallOfTheWildType.HORSE.getConfigEntityTypeEntry())) {
tamingManager.summonHorse();
}
break; break;

View File

@ -163,48 +163,6 @@ public class TamingManager extends SkillManager {
return pluginRef.getConfigManager().getConfigTaming().getSubSkills().getSharpenedClaws().getBonusDamage().getPVPModifier(); return pluginRef.getConfigManager().getConfigTaming().getSubSkills().getSharpenedClaws().getBonusDamage().getPVPModifier();
} }
/**
* Summon an ocelot to your side.
*/
public void summonOcelot() {
if(!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_CALL_OF_THE_WILD))
return;
if (!pluginRef.getPermissionTools().callOfTheWild(getPlayer(), EntityType.OCELOT)) {
return;
}
processCallOfTheWild();
}
/**
* Summon a wolf to your side.
*/
public void summonWolf() {
if(!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_CALL_OF_THE_WILD))
return;
if (!pluginRef.getPermissionTools().callOfTheWild(getPlayer(), EntityType.WOLF)) {
return;
}
processCallOfTheWild();
}
/**
* Summon a horse to your side.
*/
public void summonHorse() {
if(!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_CALL_OF_THE_WILD))
return;
if (!pluginRef.getPermissionTools().callOfTheWild(getPlayer(), EntityType.HORSE)) {
return;
}
processCallOfTheWild();
}
/** /**
* Handle the Beast Lore ability. * Handle the Beast Lore ability.
* *
@ -282,7 +240,10 @@ public class TamingManager extends SkillManager {
} }
private void processCallOfTheWild() { public void processCallOfTheWild() {
if(!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_CALL_OF_THE_WILD))
return;
//Prevent summoning too many things accidentally if a player holds down the button //Prevent summoning too many things accidentally if a player holds down the button
if(lastSummonTimeStamp + 150 > System.currentTimeMillis()) { if(lastSummonTimeStamp + 150 > System.currentTimeMillis()) {
return; return;
@ -299,6 +260,11 @@ public class TamingManager extends SkillManager {
CallOfTheWildType callOfTheWildType = pluginRef.getDynamicSettingsManager().getTamingItemManager().getCallType(itemInMainHand.getType()); CallOfTheWildType callOfTheWildType = pluginRef.getDynamicSettingsManager().getTamingItemManager().getCallType(itemInMainHand.getType());
TamingSummon tamingSummon = tamingBehaviour.getSummon(callOfTheWildType); TamingSummon tamingSummon = tamingBehaviour.getSummon(callOfTheWildType);
//Permission Check
if(!pluginRef.getPermissionTools().callOfTheWild(getPlayer(), tamingSummon.getEntityType())) {
return;
}
//Players will pay for the cost if at least one thing was summoned //Players will pay for the cost if at least one thing was summoned
int amountSummoned = 0; int amountSummoned = 0;