Advertisement
Txcraf

Untitled

May 30th, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.87 KB | None | 0 0
  1. package me.check_plys.craftingthings;
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.Material;
  7. import org.bukkit.command.Command;
  8. import org.bukkit.command.CommandSender;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.inventory.ItemStack;
  11. import org.bukkit.inventory.ShapedRecipe;
  12. import org.bukkit.inventory.meta.ItemMeta;
  13. import org.bukkit.plugin.PluginDescriptionFile;
  14. import org.bukkit.plugin.java.JavaPlugin;
  15.  
  16. public class Main extends JavaPlugin{
  17.    
  18.  
  19.     public final Logger logger = Logger.getLogger("Minecraft");
  20.     public static Main plugin;
  21.    
  22.     @Override
  23.     public void onDisable() {
  24.         PluginDescriptionFile pdfFile = this.getDescription();
  25.         this.logger.info(pdfFile.getName() + " Has Been Disabled!");
  26.         this.logger.warning(pdfFile.getName() + " If you are disabling the plugin without disable all server some errors may appear in console in future versions");  
  27.     }
  28.    
  29.     @Override
  30.     public void onEnable() {
  31.         horsearmouriron();
  32.         saddlerecipe();
  33.         disk11();
  34.           PluginDescriptionFile pdfFile = this.getDescription();
  35.           this.logger.info(pdfFile.getName() + "Version" + pdfFile.getVersion() + " Has Been Enabled!");   
  36.           getConfig().options().copyDefaults(true);
  37.           saveConfig();
  38.        
  39.     }
  40.     //reloadconfig
  41.     public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
  42.         final Player p = (Player)sender;
  43.         if (cmd.getName().equalsIgnoreCase("ct")){
  44.            
  45.             if (args[0].equals("help"))
  46.             if  (p.hasPermission("craftingthings.help") || p.isOp() || p.hasPermission("*"))
  47.                 p.sendMessage(getConfig().getString("Tag").replace("&", "§") + getConfig().getString("HelpMessage").replace("&", "§"));
  48.             else
  49.            
  50.             p.sendMessage(getConfig().getString("Tag").replace("&", "§") + getConfig().getString("NoPermissionMessage").replace("&", "§"));
  51.         }
  52.         return true;
  53.        
  54.     }
  55.                    
  56.     //saddle
  57.       private void saddlerecipe() {
  58.         if (getConfig().getBoolean("CraftSaddle")) {
  59.         ItemStack saddle = new ItemStack(Material.SADDLE, 1);
  60.         ItemMeta meta = saddle.getItemMeta();
  61.         saddle.setItemMeta(meta);
  62.        
  63.         ShapedRecipe saddlecraft = new ShapedRecipe(saddle);
  64.         saddlecraft.shape(
  65.                         "@@@",
  66.                         "# #",
  67.                         "£ £" );
  68.         saddlecraft.setIngredient('@', Material.LEATHER);
  69.         saddlecraft.setIngredient('#', Material.STRING);
  70.         saddlecraft.setIngredient('£', Material.IRON_INGOT);
  71.         Bukkit.getServer().addRecipe(saddlecraft);
  72.          }
  73.   }
  74.  
  75.     //disk11
  76.       private void disk11() {
  77.           if (getConfig().getBoolean("CraftDisk11")) {
  78.         ItemStack disk11 = new ItemStack(Material.RECORD_11);
  79.         ItemMeta meta = disk11.getItemMeta();
  80.         disk11.setItemMeta(meta);
  81.        
  82.         ShapedRecipe disk11craft = new ShapedRecipe(disk11);
  83.         disk11craft.shape(
  84.                          "£#£",
  85.                          "#$#",
  86.                          "£#£" );
  87.         disk11craft.setIngredient('£', Material.SOUL_SAND);
  88.         disk11craft.setIngredient('#', Material.OBSIDIAN);
  89.         disk11craft.setIngredient('$', Material.REDSTONE_BLOCK);
  90.         Bukkit.getServer().addRecipe(disk11craft);
  91.        
  92.           }
  93.       }
  94.     //horse armour iron
  95.      private void horsearmouriron() {
  96.          if (getConfig().getBoolean("CraftIronHorseArmour")) {
  97.              ItemStack horsearmouriron = new ItemStack(Material.IRON_BARDING);
  98.              ItemMeta meta = horsearmouriron.getItemMeta();
  99.              horsearmouriron.setItemMeta(meta);
  100.              
  101.              ShapedRecipe horsearmourironcraft = new ShapedRecipe(horsearmouriron);
  102.              horsearmourironcraft.shape(
  103.                                         "  #",
  104.                                         "#$#",
  105.                                         "###");
  106.              horsearmourironcraft.setIngredient('#', Material.IRON_INGOT);
  107.              horsearmourironcraft.setIngredient('$', Material.WOOL);
  108.              Bukkit.getServer().addRecipe(horsearmourironcraft);
  109.              
  110.          }
  111.      }
  112.    
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement