Permalink
Browse files

Pipe signs through NMSAdapter

  • Loading branch information...
me4502 committed Nov 2, 2017
1 parent 2d301ee commit d4fa3cda870cba151f942a6ff7fa9f26720b8f72
@@ -369,6 +369,15 @@ public NMSAdapter getNmsAdapter() {
return this.nmsAdapter;
}
/**
* Sets the NMS Adapter.
*
* @param nmsAdapter The NMS Adapter
*/
public void setNmsAdapter(NMSAdapter nmsAdapter) {
this.nmsAdapter = nmsAdapter;
}
/**
* Called on plugin enable.
*/
@@ -52,8 +52,7 @@ public static ChangedSign toChangedSign(Block block, String[] lines) {
}
public static ChangedSign toChangedSign(Block block, String[] lines, LocalPlayer player) {
if (!SignUtil.isSign(block)) return null;
return new ChangedSign(block, lines, player);
return CraftBookPlugin.inst().getNmsAdapter().getChangedSign(block, lines, player);
}
public static Block toBlock(ChangedSign sign) {
@@ -1,5 +1,10 @@
package com.sk89q.craftbook.util.compat.nms;
import com.sk89q.craftbook.ChangedSign;
import com.sk89q.craftbook.LocalPlayer;
import com.sk89q.craftbook.util.SignUtil;
import org.bukkit.block.Block;
public class NMSAdapter {
/**
@@ -11,5 +16,16 @@ public boolean hasNMSExtension() {
return false;
}
/**
* Get a CraftBook sign-wrapper instance
*
* @param block The block
* @param lines The lines
* @param player The player (Optional)
* @return The ChangedSign
*/
public ChangedSign getChangedSign(Block block, String[] lines, LocalPlayer player) {
if (!SignUtil.isSign(block)) return null;
return new ChangedSign(block, lines, player);
}
}

0 comments on commit d4fa3cd

Please sign in to comment.