diff --git a/pom.xml b/pom.xml
index 827b9f1..d7a50b5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -160,6 +160,14 @@
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 8
+
+
\ No newline at end of file
diff --git a/src/main/java/xyz/etztech/minecraftmanager/listeners/AsyncPlayerChatListener.java b/src/main/java/xyz/etztech/minecraftmanager/listeners/AsyncPlayerChatListener.java
index 0108ec2..7032b2c 100644
--- a/src/main/java/xyz/etztech/minecraftmanager/listeners/AsyncPlayerChatListener.java
+++ b/src/main/java/xyz/etztech/minecraftmanager/listeners/AsyncPlayerChatListener.java
@@ -1,11 +1,11 @@
package xyz.etztech.minecraftmanager.listeners;
+import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -45,7 +45,9 @@ public class AsyncPlayerChatListener implements Listener {
String chat = event.getMessage();
boolean applyChat = MinecraftManager.inApplyMode(sender.getUniqueId().toString());
- TextComponent pre = new TextComponent(ChatColor.GOLD + sender.getName() + " > ");
+ ComponentBuilder message = new ComponentBuilder("");
+
+ message.append(sender.getName() + " > ").color(ChatColor.GOLD);
if (!applyChat) {
boolean hasPermission = sender.hasPermission("minecraftmanager.staff");
boolean singlePrefix = false;
@@ -65,19 +67,18 @@ public class AsyncPlayerChatListener implements Listener {
chat = chat.replaceFirst(Pattern.quote(prefix), "");
}
HoverEvent hover = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Staff Chat").create());
- pre.setHoverEvent(hover);
- TextComponent message = generateMessage(chat);
- message.setHoverEvent(hover);
+ message.event(hover);
+ message.append(chat).color(ChatColor.GREEN).event(hover);
for (Player player : event.getRecipients()) {
if (player.hasPermission("minecraftmanager.staff")) {
- player.spigot().sendMessage(pre, message);
+ player.spigot().sendMessage(message.create());
}
}
- MCMUtil.log(MCMUtil.staffLog, componentText(pre, message));
+ MCMUtil.log(MCMUtil.staffLog, componentText(message.create()));
} else {
- TextComponent message = generateMessage(chat);
+ message.append(chat);
if (!MinecraftManager.getLogOverride()) {
- MCMUtil.log(MCMUtil.globalLog, componentText(pre, message));
+ MCMUtil.log(MCMUtil.globalLog, componentText(message.create()));
}
}
} else {
@@ -153,13 +154,7 @@ public class AsyncPlayerChatListener implements Listener {
}
- private TextComponent generateMessage(String message) {
- TextComponent text = new TextComponent();
- for (String part : message.split(" ")) {
- text.addExtra(new TextComponent(ChatColor.GREEN + part + " "));
- }
- return text;
- }
+
private List trimmed(List list) {
for (int i = 0; i < list.size(); i++) {
diff --git a/src/main/java/xyz/etztech/minecraftmanager/listeners/BlockBreakListener.java b/src/main/java/xyz/etztech/minecraftmanager/listeners/BlockBreakListener.java
index f5cf0a4..1566226 100644
--- a/src/main/java/xyz/etztech/minecraftmanager/listeners/BlockBreakListener.java
+++ b/src/main/java/xyz/etztech/minecraftmanager/listeners/BlockBreakListener.java
@@ -1,5 +1,6 @@
package xyz.etztech.minecraftmanager.listeners;
+import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@@ -25,15 +26,19 @@ public class BlockBreakListener implements Listener {
public void onBlockBreak(BlockBreakEvent event) {
Block block = event.getBlock();
- boolean isDiamond = Material.DIAMOND_ORE == block.getType();
- if (isDiamond) {
- boolean notify = MinecraftManager.addDiamond(getLocationString(block));
- for (Block radiusBlock : getBlocks(block, 5)) {
- MinecraftManager.addDiamond(getLocationString(radiusBlock));
- }
- if (notify) {
+ if (Material.DIAMOND_ORE == block.getType()) {
+ if (MinecraftManager.addDiamond(getLocationString(block))) {
plugin.log("[OreAlert]: " + event.getPlayer().getName());
}
+
+ Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
+ for (Block radiusBlock : getBlocks(block, 5)) {
+ if (Material.DIAMOND_ORE == radiusBlock.getType()) {
+ MinecraftManager.addDiamond(getLocationString(radiusBlock));
+ }
+ }
+ });
+
}
}
diff --git a/src/main/java/xyz/etztech/minecraftmanager/listeners/SessionListener.java b/src/main/java/xyz/etztech/minecraftmanager/listeners/SessionListener.java
index f29bfa0..ed5618d 100644
--- a/src/main/java/xyz/etztech/minecraftmanager/listeners/SessionListener.java
+++ b/src/main/java/xyz/etztech/minecraftmanager/listeners/SessionListener.java
@@ -45,14 +45,6 @@ public class SessionListener implements Listener {
Map filters = MCMAPI.setup();
filters.put("username__iexact", player.getName());
CoreWeb.asyncGetCallback(plugin, MCMAPI.getModelUrl("application"), filters, new JoinCallback(player.getName()));
- JsonArray query = MCMAPI.queryModel("application", filters);
- if (query.size() == 1) {
- JsonElement element = query.get(0).getAsJsonObject().get("accepted");
- boolean accepted = !element.isJsonNull() && element.getAsBoolean();
- if (accepted) {
- MinecraftManagerThread.action(player.getName(), true);
- }
- }
}
}