mirror of
https://github.com/Ste3et/furniture.git
synced 2024-11-22 10:36:12 +01:00
FurnitureLibary
This commit is contained in:
parent
6c49c04950
commit
02a6beee6f
@ -1,6 +1,10 @@
|
||||
Barrels:
|
||||
name: '&cBarrels'
|
||||
material: 383
|
||||
glow: true
|
||||
lore:
|
||||
- "&cTest1"
|
||||
- "&a&lTest2"
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: X0X,X0X,XXX
|
||||
|
@ -1,6 +1,8 @@
|
||||
Billboard:
|
||||
name: '&cBillboard'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: true
|
||||
recipe: XXX,XXX,XXX
|
||||
|
@ -1,6 +1,8 @@
|
||||
Camera:
|
||||
name: '&cCamera'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: DXD,AEA,EAE
|
||||
|
@ -1,6 +1,8 @@
|
||||
Campfire1:
|
||||
name: '&cCampfire #1'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: 0X0,XEX,0X0
|
||||
|
@ -1,6 +1,8 @@
|
||||
Campfire2:
|
||||
name: '&cCampfire #2'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: DXD,XEX,DXD
|
||||
|
@ -1,6 +1,8 @@
|
||||
Chair:
|
||||
name: '&cChair'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: 0+0,0+0,E0E
|
||||
|
@ -1,6 +1,8 @@
|
||||
GraveStone:
|
||||
name: '&cGrave Stone'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: true
|
||||
recipe: XXX,XXX,XXX
|
||||
|
@ -1,6 +1,8 @@
|
||||
Lantern:
|
||||
name: '&cLantern'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: 0+0,XEX,0A0
|
||||
|
@ -1,6 +1,8 @@
|
||||
LargeTable:
|
||||
name: '&cLarge Table'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: XXX,XXX,A0A
|
||||
|
@ -1,6 +1,8 @@
|
||||
Mailbox:
|
||||
name: '&cMailBox'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: ADA,0X0,0X0
|
||||
|
@ -1,6 +1,8 @@
|
||||
Sofa:
|
||||
name: '&cSofa'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: +0+,+++,X0X
|
||||
|
@ -1,6 +1,8 @@
|
||||
Streetlamp:
|
||||
name: '&cStreetlamp'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: 0XX,0AX,00X
|
||||
|
@ -1,6 +1,8 @@
|
||||
Sunshade:
|
||||
name: '&cSunshade'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: AAA,0X0,0X0
|
||||
|
@ -1,6 +1,8 @@
|
||||
TV:
|
||||
name: '&cTV'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: XXX,XEX,0A0
|
||||
|
@ -1,6 +1,8 @@
|
||||
Table:
|
||||
name: '&cTable'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: 0X0,0E0,0A0
|
||||
|
@ -1,6 +1,8 @@
|
||||
Tent1:
|
||||
name: '&cTent #1'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: 0X0,XEX,EAE
|
||||
|
@ -1,6 +1,8 @@
|
||||
Tent2:
|
||||
name: '&cTent #2'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: 0X0,XEX,OAO
|
||||
|
@ -1,6 +1,8 @@
|
||||
Tent3:
|
||||
name: '&cTent #3'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: 000,0E0,EAE
|
||||
|
@ -1,6 +1,8 @@
|
||||
Fence:
|
||||
name: '&cFence'
|
||||
material: 383
|
||||
glow: false
|
||||
lore: ''
|
||||
crafting:
|
||||
disable: false
|
||||
recipe: 000,XAX,XAX
|
||||
|
@ -41,6 +41,7 @@ import de.Ste3et_C0st.FurnitureLib.Utilitis.LocationUtil;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
|
||||
|
||||
public class main extends JavaPlugin implements Listener{
|
||||
|
||||
@ -82,8 +83,11 @@ public class main extends JavaPlugin implements Listener{
|
||||
|
||||
List<ObjectID> objList = new ArrayList<ObjectID>();
|
||||
for(ObjectID obj : manager.getObjectList()){
|
||||
if(obj==null) continue;
|
||||
if(objList.contains(obj)) continue;
|
||||
if(!objList.contains(obj)) objList.add(obj);
|
||||
if(obj.getPlugin()==null) continue;
|
||||
if(obj.getSQLAction().equals(SQLAction.REMOVE)) continue;
|
||||
if(obj.getPlugin().equalsIgnoreCase(this.getName())){
|
||||
switch (obj.getProject()) {
|
||||
case "Camera":new camera(lib, this, obj);break;
|
||||
|
@ -50,8 +50,8 @@ public class billboard extends Furniture implements Listener{
|
||||
this.manager = lib.getFurnitureManager();
|
||||
this.lib = lib;
|
||||
this.plugin = plugin;
|
||||
this.obj = id;
|
||||
if(id.isFinish()){
|
||||
this.obj = id;
|
||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||
return;
|
||||
}
|
||||
@ -115,6 +115,7 @@ public class billboard extends Furniture implements Listener{
|
||||
pack.setGravity(false);
|
||||
pack.setBasePlate(false);
|
||||
}
|
||||
manager.send(obj);
|
||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
|
@ -132,9 +132,9 @@ public class camera extends Furniture implements Listener{
|
||||
@EventHandler
|
||||
public void onFurnitureBreak(FurnitureBreakEvent e) {
|
||||
if(e.isCancelled()){return;}
|
||||
if(obj==null){return;}
|
||||
if(!e.getID().equals(obj)){return;}
|
||||
if(!e.canBuild()){return;}
|
||||
if(obj==null){return;}
|
||||
e.remove();
|
||||
obj=null;
|
||||
}
|
||||
|
@ -152,10 +152,9 @@ public class graveStone extends Furniture implements Listener{
|
||||
|
||||
@EventHandler
|
||||
public void onFurnitureBreak(FurnitureBreakEvent e){
|
||||
if(e.isCancelled()) return;
|
||||
if(!e.getID().equals(obj)) return;
|
||||
if(!e.canBuild()){return;}
|
||||
if(obj==null){return;}
|
||||
if(e.isCancelled()) return;
|
||||
if(!e.canBuild()){return;}
|
||||
e.remove();
|
||||
sign.setType(Material.AIR);
|
||||
sign = null;
|
||||
|
@ -61,7 +61,7 @@ public class chair extends Furniture implements Listener{
|
||||
public void spawn(Location loc){
|
||||
List<ArmorStandPacket> aspList = new ArrayList<ArmorStandPacket>();
|
||||
BlockFace b = lutil.yawToFace(loc.getYaw()).getOppositeFace();
|
||||
Location center = lutil.getCenter(loc);
|
||||
Location center = lutil.getCenter(loc).add(0, -.05, 0);
|
||||
Location sitz = new Location(center.getWorld(), center.getX(), center.getY(), center.getZ());
|
||||
Location feet1 = new Location(center.getWorld(), center.getX(), center.getY(), center.getZ());
|
||||
Location feet2 = new Location(center.getWorld(), center.getX(), center.getY(), center.getZ());
|
||||
|
@ -27,6 +27,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.ColorType;
|
||||
|
||||
public class largeTable extends Furniture implements Listener{
|
||||
|
||||
@ -77,30 +78,33 @@ public class largeTable extends Furniture implements Listener{
|
||||
location = lutil.getRelativ(location, this.b, 0.1, 0.28);
|
||||
location.add(0,.2,0);
|
||||
Double winkel = 1.57;
|
||||
ItemStack iTemStack_1 = new ItemStack(Material.STAINED_GLASS_PANE);
|
||||
for(int x=1; x<=3;x++){
|
||||
Location l = null;
|
||||
l = lutil.getRelativ(location, this.b, 0.0, x*-.63);
|
||||
Location l = lutil.getRelativ(location.clone(), this.b, 0.0, x*-.63);
|
||||
l.add(0,-1.2,0);
|
||||
l.setYaw(yaw);
|
||||
ItemStack iTemStack_1 = new ItemStack(Material.STAINED_GLASS_PANE);
|
||||
|
||||
ArmorStandPacket as = manager.createArmorStand(obj, l);
|
||||
ArmorStandPacket as = manager.createArmorStand(obj, l.clone());
|
||||
as.setPose(new EulerAngle(winkel, 0, 0), BodyPart.HEAD);
|
||||
as.getInventory().setHelmet(iTemStack_1);
|
||||
armorlist.add(as);
|
||||
|
||||
l = lutil.getRelativ(location, this.b, 0.63, x*-.63);
|
||||
}
|
||||
|
||||
for(int x=1; x<=3;x++){
|
||||
Location l = lutil.getRelativ(location.clone(), this.b, 0.63, x*-.63);
|
||||
l.add(0,-1.2,0);
|
||||
l.setYaw(yaw);
|
||||
as = manager.createArmorStand(obj, l);
|
||||
ArmorStandPacket as = manager.createArmorStand(obj, l.clone());
|
||||
as.setPose(new EulerAngle(winkel, 0, 0), BodyPart.HEAD);
|
||||
as.getInventory().setHelmet(iTemStack_1);
|
||||
armorlist.add(as);
|
||||
|
||||
l = lutil.getRelativ(location, this.b, 1.26, x*-.63);
|
||||
}
|
||||
|
||||
for(int x=1; x<=3;x++){
|
||||
Location l = lutil.getRelativ(location.clone(), this.b, 1.26, x*-.63);
|
||||
l.add(0,-1.2,0);
|
||||
l.setYaw(yaw);
|
||||
as = manager.createArmorStand(obj, l);
|
||||
ArmorStandPacket as = manager.createArmorStand(obj, l.clone());
|
||||
as.setPose(new EulerAngle(winkel, 0, 0), BodyPart.HEAD);
|
||||
as.getInventory().setHelmet(iTemStack_1);
|
||||
armorlist.add(as);
|
||||
@ -179,10 +183,9 @@ public class largeTable extends Furniture implements Listener{
|
||||
armorlist.add(as);
|
||||
tellerIDs.add(as.getEntityId());
|
||||
|
||||
for(ArmorStandPacket asp : armorlist){
|
||||
asp.setGravity(false);
|
||||
asp.setInvisible(true);
|
||||
asp.setBasePlate(false);
|
||||
for(ArmorStandPacket packet : armorlist){
|
||||
packet.setInvisible(true);
|
||||
packet.setGravity(false);
|
||||
}
|
||||
manager.send(obj);
|
||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||
@ -223,41 +226,12 @@ public class largeTable extends Furniture implements Listener{
|
||||
if(!e.getID().equals(obj)){return;}
|
||||
if(!e.canBuild()){return;}
|
||||
e.setCancelled(true);
|
||||
final Player p = e.getPlayer();
|
||||
Player p = e.getPlayer();
|
||||
if(p.getItemInHand().getType().equals(Material.INK_SACK)){
|
||||
if(!e.canBuild()){return;}
|
||||
ItemStack is = p.getItemInHand();
|
||||
Integer Amount = is.getAmount();
|
||||
List<ArmorStandPacket> asp = manager.getArmorStandPacketByObjectID(obj);
|
||||
short color = lutil.getFromDey(is.getDurability());
|
||||
for(ArmorStandPacket packet : asp){
|
||||
if(packet.getInventory().getHelmet()!=null){
|
||||
if(packet.getInventory().getHelmet().getType().equals(Material.STAINED_GLASS_PANE)){
|
||||
if(Amount>0){
|
||||
ItemStack is2 = packet.getInventory().getHelmet();
|
||||
if(is2.getDurability()!=color){
|
||||
if(p.getGameMode().equals(GameMode.SURVIVAL) || !lib.useGamemode()){Amount=Amount-1;}
|
||||
is2.setDurability(color);
|
||||
packet.getInventory().setHelmet(is2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
manager.updateFurniture(obj);
|
||||
if(p.getGameMode().equals(GameMode.CREATIVE) && lib.useGamemode()) return;
|
||||
Integer o = Amount;
|
||||
Integer i = p.getInventory().getHeldItemSlot();
|
||||
ItemStack itemStack = p.getItemInHand();
|
||||
itemStack.setAmount(o);
|
||||
p.getInventory().setItem(i, itemStack);
|
||||
p.updateInventory();
|
||||
|
||||
lib.getColorManager().color(p, e.canBuild(), Material.STAINED_GLASS_PANE, obj, ColorType.BLOCK, 3);
|
||||
return;
|
||||
}else{
|
||||
if(!e.canBuild()) return;
|
||||
setTeller(e.getPlayer(), e.getPlayer().getInventory().getItemInHand());
|
||||
setTeller(p, p.getInventory().getItemInHand());
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,7 +252,6 @@ public class largeTable extends Furniture implements Listener{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(as!=null&&as.getInventory().getItemInHand()!= null && as.getInventory().getItemInHand().equals(is)){return;}
|
||||
if(as.getInventory().getItemInHand()!=null&&!as.getInventory().getItemInHand().getType().equals(Material.AIR)){
|
||||
ArmorStandPacket asp = as;
|
||||
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
@ -26,6 +25,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.ColorType;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.EventType;
|
||||
|
||||
public class sofa extends Furniture implements Listener {
|
||||
@ -179,9 +179,7 @@ public class sofa extends Furniture implements Listener {
|
||||
e.setCancelled(true);
|
||||
final Player p = e.getPlayer();
|
||||
if(p.getItemInHand().getType().equals(Material.INK_SACK)){
|
||||
Boolean canBuild = lib.canBuild(e.getPlayer(), obj, EventType.INTERACT);
|
||||
Material m = Material.CARPET;
|
||||
color(p, canBuild, m);
|
||||
lib.getColorManager().color(p, e.canBuild(), Material.CARPET, obj, ColorType.BLOCK, 12);
|
||||
}else{
|
||||
ArmorStandPacket packet = e.getArmorStandPacket();
|
||||
switch (packet.getName()) {
|
||||
@ -207,34 +205,6 @@ public class sofa extends Furniture implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void color(Player p, boolean canBuild, Material m){
|
||||
if(!canBuild){return;}
|
||||
ItemStack is = p.getItemInHand();
|
||||
Integer Amount = is.getAmount();
|
||||
List<ArmorStandPacket> asp = manager.getArmorStandPacketByObjectID(obj);
|
||||
short color = lutil.getFromDey(is.getDurability());
|
||||
for(ArmorStandPacket packet : asp){
|
||||
if(packet.getInventory().getHelmet()!=null&&packet.getInventory().getHelmet().getType().equals(m)){
|
||||
if(Amount>0){
|
||||
ItemStack is2 = packet.getInventory().getHelmet();
|
||||
if(is2.getDurability() != color){
|
||||
is2.setDurability(color);
|
||||
packet.getInventory().setHelmet(is2);
|
||||
if(!p.getGameMode().equals(GameMode.CREATIVE) || !lib.useGamemode()){Amount--;}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
manager.updateFurniture(obj);
|
||||
if(p.getGameMode().equals(GameMode.CREATIVE) && lib.useGamemode()) return;
|
||||
Integer i = p.getInventory().getHeldItemSlot();
|
||||
ItemStack item = p.getItemInHand();
|
||||
item.setAmount(Amount);
|
||||
p.getInventory().setItem(i, item);
|
||||
p.updateInventory();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFurnitureBreak(FurnitureBreakEvent e){
|
||||
if(obj==null){return;}
|
||||
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
@ -28,6 +27,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.ColorType;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.EventType;
|
||||
|
||||
public class tent_1 extends Furniture implements Listener{
|
||||
@ -282,9 +282,7 @@ public class tent_1 extends Furniture implements Listener{
|
||||
if(!p.getItemInHand().getType().equals(Material.INK_SACK)){
|
||||
p.openWorkbench(this.block.getLocation(), true);
|
||||
}else{
|
||||
Boolean canBuild = true;
|
||||
Material m = Material.CARPET;
|
||||
color(p, canBuild, m);
|
||||
lib.getColorManager().color(p, e.canBuild(), Material.CARPET, obj, ColorType.BLOCK, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,31 +295,4 @@ public class tent_1 extends Furniture implements Listener{
|
||||
this.obj.remove(e.getPlayer());
|
||||
obj=null;
|
||||
}
|
||||
|
||||
private void color(Player p, boolean canBuild, Material m){
|
||||
if(!canBuild){return;}
|
||||
ItemStack is = p.getItemInHand();
|
||||
Integer Amount = is.getAmount();
|
||||
List<ArmorStandPacket> asp = manager.getArmorStandPacketByObjectID(obj);
|
||||
short color = lutil.getFromDey(is.getDurability());
|
||||
for(ArmorStandPacket packet : asp){
|
||||
if(packet.getInventory().getHelmet()!=null&&packet.getInventory().getHelmet().getType().equals(m)){
|
||||
if(Amount>0){
|
||||
ItemStack is2 = packet.getInventory().getHelmet();
|
||||
if(is2.getDurability() != color){
|
||||
is2.setDurability(color);
|
||||
packet.getInventory().setHelmet(is2);
|
||||
if(!p.getGameMode().equals(GameMode.CREATIVE) || !lib.useGamemode()){Amount--;}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
manager.updateFurniture(obj);
|
||||
if(p.getGameMode().equals(GameMode.CREATIVE) && lib.useGamemode()) return;
|
||||
Integer i = p.getInventory().getHeldItemSlot();
|
||||
ItemStack item = p.getItemInHand();
|
||||
item.setAmount(Amount);
|
||||
p.getInventory().setItem(i, item);
|
||||
p.updateInventory();
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
@ -29,7 +28,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.EventType;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.ColorType;
|
||||
|
||||
public class tent_2 extends Furniture implements Listener{
|
||||
|
||||
@ -220,7 +219,6 @@ public class tent_2 extends Furniture implements Listener{
|
||||
e.setCancelled(true);
|
||||
Player p = e.getPlayer();
|
||||
if(!e.canBuild()){return;}
|
||||
Boolean canBuild = lib.canBuild(e.getPlayer(), obj, EventType.INTERACT);
|
||||
if(!p.getItemInHand().getType().equals(Material.INK_SACK)){
|
||||
|
||||
for(Block b : block){
|
||||
@ -230,35 +228,7 @@ public class tent_2 extends Furniture implements Listener{
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Material m = Material.CARPET;
|
||||
color(p, canBuild, m);
|
||||
lib.getColorManager().color(p, e.canBuild(), Material.CARPET, obj, ColorType.BLOCK, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void color(Player p, boolean canBuild, Material m){
|
||||
if(!canBuild){return;}
|
||||
ItemStack is = p.getItemInHand();
|
||||
Integer Amount = is.getAmount();
|
||||
List<ArmorStandPacket> asp = manager.getArmorStandPacketByObjectID(obj);
|
||||
short color = lutil.getFromDey(is.getDurability());
|
||||
for(ArmorStandPacket packet : asp){
|
||||
if(packet.getInventory().getHelmet()!=null&&packet.getInventory().getHelmet().getType().equals(m)){
|
||||
if(Amount>0){
|
||||
ItemStack is2 = packet.getInventory().getHelmet();
|
||||
if(is2.getDurability() != color){
|
||||
is2.setDurability(color);
|
||||
packet.getInventory().setHelmet(is2);
|
||||
if(!p.getGameMode().equals(GameMode.CREATIVE)){Amount--;}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
manager.updateFurniture(obj);
|
||||
if(p.getGameMode().equals(GameMode.CREATIVE) && lib.useGamemode()) return;
|
||||
Integer i = p.getInventory().getHeldItemSlot();
|
||||
ItemStack item = p.getItemInHand();
|
||||
item.setAmount(Amount);
|
||||
p.getInventory().setItem(i, item);
|
||||
p.updateInventory();
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
@ -31,6 +30,7 @@ import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.ColorType;
|
||||
|
||||
public class tent_3 extends Furniture implements Listener{
|
||||
|
||||
@ -193,9 +193,7 @@ public class tent_3 extends Furniture implements Listener{
|
||||
if(!e.canBuild()){return;}
|
||||
Player p = e.getPlayer();
|
||||
if(p.getItemInHand().getType().equals(Material.INK_SACK)){
|
||||
Boolean canBuild = true;
|
||||
Material m = Material.BANNER;
|
||||
color(p, canBuild, m);
|
||||
lib.getColorManager().color(p, e.canBuild(), Material.BANNER, obj, ColorType.BANNER, 1);
|
||||
}else{
|
||||
for(ArmorStandPacket packet : manager.getArmorStandPacketByObjectID(obj)){
|
||||
if(packet.getName().equalsIgnoreCase("#SITZ#")){
|
||||
@ -207,34 +205,4 @@ public class tent_3 extends Furniture implements Listener{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void color(Player p, boolean canBuild, Material m){
|
||||
if(!canBuild){return;}
|
||||
ItemStack is = p.getItemInHand();
|
||||
Integer Amount = is.getAmount();
|
||||
List<ArmorStandPacket> asp = manager.getArmorStandPacketByObjectID(obj);
|
||||
DyeColor change = DyeColor.getByColor(lutil.getDyeFromDurability(is.getDurability()));
|
||||
for(ArmorStandPacket packet : asp){
|
||||
if(packet.getInventory().getHelmet()!=null&&packet.getInventory().getHelmet().getType().equals(m)){
|
||||
if(Amount>0){
|
||||
ItemStack is2 = packet.getInventory().getHelmet();
|
||||
BannerMeta banner = (BannerMeta) is2.getItemMeta();
|
||||
DyeColor change2 = banner.getBaseColor();
|
||||
if(change2 != change){
|
||||
banner.setBaseColor(change);
|
||||
is2.setItemMeta(banner);
|
||||
packet.getInventory().setHelmet(is2);
|
||||
if(!p.getGameMode().equals(GameMode.CREATIVE) || !lib.useGamemode()){Amount--;}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
manager.updateFurniture(obj);
|
||||
if(p.getGameMode().equals(GameMode.CREATIVE) && lib.useGamemode()) return;
|
||||
Integer i = p.getInventory().getHeldItemSlot();
|
||||
ItemStack item = p.getItemInHand();
|
||||
item.setAmount(Amount);
|
||||
p.getInventory().setItem(i, item);
|
||||
p.updateInventory();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: DiceFurniture
|
||||
version: 2.1
|
||||
description: Furniture
|
||||
version: 2.2
|
||||
description: Add some new Objects to the Server
|
||||
author: Ste3et_C0st
|
||||
website: http://dicecraft.de
|
||||
depend: [FurnitureLib]
|
||||
|
Loading…
Reference in New Issue
Block a user