Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.Rbmc.Pintocraft;
- import java.io.File;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.ObjectOutputStream;
- import java.sql.ResultSet;
- import org.apache.logging.log4j.core.config.plugins.Plugin;
- import org.bukkit.plugin.java.JavaPlugin;
- public class main extends JavaPlugin
- {
- Plugin plugin;
- public void StructureAPI(Plugin pl)
- {
- this.plugin = pl;
- }
- public SqlConnection sql;
- public ResultSet ID;
- public void onEnable()
- {
- sql = new SqlConnection("jdbc:mysql://","149.202.36.43:3306","TestPluginImpr3D","printschem","schempass");
- sql.connection();
- }
- public void onDisable()
- {
- sql.disconnect();
- }
- public class ITOA
- {
- public String convert(int value, int base)
- {
- boolean negative = false;
- String s = "";
- if (value == 0)
- return "0";
- negative = (value < 0);
- if (negative)
- value = -1 * value;
- while (value != 0)
- {
- s = (value % base) + s;
- ID = value / base;
- }
- if (negative)
- s = "-" + s;
- return s;
- }
- }
- public void save(int ID, int[][][] b)
- {
- ObjectOutputStream oos = null;
- FileOutputStream fout = null;
- File f = new File(((JavaPlugin) plugin).getDataFolder() + "/schematics/"+ convert(ID, 10) + ".schem");
- File dir = new File(((JavaPlugin) plugin).getDataFolder() + "/schematics");
- try
- {
- dir.mkdirs();
- f.createNewFile();
- }
- catch (IOException e1)
- {
- e1.printStackTrace();
- }
- try
- {
- fout = new FileOutputStream(f);
- oos = new ObjectOutputStream(fout);
- oos.writeObject(b);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- finally
- {
- if(oos != null)
- {
- try
- {
- oos.close();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement