mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 12:06:41 +00:00
Add new Bukkit implementation adapter system to access MC internals.
Replaces the old NMSBlocks.
This commit is contained in:
@ -47,6 +47,37 @@ public abstract class AbstractWorld implements World {
|
||||
private final PriorityQueue<QueuedEffect> effectQueue = new PriorityQueue<QueuedEffect>();
|
||||
private int taskId = -1;
|
||||
|
||||
@Override
|
||||
public final boolean setBlockType(Vector position, int type) {
|
||||
try {
|
||||
return setBlock(position, new BaseBlock(type));
|
||||
} catch (WorldEditException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setBlockData(Vector position, int data) {
|
||||
try {
|
||||
setBlock(position, new BaseBlock(getLazyBlock(position).getType(), data));
|
||||
} catch (WorldEditException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean setTypeIdAndData(Vector position, int type, int data) {
|
||||
try {
|
||||
return setBlock(position, new BaseBlock(type, data));
|
||||
} catch (WorldEditException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean setBlock(Vector pt, BaseBlock block) throws WorldEditException {
|
||||
return setBlock(pt, block, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxY() {
|
||||
return getMaximumPoint().getBlockY();
|
||||
@ -82,56 +113,6 @@ public abstract class AbstractWorld implements World {
|
||||
return getLazyBlock(pt).getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector position, BaseBlock block) throws WorldEditException {
|
||||
return setBlock(position, block, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlockType(Vector position, int type) {
|
||||
try {
|
||||
return setBlock(position, new BaseBlock(type));
|
||||
} catch (WorldEditException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockData(Vector position, int data) {
|
||||
try {
|
||||
setBlock(position, new BaseBlock(getLazyBlock(position).getId(), data));
|
||||
} catch (WorldEditException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockDataFast(Vector position, int data) {
|
||||
setBlockData(position, data);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean setBlockTypeFast(Vector pt, int type) {
|
||||
return setBlockType(pt, type);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean setTypeIdAndData(Vector pt, int type, int data) {
|
||||
boolean ret = setBlockType(pt, type);
|
||||
setBlockData(pt, data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean setTypeIdAndDataFast(Vector pt, int type, int data) {
|
||||
boolean ret = setBlockTypeFast(pt, type);
|
||||
setBlockDataFast(pt, data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropItem(Vector pt, BaseItemStack item, int times) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
|
@ -122,36 +122,18 @@ public interface World extends Extent {
|
||||
@Deprecated
|
||||
boolean setBlockType(Vector position, int type);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setBlock(Vector, BaseBlock)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean setBlockTypeFast(Vector position, int type);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setBlock(Vector, BaseBlock)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setBlockData(Vector position, int data);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setBlock(Vector, BaseBlock)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setBlockDataFast(Vector position, int data);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setBlock(Vector, BaseBlock)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean setTypeIdAndData(Vector position, int type, int data);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setBlock(Vector, BaseBlock)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean setTypeIdAndDataFast(Vector position, int type, int data);
|
||||
|
||||
/**
|
||||
* Get the light level at the given block.
|
||||
*
|
||||
|
Reference in New Issue
Block a user