Permalink
Browse files

Clean up some deprecations

  • Loading branch information...
PseudoKnight committed Aug 21, 2018
1 parent a34b3af commit 6e10805e864fa00ca411cb3e75af6608da7f4f5f
@@ -1,15 +1,11 @@
package com.laytonsmith.abstraction;
import com.laytonsmith.abstraction.enums.MCDyeColor;
import java.util.List;
public interface MCBannerMeta extends MCItemMeta {
void addPattern(MCPattern pattern);
MCDyeColor getBaseColor();
MCPattern getPattern(int i);
List<MCPattern> getPatterns();
@@ -18,8 +14,6 @@
void removePattern(int i);
void setBaseColor(MCDyeColor color);
void setPattern(int i, MCPattern pattern);
void setPatterns(List<MCPattern> patterns);
@@ -32,7 +32,6 @@
MCInventoryView openWorkbench(MCLocation loc, boolean force);
//MCInventoryView openWorkbench(MCLocation location, boolean force);
void setGameMode(MCGameMode mode);
void setItemInHand(MCItemStack item);
@@ -1,7 +1,6 @@
package com.laytonsmith.abstraction;
import com.laytonsmith.abstraction.blocks.MCBlockData;
import com.laytonsmith.abstraction.blocks.MCMaterial;
import com.laytonsmith.abstraction.enums.MCInstrument;
import com.laytonsmith.abstraction.enums.MCParticle;
import com.laytonsmith.abstraction.enums.MCSound;
@@ -111,8 +110,6 @@
String getHost();
void sendBlockChange(MCLocation loc, MCMaterial material, byte data);
void sendBlockChange(MCLocation loc, MCBlockData data);
void sendSignTextChange(MCLocation loc, String[] lines);
@@ -1,16 +1,10 @@
package com.laytonsmith.abstraction.blocks;
import com.laytonsmith.abstraction.MCPattern;
import com.laytonsmith.abstraction.enums.MCDyeColor;
import java.util.List;
public interface MCBanner extends MCBlockState {
MCDyeColor getBaseColor();
void setBaseColor(MCDyeColor color);
int numberOfPatterns();
List<MCPattern> getPatterns();
@@ -27,18 +27,6 @@
void setType(MCMaterial mat, boolean physics);
/**
* @deprecated Magic value
*/
@Deprecated
void setTypeId(int idata);
/**
* @deprecated Magic value
*/
@Deprecated
void setData(byte imeta);
/**
* @deprecated Magic value
*/
@@ -2,8 +2,6 @@
import com.laytonsmith.abstraction.MCBannerMeta;
import com.laytonsmith.abstraction.MCPattern;
import com.laytonsmith.abstraction.enums.MCDyeColor;
import com.laytonsmith.abstraction.enums.bukkit.BukkitMCDyeColor;
import org.bukkit.block.banner.Pattern;
import org.bukkit.inventory.meta.BannerMeta;
@@ -29,11 +27,6 @@ public void addPattern(MCPattern pattern) {
bm.addPattern((Pattern) pattern.getHandle());
}
@Override
public MCDyeColor getBaseColor() {
return BukkitMCDyeColor.getConvertor().getAbstractedEnum(bm.getBaseColor());
}
@Override
public MCPattern getPattern(int i) {
return new BukkitMCPattern(bm.getPattern(i));
@@ -59,11 +52,6 @@ public void removePattern(int i) {
bm.removePattern(i);
}
@Override
public void setBaseColor(MCDyeColor color) {
bm.setBaseColor(BukkitMCDyeColor.getConvertor().getConcreteEnum(color));
}
@Override
public void setPattern(int i, MCPattern pattern) {
bm.setPattern(i, (Pattern) pattern.getHandle());
@@ -148,7 +148,7 @@ public void setAllDropChances(Map<MCEquipmentSlot, Float> slots) {
// anything below this line, but they are here for flexibility and completion
@Override
public MCItemStack getWeapon() {
return new BukkitMCItemStack(ee.getItemInHand());
return new BukkitMCItemStack(ee.getItemInMainHand());
}
@Override
@@ -178,7 +178,7 @@ public MCItemStack getBoots() {
@Override
public void setWeapon(MCItemStack stack) {
ee.setItemInHand(((BukkitMCItemStack) stack).asItemStack());
ee.setItemInMainHand(((BukkitMCItemStack) stack).asItemStack());
}
@Override
@@ -208,7 +208,7 @@ public void setBoots(MCItemStack stack) {
@Override
public float getWeaponDropChance() {
return ee.getItemInHandDropChance();
return ee.getItemInMainHandDropChance();
}
@Override
@@ -238,7 +238,7 @@ public float getBootsDropChance() {
@Override
public void setWeaponDropChance(float chance) {
ee.setItemInHandDropChance(chance);
ee.setItemInMainHandDropChance(chance);
}
@Override
@@ -3,8 +3,6 @@
import com.laytonsmith.abstraction.MCPattern;
import com.laytonsmith.abstraction.blocks.MCBanner;
import com.laytonsmith.abstraction.bukkit.BukkitMCPattern;
import com.laytonsmith.abstraction.enums.MCDyeColor;
import com.laytonsmith.abstraction.enums.bukkit.BukkitMCDyeColor;
import org.bukkit.block.Banner;
import org.bukkit.block.banner.Pattern;
@@ -20,16 +18,6 @@ public BukkitMCBanner(Banner block) {
b = block;
}
@Override
public MCDyeColor getBaseColor() {
return BukkitMCDyeColor.getConvertor().getAbstractedEnum(b.getBaseColor());
}
@Override
public void setBaseColor(MCDyeColor color) {
b.setBaseColor(BukkitMCDyeColor.getConvertor().getConcreteEnum(color));
}
@Override
public int numberOfPatterns() {
return b.numberOfPatterns();
@@ -80,20 +80,6 @@ public void setType(MCMaterial mat, boolean physics) {
b.setType((Material) mat.getHandle(), physics);
}
@Override
public void setTypeId(int idata) {
Material mat = BukkitMCLegacyMaterial.getMaterial(idata);
if(mat == null) {
b.setType(Material.AIR);
}
b.setType(mat);
}
@Override
public void setData(byte imeta) {
setTypeAndData(getTypeId(), imeta, true);
}
@Override
public void setTypeAndData(int type, byte data, boolean physics) {
b.setBlockData(BukkitMCLegacyMaterial.getBlockData(type, data), physics);
@@ -305,11 +305,13 @@ public Entity getHolder() {
}
@Override
@SuppressWarnings("deprecation")
public ItemStack getItemInHand() {
return holder.getItemInHand();
}
@Override
@SuppressWarnings("deprecation")
public void setItemInHand(ItemStack itemStack) {
holder.setItemInHand(itemStack);
}
@@ -412,11 +414,13 @@ public void clear() {
}
@Override
@SuppressWarnings("deprecation")
public float getItemInHandDropChance() {
return 0;
}
@Override
@SuppressWarnings("deprecation")
public void setItemInHandDropChance(float v) {
}
@@ -22,7 +22,7 @@ public boolean getDropItem() {
@Override
public MCMaterial getMaterial() {
return new BukkitMCMaterial(f.getMaterial());
return new BukkitMCMaterial(f.getBlockData().getMaterial());
}
@Override
@@ -13,7 +13,6 @@
import com.laytonsmith.abstraction.MCScoreboard;
import com.laytonsmith.abstraction.StaticLayer;
import com.laytonsmith.abstraction.blocks.MCBlockData;
import com.laytonsmith.abstraction.blocks.MCMaterial;
import com.laytonsmith.abstraction.bukkit.BukkitConvertor;
import com.laytonsmith.abstraction.bukkit.BukkitMCColor;
import com.laytonsmith.abstraction.bukkit.BukkitMCItemStack;
@@ -33,7 +32,6 @@
import com.laytonsmith.core.Static;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Note;
import org.bukkit.Particle;
import org.bukkit.Server;
@@ -467,11 +465,6 @@ public String getHost() {
return Static.GetHost(this);
}
@Override
public void sendBlockChange(MCLocation loc, MCMaterial material, byte data) {
p.sendBlockChange(((Location) loc.getHandle()), (Material) material.getHandle(), data);
}
@Override
public void sendBlockChange(MCLocation loc, MCBlockData data) {
p.sendBlockChange(((Location) loc.getHandle()), (BlockData) data.getHandle());
@@ -41,7 +41,6 @@
import com.laytonsmith.core.constructs.CString;
import com.laytonsmith.core.constructs.Target;
import com.laytonsmith.core.exceptions.CRE.CREIllegalArgumentException;
import org.bukkit.Note;
import org.bukkit.block.Block;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
@@ -525,20 +524,10 @@ public MCNote getNote() {
return new BukkitMCNote(npe.getNote());
}
@Override
public void setNote(MCNote note) {
npe.setNote((Note) note.getHandle());
}
@Override
public MCInstrument getInstrument() {
return BukkitMCInstrument.getConvertor().getAbstractedEnum(npe.getInstrument());
}
@Override
public void setInstrument(MCInstrument i) {
npe.setInstrument(BukkitMCInstrument.getConvertor().getConcreteEnum(i));
}
}
@abstraction(type = Implementation.Type.BUKKIT)
@@ -13,6 +13,7 @@
import com.laytonsmith.core.events.drivers.VehicleEvents;
import org.bukkit.Location;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Entity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
@@ -24,6 +25,7 @@
import org.bukkit.event.vehicle.VehicleDestroyEvent;
import org.bukkit.util.Vector;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -43,7 +45,7 @@ public void onExit(VehicleExitEvent event) {
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockCollide(VehicleBlockCollisionEvent event) {
if(event.getVehicle() instanceof Animals && event.getVehicle().getPassenger() == null) {
if(event.getVehicle() instanceof Animals && event.getVehicle().getPassengers().isEmpty()) {
return;
}
BukkitMCVehicleBlockCollideEvent vbc = new BukkitMCVehicleBlockCollideEvent(event);
@@ -52,7 +54,8 @@ public void onBlockCollide(VehicleBlockCollisionEvent event) {
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityCollide(VehicleEntityCollisionEvent event) {
if(event.getVehicle().getPassenger() != event.getEntity()) {
List<Entity> passengers = event.getVehicle().getPassengers();
if(passengers.isEmpty() || passengers.get(0) != event.getEntity()) {
BukkitMCVehicleEntityCollideEvent vec = new BukkitMCVehicleEntityCollideEvent(event);
EventUtils.TriggerListener(Driver.VEHICLE_COLLIDE, "vehicle_collide", vec);
}
@@ -4,12 +4,6 @@
import com.laytonsmith.abstraction.enums.MCInstrument;
public interface MCNotePlayEvent extends MCBlockEvent {
MCNote getNote();
void setNote(MCNote note);
MCInstrument getInstrument();
void setInstrument(MCInstrument i);
}

0 comments on commit 6e10805

Please sign in to comment.