diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..5869b87
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 0000000..91c2ee5
--- /dev/null
+++ b/.project
@@ -0,0 +1,23 @@
+
+
+ EasyAPI
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+
+
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..7251e5a
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/README.md b/README.md
index cf3b39b..0346345 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,99 @@
-# EasyAPI
\ No newline at end of file
+# EasyAPI
+_Made for making games more easy_
+authors:
+ - JernejTDO
+ - alandioda (made regions)
+
+## Features
+ - Regions (Create regions and use their system)
+ - Json File manager (Save files, get body and option to create them)
+ - MySQL (Setup the mysql connection and use it)
+ - HexColer codes replacer
+
+## Regions
+Create a region
+ - First you need to make to make 2 locations.
+ - Create the region.
+ - Last step add the region to the list.
+```sh
+Location loc1 = new Location(Bukkit.getWorld(""), 0, 0, 0);
+Location loc2 = new Location(Bukkit.getWorld(""), 0, 0, 0);
+Region region = new Region("", loc1, loc2);
+Regions.addRegion(region);
+```
+
+Region Events
+> PlayerEnterRegionEvent - When a player joins the region.
+> PlayerExitRegionEvent - When a player leaves a region.
+```sh
+@EventHandler
+public void regionEnter(PlayerEnterRegionEvent event) {
+}
+
+@EventHandler
+public void Region(PlayerExitRegionEvent event) {
+}
+```
+
+Get info of region.
+```sh
+Region region = null; //Your region
+Location loc = null; //Bukkit location
+
+Regions.addRegion(region); //Adds a region to the plugin.
+Regions.deleteRegion(region); //Removes the region from the plugin.
+Regions.getRegionInLocation(loc); //Gets the region in that location.
+Regions.getRegions(); //List of all the regions created.
+Regions.getRegionsByName(""); //Gets the region by name.
+Regions.getRegionsInLocation(loc); //List of all the regions in that location.
+```
+## Json Manager
+You need to use Google`s json dependency.
+```sh
+
+ com.googlecode.json-simple
+ json-simple
+ 1.1.1
+
+```
+
+ Json Features
+```sh
+import net.hypple.EasyAPI.Json.JsonManager;
+
+JsonManager.createJsonFile("");
+JsonManager.getJsonBody("");
+JsonManager.updateJsonBody("", JSONObject);
+```
+
+## MySQL
+Connect to database.
+_put in onEnable()_
+```sh
+@Override
+public void onEnable() {
+ EasyAPI.setupMySQL("Host", "Data Base", "Username", "Password");
+}
+```
+
+You need to install this dependency
+```sh
+
+ mysql
+ mysql-connector-java
+ 8.0.21
+
+```
+
+Get the connection to data base.
+```sh
+EasyAPI.mysql.GetConnection();
+```
+
+## Hex Coler Codes
+Its for the version 1.16+ that support RGB. You can you this on spigot and Bungee servers.
+_You just need to put the & symbol in front of the hex code_
+```sh
+Player player = null; //Your player
+player.sendMessage(HexColors.replaceHexCodes("f2ff message in your coler."));
+```
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..d57e4e1
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,35 @@
+
+ 4.0.0
+ net.hypple
+ EasyAPI
+ 1.1.1
+ EasyAPI
+
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+
+
+
+
+ org.spigotmc
+ spigot-api
+ 1.18.2-R0.1-SNAPSHOT
+ provided
+
+
+
+ mysql
+ mysql-connector-java
+ 8.0.21
+
+
+ com.googlecode.json-simple
+ json-simple
+ 1.1.1
+
+
+
\ No newline at end of file
diff --git a/src/main/java/net/hypple/EasyAPI/Bungee/Bungee.java b/src/main/java/net/hypple/EasyAPI/Bungee/Bungee.java
new file mode 100644
index 0000000..231272e
--- /dev/null
+++ b/src/main/java/net/hypple/EasyAPI/Bungee/Bungee.java
@@ -0,0 +1,18 @@
+package net.hypple.EasyAPI.Bungee;
+
+import org.bukkit.entity.Player;
+
+import com.google.common.io.ByteArrayDataOutput;
+import com.google.common.io.ByteStreams;
+
+import net.hypple.EasyAPI.EasyAPI;
+
+public class Bungee {
+
+ public static void sendPlayerToServer(Player player, String server) {
+ ByteArrayDataOutput byteArrayDataOutput = ByteStreams.newDataOutput();
+ byteArrayDataOutput.writeUTF("Connect");
+ byteArrayDataOutput.writeUTF(server);
+ player.sendPluginMessage(EasyAPI.getInstance(), "BungeeCord", byteArrayDataOutput.toByteArray());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/hypple/EasyAPI/EasyAPI.java b/src/main/java/net/hypple/EasyAPI/EasyAPI.java
new file mode 100644
index 0000000..ec3011a
--- /dev/null
+++ b/src/main/java/net/hypple/EasyAPI/EasyAPI.java
@@ -0,0 +1,57 @@
+package net.hypple.EasyAPI;
+
+import java.awt.Color;
+import java.io.File;
+
+import org.bukkit.Bukkit;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import net.hypple.EasyAPI.Json.JsonManager;
+import net.hypple.EasyAPI.Regions.BukkitPlayerMoveEvent;
+import net.hypple.EasyAPI.mysql.EasyMySQL;
+import net.md_5.bungee.api.ChatColor;
+
+public class EasyAPI extends JavaPlugin {
+
+ private static EasyAPI plugin;
+ public static EasyMySQL mysql;
+
+ @Override
+ public void onEnable() {
+
+ plugin = this;
+
+ createFolder();
+ defaultFile();
+
+
+ getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
+ Bukkit.getPluginManager().registerEvents(new BukkitPlayerMoveEvent(), plugin);
+ }
+
+ private void createFolder() {
+ String dir = plugin.getServer().getWorldContainer().getAbsolutePath();
+ if(dir.endsWith(".")) {
+ dir = dir.substring(0, dir.length() - 1);
+ }
+ File tempFile = new File(dir + "EasyAPI");
+ if(!tempFile.exists()) {
+ new File(dir + "EasyAPI").mkdirs();
+ Bukkit.getConsoleSender().sendMessage(ChatColor.of(new Color(51,255,255))+"EasyAPI §7- "+ChatColor.of(new Color(0,255,0))+"EasyAPI"+" folder was created.");
+ }
+ }
+
+ public static EasyAPI getInstance() {
+ return plugin;
+ }
+
+ private static void defaultFile() {
+ JsonManager.createJsonFile("EasyAPI");
+ }
+
+ public static void createPluginConfig(Plugin plugin) {
+ JsonManager.createJsonFile(plugin.getName());
+ }
+}
+
diff --git a/src/main/java/net/hypple/EasyAPI/Json/JsonManager.java b/src/main/java/net/hypple/EasyAPI/Json/JsonManager.java
new file mode 100644
index 0000000..e03cdfb
--- /dev/null
+++ b/src/main/java/net/hypple/EasyAPI/Json/JsonManager.java
@@ -0,0 +1,83 @@
+package net.hypple.EasyAPI.Json;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.bukkit.Bukkit;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+import net.hypple.EasyAPI.EasyAPI;
+import net.md_5.bungee.api.ChatColor;
+
+public class JsonManager {
+
+ public static void createJsonFile(String name) {
+ String dir = EasyAPI.getInstance().getServer().getWorldContainer().getAbsolutePath();
+ if(dir.endsWith(".")) {
+ dir = dir.substring(0, dir.length() - 1);
+ }
+ dir = dir + "EasyAPI/";
+ File tempFile = new File(dir + name+".json");
+ if(!tempFile.exists()) {
+ JSONObject jsonFile = new JSONObject();
+ try {
+ FileWriter file = new FileWriter(dir+"/"+name+".json");
+ Bukkit.getConsoleSender().sendMessage(ChatColor.of(new Color(51,255,255))+"EasyAPI §7- "+ChatColor.of(new Color(0,255,0))+name+".json"+" file was created.");
+ file.write(jsonFile.toJSONString());
+ file.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ } else {
+ }
+ }
+
+ public static JSONObject getJsonBody(String name) {
+ String dir = EasyAPI.getInstance().getServer().getWorldContainer().getAbsolutePath();
+ if(dir.endsWith(".")) {
+ dir = dir.substring(0, dir.length() - 1);
+ }
+ dir = dir + "EasyAPI/";
+ File tempFile = new File(dir + name+".json");
+ if(tempFile.exists()) {
+ JSONParser parser = new JSONParser();
+ try {
+ Object obj = parser.parse(new FileReader(dir+name+".json"));
+ JSONObject jsonObject = (JSONObject) obj;
+ return jsonObject;
+ } catch (IOException | ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public static void updateJsonBody(String name, JSONObject JSONObject) {
+ String dir = EasyAPI.getInstance().getServer().getWorldContainer().getAbsolutePath();
+ if(dir.endsWith(".")) {
+ dir = dir.substring(0, dir.length() - 1);
+ }
+ dir = dir + "EasyAPI/";
+ File tempFile = new File(dir + name+".json");
+ if(tempFile.exists()) {
+ try {
+ FileWriter file = new FileWriter(dir+"/"+name+".json");
+ Bukkit.getConsoleSender().sendMessage(ChatColor.of(new Color(51,255,255))+"EasyAPI §7- "+ChatColor.of(new Color(0,255,0))+name+".json"+" file was updated.");
+ file.write(JSONObject.toJSONString());
+ file.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/hypple/EasyAPI/Main.java b/src/main/java/net/hypple/EasyAPI/Main.java
new file mode 100644
index 0000000..e9d57ea
--- /dev/null
+++ b/src/main/java/net/hypple/EasyAPI/Main.java
@@ -0,0 +1,10 @@
+package net.hypple.EasyAPI;
+
+public class Main {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/main/java/net/hypple/EasyAPI/RGB/HexColors.java b/src/main/java/net/hypple/EasyAPI/RGB/HexColors.java
new file mode 100644
index 0000000..ea7133e
--- /dev/null
+++ b/src/main/java/net/hypple/EasyAPI/RGB/HexColors.java
@@ -0,0 +1,27 @@
+package net.hypple.EasyAPI.RGB;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import net.md_5.bungee.api.ChatColor;
+
+public class HexColors {
+
+ public static String replaceHexCodes(String str) {
+ Pattern unicode = Pattern.compile("\\\\u\\+[a-fA-F0-9]{4}");
+ Matcher match = unicode.matcher(str);
+ while (match.find()) {
+ String code = str.substring(match.start(),match.end());
+ str = str.replace(code,Character.toString((char) Integer.parseInt(code.replace("\\u+",""),16)));
+ match = unicode.matcher(str);
+ }
+ Pattern pattern = Pattern.compile("[a-fA-F0-9]{6}");
+ match = pattern.matcher(str);
+ while (match.find()) {
+ String color = str.substring(match.start(),match.end());
+ str = str.replace(color,ChatColor.of(color.replace("&","")) + "");
+ match = pattern.matcher(str);
+ }
+ return ChatColor.translateAlternateColorCodes('&',str);
+ }
+}
diff --git a/src/main/java/net/hypple/EasyAPI/Regions/BukkitPlayerMoveEvent.java b/src/main/java/net/hypple/EasyAPI/Regions/BukkitPlayerMoveEvent.java
new file mode 100644
index 0000000..105b3e6
--- /dev/null
+++ b/src/main/java/net/hypple/EasyAPI/Regions/BukkitPlayerMoveEvent.java
@@ -0,0 +1,42 @@
+package net.hypple.EasyAPI.Regions;
+
+import org.bukkit.Bukkit;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerMoveEvent;
+
+public class BukkitPlayerMoveEvent implements Listener {
+
+ @EventHandler
+ public void move(PlayerMoveEvent event) {
+ if(event.getFrom().getBlockX() != event.getTo().getBlockX()
+ || event.getFrom().getBlockY() != event.getTo().getBlockY()
+ || event.getFrom().getBlockZ() != event.getTo().getBlockZ()) {
+
+ Region to = Regions.getRegionInLocation(event.getTo());
+ Region from = Regions.getRegionInLocation(event.getFrom());
+
+ if(to != null) {
+ if(from != null) {
+ if(to != from) {
+ PlayerEnterRegionEvent enterEvent = new PlayerEnterRegionEvent(event.getPlayer(), from, to, event.isCancelled());
+ Bukkit.getPluginManager().callEvent(enterEvent);
+ PlayerExitRegionEvent exitEvent = new PlayerExitRegionEvent(event.getPlayer(), from, to, enterEvent.isCanceled());
+ Bukkit.getPluginManager().callEvent(exitEvent);
+ event.setCancelled(exitEvent.isCanceled());
+ }
+ } else {
+ PlayerEnterRegionEvent enterEvent = new PlayerEnterRegionEvent(event.getPlayer(), from, to, event.isCancelled());
+ Bukkit.getPluginManager().callEvent(enterEvent);
+ event.setCancelled(enterEvent.isCanceled());
+ }
+ } else {
+ if(from != null) {
+ PlayerExitRegionEvent exitEvent = new PlayerExitRegionEvent(event.getPlayer(), from, to, event.isCancelled());
+ Bukkit.getPluginManager().callEvent(exitEvent);
+ event.setCancelled(exitEvent.isCanceled());
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/net/hypple/EasyAPI/Regions/PlayerEnterRegionEvent.java b/src/main/java/net/hypple/EasyAPI/Regions/PlayerEnterRegionEvent.java
new file mode 100644
index 0000000..c1980f6
--- /dev/null
+++ b/src/main/java/net/hypple/EasyAPI/Regions/PlayerEnterRegionEvent.java
@@ -0,0 +1,52 @@
+package net.hypple.EasyAPI.Regions;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class PlayerEnterRegionEvent extends Event {
+
+ private static final HandlerList handlers = new HandlerList();
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ private Region from;
+ private Region to;
+ private Player player;
+ private boolean isCanceled;
+
+ public PlayerEnterRegionEvent(Player player, Region from, Region to, boolean isCanceled) {
+ this.from = from;
+ this.to = to;
+ this.player = player;
+ this.isCanceled = isCanceled;
+ }
+
+ public Region getFrom() {
+ return from;
+ }
+
+ public Region getTo() {
+ return to;
+ }
+
+ public Player getPlayer() {
+ return player;
+ }
+
+ public boolean isCanceled() {
+ return isCanceled;
+ }
+
+ public void setCanceled(boolean isCanceled) {
+ this.isCanceled = isCanceled;
+ }
+
+
+}
diff --git a/src/main/java/net/hypple/EasyAPI/Regions/PlayerExitRegionEvent.java b/src/main/java/net/hypple/EasyAPI/Regions/PlayerExitRegionEvent.java
new file mode 100644
index 0000000..de2728c
--- /dev/null
+++ b/src/main/java/net/hypple/EasyAPI/Regions/PlayerExitRegionEvent.java
@@ -0,0 +1,52 @@
+package net.hypple.EasyAPI.Regions;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class PlayerExitRegionEvent extends Event {
+
+ private static final HandlerList handlers = new HandlerList();
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ private Region from;
+ private Region to;
+ private Player player;
+ private boolean isCanceled;
+
+ public PlayerExitRegionEvent(Player player, Region from, Region to, boolean isCanceled) {
+ this.from = from;
+ this.to = to;
+ this.player = player;
+ this.isCanceled = isCanceled;
+ }
+
+ public Region getFrom() {
+ return from;
+ }
+
+ public Region getTo() {
+ return to;
+ }
+
+ public Player getPlayer() {
+ return player;
+ }
+
+ public boolean isCanceled() {
+ return isCanceled;
+ }
+
+ public void setCanceled(boolean isCanceled) {
+ this.isCanceled = isCanceled;
+ }
+
+
+}
diff --git a/src/main/java/net/hypple/EasyAPI/Regions/Region.java b/src/main/java/net/hypple/EasyAPI/Regions/Region.java
new file mode 100644
index 0000000..ba92797
--- /dev/null
+++ b/src/main/java/net/hypple/EasyAPI/Regions/Region.java
@@ -0,0 +1,51 @@
+package net.hypple.EasyAPI.Regions;
+
+import org.bukkit.Location;
+
+public class Region {
+
+ private String name;
+ private Location location_0;
+ private Location location_1;
+
+ public Region(String regionName, Location location_0, Location location_1) {
+ this.name = regionName;
+ sortLocations(location_0, location_1);
+ }
+
+ private void sortLocations(Location loc1, Location loc2) {
+ location_0 = new Location(loc1.getWorld(), Math.min(loc1.getX(), loc2.getX()), Math.min(loc1.getY(), loc2.getY()), Math.min(loc1.getZ(), loc2.getZ()));
+ location_1 = new Location(loc1.getWorld(), Math.max(loc1.getX(), loc2.getX()), Math.max(loc1.getY(), loc2.getY()), Math.max(loc1.getZ(), loc2.getZ()));
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Location getLocation_0() {
+ return location_0;
+ }
+
+ public void setLocation_0(Location location_0) {
+ sortLocations(location_0, location_1);
+ }
+
+ public Location getLocation_1() {
+ return location_1;
+ }
+
+ public void setLocation_1(Location location_1) {
+ sortLocations(location_0, location_1);
+ }
+
+ public boolean isInRegion(Location location) {
+ boolean isInX = location.getX() >= location_0.getX() && location.getX() <= location_1.getX();
+ boolean isInY = location.getY() >= location_0.getY() && location.getY() <= location_1.getY();
+ boolean isInZ = location.getZ() >= location_0.getZ() && location.getZ() <= location_1.getZ();
+ return isInX && isInY && isInZ;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/hypple/EasyAPI/Regions/Regions.java b/src/main/java/net/hypple/EasyAPI/Regions/Regions.java
new file mode 100644
index 0000000..3151788
--- /dev/null
+++ b/src/main/java/net/hypple/EasyAPI/Regions/Regions.java
@@ -0,0 +1,52 @@
+package net.hypple.EasyAPI.Regions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.bukkit.Location;
+
+public class Regions {
+
+ private static List regionsList = new ArrayList<>();
+
+ public static void addRegion(Region region) {
+ regionsList.add(region);
+ }
+
+ public static void deleteRegion(Region region) {
+ regionsList.remove(region);
+ }
+
+ public static List getRegionsByName(String name) {
+ List reg = new ArrayList<>();
+ for(Region region : regionsList) {
+ if(region.getName().equals(name)) {
+ reg.add(region);
+ }
+ }
+ return reg;
+ }
+
+ public static List getRegions() {
+ return regionsList;
+ }
+
+ public static List getRegionsInLocation(Location loc) {
+ List reg = new ArrayList<>();
+ for(Region region : regionsList) {
+ if(region.isInRegion(loc)) {
+ reg.add(region);
+ }
+ }
+ return reg;
+ }
+
+ public static Region getRegionInLocation(Location loc) {
+ for(Region region : regionsList) {
+ if(region.isInRegion(loc)) {
+ return region;
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/net/hypple/EasyAPI/mysql/EasyMySQL.java b/src/main/java/net/hypple/EasyAPI/mysql/EasyMySQL.java
new file mode 100644
index 0000000..cbc0928
--- /dev/null
+++ b/src/main/java/net/hypple/EasyAPI/mysql/EasyMySQL.java
@@ -0,0 +1,93 @@
+package net.hypple.EasyAPI.mysql;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class EasyMySQL {
+
+ public Connection connection;
+
+ String host;
+ String database;
+ String username;
+ String password;
+
+ public EasyMySQL(String host, String database, String username, String password) {
+ this.host = host;
+ this.database = database;
+ this.username = username;
+ this.password = password;
+ }
+
+ public boolean CanConnect() {
+ if(GetConnection() != null) {
+ return true;
+ }
+ return false;
+ }
+
+ public static String mysql_real_escape_string(String str) {
+ if (str == null) {
+ return "";
+ }
+
+ if (str.replaceAll("[a-zA-Z0-9_!@#$%^&*()-=+~.;:,\\Q[\\E\\Q]\\E<>{}\\/? ]","").length() < 1) {
+ return str;
+ }
+
+ String clean_string = str;
+ clean_string = clean_string.replaceAll("\\\\", "\\\\\\\\");
+ clean_string = clean_string.replaceAll("\\n","\\\\n");
+ clean_string = clean_string.replaceAll("\\r", "\\\\r");
+ clean_string = clean_string.replaceAll("\\t", "\\\\t");
+ clean_string = clean_string.replaceAll("\\00", "\\\\0");
+ clean_string = clean_string.replaceAll("'", "\\\\'");
+ clean_string = clean_string.replaceAll("\\\"", "\\\\\"");
+ return clean_string;
+ }
+
+ public static String mysql_real_date_string(Date date) {
+ SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ return sdf.format(date);
+ }
+
+ public Connection GetConnection() {
+ if (connection != null) {
+ try {
+ if(connection.isClosed() || !connection.isValid(28800)) {
+ //Class.forName("com.mysql.jdbc.Driver");
+ connection = DriverManager.getConnection("jdbc:mysql://" + host + ":3306/" + database + "?useSSL=false&serverTimezone=UTC&tcpKeepAlive=true&autoReconnect=true", username, password);
+ }
+ return connection;
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ try{
+ //Class.forName("com.mysql.jdbc.Driver");
+ connection = DriverManager.getConnection("jdbc:mysql://" + host + ":3306/" + database + "?useSSL=false&serverTimezone=UTC&tcpKeepAlive=true&autoReconnect=true", username, password);
+ return connection;
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public void Update(Connection connection, String command) {
+ if (command == null) {
+ return;
+ }
+ try {
+ Statement st = connection.createStatement();
+ st.executeUpdate(command);
+ st.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/target/classes/net/hypple/EasyAPI/Bungee/Bungee.class b/target/classes/net/hypple/EasyAPI/Bungee/Bungee.class
new file mode 100644
index 0000000..e737479
Binary files /dev/null and b/target/classes/net/hypple/EasyAPI/Bungee/Bungee.class differ
diff --git a/target/classes/net/hypple/EasyAPI/EasyAPI.class b/target/classes/net/hypple/EasyAPI/EasyAPI.class
new file mode 100644
index 0000000..948c163
Binary files /dev/null and b/target/classes/net/hypple/EasyAPI/EasyAPI.class differ
diff --git a/target/classes/net/hypple/EasyAPI/Json/JsonManager.class b/target/classes/net/hypple/EasyAPI/Json/JsonManager.class
new file mode 100644
index 0000000..81e81b6
Binary files /dev/null and b/target/classes/net/hypple/EasyAPI/Json/JsonManager.class differ
diff --git a/target/classes/net/hypple/EasyAPI/Main.class b/target/classes/net/hypple/EasyAPI/Main.class
new file mode 100644
index 0000000..626d6a7
Binary files /dev/null and b/target/classes/net/hypple/EasyAPI/Main.class differ
diff --git a/target/classes/net/hypple/EasyAPI/RGB/HexColors.class b/target/classes/net/hypple/EasyAPI/RGB/HexColors.class
new file mode 100644
index 0000000..9b557cd
Binary files /dev/null and b/target/classes/net/hypple/EasyAPI/RGB/HexColors.class differ
diff --git a/target/classes/net/hypple/EasyAPI/Regions/BukkitPlayerMoveEvent.class b/target/classes/net/hypple/EasyAPI/Regions/BukkitPlayerMoveEvent.class
new file mode 100644
index 0000000..04e188c
Binary files /dev/null and b/target/classes/net/hypple/EasyAPI/Regions/BukkitPlayerMoveEvent.class differ
diff --git a/target/classes/net/hypple/EasyAPI/Regions/PlayerEnterRegionEvent.class b/target/classes/net/hypple/EasyAPI/Regions/PlayerEnterRegionEvent.class
new file mode 100644
index 0000000..da93ceb
Binary files /dev/null and b/target/classes/net/hypple/EasyAPI/Regions/PlayerEnterRegionEvent.class differ
diff --git a/target/classes/net/hypple/EasyAPI/Regions/PlayerExitRegionEvent.class b/target/classes/net/hypple/EasyAPI/Regions/PlayerExitRegionEvent.class
new file mode 100644
index 0000000..4e71fe4
Binary files /dev/null and b/target/classes/net/hypple/EasyAPI/Regions/PlayerExitRegionEvent.class differ
diff --git a/target/classes/net/hypple/EasyAPI/Regions/Region.class b/target/classes/net/hypple/EasyAPI/Regions/Region.class
new file mode 100644
index 0000000..2545246
Binary files /dev/null and b/target/classes/net/hypple/EasyAPI/Regions/Region.class differ
diff --git a/target/classes/net/hypple/EasyAPI/Regions/Regions.class b/target/classes/net/hypple/EasyAPI/Regions/Regions.class
new file mode 100644
index 0000000..fb109d1
Binary files /dev/null and b/target/classes/net/hypple/EasyAPI/Regions/Regions.class differ
diff --git a/target/classes/net/hypple/EasyAPI/mysql/EasyMySQL.class b/target/classes/net/hypple/EasyAPI/mysql/EasyMySQL.class
new file mode 100644
index 0000000..7df275b
Binary files /dev/null and b/target/classes/net/hypple/EasyAPI/mysql/EasyMySQL.class differ