mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-01 20:46:41 +00:00
Compare commits
33 Commits
FS-24-Agai
...
RELEASE-20
Author | SHA1 | Date | |
---|---|---|---|
a33a39af19 | |||
e1e8f1b3b5 | |||
86a8e21d06 | |||
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 |
@ -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.
|
||||||
|
@ -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