This commit is contained in:
Draycia committed 2020-07-01 13:06:15 -07:00
1 parent c1781dbdd8
commit a57254aa6a
11 files changed
+12 -43

No files matched your search

@@ -1,10 +1,5 @@
package net.draycia.simplechat;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import net.draycia.simplechat.channels.ChatChannel;
import net.draycia.simplechat.listeners.PlayerListener;
import net.draycia.simplechat.listeners.VoteListener;
@@ -21,12 +16,6 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import javax.annotation.CheckForNull;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.*;
public final class SimpleChat extends JavaPlugin {
@@ -44,8 +33,6 @@ public final class SimpleChat extends JavaPlugin {
private BukkitAudiences audiences;
private Gson gson = new GsonBuilder().setPrettyPrinting().create();
@Override
public void onEnable() {
// Setup Adventure
@@ -4,7 +4,6 @@ import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.storage.ChatUser;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.javacord.api.event.message.MessageCreateEvent;
@@ -6,8 +6,6 @@ import com.palmergames.bukkit.towny.object.Resident;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.storage.ChatUser;
import net.kyori.adventure.text.format.TextColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import java.util.Map;
@@ -7,8 +7,6 @@ import com.palmergames.bukkit.towny.object.Resident;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.storage.ChatUser;
import net.kyori.adventure.text.format.TextColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import java.util.Map;
@@ -15,15 +15,12 @@ import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.milkbowl.vault.chat.Chat;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.javacord.api.entity.channel.ServerTextChannel;
import org.javacord.api.entity.message.MessageAuthor;
import org.javacord.api.entity.permission.Role;
import org.javacord.api.entity.user.User;
import org.javacord.api.event.message.MessageCreateEvent;
import java.io.IOException;
@@ -6,8 +6,6 @@ import com.palmergames.bukkit.towny.object.Resident;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.storage.ChatUser;
import net.kyori.adventure.text.format.TextColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import java.util.Map;
@@ -5,6 +5,7 @@ import net.draycia.simplechat.storage.ChatUser;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class ChannelChatEvent extends Event implements Cancellable {
@@ -36,6 +37,7 @@ public class ChannelChatEvent extends Event implements Cancellable {
}
@Override
@NotNull
public HandlerList getHandlers() {
return HANDLERS_LIST;
}
@@ -5,8 +5,6 @@ import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.channels.ChatChannel;
import net.draycia.simplechat.commands.*;
import net.draycia.simplechat.storage.ChatUser;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
@@ -9,9 +9,9 @@ import net.draycia.simplechat.storage.ChatUser;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
@@ -27,7 +27,7 @@ public class PluginMessageManager implements PluginMessageListener {
}
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
public void onPluginMessageReceived(String channel, @NotNull Player player, @NotNull byte[] message) {
if (!channel.equals("BungeeCord")) {
return;
}
@@ -248,7 +248,7 @@ public class DiscordWebhook {
return this;
}
private class Footer {
private static class Footer {
private String text;
private String iconUrl;
@@ -266,7 +266,7 @@ public class DiscordWebhook {
}
}
private class Thumbnail {
private static class Thumbnail {
private String url;
private Thumbnail(String url) {
@@ -278,7 +278,7 @@ public class DiscordWebhook {
}
}
private class Image {
private static class Image {
private String url;
private Image(String url) {
@@ -290,7 +290,7 @@ public class DiscordWebhook {
}
}
private class Author {
private static class Author {
private String name;
private String url;
private String iconUrl;
@@ -314,7 +314,7 @@ public class DiscordWebhook {
}
}
private class Field {
private static class Field {
private String name;
private String value;
private boolean inline;
@@ -339,7 +339,7 @@ public class DiscordWebhook {
}
}
private class JSONObject {
private static class JSONObject {
private final HashMap<String, Object> map = new HashMap<>();
@@ -40,9 +40,9 @@ public final class ItemStackUtils {
final String version = Bukkit.getServer().getClass().getPackage().getName()
.substring("org.bukkit.craftbukkit.".length());
this.craftItemStackClass = cbClass(version, "inventory.CraftItemStack");
this.craftItemStackClass = Class.forName("org.bukkit.craftbukkit." + version + ".inventory.CraftItemStack");
this.asNMSCopyMethod = this.craftItemStackClass.getMethod("asNMSCopy", ItemStack.class);
this.itemStackClass = nmsClass(version, "ItemStack");
this.itemStackClass = Class.forName("net.minecraft.server." + version + ".ItemStack");
this.cMethod = this.itemStackClass.getMethod("C");
}
@@ -68,12 +68,4 @@ public final class ItemStackUtils {
}
}
private static Class<?> cbClass(final String version, final String name) throws ClassNotFoundException {
return Class.forName("org.bukkit.craftbukkit." + version + "." + name);
}
private static Class<?> nmsClass(final String version, final String name) throws ClassNotFoundException {
return Class.forName("net.minecraft.server." + version + "." + name);
}
}