Compare commits

..

28 Commits

Author SHA1 Message Date
13e04475f0 FS-326 & quick formatting fix
The formatting of DiscordToMinecraft was adjusted in addition to make it look nicer
2021-07-29 17:06:31 -06:00
adc7b4a754 FS-333
According to Intellij, `bukkitTelnet instanceof BukkitTelnet` can replace the nullcheck. If this is not the case, then I apologize profoundly for my IDE's mistakes (again)
2021-07-29 05:58:14 -06:00
40498c03f4 FS-334
If Codacy complains about Line 365 being potentially combinable with Line 363, please kindly tell it to fuck off
2021-07-29 05:54:00 -06:00
cc9c07d498 FS-335 2021-07-29 05:49:37 -06:00
5fa3f9f26a FS-337
I hate Codacy
2021-07-29 05:48:11 -06:00
a79b2cbe0f FS-338 2021-07-29 05:45:21 -06:00
6c8d1934e7 FS-313 2021-07-29 05:38:30 -06:00
a1de7ac9ff FS-314 2021-07-29 05:35:28 -06:00
a37364d07e Correct JDK Version in README (#92)
It's currently wrong so needed updating.
2021-07-16 11:43:46 +01:00
939e98b759 Update badges (#88)
Remove TravisCI
Add Github Maven Build Action 
Add CodeQL Badge
2021-07-08 20:48:41 +01:00
17b051e2a7 Retired support for 2021.02 fully. (#72) 2021-06-07 16:26:15 +01:00
77a05f22a8 TotalFreedomMod May Update 2021-06-07 16:26:15 +01:00
5c3ef1f107 Bump version 2021-06-07 16:26:15 +01:00
53c5991971 Addresses FS-224 (#70) 2021-06-07 16:26:15 +01:00
ff760a6c11 Use long instead of int and use offset to check time (FS-181) (#69)
* Use long instead of int and use offset to check time (FS-181)

* Remove star import
2021-06-07 16:26:15 +01:00
63069ff9ec Calculate the player count without offline players (FS-247) (#68)
Co-authored-by: Ryan <Wild1145@users.noreply.github.com>
2021-06-07 16:26:15 +01:00
5e63b71861 Small modification to new TFGuilds (FS-255) (#67) 2021-06-07 16:26:15 +01:00
b72782de4f Add //g to blocked commands (#62)
Co-authored-by: Nathan Curran <30569566+Focusvity@users.noreply.github.com>
2021-06-07 16:26:15 +01:00
de9556c550 Name change for Fleek (#64) 2021-06-07 16:26:15 +01:00
6590504545 Added new dependency to allow TFM to compile (#65) 2021-06-07 16:26:15 +01:00
8d1e8dcf05 Switched from -c to -ci (#63)
Resolves FS-219
2021-06-07 16:26:15 +01:00
07b5076717 Bug fixes, improvements, and removals (FS-192) (#46)
* Three fixes

* Fixes /tempban throwing a NullPointerException when trying to get a player who isn't on the server but was in the past
* Fixes /tempban banning players for 24 hours regardless of the duration defined
* Fixes /list -t throwing a NullPointerException when performed from a non-player source (such as Telnet)

* Removes hubworld entriely

* Configurable blacklists for tag, muted commands, and wildcard

Changes:
* Moves globally blocked commands to the `global` subsection of the original `blocked_commands` section. You *will* need to update your configurations
* /wildcard's command blacklist is now configurable under the `wildcard` section in `blocked_commands`.
* The commands muted players can't use are now configurable under the `muted` section in `blocked_commands`.
* Removes some commented-out globally blocked command entries.

Co-authored-by: Ryan <Wild1145@users.noreply.github.com>
2021-06-07 16:26:15 +01:00
6fb9507a4c Why overcomplicating things is a horrifically bad idea (#55)
The longer I look into this plugin's code, the angrier I will become.

This fixes 2 bugs in the /potion command:
- Fixes non-admins being able to clear other players
- Fixes NPE caused when trying to add potion effects to players who are not on the server as a non-admin.

Both of these issues are caused by overcomplicating seemingly simple solutions, hence the name of this commit.

Co-authored-by: Ryan <Wild1145@users.noreply.github.com>
Co-authored-by: Nathan Curran <30569566+Focusvity@users.noreply.github.com>
2021-06-07 16:26:15 +01:00
879a524bb4 Remove a number of wipe commands we don't want anyway
We shouldn't be wiping any of this data within the server now anyway so let's not tempt fate again.
2021-06-07 16:26:15 +01:00
c60b451ce7 grammar fix 2021-06-07 16:26:15 +01:00
f85f3e32ea Fixes FS-137 2021-06-07 16:26:15 +01:00
57b3351047 ok, done (FS-156) 2021-06-07 16:26:15 +01:00
dd10eb3f5e Update Command_ride.java 2021-06-07 16:26:15 +01:00
9 changed files with 133 additions and 149 deletions

View File

@ -1,4 +1,4 @@
# TotalFreedomMod [![Build Status](https://travis-ci.com/AtlasMediaGroup/TotalFreedomMod.svg?branch=development)](https://travis-ci.com/AtlasMediaGroup/TotalFreedomMod) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/29c0f964da304666bd654bc7b1d556db)](https://www.codacy.com/gh/AtlasMediaGroup/TotalFreedomMod/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AtlasMediaGroup/TotalFreedomMod&utm_campaign=Badge_Grade)
# TotalFreedomMod [![Maven-Build](https://github.com/AtlasMediaGroup/TotalFreedomMod/actions/workflows/maven.yml/badge.svg)](https://github.com/AtlasMediaGroup/TotalFreedomMod/actions/workflows/maven.yml) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/29c0f964da304666bd654bc7b1d556db)](https://www.codacy.com/gh/AtlasMediaGroup/TotalFreedomMod/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AtlasMediaGroup/TotalFreedomMod&utm_campaign=Badge_Grade) [![CodeQL](https://github.com/AtlasMediaGroup/TotalFreedomMod/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/AtlasMediaGroup/TotalFreedomMod/actions/workflows/codeql-analysis.yml)
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
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.
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.

View File

@ -46,7 +46,7 @@ public class SavedFlags extends FreedomService
return flags;
}
public boolean getSavedFlag(String flag) throws Exception
public boolean getSavedFlag(String flag) throws IllegalStateException
{
Boolean flagValue = null;
@ -66,7 +66,7 @@ public class SavedFlags extends FreedomService
}
else
{
throw new Exception();
throw new IllegalStateException("Attempt to get non-existent flag " + flag);
}
}

View File

@ -146,15 +146,12 @@ public class EventBlocker extends FreedomService
if (ConfigEntry.ENABLE_PET_PROTECT.getBoolean())
{
Entity entity = event.getEntity();
if (entity instanceof Tameable)
{
if (((Tameable)entity).isTamed())
if (entity instanceof Tameable && ((Tameable) entity).isTamed())
{
event.setCancelled(true);
}
}
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerDropItem(PlayerDropItemEvent event)

View File

@ -101,12 +101,9 @@ public class BukkitTelnetBridge extends FreedomService
try
{
final Plugin bukkitTelnet = server.getPluginManager().getPlugin("BukkitTelnet");
if (bukkitTelnet != null)
{
if (bukkitTelnet instanceof BukkitTelnet)
{
bukkitTelnetPlugin = (BukkitTelnet)bukkitTelnet;
}
bukkitTelnetPlugin = (BukkitTelnet) bukkitTelnet;
}
}
catch (Exception ex)

View File

@ -362,9 +362,7 @@ public class CoreProtectBridge extends FreedomService
}
else if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
{
if (block != null)
{
if (data.hasInspection())
if (block != null && data.hasInspection())
{
BlockState blockState = block.getRelative(event.getBlockFace()).getState();
Block placedBlock = blockState.getBlock();
@ -453,5 +451,4 @@ public class CoreProtectBridge extends FreedomService
}
}
}
}
}

View File

@ -30,15 +30,12 @@ public class TFGuildsBridge extends FreedomService
try
{
final Plugin tfGuilds = server.getPluginManager().getPlugin("TFGuilds");
if (tfGuilds != null && tfGuilds.isEnabled())
{
if (tfGuilds instanceof TFGuilds)
if (tfGuilds != null && tfGuilds.isEnabled() && tfGuilds instanceof TFGuilds)
{
enabled = true;
return true;
}
}
}
catch (NoClassDefFoundError ex)
{
return false;

View File

@ -32,10 +32,9 @@ public class Command_deop extends FreedomCommand
final List<String> matchedPlayerNames = new ArrayList<>();
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))
{
if (player.isOp() && !plugin.al.isVanished(player.getName()))
&& player.isOp() && !plugin.al.isVanished(player.getName()))
{
matchedPlayerNames.add(player.getName());
player.setOp(false);
@ -43,7 +42,6 @@ public class Command_deop extends FreedomCommand
plugin.rm.updateDisplay(player);
}
}
}
if (!matchedPlayerNames.isEmpty())
{

View File

@ -251,9 +251,7 @@ public class Command_enchant extends FreedomCommand
return getEnchantments(item);
}
}
else if (args.length == 3)
{
if (args[0].equals("add"))
else if (args.length == 3 && args[0].equalsIgnoreCase("add"))
{
Enchantment enchantment = Enchantment.getByName(args[1].toUpperCase());
if (enchantment != null)
@ -268,7 +266,6 @@ public class Command_enchant extends FreedomCommand
}
}
}
}
return Collections.emptyList();
}

View File

@ -22,19 +22,21 @@ public class DiscordToMinecraftListener extends ListenerAdapter
public void onMessageReceived(MessageReceivedEvent event)
{
String chat_channel_id = ConfigEntry.DISCORD_CHAT_CHANNEL_ID.getString();
if (event.getMember() != null && !chat_channel_id.isEmpty() && event.getChannel().getId().equals(chat_channel_id))
{
if (!event.getAuthor().getId().equals(Discord.bot.getSelfUser().getId()))
if (event.getMember() != null && !chat_channel_id.isEmpty()
&& event.getChannel().getId().equals(chat_channel_id)
&& !event.getAuthor().getId().equals(Discord.bot.getSelfUser().getId()))
{
Member member = event.getMember();
String tag = getDisplay(member);
StringBuilder message = new StringBuilder(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_AQUA + "Discord" + ChatColor.DARK_GRAY + "]");
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);
}
message.append(" ").append(ChatColor.RED).append(ChatColor.stripColor(member.getEffectiveName())).append(ChatColor.DARK_GRAY).append(":").append(ChatColor.RESET);
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())
{
@ -63,7 +65,6 @@ public class DiscordToMinecraftListener extends ListenerAdapter
FLog.info(message.toString());
}
}
}
public String getDisplay(Member member)
{