mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 02:08:27 +01:00
Update SubServers.Console
This commit is contained in:
parent
dfa37c9022
commit
f4a78fc7b0
@ -59,12 +59,12 @@ public final class SubPlugin extends JavaPlugin {
|
||||
}
|
||||
if (!(new UniversalFile(getDataFolder(), "config.yml").exists())) {
|
||||
Util.copyFromJar(SubPlugin.class.getClassLoader(), "config.yml", new UniversalFile(getDataFolder(), "config.yml").getPath());
|
||||
Bukkit.getLogger().info("SubServers > Created ~/plugins/SubServers/config.yml");
|
||||
Bukkit.getLogger().info("SubServers > Created ~/plugins/SubServers-Client-Bukkit/config.yml");
|
||||
} else if ((new Version((new YAMLConfig(new UniversalFile(getDataFolder(), "config.yml"))).get().getSection("Settings").getString("Version", "0")).compareTo(new Version("2.11.2a+"))) != 0) {
|
||||
Files.move(new UniversalFile(getDataFolder(), "config.yml").toPath(), new UniversalFile(getDataFolder(), "config.old" + Math.round(Math.random() * 100000) + ".yml").toPath());
|
||||
|
||||
Util.copyFromJar(SubPlugin.class.getClassLoader(), "config.yml", new UniversalFile(getDataFolder(), "config.yml").getPath());
|
||||
Bukkit.getLogger().info("SubServers > Updated ~/plugins/SubServers/config.yml");
|
||||
Bukkit.getLogger().info("SubServers > Updated ~/plugins/SubServers-Client-Bukkit/config.yml");
|
||||
}
|
||||
config = new YAMLConfig(new UniversalFile(getDataFolder(), "config.yml"));
|
||||
if (new UniversalFile(new File(System.getProperty("user.dir")), "subservers.client").exists()) {
|
||||
|
@ -84,12 +84,12 @@ public final class SubPlugin {
|
||||
}
|
||||
if (!(new UniversalFile(dir, "config.yml").exists())) {
|
||||
Util.copyFromJar(SubPlugin.class.getClassLoader(), "config.yml", new UniversalFile(dir, "config.yml").getPath());
|
||||
logger.info("Created ~/plugins/SubServers/config.yml");
|
||||
logger.info("Created ~/config/subservers-client-sponge/config.yml");
|
||||
} else if ((new Version((new YAMLConfig(new UniversalFile(dir, "config.yml"))).get().getSection("Settings").getString("Version", "0")).compareTo(new Version("2.11.2a+"))) != 0) {
|
||||
Files.move(new UniversalFile(dir, "config.yml").toPath(), new UniversalFile(dir, "config.old" + Math.round(Math.random() * 100000) + ".yml").toPath());
|
||||
|
||||
Util.copyFromJar(SubPlugin.class.getClassLoader(), "config.yml", new UniversalFile(dir, "config.yml").getPath());
|
||||
logger.info("Updated ~/plugins/SubServers/config.yml");
|
||||
logger.info("Updated ~/config/subservers-client-sponge/config.yml");
|
||||
}
|
||||
config = new YAMLConfig(new UniversalFile(dir, "config.yml"));
|
||||
if (new UniversalFile(new File(System.getProperty("user.dir")), "subservers.client").exists()) {
|
||||
|
@ -49,6 +49,15 @@
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>ideauidesigner-maven-plugin</artifactId>
|
||||
@ -66,15 +75,6 @@
|
||||
<failOnError>true</failOnError>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: SubServers-Console
|
||||
main: net.ME1312.SubServers.Console.ConsolePlugin
|
||||
version: 2.12.1a
|
||||
version: 2.13.2a
|
||||
author: ME1312
|
@ -356,8 +356,6 @@ public final class ConsoleWindow implements SubLogFilter {
|
||||
if (logger.getHandler() instanceof SubServer && input.getText().length() > 0 && !input.getText().equals(">")) {
|
||||
if (((SubServer) logger.getHandler()).command((input.getText().startsWith(">")) ? input.getText().substring(1) : input.getText())) {
|
||||
popup.commands.add((input.getText().startsWith(">")) ? input.getText().substring(1) : input.getText());
|
||||
popup.current = 0;
|
||||
popup.last = true;
|
||||
input.setText("");
|
||||
}
|
||||
}
|
||||
@ -376,9 +374,21 @@ public final class ConsoleWindow implements SubLogFilter {
|
||||
public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
|
||||
if (offset < 1) {
|
||||
length = Math.max(0, length - 1);
|
||||
offset = 1;
|
||||
offset = input.getDocument().getLength();
|
||||
input.setCaretPosition(offset);
|
||||
}
|
||||
|
||||
if (popup.history == Boolean.TRUE) {
|
||||
popup.history = null;
|
||||
} else if (popup.history == null) {
|
||||
popup.history = false;
|
||||
}
|
||||
|
||||
try {
|
||||
super.replace(fb, offset, length, text, attrs);
|
||||
} catch (BadLocationException e) {
|
||||
super.replace(fb, 1, length, text, attrs);
|
||||
}
|
||||
super.replace(fb, offset, length, text, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -664,8 +674,9 @@ public final class ConsoleWindow implements SubLogFilter {
|
||||
|
||||
private class TextFieldPopup extends JPanel {
|
||||
protected LinkedList<String> commands = new LinkedList<String>();
|
||||
protected int current = 0;
|
||||
protected boolean last = true;
|
||||
protected Boolean history = false;
|
||||
protected int hpos = -1;
|
||||
protected String hcache = "";
|
||||
|
||||
public TextFieldPopup(JTextComponent field, boolean command) {
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
@ -738,11 +749,17 @@ public final class ConsoleWindow implements SubLogFilter {
|
||||
if (field.isEditable()) {
|
||||
LinkedList<String> list = new LinkedList<String>(commands);
|
||||
Collections.reverse(list);
|
||||
if (current > 0) {
|
||||
if (last && current != 1) current--;
|
||||
last = false;
|
||||
field.setText(list.get(--current));
|
||||
} else field.setText("");
|
||||
if (history == Boolean.FALSE) {
|
||||
hcache = (field.getText().startsWith(">"))?field.getText().substring(1):field.getText();
|
||||
hpos = -1;
|
||||
} else {
|
||||
hpos--;
|
||||
if (hpos < -1) hpos = -1;
|
||||
}
|
||||
if (hpos >= 0) {
|
||||
history = true;
|
||||
field.setText(list.get(hpos));
|
||||
} else field.setText(hcache);
|
||||
field.setCaretPosition(field.getText().length());
|
||||
}
|
||||
}
|
||||
@ -751,11 +768,16 @@ public final class ConsoleWindow implements SubLogFilter {
|
||||
if (field.isEditable()) {
|
||||
LinkedList<String> list = new LinkedList<String>(commands);
|
||||
Collections.reverse(list);
|
||||
if (list.size() > current) {
|
||||
if (!last) current++;
|
||||
last = true;
|
||||
field.setText(list.get(current++));
|
||||
field.setCaretPosition(field.getText().length());
|
||||
if (history == Boolean.FALSE) {
|
||||
hcache = (field.getText().startsWith(">"))?field.getText().substring(1):field.getText();
|
||||
hpos = 0;
|
||||
} else {
|
||||
hpos++;
|
||||
}
|
||||
if (hpos >= list.size()) hpos = list.size() - 1;
|
||||
if (hpos >= 0) {
|
||||
history = true;
|
||||
field.setText(list.get(hpos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ME1312.Galaxi</groupId>
|
||||
<artifactId>GalaxiEngine</artifactId>
|
||||
<version>18w43b</version>
|
||||
<version>18w43d</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -132,6 +132,7 @@ public final class ExHost {
|
||||
try {
|
||||
info = PluginInfo.getPluginInfo(this);
|
||||
info.setLogger(log);
|
||||
info.setIcon(ExHost.class.getResourceAsStream("/net/ME1312/SubServers/Host/Library/Files/icon.png"));
|
||||
engine = GalaxiEngine.init(info);
|
||||
log.info.println("Loading SubServers.Host v" + info.getVersion().toString() + " Libraries");
|
||||
if (!(new UniversalFile(engine.getRuntimeDirectory(), "config.yml").exists())) {
|
||||
@ -242,7 +243,7 @@ public final class ExHost {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error.println(e);
|
||||
stop();
|
||||
engine.stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.ME1312.SubServers.Host.Executable;
|
||||
|
||||
import net.ME1312.Galaxi.Library.Config.YAMLSection;
|
||||
import net.ME1312.Galaxi.Library.Container;
|
||||
import net.ME1312.Galaxi.Library.Log.LogStream;
|
||||
import net.ME1312.Galaxi.Library.Log.Logger;
|
||||
@ -104,10 +105,11 @@ public class SubLogger {
|
||||
}
|
||||
|
||||
// Log to NETWORK
|
||||
if (log.get() && SubAPI.getInstance().getInternals().config.get().getSection("Settings").getBoolean("Network-Log", true)) SubAPI.getInstance().getSubDataNetwork().sendPacket(new PacketOutExLogMessage(address, line));
|
||||
YAMLSection yaml = SubAPI.getInstance().getInternals().config.get().getSection("Settings");
|
||||
if (log.get() && yaml.getBoolean("Network-Log", true)) SubAPI.getInstance().getSubDataNetwork().sendPacket(new PacketOutExLogMessage(address, line));
|
||||
|
||||
// Log to CONSOLE
|
||||
if (log.get() && SubAPI.getInstance().getInternals().config.get().getSection("Settings").getBoolean("Console-Log", true)) level.println(TextColor.convertColor(msg));
|
||||
if (log.get() && yaml.getBoolean("Console-Log", true)) level.println(TextColor.convertColor(msg));
|
||||
|
||||
// Log to FILE
|
||||
if (writer != null) {
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Loading…
Reference in New Issue
Block a user