mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 11:55:38 +01:00
Update BukkitLocalQueue to new LegacyMappings
This commit is contained in:
parent
444222c7f9
commit
e7b25d3fc8
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.util.block;
|
package com.github.intellectualsites.plotsquared.bukkit.util.block;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings;
|
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock;
|
import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock;
|
import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock;
|
||||||
@ -114,15 +114,18 @@ public class BukkitLocalQueue<T> extends BasicLocalBlockQueue<T> {
|
|||||||
|
|
||||||
private void setMaterial(@NonNull final PlotBlock plotBlock, @NonNull final Block block) {
|
private void setMaterial(@NonNull final PlotBlock plotBlock, @NonNull final Block block) {
|
||||||
if (plotBlock instanceof StringPlotBlock) {
|
if (plotBlock instanceof StringPlotBlock) {
|
||||||
final Material material = Material.getMaterial(((StringPlotBlock) plotBlock).getItemId().toLowerCase(
|
final Material material = Material
|
||||||
Locale.ENGLISH));
|
.getMaterial(((StringPlotBlock) plotBlock).getItemId().toLowerCase(Locale.ENGLISH));
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
throw new IllegalStateException(String.format("Could not find material that matches %s", block.toString()));
|
throw new IllegalStateException(
|
||||||
|
String.format("Could not find material that matches %s", block.toString()));
|
||||||
}
|
}
|
||||||
block.setType(material, false);
|
block.setType(material, false);
|
||||||
} else {
|
} else {
|
||||||
final LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) plotBlock;
|
final LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) plotBlock;
|
||||||
block.setType(LegacyMappings.fromIdAndData(legacyPlotBlock.getId(), legacyPlotBlock.getData()).getMaterial());
|
block.setType(Material.getMaterial(PlotSquared.get().IMP.getLegacyMappings()
|
||||||
|
.fromLegacyToString(legacyPlotBlock.getId(), legacyPlotBlock.getData())
|
||||||
|
.toString()));
|
||||||
// block.setTypeIdAndData(legacyPlotBlock.getId(), legacyPlotBlock.getData(), false);
|
// block.setTypeIdAndData(legacyPlotBlock.getId(), legacyPlotBlock.getData(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,7 +135,9 @@ public class BukkitLocalQueue<T> extends BasicLocalBlockQueue<T> {
|
|||||||
return ((StringPlotBlock) plotBlock).idEquals(block.getType().name());
|
return ((StringPlotBlock) plotBlock).idEquals(block.getType().name());
|
||||||
}
|
}
|
||||||
final LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) plotBlock;
|
final LegacyPlotBlock legacyPlotBlock = (LegacyPlotBlock) plotBlock;
|
||||||
return LegacyMappings.fromLegacyId(((LegacyPlotBlock) plotBlock).id).getMaterial() == block.getType() && (legacyPlotBlock.id == 0 || legacyPlotBlock.data == block.getData());
|
return Material.getMaterial(PlotSquared.get().IMP.getLegacyMappings()
|
||||||
|
.fromLegacyToString(((LegacyPlotBlock) plotBlock).id).toString()) == block.getType()
|
||||||
|
&& (legacyPlotBlock.id == 0 || legacyPlotBlock.data == block.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBiomes(LocalChunk<T> lc) {
|
public void setBiomes(LocalChunk<T> lc) {
|
||||||
|
Loading…
Reference in New Issue
Block a user