mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
More work on commands
This commit is contained in:
@ -3,9 +3,8 @@ package com.boydti.fawe.util.chat;
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Message {
|
||||
@ -24,10 +23,6 @@ public class Message {
|
||||
active = !(Fawe.get().getChatManager() instanceof PlainChatManager);
|
||||
}
|
||||
|
||||
public Message(BBC caption, Object... args) {
|
||||
this(BBC.getPrefix() + caption.format(args));
|
||||
}
|
||||
|
||||
public Message(String text) {
|
||||
this();
|
||||
text(text);
|
||||
@ -41,13 +36,6 @@ public class Message {
|
||||
return (T) (this.builder = manager.builder());
|
||||
}
|
||||
|
||||
public Message activeText(String text) {
|
||||
if (active) {
|
||||
text(text);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean supportsInteraction() {
|
||||
return active;
|
||||
}
|
||||
@ -56,7 +44,7 @@ public class Message {
|
||||
return text(caption.format(args));
|
||||
}
|
||||
|
||||
public Message text(java.io.Serializable text) {
|
||||
public Message text(Serializable text) {
|
||||
Fawe.get().getChatManager().text(this, BBC.color(Objects.toString(text)));
|
||||
return this;
|
||||
}
|
||||
@ -76,14 +64,10 @@ public class Message {
|
||||
}
|
||||
|
||||
public Message command(String command) {
|
||||
Fawe.get().getChatManager().command(this, ("/") + command);
|
||||
Fawe.get().getChatManager().command(this, "/" + command);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Message prefix() {
|
||||
return text(BBC.getPrefix());
|
||||
}
|
||||
|
||||
public Message newline() {
|
||||
return text("\n");
|
||||
}
|
||||
@ -98,8 +82,8 @@ public class Message {
|
||||
|
||||
public Message cmdOptions(String prefix, String suffix, String... options) {
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
if (i != 0) text(" &8|&7 ");
|
||||
text("&7[&a" + options[i] + "&7]")
|
||||
if (i != 0) text(" | ");
|
||||
text("[" + options[i] + "]")
|
||||
.cmdTip(prefix + options[i] + suffix);
|
||||
}
|
||||
return this;
|
||||
@ -114,11 +98,6 @@ public class Message {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Message color(String color) {
|
||||
Fawe.get().getChatManager().color(this, BBC.color(color));
|
||||
return this;
|
||||
}
|
||||
|
||||
public void send(Actor player) {
|
||||
send(FawePlayer.wrap(player));
|
||||
}
|
||||
@ -129,19 +108,19 @@ public class Message {
|
||||
|
||||
public Message paginate(String baseCommand, int page, int totalPages) {
|
||||
if (!active) {
|
||||
return text(BBC.PAGE_FOOTER.f(baseCommand, page + 1));
|
||||
return text(BBC.PAGE_FOOTER.format(baseCommand, page + 1));
|
||||
}
|
||||
if (page < totalPages && page > 1) { // Back | Next
|
||||
this.text("&f<<").command(baseCommand + " " + (page - 1)).text("&8 | ").text("&f>>")
|
||||
this.text("<<").command(baseCommand + " " + (page - 1)).text(" | ").text(">>")
|
||||
.command(baseCommand + " " + (page + 1));
|
||||
} else if (page <= 1 && totalPages > page) { // Next
|
||||
this.text("&8 -").text(" | ").text("&f>>")
|
||||
this.text(" -").text(" | ").text(">>")
|
||||
.command(baseCommand + " " + (page + 1));
|
||||
|
||||
} else if (page == totalPages && totalPages > 1) { // Back
|
||||
this.text("&f<<").command(baseCommand + " " + (page - 1)).text("&8 | ").text("- ");
|
||||
this.text("<<").command(baseCommand + " " + (page - 1)).text(" | ").text("- ");
|
||||
} else {
|
||||
this.text("&8 - | - ");
|
||||
this.text(" - | - ");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user