From de4beb8be470912791eb216daf21e7efbbcf706b Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 28 Jan 2016 15:28:44 +0100 Subject: [PATCH] Pager#messageAsync and remove space in niced enum. --- .../massivecraft/massivecore/pager/Pager.java | 14 ++++++++ .../massivecore/ps/PSFormatArgument.java | 36 +++++++++++++++++++ .../massivecraft/massivecore/util/Txt.java | 2 +- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 src/com/massivecraft/massivecore/ps/PSFormatArgument.java diff --git a/src/com/massivecraft/massivecore/pager/Pager.java b/src/com/massivecraft/massivecore/pager/Pager.java index cacf06dc..9ba76843 100644 --- a/src/com/massivecraft/massivecore/pager/Pager.java +++ b/src/com/massivecraft/massivecore/pager/Pager.java @@ -1,5 +1,6 @@ package com.massivecraft.massivecore.pager; +import com.massivecraft.massivecore.MassiveCore; import com.massivecraft.massivecore.command.MassiveCommand; import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mson.Mson; @@ -9,6 +10,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -267,4 +269,16 @@ public class Pager Mixin.messageOne(this.getSender(), messages); } + public void messageAsync() + { + Bukkit.getScheduler().runTaskAsynchronously(MassiveCore.get(), new Runnable() + { + @Override + public void run() + { + message(); + } + }); + } + } diff --git a/src/com/massivecraft/massivecore/ps/PSFormatArgument.java b/src/com/massivecraft/massivecore/ps/PSFormatArgument.java new file mode 100644 index 00000000..af2c5c4f --- /dev/null +++ b/src/com/massivecraft/massivecore/ps/PSFormatArgument.java @@ -0,0 +1,36 @@ +package com.massivecraft.massivecore.ps; + +public class PSFormatArgument extends PSFormatAbstract +{ + // -------------------------------------------- // + // INSTANCE & CONSTRUCT + // -------------------------------------------- // + + private static PSFormatArgument i = new PSFormatArgument(); + public static PSFormatArgument get() { return i; } + private PSFormatArgument() + { + super( + "null", + "", + false, + false, + PS.NAME_SERIALIZED_WORLD + ":%s", + PS.NAME_SERIALIZED_BLOCKX + ":%+d", + PS.NAME_SERIALIZED_BLOCKY + ":%+d", + PS.NAME_SERIALIZED_BLOCKZ + ":%+d", + PS.NAME_SERIALIZED_LOCATIONX + ":%+.2f", + PS.NAME_SERIALIZED_LOCATIONY + ":%+.2f", + PS.NAME_SERIALIZED_LOCATIONZ + ":%+.2f", + PS.NAME_SERIALIZED_CHUNKX + ":%+d", + PS.NAME_SERIALIZED_CHUNKZ + ":%+d", + PS.NAME_SERIALIZED_PITCH + ":%.2f", + PS.NAME_SERIALIZED_YAW + ": %.2f", + PS.NAME_SERIALIZED_VELOCITYX + ":%+.2f", + PS.NAME_SERIALIZED_VELOCITYY + ":%+.2f", + PS.NAME_SERIALIZED_VELOCITYZ + ":%+.2f", + " ", + "" + ); + } +} diff --git a/src/com/massivecraft/massivecore/util/Txt.java b/src/com/massivecraft/massivecore/util/Txt.java index 3016074b..f7c6aa2d 100644 --- a/src/com/massivecraft/massivecore/util/Txt.java +++ b/src/com/massivecraft/massivecore/util/Txt.java @@ -408,7 +408,7 @@ public class Txt { parts.add(upperCaseFirst(part)); } - return implode(parts, " "); + return implode(parts, ""); } public static > String getNicedEnum(T enumObject)