mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-01 12:36:41 +00:00
Compare commits
30 Commits
FS-24-Agai
...
2021.05-RC
Author | SHA1 | Date | |
---|---|---|---|
da37ca52fa | |||
8c7bf365a0 | |||
eedb7a5375 | |||
d047cfc8ff | |||
9ff5da8d8f | |||
ac615f54f7 | |||
21af722e23 | |||
b1196fcf00 | |||
d170f6d323 | |||
9dd0298f56 | |||
bdf4ca84e0 | |||
7258d7f1bf | |||
8a504bff07 | |||
c00e64f736 | |||
9e73db0f24 | |||
951c061d77 | |||
579d3e0719 | |||
9777733d04 | |||
05e118dcb4 | |||
7a0d6f49f4 | |||
19f1b7f6bd | |||
b12afbdc1f | |||
49e77d4f93 | |||
eb9107bedf | |||
951c699ed0 | |||
6895e46375 | |||
1cf46c7337 | |||
407b63e48b | |||
be562fe722 | |||
928ab41d7f |
43
.github/workflows/downstream.yml
vendored
43
.github/workflows/downstream.yml
vendored
@ -1,43 +0,0 @@
|
|||||||
# This is a basic workflow to help you get started with Actions
|
|
||||||
|
|
||||||
name: Downstream Branch Updates
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '20 7 * * *'
|
|
||||||
# scheduled at 07:00 every Monday and Thursday
|
|
||||||
|
|
||||||
workflow_dispatch: # click the button on Github repo!
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
sync_with_upstream:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Sync main with upstream latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
# Step 1: run a standard checkout action, provided by github
|
|
||||||
- name: Checkout main
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
ref: main
|
|
||||||
# submodules: 'recursive' ### may be needed in your situation
|
|
||||||
|
|
||||||
# Step 2: run this sync action - specify the upstream repo, upstream branch to sync with, and target sync branch
|
|
||||||
- name: Pull (Fast-Forward) upstream changes
|
|
||||||
id: sync
|
|
||||||
uses: aormsby/Fork-Sync-With-Upstream-action@v2.1
|
|
||||||
with:
|
|
||||||
upstream_repository: AtlasMediaGroup/TotalFreedomMod
|
|
||||||
upstream_branch: main
|
|
||||||
target_branch: main
|
|
||||||
git_pull_args: --ff-only # optional arg use, defaults to simple 'pull'
|
|
||||||
|
|
||||||
# Step 3: Display a message if 'sync' step had new commits (simple test)
|
|
||||||
- name: Check for new commits
|
|
||||||
if: steps.sync.outputs.has_new_commits
|
|
||||||
run: echo "There were new commits."
|
|
||||||
|
|
||||||
# Step 4: Print a helpful timestamp for your records (not required, just nice)
|
|
||||||
- name: Timestamp
|
|
||||||
run: date
|
|
@ -1,4 +1,4 @@
|
|||||||
# TotalFreedomMod [](https://github.com/AtlasMediaGroup/TotalFreedomMod/actions/workflows/maven.yml) [](https://www.codacy.com/gh/AtlasMediaGroup/TotalFreedomMod/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AtlasMediaGroup/TotalFreedomMod&utm_campaign=Badge_Grade) [](https://github.com/AtlasMediaGroup/TotalFreedomMod/actions/workflows/codeql-analysis.yml)
|
# TotalFreedomMod [](https://travis-ci.com/AtlasMediaGroup/TotalFreedomMod) [](https://www.codacy.com/gh/AtlasMediaGroup/TotalFreedomMod/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AtlasMediaGroup/TotalFreedomMod&utm_campaign=Badge_Grade)
|
||||||
|
|
||||||
TotalFreedomMod is a CraftBukkit server plugin designed primarily to support the [Official TotalFreedom Minecraft Server](https://totalfreedom.me/). However, you are more than welcome to adapt the source for your own server.
|
TotalFreedomMod is a CraftBukkit server plugin designed primarily to support the [Official TotalFreedom Minecraft Server](https://totalfreedom.me/). However, you are more than welcome to adapt the source for your own server.
|
||||||
|
|
||||||
@ -14,4 +14,4 @@ For information on our security policy and reporting an issue, please see [SECUR
|
|||||||
|
|
||||||
### Compiling
|
### Compiling
|
||||||
|
|
||||||
You need Maven to build. You'd also need to set the JDK version to Java 11 as that is the current standard as of now.
|
You need Maven to build. You'd also need to set the JDK version to Java 8 as that is the current standard as of now.
|
||||||
|
36
SECURITY.md
36
SECURITY.md
@ -2,34 +2,18 @@
|
|||||||
|
|
||||||
## Supported Versions
|
## Supported Versions
|
||||||
|
|
||||||
We currently support the code running on the "main" branch and "development" branch of this repository. This is supported in addition to those formal releases, but note anything not yet released should be treated as in-development.
|
We currently support the code running on the "development" branch of this repository. This is supported in addition to those formal releases, but note anything not yet released should be treated as in-development.
|
||||||
|
|
||||||
In terms of plugin releases, our support matrix is as follows:
|
In terms of plugin releases, we support the following versions:
|
||||||
|
|
||||||
### Actively Supported
|
| Version | Supported |
|
||||||
These versions are currently actively supported by our team, and you should expect security patches where appropriate for these versions.
|
| ------------------- | ------------------ |
|
||||||
|
| 2021.04 | :white_check_mark: |
|
||||||
| Version | Supported | Support End: |
|
| 2021.02 | :white_check_mark: |
|
||||||
| ------------------- | ------------------ | ------------------------------ |
|
| 2020.11 | :white_check_mark: |
|
||||||
| 2021.05 | :white_check_mark: | No Earlier than August 2021 |
|
| 6.0.x (Pre-Release) | :x: |
|
||||||
|
| < 2020.11 | :x: |
|
||||||
### Legacy Supported
|
| < 5.x | :x: |
|
||||||
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 |
|
|
||||||
|
|
||||||
### 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.02 | :x: | 6 June 2021 |
|
|
||||||
| 2020.11 | :x: | 3 May 2021 |
|
|
||||||
| 6.0.x (Pre-Release) | :x: | December 2020 |
|
|
||||||
| < 2020.11 | :x: | December 2020 |
|
|
||||||
| < 5.x | :x: | December 2020 |
|
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>me.totalfreedom</groupId>
|
<groupId>me.totalfreedom</groupId>
|
||||||
<artifactId>TotalFreedomMod</artifactId>
|
<artifactId>TotalFreedomMod</artifactId>
|
||||||
<version>2021.05</version>
|
<version>2021.05-RC01</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -46,7 +46,7 @@ public class SavedFlags extends FreedomService
|
|||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getSavedFlag(String flag) throws IllegalStateException
|
public boolean getSavedFlag(String flag) throws Exception
|
||||||
{
|
{
|
||||||
Boolean flagValue = null;
|
Boolean flagValue = null;
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ public class SavedFlags extends FreedomService
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("Attempt to get non-existent flag " + flag);
|
throw new Exception();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,9 +146,12 @@ public class EventBlocker extends FreedomService
|
|||||||
if (ConfigEntry.ENABLE_PET_PROTECT.getBoolean())
|
if (ConfigEntry.ENABLE_PET_PROTECT.getBoolean())
|
||||||
{
|
{
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (entity instanceof Tameable && ((Tameable) entity).isTamed())
|
if (entity instanceof Tameable)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
if (((Tameable)entity).isTamed())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,9 +101,12 @@ public class BukkitTelnetBridge extends FreedomService
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
final Plugin bukkitTelnet = server.getPluginManager().getPlugin("BukkitTelnet");
|
final Plugin bukkitTelnet = server.getPluginManager().getPlugin("BukkitTelnet");
|
||||||
if (bukkitTelnet instanceof BukkitTelnet)
|
if (bukkitTelnet != null)
|
||||||
{
|
{
|
||||||
bukkitTelnetPlugin = (BukkitTelnet) bukkitTelnet;
|
if (bukkitTelnet instanceof BukkitTelnet)
|
||||||
|
{
|
||||||
|
bukkitTelnetPlugin = (BukkitTelnet)bukkitTelnet;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -362,90 +362,93 @@ public class CoreProtectBridge extends FreedomService
|
|||||||
}
|
}
|
||||||
else if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
else if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
||||||
{
|
{
|
||||||
if (block != null && data.hasInspection())
|
if (block != null)
|
||||||
{
|
{
|
||||||
BlockState blockState = block.getRelative(event.getBlockFace()).getState();
|
if (data.hasInspection())
|
||||||
Block placedBlock = blockState.getBlock();
|
|
||||||
event.setCancelled(true);
|
|
||||||
List<String[]> lookup = coreProtect.blockLookup(placedBlock, -1);
|
|
||||||
|
|
||||||
if (lookup.isEmpty())
|
|
||||||
{
|
{
|
||||||
lookup = coreProtect.blockLookup(block, -1);
|
BlockState blockState = block.getRelative(event.getBlockFace()).getState();
|
||||||
}
|
Block placedBlock = blockState.getBlock();
|
||||||
|
event.setCancelled(true);
|
||||||
|
List<String[]> lookup = coreProtect.blockLookup(placedBlock, -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());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lookup != null)
|
|
||||||
{
|
|
||||||
if (lookup.isEmpty())
|
if (lookup.isEmpty())
|
||||||
{
|
{
|
||||||
player.sendMessage(net.md_5.bungee.api.ChatColor.of("#30ade4") + "Block Inspector " + ChatColor.WHITE + "- " + "No block data found for this location");
|
lookup = coreProtect.blockLookup(block, -1);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HISTORY_MAP.remove(event.getPlayer());
|
int cooldownTime = 3;
|
||||||
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 + " ---- " +
|
if (cooldown.containsKey(player.getName()))
|
||||||
ChatColor.GRAY + "(x" + block.getX() + "/" + "y" + block.getY() + "/" + "z" + block.getZ() + ")");
|
|
||||||
|
|
||||||
for (String[] value : lookup)
|
|
||||||
{
|
{
|
||||||
CoreProtectAPI.ParseResult result = coreProtect.parseResult(value);
|
long secondsLeft = getSecondsLeft(cooldown.get(player.getName()), cooldownTime);
|
||||||
BlockData bl = result.getBlockData();
|
if (secondsLeft > 0L)
|
||||||
|
|
||||||
String s;
|
|
||||||
String st = "";
|
|
||||||
|
|
||||||
if (result.getActionString().equals("Placement"))
|
|
||||||
{
|
{
|
||||||
s = " placed ";
|
event.setCancelled(true);
|
||||||
|
player.sendMessage(ChatColor.RED + String.valueOf(secondsLeft) + " seconds left before next query.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
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);
|
if (!plugin.al.isAdmin(player))
|
||||||
for (String entries : page)
|
|
||||||
{
|
{
|
||||||
player.sendMessage(entries);
|
cooldown.put(player.getName(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendMessage("Page 1/" + paged.getPageCount() + " | To index through the pages, type " + net.md_5.bungee.api.ChatColor.of("#30ade4") + "/ins history <page>");
|
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>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,10 +30,13 @@ public class TFGuildsBridge extends FreedomService
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
final Plugin tfGuilds = server.getPluginManager().getPlugin("TFGuilds");
|
final Plugin tfGuilds = server.getPluginManager().getPlugin("TFGuilds");
|
||||||
if (tfGuilds != null && tfGuilds.isEnabled() && tfGuilds instanceof TFGuilds)
|
if (tfGuilds != null && tfGuilds.isEnabled())
|
||||||
{
|
{
|
||||||
enabled = true;
|
if (tfGuilds instanceof TFGuilds)
|
||||||
return true;
|
{
|
||||||
|
enabled = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (NoClassDefFoundError ex)
|
catch (NoClassDefFoundError ex)
|
||||||
|
@ -32,14 +32,16 @@ public class Command_deop extends FreedomCommand
|
|||||||
final List<String> matchedPlayerNames = new ArrayList<>();
|
final List<String> matchedPlayerNames = new ArrayList<>();
|
||||||
for (Player player : server.getOnlinePlayers())
|
for (Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if ((player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)
|
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)
|
||||||
|| player.getName().contains(targetName) || player.getDisplayName().contains(targetName))
|
|| player.getName().contains(targetName) || player.getDisplayName().contains(targetName))
|
||||||
&& player.isOp() && !plugin.al.isVanished(player.getName()))
|
|
||||||
{
|
{
|
||||||
matchedPlayerNames.add(player.getName());
|
if (player.isOp() && !plugin.al.isVanished(player.getName()))
|
||||||
player.setOp(false);
|
{
|
||||||
msg(player, YOU_ARE_NOT_OP);
|
matchedPlayerNames.add(player.getName());
|
||||||
plugin.rm.updateDisplay(player);
|
player.setOp(false);
|
||||||
|
msg(player, YOU_ARE_NOT_OP);
|
||||||
|
plugin.rm.updateDisplay(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,18 +251,21 @@ public class Command_enchant extends FreedomCommand
|
|||||||
return getEnchantments(item);
|
return getEnchantments(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args.length == 3 && args[0].equalsIgnoreCase("add"))
|
else if (args.length == 3)
|
||||||
{
|
{
|
||||||
Enchantment enchantment = Enchantment.getByName(args[1].toUpperCase());
|
if (args[0].equals("add"))
|
||||||
if (enchantment != null)
|
|
||||||
{
|
{
|
||||||
if (!unsafe)
|
Enchantment enchantment = Enchantment.getByName(args[1].toUpperCase());
|
||||||
|
if (enchantment != null)
|
||||||
{
|
{
|
||||||
return stringNumberRange(1, enchantment.getMaxLevel());
|
if (!unsafe)
|
||||||
}
|
{
|
||||||
else
|
return stringNumberRange(1, enchantment.getMaxLevel());
|
||||||
{
|
}
|
||||||
return Collections.singletonList("[level]");
|
else
|
||||||
|
{
|
||||||
|
return Collections.singletonList("[level]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,47 +22,46 @@ public class DiscordToMinecraftListener extends ListenerAdapter
|
|||||||
public void onMessageReceived(MessageReceivedEvent event)
|
public void onMessageReceived(MessageReceivedEvent event)
|
||||||
{
|
{
|
||||||
String chat_channel_id = ConfigEntry.DISCORD_CHAT_CHANNEL_ID.getString();
|
String chat_channel_id = ConfigEntry.DISCORD_CHAT_CHANNEL_ID.getString();
|
||||||
if (event.getMember() != null && !chat_channel_id.isEmpty()
|
if (event.getMember() != null && !chat_channel_id.isEmpty() && event.getChannel().getId().equals(chat_channel_id))
|
||||||
&& event.getChannel().getId().equals(chat_channel_id)
|
|
||||||
&& !event.getAuthor().getId().equals(Discord.bot.getSelfUser().getId()))
|
|
||||||
{
|
{
|
||||||
Member member = event.getMember();
|
if (!event.getAuthor().getId().equals(Discord.bot.getSelfUser().getId()))
|
||||||
String tag = getDisplay(member);
|
|
||||||
StringBuilder message = new StringBuilder(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_AQUA + "Discord"
|
|
||||||
+ ChatColor.DARK_GRAY + "]");
|
|
||||||
Message msg = event.getMessage();
|
|
||||||
if (tag != null)
|
|
||||||
{
|
{
|
||||||
message.append(" ").append(tag);
|
Member member = event.getMember();
|
||||||
}
|
String tag = getDisplay(member);
|
||||||
message.append(" ").append(ChatColor.RED).append(ChatColor.stripColor(member.getEffectiveName()))
|
StringBuilder message = new StringBuilder(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_AQUA + "Discord" + ChatColor.DARK_GRAY + "]");
|
||||||
.append(ChatColor.DARK_GRAY).append(":").append(ChatColor.RESET);
|
Message msg = event.getMessage();
|
||||||
ComponentBuilder builder = new ComponentBuilder(message.toString());
|
if (tag != null)
|
||||||
if (!msg.getContentDisplay().isEmpty())
|
|
||||||
{
|
|
||||||
builder.append(" ").append(ChatColor.stripColor(msg.getContentDisplay()));
|
|
||||||
message.append(" ").append(ChatColor.stripColor(msg.getContentDisplay())); // for logging
|
|
||||||
}
|
|
||||||
if (!msg.getAttachments().isEmpty())
|
|
||||||
{
|
|
||||||
for (Message.Attachment attachment : msg.getAttachments())
|
|
||||||
{
|
{
|
||||||
attachment.getUrl();
|
message.append(" ").append(tag);
|
||||||
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
|
|
||||||
}
|
}
|
||||||
}
|
message.append(" ").append(ChatColor.RED).append(ChatColor.stripColor(member.getEffectiveName())).append(ChatColor.DARK_GRAY).append(":").append(ChatColor.RESET);
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
ComponentBuilder builder = new ComponentBuilder(message.toString());
|
||||||
{
|
if (!msg.getContentDisplay().isEmpty())
|
||||||
if (TotalFreedomMod.getPlugin().pl.getData(player).doesDisplayDiscord())
|
|
||||||
{
|
{
|
||||||
player.spigot().sendMessage(builder.create());
|
builder.append(" ").append(ChatColor.stripColor(msg.getContentDisplay()));
|
||||||
|
message.append(" ").append(ChatColor.stripColor(msg.getContentDisplay())); // for logging
|
||||||
}
|
}
|
||||||
|
if (!msg.getAttachments().isEmpty())
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
if (TotalFreedomMod.getPlugin().pl.getData(player).doesDisplayDiscord())
|
||||||
|
{
|
||||||
|
player.spigot().sendMessage(builder.create());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FLog.info(message.toString());
|
||||||
}
|
}
|
||||||
FLog.info(message.toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user