Skip to content
Permalink
Browse files

Fix 1.13.2 compatibility

  • Loading branch information...
PseudoKnight committed Aug 13, 2019
1 parent 0eac533 commit 21c1d57e3030f519aae82f3114327bbdf54b2bca
@@ -51,7 +51,6 @@
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer;
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCProjectile;
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCTameable;
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCTrader;
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCVehicle;
import com.laytonsmith.abstraction.bukkit.events.BukkitAbstractEventMixin;
import com.laytonsmith.abstraction.bukkit.events.drivers.BukkitBlockListener;
@@ -104,7 +103,6 @@
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.AbstractVillager;
import org.bukkit.entity.Ageable;
import org.bukkit.entity.ComplexEntityPart;
import org.bukkit.entity.ComplexLivingEntity;
@@ -388,11 +386,6 @@ public static MCEntity BukkitGetCorrectEntity(Entity be) {
return new BukkitMCProjectile(be);
}

if(be instanceof AbstractVillager) {
type.setWrapperClass(BukkitMCTrader.class);
return new BukkitMCTrader(be);
}

if(be instanceof Tameable) {
// Must come before Ageable
type.setWrapperClass(BukkitMCTameable.class);
@@ -1,38 +1,11 @@
package com.laytonsmith.abstraction.bukkit.entities;

import com.laytonsmith.abstraction.AbstractionObject;
import com.laytonsmith.abstraction.MCInventory;
import com.laytonsmith.abstraction.MCMerchant;
import com.laytonsmith.abstraction.bukkit.BukkitMCInventory;
import com.laytonsmith.abstraction.bukkit.BukkitMCMerchant;
import com.laytonsmith.abstraction.entities.MCTrader;
import org.bukkit.entity.AbstractVillager;
import org.bukkit.entity.Entity;

public class BukkitMCTrader extends BukkitMCAgeable implements MCTrader {
public abstract class BukkitMCTrader extends BukkitMCAgeable implements MCTrader {

public BukkitMCTrader(Entity be) {
super(be);
}

public BukkitMCTrader(AbstractionObject ao) {
this((AbstractVillager) ao.getHandle());
}

@Override
public AbstractVillager getHandle() {
return (AbstractVillager) super.getHandle();
}

@Override
public MCMerchant asMerchant() {
AbstractVillager villager = getHandle();
String title = getHandle().getCustomName() == null ? villager.getType().name() : villager.getCustomName();
return new BukkitMCMerchant(villager, title);
}

@Override
public MCInventory getInventory() {
return new BukkitMCInventory(getHandle().getInventory());
}
}
@@ -1,7 +1,9 @@
package com.laytonsmith.abstraction.bukkit.entities;

import com.laytonsmith.abstraction.AbstractionObject;
import com.laytonsmith.abstraction.MCInventory;
import com.laytonsmith.abstraction.MCMerchant;
import com.laytonsmith.abstraction.bukkit.BukkitMCInventory;
import com.laytonsmith.abstraction.bukkit.BukkitMCMerchant;
import com.laytonsmith.abstraction.entities.MCVillager;
import com.laytonsmith.abstraction.enums.MCProfession;
@@ -40,4 +42,9 @@ public MCMerchant asMerchant() {
String title = villager.getCustomName() == null ? getHandle().getProfession().name() : villager.getCustomName();
return new BukkitMCMerchant(villager, title);
}

@Override
public MCInventory getInventory() {
return new BukkitMCInventory(getHandle().getInventory());
}
}
@@ -1,6 +1,11 @@
package com.laytonsmith.abstraction.bukkit.entities;

import com.laytonsmith.abstraction.MCInventory;
import com.laytonsmith.abstraction.MCMerchant;
import com.laytonsmith.abstraction.bukkit.BukkitMCInventory;
import com.laytonsmith.abstraction.bukkit.BukkitMCMerchant;
import com.laytonsmith.abstraction.entities.MCWanderingTrader;
import org.bukkit.entity.AbstractVillager;
import org.bukkit.entity.Entity;
import org.bukkit.entity.WanderingTrader;

@@ -14,4 +19,16 @@ public BukkitMCWanderingTrader(Entity wanderingtrader) {
public WanderingTrader getHandle() {
return (WanderingTrader) super.getHandle();
}

@Override
public MCMerchant asMerchant() {
AbstractVillager villager = getHandle();
String title = getHandle().getCustomName() == null ? villager.getType().name() : villager.getCustomName();
return new BukkitMCMerchant(villager, title);
}

@Override
public MCInventory getInventory() {
return new BukkitMCInventory(getHandle().getInventory());
}
}

0 comments on commit 21c1d57

Please sign in to comment.
You can’t perform that action at this time.