diff --git a/.gitignore b/.gitignore index aaed7192..9c52254b 100644 --- a/.gitignore +++ b/.gitignore @@ -60,18 +60,19 @@ hs_err_pid* .idea/modules .idea/misc.xml -# Maven generated files -/target/ -*/target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -.mvn/wrapper/maven-wrapper.jar - # Dolphin browser keeps recreating this -.directory \ No newline at end of file +.directory + +# Gradle +.gradle +**/build/ +!src/**/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache \ No newline at end of file diff --git a/SimpleChatMCMMO/build.gradle b/SimpleChatMCMMO/build.gradle new file mode 100644 index 00000000..01dae983 --- /dev/null +++ b/SimpleChatMCMMO/build.gradle @@ -0,0 +1,30 @@ +buildscript { + repositories { + mavenLocal() + mavenCentral() + } + dependencies { + classpath "me.bristermitten:pdm-gradle:0.0.1" + } +} + +apply plugin: 'me.bristermitten.pdm' + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + pdm 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72' //This will be added to the dependencies.json + + compileOnly 'org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT' + compileOnly 'com.github.MilkBowl:VaultAPI:1.7' + compileOnly 'com.gmail.nossr50.mcMMO:mcMMO:2.1.130' + + providedCompile project(':SimpleChat') +} + +jar.dependsOn project.tasks.getByName('pdm') // Always run the pdm task when we build + +description = 'SimpleChatMCMMO' diff --git a/SimpleChatMCMMO/src/main/java/net/draycia/simplechatmcmmo/PartyChatChannel.java b/SimpleChatMCMMO/src/main/java/net/draycia/simplechatmcmmo/PartyChatChannel.java new file mode 100644 index 00000000..e39fc1ab --- /dev/null +++ b/SimpleChatMCMMO/src/main/java/net/draycia/simplechatmcmmo/PartyChatChannel.java @@ -0,0 +1,78 @@ +package net.draycia.simplechatmcmmo; + +import com.gmail.nossr50.api.PartyAPI; +import com.gmail.nossr50.events.party.McMMOPartyChangeEvent; +import net.draycia.simplechat.SimpleChat; +import net.draycia.simplechat.channels.impls.SimpleChatChannel; +import net.draycia.simplechat.storage.ChatUser; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; + +public class PartyChatChannel extends SimpleChatChannel implements Listener { + + public PartyChatChannel(String name, SimpleChat simpleChat) { + super(name, simpleChat); + } + + @Override + public String processPlaceholders(ChatUser user, String input) { + String partyName = PartyAPI.getPartyName(user.asPlayer()); + + if (partyName == null) { + partyName = "NotLoaded"; + } + + return input.replace("", partyName); + } + + @Override + public Boolean canPlayerSee(ChatUser sender, ChatUser target, boolean checkSpying) { + if (checkSpying && target.asPlayer().hasPermission("simplechat.spy." + getName())) { + if (target.getChannelSettings(this).isSpying()) { + return true; + } + } + + if (super.canPlayerSee(sender, target, false) && sender != null) { + return PartyAPI.inSameParty(sender.asPlayer(), target.asPlayer()); + } + + return false; + } + + @Override + public Boolean canPlayerUse(ChatUser user) { + return super.canPlayerUse(user) && isInParty(user); + } + + private final McMMOPartyChangeEvent.EventReason LEFT = McMMOPartyChangeEvent.EventReason.LEFT_PARTY; + private final McMMOPartyChangeEvent.EventReason KICKED = McMMOPartyChangeEvent.EventReason.KICKED_FROM_PARTY; + + @EventHandler + public void onPartyLeave(McMMOPartyChangeEvent event) { + if (event.getReason() != LEFT && event.getReason() != KICKED) { + return; + } + + ChatUser user = getSimpleChat().getUserService().wrap(event.getPlayer()); + + if (user.getSelectedChannel() instanceof PartyChatChannel) { + user.clearSelectedChannel(); + } + } + + @EventHandler + public void onPlayerJoin(PlayerJoinEvent event) { + ChatUser user = getSimpleChat().getUserService().wrap(event.getPlayer()); + + if ((user.getSelectedChannel() instanceof PartyChatChannel) && !isInParty(user)) { + user.clearSelectedChannel(); + } + } + + public boolean isInParty(ChatUser user) { + return PartyAPI.inParty(user.asPlayer()); + } + +} \ No newline at end of file diff --git a/SimpleChatMCMMO/src/main/java/net/draycia/simplechatmcmmo/SimpleChatMCMMO.java b/SimpleChatMCMMO/src/main/java/net/draycia/simplechatmcmmo/SimpleChatMCMMO.java new file mode 100644 index 00000000..39f2e1e4 --- /dev/null +++ b/SimpleChatMCMMO/src/main/java/net/draycia/simplechatmcmmo/SimpleChatMCMMO.java @@ -0,0 +1,25 @@ +package net.draycia.simplechatmcmmo; + +import net.draycia.simplechat.events.ChannelRegisterEvent; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +public final class SimpleChatMCMMO extends JavaPlugin { + + @Override + public void onEnable() { + // Plugin startup logic + + } + + @Override + public void onDisable() { + // Plugin shutdown logic + } + + @EventHandler + public void onChannelRegister(ChannelRegisterEvent event) { + + } + +} diff --git a/SimpleChatMCMMO/src/main/resources/plugin.yml b/SimpleChatMCMMO/src/main/resources/plugin.yml new file mode 100644 index 00000000..ee4a5b1d --- /dev/null +++ b/SimpleChatMCMMO/src/main/resources/plugin.yml @@ -0,0 +1,5 @@ +name: SimpleChatMCMMO +version: ${project.version} +main: net.draycia.simplechatmcmmo.SimpleChatMCMMO +api-version: 1.16 +depend: [SimpleChat] \ No newline at end of file diff --git a/SimpleChatModeration/build.gradle b/SimpleChatModeration/build.gradle new file mode 100644 index 00000000..5c18e41b --- /dev/null +++ b/SimpleChatModeration/build.gradle @@ -0,0 +1,26 @@ +buildscript { + repositories { + mavenLocal() + mavenCentral() + } + dependencies { + classpath "me.bristermitten:pdm-gradle:0.0.1" + } +} + +apply plugin: 'me.bristermitten.pdm' + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + pdm 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72' //This will be added to the dependencies.json + + providedCompile project(':SimpleChat') +} + +jar.dependsOn project.tasks.getByName('pdm') // Always run the pdm task when we build + +description = 'SimpleChatModeration' \ No newline at end of file diff --git a/SimpleChatModeration/pom.xml b/SimpleChatModeration/pom.xml deleted file mode 100644 index 03beea82..00000000 --- a/SimpleChatModeration/pom.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - 4.0.0 - - - SimpleChatParent - net.draycia - 1.0 - - - SimpleChatModeration - jar - - SimpleChatModeration - - - clean package - - - org.apache.maven.plugins - maven-shade-plugin - 3.1.1 - - ${project.build.directory}/dependency-reduced-pom.xml - - - - package - - shade - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.7.0 - - - compile - compile - - compile - - - - testCompile - test-compile - - testCompile - - - - - ${java.version} - ${java.version} - - - - - - src/main/resources - true - - - - - - - jitpack.io - https://jitpack.io - - - - - - org.spigotmc - spigot-api - 1.16.1-R0.1-SNAPSHOT - provided - - - net.draycia - SimpleChat - 1.0 - provided - - - com.github.MilkBowl - VaultAPI - 1.7 - provided - - - - \ No newline at end of file diff --git a/SimpleChatModeration/src/main/java/net/draycia/simplechatmoderation/commands/ClearChatCommand.java b/SimpleChatModeration/src/main/java/net/draycia/simplechatmoderation/commands/ClearChatCommand.java index e0259363..8b024889 100644 --- a/SimpleChatModeration/src/main/java/net/draycia/simplechatmoderation/commands/ClearChatCommand.java +++ b/SimpleChatModeration/src/main/java/net/draycia/simplechatmoderation/commands/ClearChatCommand.java @@ -24,14 +24,14 @@ public class ClearChatCommand extends BaseCommand { @Default public void baseCommand(CommandIssuer issuer) { String format = moderation.getConfig().getString("clear-chat.message", ""); - Component component = moderation.getSimpleChat().processMessage(format, "br", "\n"); + Component component = moderation.getSimpleChat().getAdventureManager().processMessage(format, "br", "\n"); for (Player player : Bukkit.getOnlinePlayers()) { if (player.hasPermission("simplechat.clearchat.exempt")) { continue; } - Audience audience = moderation.getSimpleChat().getAudiences().player(player); + Audience audience = moderation.getSimpleChat().getAdventureManager().getAudiences().player(player); for (int i = 0; i < moderation.getConfig().getInt("clear-chat.message-count", 100); i++) { audience.sendMessage(component); @@ -41,12 +41,12 @@ public class ClearChatCommand extends BaseCommand { if (player.hasPermission("simplechat.clearchat.notify")) { String message = moderation.getConfig().getString("language.clear-notify"); - audience.sendMessage(moderation.getSimpleChat().processMessage(message, "player", name)); + audience.sendMessage(moderation.getSimpleChat().getAdventureManager().processMessage(message, "player", name)); } if (player.hasPermission("simplechat.clearchat.exempt")) { String message = moderation.getConfig().getString("language.clear-exempt"); - audience.sendMessage(moderation.getSimpleChat().processMessage(message, "player", name)); + audience.sendMessage(moderation.getSimpleChat().getAdventureManager().processMessage(message, "player", name)); } } } diff --git a/SimpleChatModeration/src/main/java/net/draycia/simplechatmoderation/commands/MuteCommand.java b/SimpleChatModeration/src/main/java/net/draycia/simplechatmoderation/commands/MuteCommand.java index aee7adc7..ff03290e 100644 --- a/SimpleChatModeration/src/main/java/net/draycia/simplechatmoderation/commands/MuteCommand.java +++ b/SimpleChatModeration/src/main/java/net/draycia/simplechatmoderation/commands/MuteCommand.java @@ -40,10 +40,10 @@ public class MuteCommand extends BaseCommand { } } - Component message = moderation.getSimpleChat().processMessage(format, "br", "\n", + Component message = moderation.getSimpleChat().getAdventureManager().processMessage(format, "br", "\n", "player", targetUser.asOfflinePlayer().getName()); - moderation.getSimpleChat().getAudiences().audience(sender).sendMessage(message); + moderation.getSimpleChat().getAdventureManager().getAudiences().audience(sender).sendMessage(message); } } diff --git a/SimpleChatModeration/src/main/java/net/draycia/simplechatmoderation/commands/ShadowMuteCommand.java b/SimpleChatModeration/src/main/java/net/draycia/simplechatmoderation/commands/ShadowMuteCommand.java index d2692716..e9e24f09 100644 --- a/SimpleChatModeration/src/main/java/net/draycia/simplechatmoderation/commands/ShadowMuteCommand.java +++ b/SimpleChatModeration/src/main/java/net/draycia/simplechatmoderation/commands/ShadowMuteCommand.java @@ -40,10 +40,10 @@ public class ShadowMuteCommand extends BaseCommand { } } - Component message = moderation.getSimpleChat().processMessage(format, "br", "\n", + Component message = moderation.getSimpleChat().getAdventureManager().processMessage(format, "br", "\n", "player", targetUser.asOfflinePlayer().getName()); - moderation.getSimpleChat().getAudiences().audience(sender).sendMessage(message); + moderation.getSimpleChat().getAdventureManager().getAudiences().audience(sender).sendMessage(message); } } diff --git a/SimpleChatPlugin/build.gradle b/SimpleChatPlugin/build.gradle new file mode 100644 index 00000000..4d3233a7 --- /dev/null +++ b/SimpleChatPlugin/build.gradle @@ -0,0 +1,42 @@ +buildscript { + repositories { + mavenLocal() + mavenCentral() + } + dependencies { + classpath "me.bristermitten:pdm-gradle:0.0.1" + } +} + +apply plugin: 'me.bristermitten.pdm' + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + pdm 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72' //This will be added to the dependencies.json + + pdm 'co.aikar:acf-bukkit:0.5.0-SNAPSHOT' + pdm 'net.kyori:adventure-api:4.0.0-SNAPSHOT' + pdm 'net.kyori:adventure-nbt:4.0.0-SNAPSHOT' + pdm 'net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT' + pdm 'net.kyori:adventure-text-minimessage:3.0.0-SNAPSHOT' + pdm 'de.themoep:minedown:1.6.1-SNAPSHOT' + pdm 'co.aikar:idb-bukkit:1.0.0-SNAPSHOT' + pdm 'com.zaxxer:HikariCP:2.4.1' + pdm 'io.github.leonardosnt:bungeechannelapi:1.0.0-SNAPSHOT' + pdm 'io.lettuce:lettuce-core:6.0.0.M1' + + compileOnly 'me.clip:placeholderapi:2.10.6' + compileOnly 'com.github.TownyAdvanced:Towny:0.96.1.11' + compileOnly 'com.github.MilkBowl:VaultAPI:1.7' + compileOnly 'com.vexsoftware:nuvotifier-universal:2.6.0' + compileOnly 'net.luckperms:api:5.1' + compileOnly 'org.jetbrains:annotations:16.0.1' +} + +jar.dependsOn project.tasks.getByName('pdm') // Always run the pdm task when we build + +description = 'SimpleChatPlugin' diff --git a/SimpleChatPlugin/pom.xml b/SimpleChatPlugin/pom.xml deleted file mode 100644 index cf13dfb9..00000000 --- a/SimpleChatPlugin/pom.xml +++ /dev/null @@ -1,255 +0,0 @@ - - - 4.0.0 - - - SimpleChatParent - net.draycia - 1.0 - - - SimpleChat - jar - - SimpleChat - - - clean package - - - org.apache.maven.plugins - maven-shade-plugin - 3.1.1 - - ${project.build.directory}/dependency-reduced-pom.xml - - - - package - - shade - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.7.0 - - - compile - compile - - compile - - - - testCompile - test-compile - - testCompile - - - - - ${java.version} - ${java.version} - - - - - - src/main/resources - true - - - - - - - - spigotmc-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - - - sonatype - https://oss.sonatype.org/content/groups/public/ - - - - - placeholderapi - http://repo.extendedclip.com/content/repositories/placeholderapi/ - - - - - jitpack.io - https://jitpack.io - - - - - aikar - https://repo.aikar.co/content/groups/aikar/ - - - - - bintray-repo - https://dl.bintray.com/ichbinjoe/public/ - - - - - codemc-repo - https://repo.codemc.org/repository/maven-public/ - - false - - - false - - - - - - minebench-repo - http://repo.minebench.de/ - - - - - - - - - org.spigotmc - spigot-api - 1.16.1-R0.1-SNAPSHOT - provided - - - - - co.aikar - acf-bukkit - 0.5.0-SNAPSHOT - - - - - net.kyori - adventure-api - 4.0.0-SNAPSHOT - - - net.kyori - adventure-nbt - 4.0.0-SNAPSHOT - - - net.kyori - adventure-platform-bukkit - 4.0.0-SNAPSHOT - - - com.google.code.gson - gson - - - - - - net.kyori - adventure-text-minimessage - 3.0.0-SNAPSHOT - - - - - de.themoep - minedown - 1.6.1-SNAPSHOT - - - - - co.aikar - idb-bukkit - 1.0.0-SNAPSHOT - - - com.zaxxer - HikariCP - 2.4.1 - - - - - io.github.leonardosnt - bungeechannelapi - 1.0.0-SNAPSHOT - - - - - io.lettuce - lettuce-core - 6.0.0.M1 - - - - - me.clip - placeholderapi - 2.10.6 - provided - - - - - com.github.TownyAdvanced - Towny - 0.96.1.11 - provided - - - - - com.gmail.nossr50.mcMMO - mcMMO - 2.1.130 - provided - - - - - com.github.MilkBowl - VaultAPI - 1.7 - provided - - - - - com.vexsoftware - nuvotifier-universal - 2.6.0 - provided - - - - - net.luckperms - api - 5.1 - provided - - - diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/SimpleChat.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/SimpleChat.java index 5b7ce48d..2c820739 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/SimpleChat.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/SimpleChat.java @@ -1,19 +1,12 @@ package net.draycia.simplechat; -import de.themoep.minedown.MineDown; -import me.clip.placeholderapi.PlaceholderAPI; import net.draycia.simplechat.listeners.*; import net.draycia.simplechat.managers.*; import net.draycia.simplechat.storage.UserService; import net.draycia.simplechat.storage.impl.JSONUserService; import net.draycia.simplechat.storage.impl.MySQLUserService; import net.draycia.simplechat.util.ItemStackUtils; -import net.kyori.adventure.platform.bukkit.BukkitAudiences; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.minimessage.MiniMessage; -import net.kyori.adventure.text.serializer.bungeecord.BungeeCordComponentSerializer; import net.milkbowl.vault.permission.Permission; -import org.bukkit.entity.Player; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; @@ -30,17 +23,16 @@ public final class SimpleChat extends JavaPlugin { private CommandManager commandManager; private ChannelManager channelManager; private RedisManager redisManager = null; + private AdventureManager adventureManager; private UserService userService; private ItemStackUtils itemStackUtils; - private BukkitAudiences audiences; - @Override public void onEnable() { // Setup Adventure - audiences = BukkitAudiences.create(this); + adventureManager = new AdventureManager(this); try { itemStackUtils = new ItemStackUtils(); @@ -106,26 +98,6 @@ public final class SimpleChat extends JavaPlugin { } } - public Component processMessageWithPapi(Player player, String input, String... placeholders) { - return processMessage(PlaceholderAPI.setPlaceholders(player, input), placeholders); - } - - public Component processMessage(String input, String... placeholders) { - switch (getConfig().getString("formatting.type", "minimessage").toLowerCase()) { - case "minedown": - return processMineDown(input, placeholders); - case "minimessage-markdown": - return MiniMessage.markdown().parse(input, placeholders); - case "minimessage": - default: - return MiniMessage.get().parse(input, placeholders); - } - } - - private Component processMineDown(String input, String... placeholders) { - return BungeeCordComponentSerializer.get().deserialize(MineDown.parse(input, placeholders)); - } - public Permission getPermission() { return permission; } @@ -150,11 +122,11 @@ public final class SimpleChat extends JavaPlugin { return userService; } - public BukkitAudiences getAudiences() { - return audiences; - } - public ItemStackUtils getItemStackUtils() { return itemStackUtils; } + + public AdventureManager getAdventureManager() { + return adventureManager; + } } diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/channels/impls/SimpleChatChannel.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/channels/impls/SimpleChatChannel.java index 56edd279..85a91ece 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/channels/impls/SimpleChatChannel.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/channels/impls/SimpleChatChannel.java @@ -5,7 +5,6 @@ import net.draycia.simplechat.channels.ChatChannel; import net.draycia.simplechat.events.ChatComponentEvent; import net.draycia.simplechat.events.ChatFormatEvent; import net.draycia.simplechat.storage.ChatUser; -import net.kyori.adventure.audience.MessageType; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.format.TextColor; import net.kyori.adventure.text.Component; @@ -31,15 +30,10 @@ public class SimpleChatChannel extends ChatChannel { this.simpleChat = simpleChat; } - SimpleChat getSimpleChat() { + public SimpleChat getSimpleChat() { return simpleChat; } - private String getDiscordFormatting() { - return getFormats().getOrDefault("discord-to-mc", - "[Discord] : "); - } - @Override public Boolean canPlayerUse(ChatUser user) { return user.asPlayer().hasPermission("simplechat.channels." + getName() + ".use"); @@ -73,7 +67,7 @@ public class SimpleChatChannel extends ChatChannel { } // Get formatted message - TextComponent formattedMessage = (TextComponent)simpleChat.processMessage(formatEvent.getFormat(), + TextComponent formattedMessage = (TextComponent)simpleChat.getAdventureManager().processMessage(formatEvent.getFormat(), "br", "\n", "color", "", "phase", Long.toString(System.currentTimeMillis() % 25), @@ -98,16 +92,16 @@ public class SimpleChatChannel extends ChatChannel { if (isUserSpying(user, chatUser)) { prefix = prefix.replace("", ""); - chatUser.sendMessage(simpleChat.processMessage(prefix).append(componentEvent.getComponent()), MessageType.CHAT); + chatUser.sendMessage(simpleChat.getAdventureManager().processMessage(prefix).append(componentEvent.getComponent())); } else if (componentEvent.getRecipients().contains(chatUser)) { - chatUser.sendMessage(componentEvent.getComponent(), MessageType.CHAT); + chatUser.sendMessage(componentEvent.getComponent()); } } else { prefix = prefix.replace("", ""); String format = formatEvent.getFormat(); - TextComponent newFormat = (TextComponent)simpleChat.processMessage(format, + TextComponent newFormat = (TextComponent)simpleChat.getAdventureManager().processMessage(format, "br", "\n", "color", "", "phase", Long.toString(System.currentTimeMillis() % 25), @@ -115,7 +109,7 @@ public class SimpleChatChannel extends ChatChannel { "message", formatEvent.getMessage()); if (isUserSpying(user, chatUser)) { - newFormat = (TextComponent)simpleChat.processMessage(prefix, "br", "\n") + newFormat = (TextComponent)simpleChat.getAdventureManager().processMessage(prefix, "br", "\n") .append(newFormat); } else if (!componentEvent.getRecipients().contains(chatUser)) { return; @@ -126,7 +120,7 @@ public class SimpleChatChannel extends ChatChannel { Bukkit.getPluginManager().callEvent(newEvent); - chatUser.sendMessage(newEvent.getComponent(), MessageType.CHAT); + chatUser.sendMessage(newEvent.getComponent()); } } diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/AliasedChannelCommand.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/AliasedChannelCommand.java index 97bfe5bc..2ae0d28a 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/AliasedChannelCommand.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/AliasedChannelCommand.java @@ -32,7 +32,7 @@ public class AliasedChannelCommand extends BaseCommand { if (args == null || args.length == 0) { user.setSelectedChannel(getChatChannel()); - user.sendMessage(simpleChat.processMessage(getChatChannel().getSwitchMessage(), + user.sendMessage(simpleChat.getAdventureManager().processMessage(getChatChannel().getSwitchMessage(), "color", "<" + getChatChannel().getColor().toString() + ">", "channel", getChatChannel().getName())); } else { diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ChannelCommand.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ChannelCommand.java index d2fb6ebd..59e53a88 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ChannelCommand.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ChannelCommand.java @@ -27,7 +27,7 @@ public class ChannelCommand extends BaseCommand { if (args == null || args.length == 0) { user.setSelectedChannel(channel); - user.sendMessage(simpleChat.processMessageWithPapi(player, channel.getSwitchMessage(), + user.sendMessage(simpleChat.getAdventureManager().processMessageWithPapi(player, channel.getSwitchMessage(), "br", "\n", "color", "<" + channel.getColor().toString() + ">", "channel", channel.getName())); @@ -47,10 +47,10 @@ public class ChannelCommand extends BaseCommand { String message = channel.getSwitchMessage(); String otherMessage = channel.getSwitchOtherMessage(); - user.sendMessage(simpleChat.processMessage(message, "br", "\n", + user.sendMessage(simpleChat.getAdventureManager().processMessage(message, "br", "\n", "color", "", "channel", channel.getName())); - simpleChat.getAudiences().audience(sender).sendMessage(simpleChat.processMessage(otherMessage, "br", "\n", + simpleChat.getAdventureManager().getAudiences().audience(sender).sendMessage(simpleChat.getAdventureManager().processMessage(otherMessage, "br", "\n", "color", "", "channel", channel.getName(), "player", user.asOfflinePlayer().getName())); } diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ChatReloadCommand.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ChatReloadCommand.java index ce443f66..06331361 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ChatReloadCommand.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ChatReloadCommand.java @@ -23,10 +23,10 @@ public class ChatReloadCommand extends BaseCommand { simpleChat.reloadConfig(); simpleChat.reloadPatterns(); - Component message = simpleChat.processMessage(simpleChat.getConfig().getString("language.reloaded"), + Component message = simpleChat.getAdventureManager().processMessage(simpleChat.getConfig().getString("language.reloaded"), "br", "\n"); - simpleChat.getAudiences().audience(sender).sendMessage(message); + simpleChat.getAdventureManager().getAudiences().audience(sender).sendMessage(message); } } diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/IgnoreCommand.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/IgnoreCommand.java index a370b406..4c7ff731 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/IgnoreCommand.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/IgnoreCommand.java @@ -41,7 +41,7 @@ public class IgnoreCommand extends BaseCommand { } } - user.sendMessage(simpleChat.processMessageWithPapi(player, message, "br", "\n")); + user.sendMessage(simpleChat.getAdventureManager().processMessageWithPapi(player, message, "br", "\n")); } } diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/MeCommand.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/MeCommand.java index fb97ba07..45aee459 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/MeCommand.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/MeCommand.java @@ -25,7 +25,7 @@ public class MeCommand extends BaseCommand { public void baseCommand(Player player, String... args) { String message = String.join(" ", args).replace("", ""); String format = PlaceholderAPI.setPlaceholders(player, simpleChat.getConfig().getString("language.me")); - Component component = simpleChat.processMessage(format, "br", "\n", "message", message); + Component component = simpleChat.getAdventureManager().processMessage(format, "br", "\n", "message", message); ChatUser user = simpleChat.getUserService().wrap(player); @@ -37,7 +37,7 @@ public class MeCommand extends BaseCommand { continue; } - simpleChat.getAudiences().player(onlinePlayer).sendMessage(component); + simpleChat.getAdventureManager().getAudiences().player(onlinePlayer).sendMessage(component); } } } diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ReplyCommand.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ReplyCommand.java index 44b2b04e..e3b68265 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ReplyCommand.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ReplyCommand.java @@ -30,7 +30,7 @@ public class ReplyCommand extends BaseCommand { if (user.getReplyTarget() == null) { String message = simpleChat.getConfig().getString("language.no-reply-target"); - Component component = simpleChat.processMessage(message, "br", "\n"); + Component component = simpleChat.getAdventureManager().processMessage(message, "br", "\n"); user.sendMessage(component); return; diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/SetColorCommand.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/SetColorCommand.java index 3deecc1c..4c2c743a 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/SetColorCommand.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/SetColorCommand.java @@ -39,7 +39,7 @@ public class SetColorCommand extends BaseCommand { settings.setColor(TextColor.fromHexString(color)); - user.sendMessage(simpleChat.processMessageWithPapi(player, simpleChat.getConfig().getString("language.channel-color-set"), + user.sendMessage(simpleChat.getAdventureManager().processMessageWithPapi(player, simpleChat.getConfig().getString("language.channel-color-set"), "br", "\n", "color", "", "channel", channel.getName(), "hex", color)); } diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/SpyChannelCommand.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/SpyChannelCommand.java index 8f829632..7b6ccfa2 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/SpyChannelCommand.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/SpyChannelCommand.java @@ -35,7 +35,7 @@ public class SpyChannelCommand extends BaseCommand { message = simpleChat.getConfig().getString("language.spy-toggled-on"); } - user.sendMessage(simpleChat.processMessageWithPapi(player, message, "br", "\n", + user.sendMessage(simpleChat.getAdventureManager().processMessageWithPapi(player, message, "br", "\n", "color", "", "channel", channel.getName())); } @@ -53,7 +53,7 @@ public class SpyChannelCommand extends BaseCommand { message = simpleChat.getConfig().getString("language.spy-whispers-on"); } - user.sendMessage(simpleChat.processMessageWithPapi(player, message, "br", "\n")); + user.sendMessage(simpleChat.getAdventureManager().processMessageWithPapi(player, message, "br", "\n")); } } diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ToggleCommand.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ToggleCommand.java index d143e9d1..015ec799 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ToggleCommand.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/commands/ToggleCommand.java @@ -36,7 +36,7 @@ public class ToggleCommand extends BaseCommand { message = channel.getToggleOnMessage(); } - user.sendMessage(simpleChat.processMessageWithPapi(player, message, "br", "\n", + user.sendMessage(simpleChat.getAdventureManager().processMessageWithPapi(player, message, "br", "\n", "color", "", "channel", channel.getName())); } @@ -59,10 +59,10 @@ public class ToggleCommand extends BaseCommand { otherMessage = channel.getToggleOtherOnMessage(); } - user.sendMessage(simpleChat.processMessage(message, "br", "\n", + user.sendMessage(simpleChat.getAdventureManager().processMessage(message, "br", "\n", "color", "", "channel", channel.getName())); - simpleChat.getAudiences().audience(sender).sendMessage(simpleChat.processMessage(otherMessage, + simpleChat.getAdventureManager().getAudiences().audience(sender).sendMessage(simpleChat.getAdventureManager().processMessage(otherMessage, "br", "\n", "color", "", "channel", channel.getName(), "player", user.asOfflinePlayer().getName())); } diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/listeners/EmptyChatHandler.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/listeners/EmptyChatHandler.java index dd4d43af..e8aa50c0 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/listeners/EmptyChatHandler.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/listeners/EmptyChatHandler.java @@ -27,7 +27,7 @@ public class EmptyChatHandler implements Listener { return; } - event.getUser().sendMessage(simpleChat.processMessage(message)); + event.getUser().sendMessage(simpleChat.getAdventureManager().processMessage(message)); } } diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/managers/AdventureManager.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/managers/AdventureManager.java new file mode 100644 index 00000000..48992461 --- /dev/null +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/managers/AdventureManager.java @@ -0,0 +1,45 @@ +package net.draycia.simplechat.managers; + +import de.themoep.minedown.MineDown; +import me.clip.placeholderapi.PlaceholderAPI; +import net.draycia.simplechat.SimpleChat; +import net.kyori.adventure.platform.bukkit.BukkitAudiences; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.serializer.bungeecord.BungeeCordComponentSerializer; +import org.bukkit.entity.Player; + +public class AdventureManager { + + private SimpleChat simpleChat; + private BukkitAudiences audiences; + + public AdventureManager(SimpleChat simpleChat) { + this.simpleChat = simpleChat; + this.audiences = BukkitAudiences.create(simpleChat); + } + + public Component processMessageWithPapi(Player player, String input, String... placeholders) { + return processMessage(PlaceholderAPI.setPlaceholders(player, input), placeholders); + } + + public Component processMessage(String input, String... placeholders) { + switch (simpleChat.getConfig().getString("formatting.type", "minimessage").toLowerCase()) { + case "minedown": + return processMineDown(input, placeholders); + case "minimessage-markdown": + return MiniMessage.markdown().parse(input, placeholders); + case "minimessage": + default: + return MiniMessage.get().parse(input, placeholders); + } + } + + private Component processMineDown(String input, String... placeholders) { + return BungeeCordComponentSerializer.get().deserialize(MineDown.parse(input, placeholders)); + } + + public BukkitAudiences getAudiences() { + return audiences; + } +} diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/managers/PluginMessageManager.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/managers/PluginMessageManager.java index dd1c9444..b9ec4eb9 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/managers/PluginMessageManager.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/managers/PluginMessageManager.java @@ -104,7 +104,7 @@ public class PluginMessageManager implements PluginMessageListener { String chatMessage = in.readUTF(); Bukkit.getScheduler().scheduleAsyncDelayedTask(simpleChat, () -> { - chatChannel.sendComponent(user, simpleChat.processMessage(chatMessage, "br", "\n")); + chatChannel.sendComponent(user, simpleChat.getAdventureManager().processMessage(chatMessage, "br", "\n")); }); } @@ -121,7 +121,7 @@ public class PluginMessageManager implements PluginMessageListener { String chatMessage = in.readUTF(); ChatUser target = simpleChat.getUserService().wrap(targetUUID); - target.sendMessage(simpleChat.processMessage(chatMessage, "br", "\n")); + target.sendMessage(simpleChat.getAdventureManager().processMessage(chatMessage, "br", "\n")); } public void sendMessage(ChatChannel chatChannel, Player player, String message) { diff --git a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/storage/impl/SimpleChatUser.java b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/storage/impl/SimpleChatUser.java index ad884b1f..b9658700 100644 --- a/SimpleChatPlugin/src/main/java/net/draycia/simplechat/storage/impl/SimpleChatUser.java +++ b/SimpleChatPlugin/src/main/java/net/draycia/simplechat/storage/impl/SimpleChatUser.java @@ -45,7 +45,7 @@ public class SimpleChatUser implements ChatUser, ForwardingAudience { @Override public @NonNull Iterable audiences() { - return Collections.singleton(simpleChat.getAudiences().player(uuid)); + return Collections.singleton(simpleChat.getAdventureManager().getAudiences().player(uuid)); } @Override @@ -199,12 +199,12 @@ public class SimpleChatUser implements ChatUser, ForwardingAudience { targetName = this.asPlayer().getDisplayName(); } - Component toPlayerComponent = simpleChat.processMessage(toPlayerFormat, "br", "\n", + Component toPlayerComponent = simpleChat.getAdventureManager().processMessage(toPlayerFormat, "br", "\n", "message", message, "targetname", targetOfflineName, "sendername", senderOfflineName, "target", targetName, "sender", senderName); - Component fromPlayerComponent = simpleChat.processMessage(fromPlayerFormat, "br", "\n", + Component fromPlayerComponent = simpleChat.getAdventureManager().processMessage(fromPlayerFormat, "br", "\n", "message", message, "targetname", targetOfflineName, "sendername", senderOfflineName, "target", targetName, "sender", senderName); @@ -242,7 +242,7 @@ public class SimpleChatUser implements ChatUser, ForwardingAudience { continue; } - user.sendMessage(simpleChat.processMessage(simpleChat.getConfig().getString("language.spy-whispers"), "br", "\n", + user.sendMessage(simpleChat.getAdventureManager().processMessage(simpleChat.getConfig().getString("language.spy-whispers"), "br", "\n", "message", message, "targetname", targetOfflineName, "sendername", senderOfflineName, "target", targetName, "sender", senderName)); diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..6a4eb0a7 --- /dev/null +++ b/build.gradle @@ -0,0 +1,63 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +allprojects { + group = 'net.draycia' + version = '1.0' +} + +subprojects { + apply plugin: 'java' + apply plugin: 'maven-publish' + apply plugin: 'war' + + repositories { + mavenLocal() + mavenCentral() + + maven {url = 'http://repo.maven.apache.org/maven2'} + maven {url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'} + maven {url = 'https://oss.sonatype.org/content/groups/public/'} + maven {url = 'http://repo.extendedclip.com/content/repositories/placeholderapi/'} + maven {url = 'https://jitpack.io'} + maven {url = 'https://repo.aikar.co/content/groups/aikar/'} + maven {url = 'https://dl.bintray.com/ichbinjoe/public/'} + maven {url = 'https://repo.codemc.org/repository/maven-public/'} + maven {url = 'http://repo.minebench.de/'} + } + + dependencies { + compileOnly 'org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT' + compileOnly 'com.github.MilkBowl:VaultAPI:1.7' + + compileOnly 'co.aikar:acf-bukkit:0.5.0-SNAPSHOT' + compileOnly 'net.kyori:adventure-api:4.0.0-SNAPSHOT' + compileOnly 'net.kyori:adventure-nbt:4.0.0-SNAPSHOT' + compileOnly 'net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT' + compileOnly 'net.kyori:adventure-text-minimessage:3.0.0-SNAPSHOT' + compileOnly 'de.themoep:minedown:1.6.1-SNAPSHOT' + compileOnly 'co.aikar:idb-bukkit:1.0.0-SNAPSHOT' + compileOnly 'com.zaxxer:HikariCP:2.4.1' + compileOnly 'io.github.leonardosnt:bungeechannelapi:1.0.0-SNAPSHOT' + compileOnly 'io.lettuce:lettuce-core:6.0.0.M1' + } + + sourceCompatibility = '1.8' + + publishing { + publications { + maven(MavenPublication) { + from(components.java) + } + } + } + + tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' + } + + tasks.withType(Jar) { + getDestinationDirectory().set(file("$rootDir/build/bundled")) + } +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..5c2d1cf0 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..c1d900bb --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sat Jul 18 06:04:19 PDT 2020 +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew new file mode 100644 index 00000000..83f2acfd --- /dev/null +++ b/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..9618d8d9 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 910b84f0..00000000 --- a/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 4.0.0 - - net.draycia - SimpleChatParent - 1.0 - - - SimpleChatPlugin - SimpleChatModeration - - - pom - - SimpleChatParent - - - 1.8 - UTF-8 - - diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..be0978b9 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,9 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +rootProject.name = 'SimpleChatParent' +include(':SimpleChat') +include(':SimpleChatModeration') +include(':SimpleChatMCMMO') +project(':SimpleChat').projectDir = file('SimpleChatPlugin')