SubServers v2.11.2i & SubServers.Host v1.11.2a

This commit is contained in:
ME1312 2017-04-03 13:08:00 -04:00
parent 78cb8f9d39
commit e22e669b78
12 changed files with 39 additions and 30 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,4 +2,4 @@ Manifest-Version: 1.0
Class-Path: BungeeCord.jar
Main-Class: net.ME1312.SubServers.Bungee.Launch
Implementation-Version: 2.11.2i
Specification-Version: 2
Specification-Version: 0

View File

@ -270,8 +270,8 @@ public class InternalSubCreator extends SubCreator {
settings.set("Use-Title-Messages", true);
YAMLSection subdata = new YAMLSection();
subdata.set("Name", name);
subdata.set("Address", host.plugin.config.get().getSection("Settings").getSection("SubData").getRawString("Address"));
subdata.set("Password", host.plugin.config.get().getSection("Settings").getSection("SubData").getRawString("Password"));
subdata.set("Address", host.plugin.config.get().getSection("Settings").getSection("SubData").getRawString("Address", "127.0.0.1").replace("0.0.0.0", "127.0.0.1"));
subdata.set("Password", host.plugin.config.get().getSection("Settings").getSection("SubData").getRawString("Password", ""));
settings.set("SubData", subdata);
config.get().set("Settings", settings);
config.save();

View File

@ -17,14 +17,11 @@ if [ -z "$2" ]
exit 1
fi
function __DL() {
if [ hash curl 2>/dev/null ]; then
curl -o $1 $2; return $?
fi
if [ hash wget 2>/dev/null ]; then
wget -o $1 $2; return $?
else
curl -o $1 $2; return $?
fi
echo Could not find a suitable download command: Please install curl or wget
exit 1;
}
if [ $2 == bukkit ] || [ $2 == spigot ]; then
echo Downloading Buildtools...

View File

@ -36,11 +36,16 @@ public final class SubDataServer {
* @throws IOException
*/
public SubDataServer(SubPlugin plugin, int port, int backlog, InetAddress address) throws IOException {
if (Util.isNull(plugin, port, backlog, address)) throw new NullPointerException();
server = new ServerSocket(port, backlog, address);
if (Util.isNull(plugin, port, backlog)) throw new NullPointerException();
if (address == null) {
server = new ServerSocket(port, backlog);
allowConnection(InetAddress.getByName("127.0.0.1"));
} else {
server = new ServerSocket(port, backlog, address);
allowConnection(address);
}
this.plugin = plugin;
allowConnection(address);
if (!defaults) loadDefaults();
}

View File

@ -172,8 +172,8 @@ public final class SubPlugin extends BungeeCord {
config = new YAMLConfig(new UniversalFile(dir, "SubServers:config.yml"));
lang = new YAMLConfig(new UniversalFile(dir, "SubServers:lang.yml"));
subdata = new SubDataServer(this, Integer.parseInt(config.get().getSection("Settings").getSection("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1]), 10,
InetAddress.getByName(config.get().getSection("Settings").getSection("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]));
System.out.println("SubServers > SubData Listening on " + subdata.getServer().getLocalSocketAddress().toString());
(config.get().getSection("Settings").getSection("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0].equals("0.0.0.0"))?null:InetAddress.getByName(config.get().getSection("Settings").getSection("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]));
System.out.println("SubServers > SubData Listening on /" + config.get().getSection("Settings").getSection("SubData").getRawString("Address", "127.0.0.1:4391"));
loop();
int hosts = 0;

View File

@ -8,6 +8,7 @@ import net.ME1312.SubServers.Client.Bukkit.Network.Packet.PacketCreateServer;
import net.ME1312.SubServers.Client.Bukkit.SubPlugin;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.scheduler.BukkitTask;
import java.util.*;
@ -17,7 +18,8 @@ import java.util.*;
public abstract class UIRenderer {
protected static HashMap<String, Renderer> hostPlugins = new HashMap<String, Renderer>();
protected static HashMap<String, Renderer> subserverPlugins = new HashMap<String, Renderer>();
private NamedContainer<String, Integer> downloading = null;
private NamedContainer<String, Integer> tdownload = null;
private BukkitTask download = null;
private final UUID player;
private SubPlugin plugin;
@ -123,23 +125,26 @@ public abstract class UIRenderer {
*/
public void setDownloading(String subtitle) {
if (subtitle != null && !(Bukkit.getPluginManager().getPlugin("TitleManager") != null && plugin.config.get().getSection("Settings").getBoolean("Use-Title-Messages", true))) {
Bukkit.getPlayer(player).sendMessage(plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Downloading", '&').replace("$str$", subtitle));
} if (subtitle != null && downloading == null) {
downloading = new NamedContainer<String, Integer>(subtitle, 0);
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
Bukkit.getPlayer(player).sendMessage(plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Downloading", '&').replace("$str$", subtitle));
download = null;
}, 30L);
} if (subtitle != null && tdownload == null) {
tdownload = new NamedContainer<String, Integer>(subtitle, 0);
final Container<Integer> delay = new Container<Integer>(0);
Bukkit.getScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
if (downloading != null) {
if (tdownload != null) {
String word = ChatColor.stripColor(plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Downloading.Title", '&'));
int i = 0;
int start = (downloading.get() - 3 < 0)?0:downloading.get()-3;
int end = (downloading.get() >= word.length())?word.length():downloading.get();
int start = (tdownload.get() - 3 < 0)?0: tdownload.get()-3;
int end = (tdownload.get() >= word.length())?word.length(): tdownload.get();
String str = plugin.lang.getSection("Lang").getColoredString((delay.get() > 7 && start == 0)?"Interface.Generic.Downloading.Title-Color-Alt":"Interface.Generic.Downloading.Title-Color", '&');
delay.set(delay.get() + 1);
if (delay.get() > 7) downloading.set(downloading.get() + 1);
if (downloading.get() >= word.length() + 3) {
downloading.set(0);
if (delay.get() > 7) tdownload.set(tdownload.get() + 1);
if (tdownload.get() >= word.length() + 3) {
tdownload.set(0);
delay.set(0);
}
@ -150,7 +155,7 @@ public abstract class UIRenderer {
if (i == end) str += plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Downloading.Title-Color", '&');
}
str += '\n' + plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Downloading.Title-Color-Alt", '&') + downloading.name();
str += '\n' + plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Downloading.Title-Color-Alt", '&') + tdownload.name();
sendTitle(str, 0, 10, 5);
Bukkit.getScheduler().runTaskLater(plugin, this, 1);
} else {
@ -159,9 +164,11 @@ public abstract class UIRenderer {
}
});
} else if (subtitle != null) {
downloading.rename(subtitle);
} else if (downloading != null) {
downloading = null;
tdownload.rename(subtitle);
} else if (tdownload != null) {
tdownload = null;
if (download != null) download.cancel();
download = null;
}
}

View File

@ -289,7 +289,7 @@ public class SubCreator {
writer.println("enable-rcon=false");
writer.println("level-seed=");
writer.println("force-gamemode=false");
writer.println("server-ip=" + host.subdata.getClient().getLocalAddress().toString().substring(1));
writer.println("server-ip=" + host.config.get().getSection("Settings").getRawString("Server-Bind"));
writer.println("network-compression-threshold=-1");
writer.println("max-build-height=256");
writer.println("spawn-npcs=true");

View File

@ -1,6 +1,7 @@
Settings:
Version: '2.11.2a+'
Log: true
Server-Bind: '127.0.0.1'
SubData:
Name: 'undefined'
Address: '127.0.0.1:4391'

View File

@ -1,6 +1,5 @@
package net.ME1312.SubServers.Host;
import net.ME1312.SubServers.Host.API.Command;
import net.ME1312.SubServers.Host.API.Event.CommandPreProcessEvent;
import net.ME1312.SubServers.Host.API.Event.SubDisableEvent;
import net.ME1312.SubServers.Host.API.Event.SubEnableEvent;
@ -45,7 +44,7 @@ public final class SubServers {
public SubDataClient subdata = null;
public final Version version = new Version("2.11.2a");
public final Version bversion = new Version(3);
public final Version bversion = null;
public final SubAPI api = new SubAPI(this);
private boolean running;