Furniture-main.class

Aug 18, 2015
Furniture-main.class
  • Code (Text):
    package de.Ste3et_C0st.Furniture.Main;

    import java.util.ArrayList;
    import java.util.List;

    import net.minecraft.server.v1_8_R3.Material;

    import org.bukkit.Bukkit;
    import org.bukkit.Effect;
    import org.bukkit.Location;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.plugin.java.JavaPlugin;

    import de.Ste3et_C0st.Furniture.Objects.electric.camera;
    import de.Ste3et_C0st.FurnitureLib.Crafting.CraftingFile;
    import de.Ste3et_C0st.FurnitureLib.Crafting.Project;
    import de.Ste3et_C0st.FurnitureLib.Events.FurnitureItemEvent;
    import de.Ste3et_C0st.FurnitureLib.Utilitis.LocationUtil;
    import de.Ste3et_C0st.FurnitureLib.main.ArmorStandPacket;
    import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib;
    import de.Ste3et_C0st.FurnitureLib.main.FurnitureManager;
    import de.Ste3et_C0st.FurnitureLib.main.ObjectID;

    public class main extends JavaPlugin implements Listener{

        FurnitureLib lib;
        FurnitureManager manager;
        static main instance;
        static LocationUtil util;

        public void onEnable(){
            if(!Bukkit.getPluginManager().isPluginEnabled("FurnitureLib")){Bukkit.getPluginManager().disablePlugin(this);}
            instance = this;
            lib = (FurnitureLib) Bukkit.getPluginManager().getPlugin("FurnitureLib");
            manager = lib.getFurnitureManager();
            util = lib.getLocationUtil();
            Bukkit.getPluginManager().registerEvents(this, this);

            new Project("Camera", new CraftingFile("Camera", getResource("Crafting/Camera.yml")),this, camera.class).setSize(1, 2, 1);

            List<ObjectID> objList = new ArrayList<ObjectID>();
            for(ObjectID obj : manager.getObjectList()){
                if(objList.contains(obj)) continue;
                if(!objList.contains(obj)) objList.add(obj);
                if(obj.getPlugin().equalsIgnoreCase(this.getName())){
                    switch (obj.getProject()) {
                    case "Camera":
                        new camera(lib, this, obj);
                        break;
                    default:
                        break;
                    }
                }
            }
        }

        public void onDisable(){

        }

        @EventHandler
        private void onClick(FurnitureItemEvent e){
            if(e.isCancelled()){return;}
            if(!e.canBuild(null)){return;}
            if(!e.getProject().hasPermissions(e.getPlayer())){return;}
            if(!e.getProject().getPlugin().getName().equalsIgnoreCase(this.getName())){return;}
            Location loc = e.getLocation().getBlock().getLocation();
            loc.setYaw(e.getPlayer().getLocation().getYaw());
            loc.add(0, 1, 0);
            Player p = e.getPlayer();
            Project pro = e.getProject();
            lib.getLimitationManager().addWorld(p.getWorld(), pro);
            ObjectID obj = new ObjectID(pro.getName(), pro.getPlugin().getName(), e.getLocation());
            switch(e.getProject().getName()){
                case "Camera" : new camera(lib, instance, obj); return;
                default: return;
            }
        }

        public static Plugin getInstance() {return instance;}
    }
    Description tho the onEnable function.

    Code (Text):
    new Project("Camera", new CraftingFile("Camera", getResource("Crafting/Camera.yml")),this, camera.class).setSize(1, 2, 1);
    "Camera" = Project name or Furniture Type it must be a single name
    "CraftingFile" = Manage Crafting Recipes
    "camera.class" = the furniture object class it must be set for spawn an furniture from another plugin or other the commandblock
    ".setSize(width,height,length)" = set the furniture dimansion this is optional and is for the out of space feature

    Back to main page.
  • Loading...
  • Loading...