Reamme
This commit is contained in:
13
README.md
13
README.md
@@ -5,6 +5,19 @@ authors:
|
|||||||
- JernejTDO
|
- JernejTDO
|
||||||
- alandioda (made regions)
|
- alandioda (made regions)
|
||||||
|
|
||||||
|
```html
|
||||||
|
<repository>
|
||||||
|
<id>maven-releases</id>
|
||||||
|
<url>http://jernejtdo.si:8081/repository/maven-releases/</url>
|
||||||
|
</repository>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.hypple</groupId>
|
||||||
|
<artifactId>EasyAPI</artifactId>
|
||||||
|
<version>1.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- Regions (Create regions and use their system)
|
- Regions (Create regions and use their system)
|
||||||
- Json File manager (Save files, get body and option to create them)
|
- Json File manager (Save files, get body and option to create them)
|
||||||
|
|||||||
@@ -1,18 +1,38 @@
|
|||||||
package net.hypple.EasyAPI.Bungee;
|
package net.hypple.EasyAPI.Bungee;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataOutput;
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
|
|
||||||
import net.hypple.EasyAPI.EasyAPI;
|
import net.hypple.EasyAPI.EasyAPI;
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
|
||||||
public class Bungee {
|
public class Bungee {
|
||||||
|
|
||||||
|
private static List<String> channels = new ArrayList<>();
|
||||||
|
|
||||||
public static void sendPlayerToServer(Player player, String server) {
|
public static void sendPlayerToServer(Player player, String server) {
|
||||||
ByteArrayDataOutput byteArrayDataOutput = ByteStreams.newDataOutput();
|
ByteArrayDataOutput byteArrayDataOutput = ByteStreams.newDataOutput();
|
||||||
byteArrayDataOutput.writeUTF("Connect");
|
byteArrayDataOutput.writeUTF("Connect");
|
||||||
byteArrayDataOutput.writeUTF(server);
|
byteArrayDataOutput.writeUTF(server);
|
||||||
player.sendPluginMessage(EasyAPI.getInstance(), "BungeeCord", byteArrayDataOutput.toByteArray());
|
player.sendPluginMessage(EasyAPI.getInstance(), "BungeeCord", byteArrayDataOutput.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerPluginChannel(String channelName) {
|
||||||
|
if(!channels.contains(channelName)) {
|
||||||
|
channels.add(channelName);
|
||||||
|
EasyAPI.getInstance().getServer().getMessenger().registerOutgoingPluginChannel(EasyAPI.getInstance(), channelName);
|
||||||
|
Bukkit.getConsoleSender().sendMessage(ChatColor.of(new Color(51,255,255))+"EasyAPI <20>7- "+ChatColor.of(new Color(0,255,0))+"plugin channel "+channelName+" is registerd.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendPluginMessage(Player player, ByteArrayDataOutput byteArrayDataOutput, String channel) {
|
||||||
|
player.sendPluginMessage(EasyAPI.getInstance(), channel, byteArrayDataOutput.toByteArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import net.hypple.EasyAPI.Bungee.Bungee;
|
||||||
import net.hypple.EasyAPI.Json.JsonManager;
|
import net.hypple.EasyAPI.Json.JsonManager;
|
||||||
import net.hypple.EasyAPI.Regions.BukkitPlayerMoveEvent;
|
import net.hypple.EasyAPI.Regions.BukkitPlayerMoveEvent;
|
||||||
import net.hypple.EasyAPI.mysql.EasyMySQL;
|
import net.hypple.EasyAPI.mysql.EasyMySQL;
|
||||||
@@ -25,9 +26,9 @@ public class EasyAPI extends JavaPlugin {
|
|||||||
createFolder();
|
createFolder();
|
||||||
defaultFile();
|
defaultFile();
|
||||||
|
|
||||||
|
Bungee.registerPluginChannel("BungeeCord");
|
||||||
|
|
||||||
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
Bukkit.getPluginManager().registerEvents(new BukkitPlayerMoveEvent(), plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(new BukkitPlayerMoveEvent(), plugin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createFolder() {
|
private void createFolder() {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user