mirror of
https://github.com/Ste3et/furniture.git
synced 2024-11-13 06:15:00 +01:00
Fix camera function in 1.14, backward support for gravestone for 1.13
and 1.14
This commit is contained in:
parent
8264f79a4e
commit
e97f6aff0d
4
pom.xml
4
pom.xml
@ -87,13 +87,13 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.14-R0.1-SNAPSHOT</version>
|
||||
<version>1.13-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.14-R0.1-SNAPSHOT</version>
|
||||
<version>1.13-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -49,7 +49,6 @@ public class weaponStand extends Furniture implements Listener{
|
||||
|
||||
Player p = null;
|
||||
Inventory inv = null;
|
||||
String title = "";
|
||||
|
||||
@Override
|
||||
public void onBreak(Player player) {
|
||||
@ -108,8 +107,7 @@ public class weaponStand extends Furniture implements Listener{
|
||||
is1.setItemMeta(im1);
|
||||
is3.setItemMeta(im3);
|
||||
|
||||
this.title = "§cWeaponBox";
|
||||
inv = Bukkit.createInventory(null, 45, this.title);
|
||||
inv = Bukkit.createInventory(null, 45, "§cWeaponBox");
|
||||
|
||||
List<fEntity> asList = getManager().getfArmorStandByObjectID(getObjID());
|
||||
|
||||
@ -169,7 +167,7 @@ public class weaponStand extends Furniture implements Listener{
|
||||
if(getObjID().getSQLAction().equals(SQLAction.REMOVE)){return;}
|
||||
if(p==null){return;}
|
||||
if(inv==null){return;}
|
||||
if(!e.getView().getTitle().equalsIgnoreCase(this.title)){return;}
|
||||
if(!e.getView().getTopInventory().equals(this.inv)){return;}
|
||||
|
||||
List<fEntity> asList = getManager().getfArmorStandByObjectID(getObjID());
|
||||
int j = 1;
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.meta.MapMeta;
|
||||
import org.bukkit.map.MapView;
|
||||
|
||||
import de.Ste3et_C0st.Furniture.Camera.Utils.RenderClass;
|
||||
@ -106,11 +107,14 @@ public class camera extends FurnitureHelper{
|
||||
}else if(!player.getInventory().getItemInMainHand().getType().equals(Material.MAP)){
|
||||
return;
|
||||
}
|
||||
MapView view = Bukkit.getMap(player.getInventory().getItemInMainHand().getDurability());
|
||||
Location l = getLocation().clone();
|
||||
l.setYaw(getLutil().FaceToYaw(getBlockFace().getOppositeFace()));
|
||||
view.getRenderers().clear();
|
||||
try{view.addRenderer(new RenderClass(l, mode));}catch (Exception ex){ex.printStackTrace();}
|
||||
MapMeta meta = (MapMeta) player.getInventory().getItemInMainHand().getItemMeta();
|
||||
if(meta.hasMapId()) {
|
||||
MapView view = Bukkit.getMap((short) meta.getMapId());
|
||||
Location l = getLocation().clone();
|
||||
l.setYaw(getLutil().FaceToYaw(getBlockFace().getOppositeFace()));
|
||||
view.getRenderers().clear();
|
||||
try{view.addRenderer(new RenderClass(l, mode));}catch (Exception ex){ex.printStackTrace();}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,15 +8,15 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.block.data.Directional;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
|
||||
import de.Ste3et_C0st.FurnitureLib.Utilitis.LocationUtil;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.FurnitureHelper;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
|
||||
|
||||
public class graveStone extends FurnitureHelper{
|
||||
@ -30,7 +30,6 @@ public class graveStone extends FurnitureHelper{
|
||||
setBlock();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void setBlock(){
|
||||
Location location = getLocation().clone();
|
||||
if(getBlockFace().equals(BlockFace.WEST)){location = getLutil().getRelativ(location, getBlockFace(), .0, -1.02);}
|
||||
@ -42,13 +41,12 @@ public class graveStone extends FurnitureHelper{
|
||||
Location sign = getLutil().getRelativ(kreutz2.getBlock().getLocation(), getBlockFace(), 0D, 1D);
|
||||
this.signLoc = sign;
|
||||
|
||||
if(!sign.getBlock().getType().equals(Material.OAK_SIGN)){
|
||||
sign.getBlock().setType(Material.OAK_SIGN);
|
||||
if(!sign.getBlock().getType().name().contains("SIGN")){
|
||||
sign.getBlock().setType(Material.valueOf(Type.version.equalsIgnoreCase("1.13") ? "WALL_SIGN" : "OAK_WALL_SIGN"));
|
||||
this.sign = sign.getBlock();
|
||||
BlockState state = this.sign.getState();
|
||||
LocationUtil util = getLutil();
|
||||
state.setRawData(util.getFacebyte(util.yawToFace(getYaw() + 90)));
|
||||
state.update();
|
||||
Directional direct = (Directional) this.sign.getBlockData();
|
||||
direct.setFacing(getBlockFace());
|
||||
this.sign.setBlockData(direct);
|
||||
}else{
|
||||
this.sign = sign.getBlock();
|
||||
}
|
||||
@ -146,14 +144,14 @@ public class graveStone extends FurnitureHelper{
|
||||
}
|
||||
|
||||
public String[] getText(){
|
||||
if(sign==null || !sign.getType().equals(Material.OAK_SIGN)){return null;}
|
||||
if(sign==null || !sign.getType().name().contains("SIGN")){return null;}
|
||||
Sign sign = (Sign) this.sign.getState();
|
||||
return sign.getLines();
|
||||
}
|
||||
|
||||
public void setText(Integer line, String text){
|
||||
if(line==null || text == null){return;}
|
||||
if(sign==null || !sign.getType().equals(Material.OAK_SIGN)){return;}
|
||||
if(sign==null || !sign.getType().name().contains("SIGN")){return;}
|
||||
Sign sign = (Sign) this.sign.getState();
|
||||
sign.setLine(line, text);
|
||||
sign.update(true, false);
|
||||
|
Loading…
Reference in New Issue
Block a user