mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-10-31 21:47:10 +00:00
Merge branch 'development' into FS-7
This commit is contained in:
commit
afe755f5c1
@ -1,9 +1,9 @@
|
||||
name: Java16-Maven-Build
|
||||
name: Java17-Maven-Build
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build-java-16:
|
||||
build-java-17:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@ -12,10 +12,10 @@ jobs:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
# Java 16 Builds
|
||||
- name: Set up JDK 16
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v2.3.0
|
||||
with:
|
||||
java-version: 16
|
||||
java-version: 17
|
||||
distribution: 'adopt'
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
@ -11,20 +11,23 @@ These versions are currently actively supported by our team, and you should expe
|
||||
|
||||
| Version | Supported | Support End: |
|
||||
| ------------------- | ------------------ | ------------------------------ |
|
||||
| 2021.05 | :white_check_mark: | No Earlier than August 2021 |
|
||||
| 2021.09 | :white_check_mark: | No Earlier than December 2021 |
|
||||
|
||||
### Legacy Supported
|
||||
These versions are no longer under active development, however we will look to release critical secuirty patches where appropriate.
|
||||
|
||||
| Version | Supported | Support End: |
|
||||
| ------------------- | ------------------ | ------------ |
|
||||
| 2021.04 | :white_check_mark: | July 2021 |
|
||||
| 2021.06 | :white_check_mark: | October 2021 |
|
||||
|
||||
|
||||
### No Longer Supported
|
||||
These versions are no longer supported at all. It is strongly advised to update if you are running any of these versions.
|
||||
|
||||
| Version | Supported | Support Ended: |
|
||||
| ------------------- | ------------------ | ------------------- |
|
||||
| 2021.05 | :white_check_mark: | September 2021 |
|
||||
| 2021.04 | :white_check_mark: | July 2021 |
|
||||
| 2021.02 | :x: | 6 June 2021 |
|
||||
| 2020.11 | :x: | 3 May 2021 |
|
||||
| 6.0.x (Pre-Release) | :x: | December 2020 |
|
||||
|
6
pom.xml
6
pom.xml
@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>me.totalfreedom</groupId>
|
||||
<artifactId>TotalFreedomMod</artifactId>
|
||||
<version>2021.06</version>
|
||||
<version>2021.09</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
@ -247,7 +247,7 @@
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<version>5.7.2</version>
|
||||
<version>5.8.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@ -429,8 +429,8 @@
|
||||
<include>org.reflections:reflections</include>
|
||||
<include>org.javassist:javassist</include>
|
||||
<include>io.papermc:paperlib</include>
|
||||
<include>com.github.speedxx:Mojangson</include>
|
||||
<include>org.bstats:bstats-bukkit</include>
|
||||
<include>org.bstats:bstats-base</include>
|
||||
<include>org.jetbrains:annotations</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
|
@ -276,8 +276,25 @@ public class CoreProtectBridge extends FreedomService
|
||||
Block block = event.getClickedBlock();
|
||||
final CoreProtectAPI coreProtect = getCoreProtectAPI();
|
||||
|
||||
// TODO: Rewrite this
|
||||
if (data.hasInspection())
|
||||
{
|
||||
int cooldownTime = 3;
|
||||
|
||||
// Cooldown check
|
||||
if ((event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
||||
&& cooldown.containsKey(player.getName()))
|
||||
{
|
||||
long secondsLeft = getSecondsLeft(cooldown.get(player.getName()), cooldownTime);
|
||||
if (secondsLeft > 0L)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.RED + String.valueOf(secondsLeft) + " seconds left before next query.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Actual lookup time
|
||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
if (block != null)
|
||||
@ -285,19 +302,6 @@ public class CoreProtectBridge extends FreedomService
|
||||
event.setCancelled(true);
|
||||
List<String[]> lookup = coreProtect.blockLookup(block, -1);
|
||||
|
||||
int cooldownTime = 3;
|
||||
|
||||
if (cooldown.containsKey(player.getName()))
|
||||
{
|
||||
long secondsLeft = getSecondsLeft(cooldown.get(player.getName()), cooldownTime);
|
||||
if (secondsLeft > 0L)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.RED + String.valueOf(secondsLeft) + " seconds left before next query.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
cooldown.put(player.getName(), System.currentTimeMillis());
|
||||
@ -364,91 +368,75 @@ public class CoreProtectBridge extends FreedomService
|
||||
{
|
||||
if (block != null)
|
||||
{
|
||||
if (data.hasInspection())
|
||||
{
|
||||
BlockState blockState = block.getRelative(event.getBlockFace()).getState();
|
||||
Block placedBlock = blockState.getBlock();
|
||||
event.setCancelled(true);
|
||||
List<String[]> lookup = coreProtect.blockLookup(placedBlock, -1);
|
||||
BlockState blockState = block.getRelative(event.getBlockFace()).getState();
|
||||
Block placedBlock = blockState.getBlock();
|
||||
event.setCancelled(true);
|
||||
List<String[]> lookup = coreProtect.blockLookup(placedBlock, -1);
|
||||
|
||||
if (lookup.isEmpty())
|
||||
{
|
||||
lookup = coreProtect.blockLookup(block, -1);
|
||||
}
|
||||
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
cooldown.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
if (lookup != null)
|
||||
{
|
||||
if (lookup.isEmpty())
|
||||
{
|
||||
lookup = coreProtect.blockLookup(block, -1);
|
||||
player.sendMessage(net.md_5.bungee.api.ChatColor.of("#30ade4") + "Block Inspector " + ChatColor.WHITE + "- " + "No block data found for this location");
|
||||
return;
|
||||
}
|
||||
|
||||
int cooldownTime = 3;
|
||||
HISTORY_MAP.remove(event.getPlayer());
|
||||
HISTORY_MAP.put(event.getPlayer(), new FUtil.PaginationList<>(10));
|
||||
FUtil.PaginationList<String> paged = HISTORY_MAP.get(event.getPlayer());
|
||||
|
||||
if (cooldown.containsKey(player.getName()))
|
||||
player.sendMessage("---- " + net.md_5.bungee.api.ChatColor.of("#30ade4") + "Block Inspector" + ChatColor.WHITE + " ---- " +
|
||||
ChatColor.GRAY + "(x" + block.getX() + "/" + "y" + block.getY() + "/" + "z" + block.getZ() + ")");
|
||||
|
||||
for (String[] value : lookup)
|
||||
{
|
||||
long secondsLeft = getSecondsLeft(cooldown.get(player.getName()), cooldownTime);
|
||||
if (secondsLeft > 0L)
|
||||
CoreProtectAPI.ParseResult result = coreProtect.parseResult(value);
|
||||
BlockData bl = result.getBlockData();
|
||||
|
||||
String s;
|
||||
String st = "";
|
||||
|
||||
if (result.getActionString().equals("Placement"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.RED + String.valueOf(secondsLeft) + " seconds left before next query.");
|
||||
return;
|
||||
s = " placed ";
|
||||
}
|
||||
else if (result.getActionString().equals("Removal"))
|
||||
{
|
||||
s = " broke ";
|
||||
}
|
||||
else
|
||||
{
|
||||
s = " interacted with ";
|
||||
}
|
||||
|
||||
if (result.isRolledBack())
|
||||
{
|
||||
st += "§m";
|
||||
}
|
||||
|
||||
int time = (int)(System.currentTimeMillis() / 1000L);
|
||||
|
||||
paged.add(ChatColor.GRAY + getTimeAgo(result.getTime(), time) + ChatColor.WHITE + " - " + net.md_5.bungee.api.ChatColor.of("#30ade4") +
|
||||
st + result.getPlayer() + ChatColor.WHITE + st + s + net.md_5.bungee.api.ChatColor.of("#30ade4") + st + bl.getMaterial().toString().toLowerCase());
|
||||
}
|
||||
|
||||
if (!plugin.al.isAdmin(player))
|
||||
List<String> page = paged.getPage(1);
|
||||
for (String entries : page)
|
||||
{
|
||||
cooldown.put(player.getName(), System.currentTimeMillis());
|
||||
player.sendMessage(entries);
|
||||
}
|
||||
|
||||
if (lookup != null)
|
||||
{
|
||||
if (lookup.isEmpty())
|
||||
{
|
||||
player.sendMessage(net.md_5.bungee.api.ChatColor.of("#30ade4") + "Block Inspector " + ChatColor.WHITE + "- " + "No block data found for this location");
|
||||
return;
|
||||
}
|
||||
|
||||
HISTORY_MAP.remove(event.getPlayer());
|
||||
HISTORY_MAP.put(event.getPlayer(), new FUtil.PaginationList<>(10));
|
||||
FUtil.PaginationList<String> paged = HISTORY_MAP.get(event.getPlayer());
|
||||
|
||||
player.sendMessage("---- " + net.md_5.bungee.api.ChatColor.of("#30ade4") + "Block Inspector" + ChatColor.WHITE + " ---- " +
|
||||
ChatColor.GRAY + "(x" + block.getX() + "/" + "y" + block.getY() + "/" + "z" + block.getZ() + ")");
|
||||
|
||||
for (String[] value : lookup)
|
||||
{
|
||||
CoreProtectAPI.ParseResult result = coreProtect.parseResult(value);
|
||||
BlockData bl = result.getBlockData();
|
||||
|
||||
String s;
|
||||
String st = "";
|
||||
|
||||
if (result.getActionString().equals("Placement"))
|
||||
{
|
||||
s = " placed ";
|
||||
}
|
||||
else if (result.getActionString().equals("Removal"))
|
||||
{
|
||||
s = " broke ";
|
||||
}
|
||||
else
|
||||
{
|
||||
s = " interacted with ";
|
||||
}
|
||||
|
||||
if (result.isRolledBack())
|
||||
{
|
||||
st += "§m";
|
||||
}
|
||||
|
||||
int time = (int)(System.currentTimeMillis() / 1000L);
|
||||
|
||||
paged.add(ChatColor.GRAY + getTimeAgo(result.getTime(), time) + ChatColor.WHITE + " - " + net.md_5.bungee.api.ChatColor.of("#30ade4") +
|
||||
st + result.getPlayer() + ChatColor.WHITE + st + s + net.md_5.bungee.api.ChatColor.of("#30ade4") + st + bl.getMaterial().toString().toLowerCase());
|
||||
}
|
||||
|
||||
List<String> page = paged.getPage(1);
|
||||
for (String entries : page)
|
||||
{
|
||||
player.sendMessage(entries);
|
||||
}
|
||||
|
||||
player.sendMessage("Page 1/" + paged.getPageCount() + " | To index through the pages, type " + net.md_5.bungee.api.ChatColor.of("#30ade4") + "/ins history <page>");
|
||||
}
|
||||
player.sendMessage("Page 1/" + paged.getPageCount() + " | To index through the pages, type " + net.md_5.bungee.api.ChatColor.of("#30ade4") + "/ins history <page>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,6 +86,7 @@ public enum ConfigEntry
|
||||
DISCORD_ASSISTANT_EXECUTIVE_ROLE_ID(String.class, "discord.assistant_executive_role_id"),
|
||||
DISCORD_EXECUTIVE_ROLE_ID(String.class, "discord.executive_role_id"),
|
||||
DISCORD_SERVER_OWNER_ROLE_ID(String.class, "discord.server_owner_role_id"),
|
||||
DISCORD_INVITE_LINK(String.class, "discord.invite_link"),
|
||||
//
|
||||
PTERO_URL(String.class, "ptero.url"),
|
||||
PTERO_DEFAULT_EMAIL_DOMAIN(String.class, "ptero.default_email_domain"),
|
||||
|
@ -10,9 +10,12 @@ import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
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 net.md_5.bungee.api.chat.hover.content.Text;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -28,39 +31,66 @@ public class DiscordToMinecraftListener extends ListenerAdapter
|
||||
{
|
||||
Member member = event.getMember();
|
||||
String tag = getDisplay(member);
|
||||
StringBuilder message = new StringBuilder(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_AQUA + "Discord" + ChatColor.DARK_GRAY + "]");
|
||||
Message msg = event.getMessage();
|
||||
|
||||
ComponentBuilder emsg = new ComponentBuilder();
|
||||
|
||||
// Prefix
|
||||
emsg.append(ChatColor.DARK_GRAY + "[");
|
||||
TextComponent inviteLink = new TextComponent("Discord");
|
||||
inviteLink.setColor(ChatColor.DARK_AQUA.asBungee());
|
||||
inviteLink.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new Text("Click here to get the invite link!")));
|
||||
inviteLink.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL,
|
||||
ConfigEntry.DISCORD_INVITE_LINK.getString()));
|
||||
emsg.append(inviteLink);
|
||||
emsg.append(ChatColor.DARK_GRAY + "] ", ComponentBuilder.FormatRetention.NONE);
|
||||
|
||||
// Tag (if they have one)
|
||||
if (tag != null)
|
||||
{
|
||||
message.append(" ").append(tag);
|
||||
}
|
||||
message.append(" ").append(ChatColor.RED).append(ChatColor.stripColor(member.getEffectiveName())).append(ChatColor.DARK_GRAY).append(":").append(ChatColor.RESET);
|
||||
ComponentBuilder builder = new ComponentBuilder(message.toString());
|
||||
if (!msg.getContentDisplay().isEmpty())
|
||||
{
|
||||
builder.append(" ").append(ChatColor.stripColor(msg.getContentDisplay()));
|
||||
message.append(" ").append(ChatColor.stripColor(msg.getContentDisplay())); // for logging
|
||||
emsg.append(tag);
|
||||
}
|
||||
|
||||
emsg.append(" ");
|
||||
|
||||
// User
|
||||
TextComponent user = new TextComponent(ChatColor.stripColor(member.getEffectiveName()));
|
||||
user.setColor(ChatColor.RED.asBungee());
|
||||
emsg.append(user);
|
||||
|
||||
// Message
|
||||
emsg.append(ChatColor.DARK_GRAY + ": " + ChatColor.RESET
|
||||
+ ChatColor.stripColor(msg.getContentDisplay()), ComponentBuilder.FormatRetention.NONE);
|
||||
|
||||
// Attachments
|
||||
if (!msg.getAttachments().isEmpty())
|
||||
{
|
||||
if (!msg.getContentDisplay().isEmpty())
|
||||
emsg.append(" ");
|
||||
|
||||
for (Message.Attachment attachment : msg.getAttachments())
|
||||
{
|
||||
attachment.getUrl();
|
||||
builder.append(" ");
|
||||
TextComponent text = new TextComponent(ChatColor.YELLOW + "[Media]");
|
||||
text.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl()));
|
||||
builder.append(text);
|
||||
message.append(" [Media]"); // for logging
|
||||
TextComponent media = new TextComponent("[Media] ");
|
||||
media.setColor(ChatColor.YELLOW.asBungee());
|
||||
media.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl()));
|
||||
media.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(attachment.getUrl())));
|
||||
|
||||
emsg.append(media, ComponentBuilder.FormatRetention.NONE);
|
||||
}
|
||||
}
|
||||
|
||||
BaseComponent[] components = emsg.create();
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (TotalFreedomMod.getPlugin().pl.getData(player).doesDisplayDiscord())
|
||||
{
|
||||
player.spigot().sendMessage(builder.create());
|
||||
player.spigot().sendMessage(components);
|
||||
}
|
||||
}
|
||||
FLog.info(message.toString());
|
||||
|
||||
FLog.info(TextComponent.toLegacyText(components), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,8 @@ discord:
|
||||
executive_role_id: ''
|
||||
# Owner role ID
|
||||
server_owner_role_id: ''
|
||||
# Invite link for your Discord server
|
||||
invite_link: 'https://discord.com/invite/PW4savJR9a'
|
||||
|
||||
# Pterodactyl
|
||||
ptero:
|
||||
|
Loading…
Reference in New Issue
Block a user