mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 22:26:46 +01:00
Cleaner TamingSummon initialization/checks
This commit is contained in:
parent
43d60b6a7d
commit
3aa896cfc9
@ -811,23 +811,8 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
/* CALL OF THE WILD CHECKS */
|
||||
Material type = heldItem.getType();
|
||||
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
tamingManager.processCallOfTheWild();
|
||||
|
||||
break;
|
||||
|
||||
|
@ -163,48 +163,6 @@ public class TamingManager extends SkillManager {
|
||||
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.
|
||||
*
|
||||
@ -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
|
||||
if(lastSummonTimeStamp + 150 > System.currentTimeMillis()) {
|
||||
return;
|
||||
@ -299,6 +260,11 @@ public class TamingManager extends SkillManager {
|
||||
CallOfTheWildType callOfTheWildType = pluginRef.getDynamicSettingsManager().getTamingItemManager().getCallType(itemInMainHand.getType());
|
||||
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
|
||||
int amountSummoned = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user