Fixed bug where short messages aren't sent
This commit is contained in:
parent
1adc2f1b4c
commit
e5bb0e43dd
2 changed files with 133 additions and 142 deletions
|
@ -98,6 +98,10 @@ public class DebugPotato {
|
||||||
int currentLineLength = 0;
|
int currentLineLength = 0;
|
||||||
int wordlength;
|
int wordlength;
|
||||||
int maxLineLength = 40;
|
int maxLineLength = 40;
|
||||||
|
if (message.length() <= maxLineLength){
|
||||||
|
newMessage.add(message);
|
||||||
|
return newMessage;
|
||||||
|
}
|
||||||
for (String word : splitString) {
|
for (String word : splitString) {
|
||||||
wordlength = word.length();
|
wordlength = word.length();
|
||||||
if (currentLineLength == 0 || (currentLineLength + wordlength) < maxLineLength) {
|
if (currentLineLength == 0 || (currentLineLength + wordlength) < maxLineLength) {
|
||||||
|
@ -114,7 +118,7 @@ public class DebugPotato {
|
||||||
public ItemStack toItemStack() {
|
public ItemStack toItemStack() {
|
||||||
ItemStack potato = new ItemStack(Material.BAKED_POTATO);
|
ItemStack potato = new ItemStack(Material.BAKED_POTATO);
|
||||||
ItemMeta meta = potato.getItemMeta();
|
ItemMeta meta = potato.getItemMeta();
|
||||||
meta.setDisplayName(this.getType() == null ? "Spicy Debug Potato" : this.getType());
|
meta.setDisplayName(this.getType() == null ? "Null Flavoured Debug Potato" : this.getType());
|
||||||
if (this.getMessage() == null){
|
if (this.getMessage() == null){
|
||||||
List<String> message = new ArrayList<String>();
|
List<String> message = new ArrayList<String>();
|
||||||
message.add("nullMessage");
|
message.add("nullMessage");
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
package buttondevteam.lib;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
/**@deprecated
|
|
||||||
* Fully Replaced by DebugPotato Class - Construct a DebugPotato*/
|
|
||||||
public class DebugPotatoAPI {
|
|
||||||
/**@deprecated Replaced by DebugPotato.send*/
|
|
||||||
public static void SendDebugPotato(DebugPotato dp, Player player) {
|
|
||||||
player.getInventory().addItem(dp.toItemStack());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue