Optionals introduced, code cleaned, potential purge fix

This commit is contained in:
MattBDev
2016-04-01 19:14:46 -04:00
parent 3edfd39af9
commit 8243e0118a
42 changed files with 361 additions and 427 deletions

View File

@ -76,10 +76,6 @@ import java.util.Collection;
import java.util.List;
import java.util.UUID;
/**
* Created by robin on 01/11/2014
*/
@Plugin(id = "com.plotsquared", name = "PlotSquared", description = "Easy, yet powerful Plot World generation and management.", url = "https://github.com/IntellectualSites/PlotSquared", version = "3.3.3")
public class SpongeMain implements IPlotMain {
public static SpongeMain THIS;
@ -169,7 +165,7 @@ public class SpongeMain implements IPlotMain {
@Override
public int[] getPluginVersion() {
PluginContainer plugin = this.game.getPluginManager().fromInstance(this).get();
String version = plugin.getVersion().get();
String version = plugin.getVersion().orElse("");
String[] split = version.split("\\.");
return new int[]{Integer.parseInt(split[0]), Integer.parseInt(split[1]), split.length == 3 ? Integer.parseInt(split[2]) : 0};
}

View File

@ -22,7 +22,7 @@ public class SpongeChatManager extends ChatManager<Text.Builder> {
}
@Override
public void color(final PlotMessage m, final String color) {
public void color(PlotMessage m, String color) {
TextColor tc = null;
TextStyle ts = null;
switch (color.charAt(1)) {
@ -114,10 +114,10 @@ public class SpongeChatManager extends ChatManager<Text.Builder> {
}
@Override
public void tooltip(final PlotMessage m, final PlotMessage... tooltips) {
final Text.Builder builder = Text.builder();
public void tooltip(PlotMessage m, PlotMessage... tooltips) {
Text.Builder builder = Text.builder();
boolean lb = false;
for (final PlotMessage tooltip : tooltips) {
for (PlotMessage tooltip : tooltips) {
if (lb) {
builder.append(Text.of("\n"));
}
@ -128,18 +128,18 @@ public class SpongeChatManager extends ChatManager<Text.Builder> {
}
@Override
public void command(final PlotMessage m, final String command) {
public void command(PlotMessage m, String command) {
apply(m, getChild(m).onClick(TextActions.runCommand(command)));
}
@Override
public void text(final PlotMessage m, final String text) {
public void text(PlotMessage m, String text) {
m.$(this).append(SpongeUtil.getText(text));
}
@Override
public void send(final PlotMessage m, final PlotPlayer player) {
if (ConsolePlayer.isConsole(player)) {
public void send(PlotMessage m, PlotPlayer player) {
if (player instanceof ConsolePlayer) {
player.sendMessage(m.$(this).build().toPlain());
} else {
((SpongePlayer) player).player.sendMessage(m.$(this).build());
@ -147,7 +147,7 @@ public class SpongeChatManager extends ChatManager<Text.Builder> {
}
@Override
public void suggest(final PlotMessage m, final String command) {
public void suggest(PlotMessage m, String command) {
apply(m, getChild(m).onClick(TextActions.suggestCommand(command)));
}
}