mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
INDEV -- Pushed for in-house testing and development
This commit is contained in:
@ -19,6 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.world.registry;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.io.Resources;
|
||||
@ -30,6 +33,7 @@ import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.gson.VectorAdapter;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
@ -222,6 +226,29 @@ public class LegacyMapper {
|
||||
Integer combinedId = getLegacyCombined(blockState);
|
||||
return combinedId == null ? null : new int[] { combinedId >> 4, combinedId & 0xF };
|
||||
}
|
||||
|
||||
public BaseBlock getBaseBlockFromPlotBlock(PlotBlock plotBlock) {
|
||||
if(plotBlock instanceof StringPlotBlock) {
|
||||
try {
|
||||
return BlockTypes.get(plotBlock.toString()).getDefaultState().toBaseBlock();
|
||||
}catch(Throwable failed) {
|
||||
log.severe("Unable to convert StringPlotBlock " + plotBlock + " to BaseBlock!");
|
||||
failed.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}else if(plotBlock instanceof LegacyPlotBlock) {
|
||||
try {
|
||||
return new BaseBlock(((LegacyPlotBlock)plotBlock).getId(), ((LegacyPlotBlock)plotBlock).getData());
|
||||
}catch(Throwable failed) {
|
||||
log.severe("Unable to convert LegacyPlotBlock " + plotBlock + " to BaseBlock!");
|
||||
failed.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}else {
|
||||
log.severe("Unable to convert LegacyPlotBlock " + plotBlock + " to BaseBlock!");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static LegacyMapper getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
|
Reference in New Issue
Block a user