diff --git a/pom.xml b/pom.xml
index 0a40bad..f578a52 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
de.tamion
DCChat
- 2.2.0
+ 2.2.1
jar
DCChat
diff --git a/src/main/java/de/tamion/discord/DCMain.java b/src/main/java/de/tamion/discord/DCMain.java
index 7f522c1..dd3af97 100644
--- a/src/main/java/de/tamion/discord/DCMain.java
+++ b/src/main/java/de/tamion/discord/DCMain.java
@@ -3,7 +3,7 @@
import de.tamion.discord.listeners.Console;
import de.tamion.discord.listeners.DCChat;
import de.tamion.minecraft.MCMain;
-import de.tamion.minecraft.listeners.Chat;
+import de.tamion.minecraft.listeners.MCChat;
import de.tamion.minecraft.listeners.JoinLeave;
import de.tamion.others.DCChatConsoleAppender;
import de.tamion.others.Schedulers;
@@ -49,7 +49,7 @@ public static void startup() {
Schedulers.consolescheduler();
Schedulers.updatesyntaxchannel();
PluginManager pluginManager = Bukkit.getPluginManager();
- pluginManager.registerEvents(new Chat(), MCMain.getPlugin());
+ pluginManager.registerEvents(new MCChat(), MCMain.getPlugin());
pluginManager.registerEvents(new JoinLeave(), MCMain.getPlugin());
EmbedBuilder eb = new EmbedBuilder();
eb.setTitle(config.getString("Bot.startsyntax"));
diff --git a/src/main/java/de/tamion/discord/listeners/DCChat.java b/src/main/java/de/tamion/discord/listeners/DCChat.java
index 911c9e0..c591e9e 100644
--- a/src/main/java/de/tamion/discord/listeners/DCChat.java
+++ b/src/main/java/de/tamion/discord/listeners/DCChat.java
@@ -6,6 +6,7 @@
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
public class DCChat extends ListenerAdapter {
@@ -23,12 +24,12 @@ public void onMessageReceived(MessageReceivedEvent e) {
if(e.getAuthor().isBot()) {
return;
}
- if(e.getMessage().getContentDisplay().startsWith("/")) {
+ if(msg.startsWith("/")) {
return;
}
if(config.getString("Bot.mcsyntax").equals("")) {
return;
}
- Bukkit.getServer().broadcastMessage(config.getString("Bot.mcsyntax").replaceAll("\\{username}", e.getMember().getEffectiveName()).replaceAll("\\{message}", msg));
+ Bukkit.getServer().broadcastMessage(ChatColor.translateAlternateColorCodes('&', config.getString("Bot.mcsyntax")).replaceAll("\\{username}", e.getMember().getEffectiveName()).replaceAll("\\{message}", msg.replaceAll("ยง", "")));
}
}
diff --git a/src/main/java/de/tamion/minecraft/MCMain.java b/src/main/java/de/tamion/minecraft/MCMain.java
index 33188fd..b3373b7 100644
--- a/src/main/java/de/tamion/minecraft/MCMain.java
+++ b/src/main/java/de/tamion/minecraft/MCMain.java
@@ -2,17 +2,12 @@
import de.tamion.discord.DCMain;
import de.tamion.minecraft.commands.*;
-import de.tamion.others.Utils;
-import net.dv8tion.jda.api.EmbedBuilder;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
-import java.awt.*;
-
public final class MCMain extends JavaPlugin {
static MCMain plugin;
-
@Override
public void onEnable() {
plugin = this;
diff --git a/src/main/java/de/tamion/minecraft/commands/DCChatCommand.java b/src/main/java/de/tamion/minecraft/commands/DCChatCommand.java
deleted file mode 100644
index 4d9603b..0000000
--- a/src/main/java/de/tamion/minecraft/commands/DCChatCommand.java
+++ /dev/null
@@ -1,2 +0,0 @@
-package de.tamion.minecraft.commands;public class DCChatCommand {
-}
diff --git a/src/main/java/de/tamion/minecraft/commands/SetGuildID.java b/src/main/java/de/tamion/minecraft/commands/SetGuildID.java
index c7d717d..220216f 100644
--- a/src/main/java/de/tamion/minecraft/commands/SetGuildID.java
+++ b/src/main/java/de/tamion/minecraft/commands/SetGuildID.java
@@ -10,7 +10,7 @@
public class SetGuildID implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, @NotNull String[] args) {
- if(!sender.hasPermission("DCChat.id") && !sender.hasPermission("DCChat.admin")) {
+ if(!sender.hasPermission("DCChat.id")) {
sender.sendMessage("You are not allowed to execute this Command!");
return false;
}
diff --git a/src/main/java/de/tamion/minecraft/commands/SetToken.java b/src/main/java/de/tamion/minecraft/commands/SetToken.java
index 467ecd9..30fe941 100644
--- a/src/main/java/de/tamion/minecraft/commands/SetToken.java
+++ b/src/main/java/de/tamion/minecraft/commands/SetToken.java
@@ -10,7 +10,7 @@
public class SetToken implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, @NotNull String[] args) {
- if(!sender.hasPermission("DCChat.token") && !sender.hasPermission("DCChat.admin")) {
+ if(!sender.hasPermission("DCChat.token")) {
sender.sendMessage("You are not allowed to execute this Command!");
return false;
}
diff --git a/src/main/java/de/tamion/minecraft/listeners/Inventory.java b/src/main/java/de/tamion/minecraft/listeners/Inventory.java
deleted file mode 100644
index 4c22e03..0000000
--- a/src/main/java/de/tamion/minecraft/listeners/Inventory.java
+++ /dev/null
@@ -1,2 +0,0 @@
-package de.tamion.minecraft.listeners;public class Inventory {
-}
diff --git a/src/main/java/de/tamion/minecraft/listeners/MCChat.java b/src/main/java/de/tamion/minecraft/listeners/MCChat.java
index 2cbd2b5..a497b52 100644
--- a/src/main/java/de/tamion/minecraft/listeners/MCChat.java
+++ b/src/main/java/de/tamion/minecraft/listeners/MCChat.java
@@ -3,13 +3,17 @@
import de.tamion.minecraft.MCMain;
import de.tamion.others.Utils;
import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
-public class Chat implements Listener {
+import java.util.HashMap;
+
+public class MCChat implements Listener {
@EventHandler
public void onChat(PlayerChatEvent e) {
+ Player p = e.getPlayer();
FileConfiguration config = MCMain.getPlugin().getConfig();
Utils.sendtochat(config.getString("Bot.dcsyntax").replaceAll("\\{username}", e.getPlayer().getName()).replaceAll("\\{message}", e.getMessage()));
}
diff --git a/src/main/java/de/tamion/others/InventoryGUI.java b/src/main/java/de/tamion/others/InventoryGUI.java
deleted file mode 100644
index f9113a2..0000000
--- a/src/main/java/de/tamion/others/InventoryGUI.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package de.testing;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.NamespacedKey;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.InventoryType;
-import org.bukkit.inventory.Inventory;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.ItemMeta;
-import org.bukkit.persistence.PersistentDataType;
-import org.bukkit.plugin.Plugin;
-
-public class InventoryGUI {
- Inventory inv;
- public static Plugin pl;
-
- public InventoryGUI(String name, int size) {
- this.inv = Bukkit.createInventory((InventoryHolder)null, size, name);
- }
- public InventoryGUI() {
- this.inv = Bukkit.createInventory(null, InventoryType.ANVIL);
- }
-
- public InventoryGUI(Inventory inv) {
- this.inv = inv;
- }
-
- public InventoryGUI addButton(String name, int index, Material material, String id) {
- ItemStack button = new ItemStack(material);
- ItemMeta buttonmeta = button.getItemMeta();
- buttonmeta.setDisplayName(name);
- NamespacedKey key = new NamespacedKey(pl, "button-id");
- buttonmeta.getPersistentDataContainer().set(key, PersistentDataType.STRING, id);
- button.setItemMeta(buttonmeta);
- this.inv.setItem(index, button);
- return this;
- }
-
- public InventoryGUI addButton(String name, int index, Material material) {
- ItemStack button = new ItemStack(material);
- ItemMeta buttonmeta = button.getItemMeta();
- buttonmeta.setDisplayName(name);
- NamespacedKey key = new NamespacedKey(pl, "button-id");
- buttonmeta.getPersistentDataContainer().set(key, PersistentDataType.STRING, name);
- button.setItemMeta(buttonmeta);
- this.inv.setItem(index, button);
- return this;
- }
- public InventoryGUI addinfo(String name, int index, Material material) {
- ItemStack button = new ItemStack(material);
- ItemMeta buttonmeta = button.getItemMeta();
- buttonmeta.setDisplayName(name);
- NamespacedKey key = new NamespacedKey(pl, "gui-info");
- buttonmeta.getPersistentDataContainer().set(key, PersistentDataType.STRING, "gui-info");
- button.setItemMeta(buttonmeta);
- this.inv.setItem(index, button);
- return this;
- }
-
- public InventoryGUI open(Player p) {
- p.openInventory(this.inv);
- return this;
- }
-
- public InventoryGUI clear() {
- this.inv.clear();
- return this;
- }
-
- public Inventory getInv() {
- return this.inv;
- }
-}
diff --git a/src/main/java/de/tamion/others/Utils.java b/src/main/java/de/tamion/others/Utils.java
index a423987..5fe1fc2 100644
--- a/src/main/java/de/tamion/others/Utils.java
+++ b/src/main/java/de/tamion/others/Utils.java
@@ -39,7 +39,7 @@ public static void sendtoconsole(MessageEmbed emb) {
});
}
public static String setsyntax(CommandSender sender, String loc, String syntax) {
- if(!sender.hasPermission("DCChat.syntax") && !sender.hasPermission("DCChat.admin")) {
+ if(!sender.hasPermission("DCChat.syntax")) {
return "You are not allowed to execute this Command!";
}
MCMain.getPlugin().getConfig().set(loc, syntax);