mirror of
https://github.com/Ste3et/furniture.git
synced 2024-11-22 02:25:44 +01:00
Fix some loading issues with async WorldLoading
This commit is contained in:
parent
0821489753
commit
2c36b5eac3
4
pom.xml
4
pom.xml
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.Ste3et_C0st.furniture</groupId>
|
||||
<artifactId>DiceFurniture</artifactId>
|
||||
<version>3.4.4</version>
|
||||
<version>3.4.6</version>
|
||||
<build>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
@ -100,7 +100,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.Ste3et</groupId>
|
||||
<artifactId>FurnitureLib</artifactId>
|
||||
<version>427b17286b</version>
|
||||
<version>9d4941bc50</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,12 +1,7 @@
|
||||
package de.Ste3et_C0st.Furniture.Main;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
|
||||
import de.Ste3et_C0st.Furniture.Main.Event.redstoneEvent;
|
||||
import de.Ste3et_C0st.Furniture.Objects.RPG.Catapult;
|
||||
import de.Ste3et_C0st.Furniture.Objects.RPG.Crossbow;
|
||||
@ -56,8 +51,6 @@ public class FurnitureHook extends FurniturePlugin{
|
||||
try {
|
||||
String modelFolder = FurnitureHook.isNewVersion() ? "Models113/" : "Models109/";
|
||||
String ending = FurnitureHook.isNewVersion() ? ".dModel" : ".yml";
|
||||
|
||||
new Project("Catapult", getPlugin(), getResource(modelFolder + "Catapult" + ending), Catapult.class).setSize(3, 2, 3, CenterType.RIGHT);
|
||||
new Project("HumanSkeleton", getPlugin(), getResource(modelFolder + "HumanSkeleton" + ending)).setSize(3, 1, 2, CenterType.RIGHT);
|
||||
new Project("CandyCane", getPlugin(), getResource(modelFolder + "CandyCane" + ending)).setSize(3, 4, 1, CenterType.RIGHT);
|
||||
new Project("SnowGolem", getPlugin(), getResource(modelFolder + "SnowGolem" + ending)).setSize(1, 2, 1, CenterType.RIGHT);
|
||||
@ -71,35 +64,37 @@ public class FurnitureHook extends FurniturePlugin{
|
||||
new Project("SchoolChair", getPlugin(), getResource(modelFolder + "SchoolChair" + ending)).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("SchoolTable", getPlugin(), getResource(modelFolder + "SchoolTable" + ending)).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("BlackBoard", getPlugin(), getResource(modelFolder + "BlackBoard" + ending)).setPlaceableSide(PlaceableSide.SIDE).setSize(1, 2, 3, CenterType.RIGHT);
|
||||
new Project("Barrels", getPlugin(), getResource(modelFolder + "Barrels" + ending), barrels.class).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("WaxCandle", getPlugin(), getResource(modelFolder + "WaxCandle" + ending), WaxCandle.class).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Lantern", getPlugin(), getResource(modelFolder + "Lantern" + ending), WaxCandle.class).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("MailBox", getPlugin(), getResource(modelFolder + "MailBox" + ending)).setSize(1, 2, 1, CenterType.RIGHT);
|
||||
new Project("Fence", getPlugin(), getResource(modelFolder + "Fence" + ending), fance.class).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Trunk", getPlugin(), getResource(modelFolder + "Trunk" + ending), Trunk.class).setSize(1, 1, 4, CenterType.RIGHT);
|
||||
new Project("Sunshade", getPlugin(), getResource(modelFolder + "Sunshade" + ending), sunshade.class).setSize(1, 3, 1, CenterType.RIGHT);
|
||||
new Project("Hammock", getPlugin(), getResource(modelFolder + "Hammock" + ending), hammock.class).setSize(1, 2, 7, CenterType.RIGHT);
|
||||
new Project("Crossbow", getPlugin(), getResource(modelFolder + "Crossbow" + ending), Crossbow.class).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Tent1", getPlugin(),getResource(modelFolder + "Tent1" + ending), tent_1.class).setSize(4, 3, 5, CenterType.RIGHT);
|
||||
new Project("GraveStone", getPlugin(),getResource(modelFolder + "GraveStone" + ending), graveStone.class).setSize(1, 2, 3, CenterType.CENTER);
|
||||
new Project("Camera", getPlugin(), getResource(modelFolder + "Camera" + ending), camera.class).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Sofa", getPlugin(), getResource(modelFolder + "Sofa" + ending)).setSize(1, 1, 3, CenterType.RIGHT);
|
||||
new Project("Log", getPlugin(), getResource(modelFolder + "Log" + ending), log.class).setSize(1, 1, 1, CenterType.CENTER);
|
||||
new Project("LargeTable", getPlugin(),getResource(modelFolder + "LargeTable" + ending),PlaceableSide.TOP, largeTable.class).setSize(2, 1, 2, CenterType.RIGHT);
|
||||
new Project("Campfire1", getPlugin(),getResource(modelFolder + "Campfire1" + ending),PlaceableSide.TOP, campfire_1.class).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Campfire2", getPlugin(),getResource(modelFolder + "Campfire2" + ending),PlaceableSide.TOP, campfire_2.class).setSize(2, 1, 2, CenterType.RIGHT);
|
||||
new Project("Tent2", getPlugin(),getResource(modelFolder + "Tent2" + ending),PlaceableSide.TOP, tent_2.class).setSize(6, 3, 5, CenterType.RIGHT);
|
||||
new Project("Tent3", getPlugin(),getResource(modelFolder + "Tent3" + ending),PlaceableSide.TOP, tent_3.class).setSize(3, 2, 3, CenterType.CENTER);
|
||||
new Project("Streetlamp", getPlugin(), getResource(modelFolder + "Streetlamp" + ending),PlaceableSide.TOP, streetlamp.class).setSize(2, 4, 1, CenterType.FRONT);
|
||||
new Project("Billboard", getPlugin(), getResource(modelFolder + "Billboard" + ending),PlaceableSide.TOP, billboard.class).setSize(1, 3, 3, CenterType.RIGHT);
|
||||
new Project("WeaponStand", getPlugin(), getResource(modelFolder + "WeaponStand" + ending),PlaceableSide.TOP, weaponStand.class).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Guillotine", getPlugin(), getResource(modelFolder + "Guillotine" + ending),PlaceableSide.TOP, Guillotine.class).setSize(1, 5, 2, CenterType.RIGHT);
|
||||
new Project("FlowerPot", getPlugin(), getResource(modelFolder + "FlowerPot" + ending),PlaceableSide.BOTTOM, TFlowerPot.class).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("BearTrap", getPlugin(), getResource(modelFolder + "BearTrap" + ending), PlaceableSide.TOP, BearTrap.class).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("TrashCan", getPlugin(), getResource(modelFolder + "TrashCan" + ending), PlaceableSide.TOP, TrashCan.class).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Flag", getPlugin(), getResource(modelFolder + "Flag" + ending), PlaceableSide.TOP, flag.class).setSize(1, 3, 1, CenterType.RIGHT);
|
||||
new Project("AdventCalender", getPlugin(), getResource(modelFolder + "AdventCalender" + ending), PlaceableSide.TOP, AdventCalender.class).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("FireworkLauncher", getPlugin(), getResource(modelFolder + "FireworkLauncher" + ending), PlaceableSide.TOP, FireworkLauncher.class).setSize(1, 1, 1, CenterType.CENTER);
|
||||
|
||||
new Project("Catapult", getPlugin(), getResource(modelFolder + "Catapult" + ending), PlaceableSide.TOP, Catapult::new).setSize(3, 2, 3, CenterType.RIGHT);
|
||||
new Project("Barrels", getPlugin(), getResource(modelFolder + "Barrels" + ending), PlaceableSide.TOP, barrels::new).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("WaxCandle", getPlugin(), getResource(modelFolder + "WaxCandle" + ending), PlaceableSide.TOP, WaxCandle::new).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Lantern", getPlugin(), getResource(modelFolder + "Lantern" + ending), PlaceableSide.TOP, WaxCandle::new).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Log", getPlugin(), getResource(modelFolder + "Log" + ending), log::new).setSize(1, 1, 1, CenterType.CENTER);
|
||||
new Project("Fence", getPlugin(), getResource(modelFolder + "Fence" + ending), fance::new).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Trunk", getPlugin(), getResource(modelFolder + "Trunk" + ending), Trunk::new).setSize(1, 1, 4, CenterType.RIGHT);
|
||||
new Project("Sunshade", getPlugin(), getResource(modelFolder + "Sunshade" + ending), sunshade::new).setSize(1, 3, 1, CenterType.RIGHT);
|
||||
new Project("Hammock", getPlugin(), getResource(modelFolder + "Hammock" + ending), hammock::new).setSize(1, 2, 7, CenterType.RIGHT);
|
||||
new Project("Crossbow", getPlugin(), getResource(modelFolder + "Crossbow" + ending), Crossbow::new).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Tent1", getPlugin(),getResource(modelFolder + "Tent1" + ending), tent_1::new).setSize(4, 3, 5, CenterType.RIGHT);
|
||||
new Project("GraveStone", getPlugin(),getResource(modelFolder + "GraveStone" + ending), graveStone::new).setSize(1, 2, 3, CenterType.CENTER);
|
||||
new Project("Camera", getPlugin(), getResource(modelFolder + "Camera" + ending), camera::new).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("LargeTable", getPlugin(),getResource(modelFolder + "LargeTable" + ending), largeTable::new).setSize(2, 1, 2, CenterType.RIGHT);
|
||||
new Project("Campfire1", getPlugin(),getResource(modelFolder + "Campfire1" + ending), campfire_1::new).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Campfire2", getPlugin(),getResource(modelFolder + "Campfire2" + ending), campfire_2::new).setSize(2, 1, 2, CenterType.RIGHT);
|
||||
new Project("Tent2", getPlugin(),getResource(modelFolder + "Tent2" + ending), tent_2::new).setSize(6, 3, 5, CenterType.RIGHT);
|
||||
new Project("Tent3", getPlugin(),getResource(modelFolder + "Tent3" + ending), tent_3::new).setSize(3, 2, 3, CenterType.CENTER);
|
||||
new Project("Streetlamp", getPlugin(), getResource(modelFolder + "Streetlamp" + ending), streetlamp::new).setSize(2, 4, 1, CenterType.FRONT);
|
||||
new Project("Billboard", getPlugin(), getResource(modelFolder + "Billboard" + ending), billboard::new).setSize(1, 3, 3, CenterType.RIGHT);
|
||||
new Project("WeaponStand", getPlugin(), getResource(modelFolder + "WeaponStand" + ending), weaponStand::new).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Guillotine", getPlugin(), getResource(modelFolder + "Guillotine" + ending), Guillotine::new).setSize(1, 5, 2, CenterType.RIGHT);
|
||||
new Project("FlowerPot", getPlugin(), getResource(modelFolder + "FlowerPot" + ending), TFlowerPot::new).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("BearTrap", getPlugin(), getResource(modelFolder + "BearTrap" + ending), BearTrap::new).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("TrashCan", getPlugin(), getResource(modelFolder + "TrashCan" + ending), TrashCan::new).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("Flag", getPlugin(), getResource(modelFolder + "Flag" + ending), flag::new).setSize(1, 3, 1, CenterType.RIGHT);
|
||||
new Project("AdventCalender", getPlugin(), getResource(modelFolder + "AdventCalender" + ending), PlaceableSide.TOP, AdventCalender::new).setSize(1, 1, 1, CenterType.RIGHT);
|
||||
new Project("FireworkLauncher", getPlugin(), getResource(modelFolder + "FireworkLauncher" + ending), PlaceableSide.TOP, FireworkLauncher::new).setSize(1, 1, 1, CenterType.CENTER);
|
||||
|
||||
FurnitureLib.getInstance().getFurnitureManager().getProjects().stream().filter(pro -> pro.getPlugin().equals(getPlugin())).forEach(pro -> pro.setEditorProject(editModels));
|
||||
}catch (Exception e) {
|
||||
@ -119,22 +114,6 @@ public class FurnitureHook extends FurniturePlugin{
|
||||
|
||||
}
|
||||
|
||||
private static Boolean newVersion = null;
|
||||
public static boolean isNewVersion() {
|
||||
if(Objects.isNull(newVersion)) {
|
||||
try {
|
||||
Class<?> descriptionClass = PluginDescriptionFile.class;
|
||||
Field field = descriptionClass.getDeclaredField("apiVersion");
|
||||
boolean bool = Objects.nonNull(field);
|
||||
newVersion = bool;
|
||||
return bool;
|
||||
}catch (Exception e) {
|
||||
newVersion = false;
|
||||
return false;
|
||||
}
|
||||
}else {
|
||||
return newVersion;
|
||||
}
|
||||
}
|
||||
public static boolean isNewVersion() {return FurnitureLib.isNewVersion();}
|
||||
|
||||
}
|
||||
|
@ -1,23 +1,12 @@
|
||||
package de.Ste3et_C0st.Furniture.Objects.RPG;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.EulerAngle;
|
||||
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Furniture;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.ObjectID;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.BodyPart;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.entity.fArmorStand;
|
||||
import de.Ste3et_C0st.FurnitureLib.main.entity.fEntity;
|
||||
|
||||
public class flag extends Furniture {
|
||||
|
@ -36,22 +36,27 @@ public class streetlamp extends Furniture{
|
||||
public void spawn(Location location){}
|
||||
|
||||
private void setBlock(){
|
||||
List<Block> blockLocation = new ArrayList<Block>();
|
||||
Location location = getLocation().getBlock().getLocation();
|
||||
List<Location> blockLocation = new ArrayList<Location>();
|
||||
Location location = getLocation();
|
||||
location.setY(location.getY()-1);
|
||||
for(int i = 0; i<=3;i++){
|
||||
location.setY(location.getY()+1);
|
||||
Block block = location.getBlock();
|
||||
block.setType(Material.BARRIER);
|
||||
blockLocation.add(block);
|
||||
blockLocation.add(location);
|
||||
if(!this.getObjID().isFinish()) {
|
||||
Block block = location.getBlock();
|
||||
block.setType(Material.BARRIER);
|
||||
}
|
||||
|
||||
if(i==3){
|
||||
Location loc =getLutil().getRelative(location, getBlockFace(), -1D, 0D);
|
||||
Block blocks = loc.getBlock();
|
||||
blocks.setType(Material.BARRIER);
|
||||
blockLocation.add(blocks);
|
||||
if(!this.getObjID().isFinish()) {
|
||||
Block blocks = loc.getBlock();
|
||||
blocks.setType(Material.BARRIER);
|
||||
}
|
||||
blockLocation.add(loc);
|
||||
}
|
||||
}
|
||||
getObjID().addBlock(blockLocation);
|
||||
getObjID().addBlockLocations(blockLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,7 +4,6 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -17,7 +16,6 @@ import de.Ste3et_C0st.FurnitureLib.main.Type.SQLAction;
|
||||
public class graveStone extends Furniture{
|
||||
|
||||
private Location signLoc;
|
||||
private Block sign;
|
||||
private String[] lines = new String[4];
|
||||
|
||||
public graveStone(ObjectID id) {
|
||||
@ -27,7 +25,7 @@ public class graveStone extends Furniture{
|
||||
|
||||
private void setBlock(){
|
||||
this.signLoc = getObjID().getBlockList().stream().filter(b -> b.getBlock().getType().name().contains("SIGN")).findFirst().orElse(null);
|
||||
if(this.signLoc != null) this.sign = this.signLoc.getBlock();
|
||||
//if(this.signLoc != null) this.sign = this.signLoc.getBlock();
|
||||
this.lines = getText();
|
||||
}
|
||||
|
||||
@ -38,8 +36,8 @@ public class graveStone extends Furniture{
|
||||
if(player == null) return;
|
||||
if(canBuild(player)) {
|
||||
this.destroy(player);
|
||||
if(sign!=null){
|
||||
sign.setType(Material.AIR);
|
||||
if(getSignLocation()!=null){
|
||||
getSignLocation().getBlock().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -61,7 +59,6 @@ public class graveStone extends Furniture{
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sign = getLutil().setSign(getBlockFace(), signLoc);
|
||||
placetext();
|
||||
}
|
||||
});
|
||||
@ -70,9 +67,8 @@ public class graveStone extends Furniture{
|
||||
public Location getSignLocation(){return this.signLoc;}
|
||||
|
||||
public void removeSign(){
|
||||
if(sign!=null){
|
||||
sign.setType(Material.AIR);
|
||||
sign = null;
|
||||
if(signLoc!=null){
|
||||
signLoc.getBlock().setType(Material.AIR);
|
||||
getManager().remove(getObjID());
|
||||
delete();
|
||||
}
|
||||
@ -108,8 +104,8 @@ public class graveStone extends Furniture{
|
||||
}
|
||||
|
||||
public void placetext(){
|
||||
if ((this.sign.getState() instanceof Sign) && lines != null){
|
||||
Sign sign = (Sign) this.sign.getState();
|
||||
if ((this.getSignLocation().getBlock().getState() instanceof Sign) && lines != null){
|
||||
Sign sign = (Sign) this.getSignLocation().getBlock().getState();
|
||||
Integer i = 0;
|
||||
for(String s : lines){
|
||||
if(i>3){break;}
|
||||
@ -121,15 +117,15 @@ public class graveStone extends Furniture{
|
||||
}
|
||||
|
||||
public String[] getText(){
|
||||
if(sign==null || !sign.getType().name().contains("SIGN")){return null;}
|
||||
Sign sign = (Sign) this.sign.getState();
|
||||
if(signLoc==null || !getSignLocation().getBlock().getType().name().contains("SIGN")){return null;}
|
||||
Sign sign = (Sign) this.getSignLocation().getBlock().getState();
|
||||
return sign.getLines();
|
||||
}
|
||||
|
||||
public void setText(Integer line, String text){
|
||||
if(line==null || text == null){return;}
|
||||
if(sign==null || !sign.getType().name().contains("SIGN")){return;}
|
||||
Sign sign = (Sign) this.sign.getState();
|
||||
if(getSignLocation()==null || !getSignLocation().getBlock().getType().name().contains("SIGN")){return;}
|
||||
Sign sign = (Sign) this.getSignLocation().getBlock().getState();
|
||||
sign.setLine(line, text);
|
||||
sign.update(true, false);
|
||||
lines[line] = text;
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: DiceFurniture
|
||||
version: 3.4.2
|
||||
version: 3.4.6
|
||||
description: Add some new Objects to the Server
|
||||
author: Ste3et_C0st
|
||||
website: http://dicecraft.de
|
||||
|
Loading…
Reference in New Issue
Block a user