-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support blockdata in item meta (Closes #1343)
- Loading branch information
1 parent
7fb7887
commit f534c4f
Showing
5 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
src/main/java/com/laytonsmith/abstraction/MCBlockDataMeta.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.laytonsmith.abstraction; | ||
|
||
import com.laytonsmith.abstraction.blocks.MCBlockData; | ||
import com.laytonsmith.abstraction.blocks.MCMaterial; | ||
|
||
public interface MCBlockDataMeta extends MCItemMeta { | ||
MCBlockData getBlockData(MCMaterial material); | ||
boolean hasBlockData(); | ||
void setBlockData(MCBlockData blockData); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/com/laytonsmith/abstraction/bukkit/BukkitMCBlockDataMeta.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.laytonsmith.abstraction.bukkit; | ||
|
||
import com.laytonsmith.abstraction.MCBlockDataMeta; | ||
import com.laytonsmith.abstraction.blocks.MCBlockData; | ||
import com.laytonsmith.abstraction.blocks.MCMaterial; | ||
import com.laytonsmith.abstraction.bukkit.blocks.BukkitMCBlockData; | ||
import org.bukkit.Material; | ||
import org.bukkit.block.data.BlockData; | ||
import org.bukkit.inventory.meta.BlockDataMeta; | ||
|
||
public class BukkitMCBlockDataMeta extends BukkitMCItemMeta implements MCBlockDataMeta { | ||
|
||
BlockDataMeta bdm; | ||
|
||
public BukkitMCBlockDataMeta(BlockDataMeta meta) { | ||
super(meta); | ||
this.bdm = meta; | ||
} | ||
|
||
|
||
@Override | ||
public MCBlockData getBlockData(MCMaterial material) { | ||
return new BukkitMCBlockData(this.bdm.getBlockData((Material) material.getHandle())); | ||
} | ||
|
||
@Override | ||
public boolean hasBlockData() { | ||
return this.bdm.hasBlockData(); | ||
} | ||
|
||
@Override | ||
public void setBlockData(MCBlockData blockData) { | ||
this.bdm.setBlockData((BlockData) blockData.getHandle()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters