Update 1.1.2

This commit is contained in:
JernejTDO
2022-05-03 16:14:46 +02:00
parent a7086e054c
commit 11987ddde2
5 changed files with 26 additions and 12 deletions

View File

@@ -16,7 +16,7 @@ Create a region
- First you need to make to make 2 locations. - First you need to make to make 2 locations.
- Create the region. - Create the region.
- Last step add the region to the list. - Last step add the region to the list.
```sh ```java
Location loc1 = new Location(Bukkit.getWorld("<World Name>"), 0, 0, 0); Location loc1 = new Location(Bukkit.getWorld("<World Name>"), 0, 0, 0);
Location loc2 = new Location(Bukkit.getWorld("<World Name>"), 0, 0, 0); Location loc2 = new Location(Bukkit.getWorld("<World Name>"), 0, 0, 0);
Region region = new Region("<Region Name>", loc1, loc2); Region region = new Region("<Region Name>", loc1, loc2);
@@ -26,7 +26,7 @@ Regions.addRegion(region);
Region Events Region Events
- PlayerEnterRegionEvent - When a player joins the region. - PlayerEnterRegionEvent - When a player joins the region.
- PlayerExitRegionEvent - When a player leaves a region. - PlayerExitRegionEvent - When a player leaves a region.
```sh ```java
@EventHandler @EventHandler
public void regionEnter(PlayerEnterRegionEvent event) { public void regionEnter(PlayerEnterRegionEvent event) {
} }
@@ -37,7 +37,7 @@ public void Region(PlayerExitRegionEvent event) {
``` ```
Get info of region. Get info of region.
```sh ```java
Region region = null; //Your region Region region = null; //Your region
Location loc = null; //Bukkit location Location loc = null; //Bukkit location
@@ -50,7 +50,7 @@ Regions.getRegionsInLocation(loc); //List of all the regions in that location.
``` ```
## Json Manager ## Json Manager
You need to use Google`s json dependency. You need to use Google`s json dependency.
```sh ```html
<dependency> <dependency>
<groupId>com.googlecode.json-simple</groupId> <groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId> <artifactId>json-simple</artifactId>
@@ -59,7 +59,7 @@ You need to use Google`s json dependency.
``` ```
Json Features Json Features
```sh ```java
import net.hypple.EasyAPI.Json.JsonManager; import net.hypple.EasyAPI.Json.JsonManager;
JsonManager.createJsonFile("<File Name>"); JsonManager.createJsonFile("<File Name>");
@@ -70,7 +70,7 @@ JsonManager.updateJsonBody("<File Name>", JSONObject);
## MySQL ## MySQL
Connect to database. Connect to database.
_put in onEnable()_ _put in onEnable()_
```sh ```java
@Override @Override
public void onEnable() { public void onEnable() {
EasyAPI.setupMySQL("Host", "Data Base", "Username", "Password"); EasyAPI.setupMySQL("Host", "Data Base", "Username", "Password");
@@ -78,7 +78,7 @@ public void onEnable() {
``` ```
You need to install this dependency You need to install this dependency
```sh ```yml
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
@@ -87,14 +87,14 @@ You need to install this dependency
``` ```
Get the connection to data base. Get the connection to data base.
```sh ```java
EasyAPI.mysql.GetConnection(); EasyAPI.getMySQL().GetConnection();
``` ```
## Hex Coler Codes ## Hex Coler Codes
Its for the version 1.16+ that support RGB. You can you this on spigot and Bungee servers. 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_ _You just need to put the & symbol in front of the hex code_
```sh ```java
Player player = null; //Your player Player player = null; //Your player
player.sendMessage(HexColors.replaceHexCodes("&#00f2ff message in your coler.")); player.sendMessage(HexColors.replaceHexCodes("&#00f2ff message in your coler."));
``` ```

5
plugin.yml Normal file
View File

@@ -0,0 +1,5 @@
name: EasyAPI
main: net.hypple.EasyAPI.EasyAPI
version: 1.1.1
api-version: 1.18
authors: [JernejTDO, alandioda]

View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>net.hypple</groupId> <groupId>net.hypple</groupId>
<artifactId>EasyAPI</artifactId> <artifactId>EasyAPI</artifactId>
<version>1.1.1</version> <version>1.1.2</version>
<name>EasyAPI</name> <name>EasyAPI</name>
<repositories> <repositories>

View File

@@ -15,7 +15,7 @@ import net.md_5.bungee.api.ChatColor;
public class EasyAPI extends JavaPlugin { public class EasyAPI extends JavaPlugin {
private static EasyAPI plugin; private static EasyAPI plugin;
public static EasyMySQL mysql; private static EasyMySQL mysql;
@Override @Override
public void onEnable() { public void onEnable() {
@@ -46,6 +46,10 @@ public class EasyAPI extends JavaPlugin {
return plugin; return plugin;
} }
public static EasyMySQL getMySQL() {
return mysql;
}
private static void defaultFile() { private static void defaultFile() {
JsonManager.createJsonFile("EasyAPI"); JsonManager.createJsonFile("EasyAPI");
} }
@@ -53,5 +57,10 @@ public class EasyAPI extends JavaPlugin {
public static void createPluginConfig(Plugin plugin) { public static void createPluginConfig(Plugin plugin) {
JsonManager.createJsonFile(plugin.getName()); JsonManager.createJsonFile(plugin.getName());
} }
public static void setupMySQL(String host, String dataBase, String username, String password) {
Bukkit.getConsoleSender().sendMessage(ChatColor.of(new Color(51,255,255))+"EasyAPI <20>7- "+ChatColor.of(new Color(0,255,0))+"connecting to database.");
mysql = new EasyMySQL(host, dataBase, username, password);
}
} }