Prevent players from picking up items when possessing and prevent players from possessing whilst sneaking, fixes #376
This commit is contained in:
@@ -201,6 +201,8 @@ public class Possession extends SpellRay {
|
|||||||
*/
|
*/
|
||||||
public boolean possess(EntityPlayer possessor, EntityLiving target, int duration){
|
public boolean possess(EntityPlayer possessor, EntityLiving target, int duration){
|
||||||
|
|
||||||
|
if(possessor.isSneaking()) return false;
|
||||||
|
|
||||||
if(WizardData.get(possessor) != null){
|
if(WizardData.get(possessor) != null){
|
||||||
|
|
||||||
WizardData.get(possessor).setVariable(POSSESSEE_KEY, target);
|
WizardData.get(possessor).setVariable(POSSESSEE_KEY, target);
|
||||||
@@ -683,11 +685,13 @@ public class Possession extends SpellRay {
|
|||||||
|
|
||||||
if(possessee != null){
|
if(possessee != null){
|
||||||
|
|
||||||
if(possessee.canPickUpLoot() && possessee.getHeldItemMainhand().isEmpty()){
|
event.setCanceled(true);
|
||||||
possessee.setHeldItem(EnumHand.MAIN_HAND, event.getItem().getItem());
|
|
||||||
}else{
|
// if(possessee.canPickUpLoot() && possessee.getHeldItemMainhand().isEmpty()){
|
||||||
event.setCanceled(true);
|
// possessee.setHeldItem(EnumHand.MAIN_HAND, event.getItem().getItem());
|
||||||
}
|
// }else{
|
||||||
|
// event.setCanceled(true);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user