diff --git a/TotalFreedomMod.iml b/TotalFreedomMod.iml index 068870e6..93d12628 100644 --- a/TotalFreedomMod.iml +++ b/TotalFreedomMod.iml @@ -35,7 +35,6 @@ - @@ -59,25 +58,19 @@ - - - - - - - - - + + + + + - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 8c214409..7dbde0fa 100644 --- a/pom.xml +++ b/pom.xml @@ -158,9 +158,8 @@ net.coreprotect coreprotect - 2.16.0 - system - ${project.basedir}/lib/CoreProtect-2.16.0.jar + 2.16.3 + provided diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/MobBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/MobBlocker.java index dec8de7c..521f5140 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/MobBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/MobBlocker.java @@ -127,7 +127,7 @@ public class MobBlocker extends FreedomService int mobcount = 0; for (Entity entity : event.getLocation().getWorld().getLivingEntities()) { - if (!(entity instanceof HumanEntity)) + if (!(entity instanceof HumanEntity) && entity instanceof LivingEntity) { mobcount++; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java index b74f2dd6..305cdc66 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java @@ -113,7 +113,7 @@ public class Command_mbconfig extends FreedomCommand if (masterBuilder == null) // New entry { checkRank(Rank.SENIOR_ADMIN); - if (!FUtil.isExecutive(sender.getName())) + if (!FUtil.canManageMasterBuilders(sender.getName())) { noPerms(); } @@ -179,7 +179,7 @@ public class Command_mbconfig extends FreedomCommand checkConsole(); checkRank(Rank.SENIOR_ADMIN); - if (!FUtil.isExecutive(sender.getName())) + if (!FUtil.canManageMasterBuilders(sender.getName())) { noPerms(); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_report.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_report.java index 76940261..1cfd6b97 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_report.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_report.java @@ -47,12 +47,15 @@ public class Command_report extends FreedomCommand String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); plugin.cm.reportAction(playerSender, player, report); + boolean logged = false; + if (plugin.dc.enabled) { - plugin.dc.sendReport(playerSender, player, report); + logged = plugin.dc.sendReport(playerSender, player, report); } - msg(ChatColor.GREEN + "Thank you, your report has been successfully logged."); + msg(ChatColor.GREEN + "Thank you, your report has been successfully logged." + + (logged ? ChatColor.RED + "\nNote: This report has been logged to a discord channel, as with any report system, spamming reports can lead to you getting banned." : "")); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java index 4644abb9..eb8966f6 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java @@ -42,7 +42,7 @@ public enum ConfigEntry SERVER_MOTD(String.class, "server.motd"), SERVER_OWNERS(List.class, "server.owners"), SERVER_EXECUTIVES(List.class, "server.executives"), - SERVER_MASTER_BUILDER_MANAGEMENT(List.class, "server.emaster_builder_management"), + SERVER_MASTER_BUILDER_MANAGEMENT(List.class, "server.master_builder_management"), SERVER_BAN_URL(String.class, "server.ban_url"), SERVER_PERMBAN_URL(String.class, "server.permban_url"), // diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java index c9fb0e34..eb0f8ec2 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java @@ -25,6 +25,7 @@ import net.dv8tion.jda.core.entities.Role; import net.dv8tion.jda.core.entities.TextChannel; import net.dv8tion.jda.core.managers.GuildController; import net.dv8tion.jda.core.requests.restaction.AuditableRestAction; +import org.apache.commons.lang.WordUtils; import org.bukkit.entity.Player; public class Discord extends FreedomService @@ -109,36 +110,41 @@ public class Discord extends FreedomService FLog.info("Discord verification bot has successfully shutdown."); } - public void sendReport(Player reporter, Player reported, String reason) + public boolean sendReport(Player reporter, Player reported, String reason) { - if (ConfigEntry.DISCORD_REPORT_CHANNEL_ID.getString() == null) + if (ConfigEntry.DISCORD_REPORT_CHANNEL_ID.getString().isEmpty()) { - return; + return false; } - if (ConfigEntry.DISCORD_SERVER_ID.getString() == null) + if (ConfigEntry.DISCORD_SERVER_ID.getString().isEmpty()) { FLog.severe("No discord server ID was specified in the config, but there is a report channel id."); - return; + return false; } Guild server = bot.getGuildById(ConfigEntry.DISCORD_SERVER_ID.getString()); if (server == null) { FLog.severe("The discord server ID specified is invalid, or the bot is not on the server."); - return; + return false; } TextChannel channel = server.getTextChannelById(ConfigEntry.DISCORD_REPORT_CHANNEL_ID.getString()); if (channel == null) { FLog.severe("The report channel ID specified in the config is invalid"); - return; + return false; } EmbedBuilder embedBuilder = new EmbedBuilder(); embedBuilder.setTitle("Report for " + reported.getName()); embedBuilder.setDescription(reason); embedBuilder.setFooter("Reported by " + reporter.getName(), "https://minotar.net/helm/" + reporter.getName() + ".png"); embedBuilder.setTimestamp(Instant.from(ZonedDateTime.now())); + String location = "World: " + reported.getLocation().getWorld().getName() + ", X: " + reported.getLocation().getBlockX() + ", Y: " + reported.getLocation().getBlockY() + ", Z: " + reported.getLocation().getBlockZ(); + embedBuilder.addField("Location", location, true); + embedBuilder.addField("Game Mode", WordUtils.capitalizeFully(reported.getGameMode().name()), true); + embedBuilder.addField("God Mode", WordUtils.capitalizeFully(String.valueOf(plugin.esb.getEssentialsUser(reported.getName()).isGodModeEnabled())), true); MessageEmbed embed = embedBuilder.build(); channel.sendMessage(embed).complete(); + return true; } public static boolean syncRoles(Admin admin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/masterbuilder/MasterBuilderWorldRestrictions.java b/src/main/java/me/totalfreedom/totalfreedommod/masterbuilder/MasterBuilderWorldRestrictions.java index 0f9c4f02..a1f83476 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/masterbuilder/MasterBuilderWorldRestrictions.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/masterbuilder/MasterBuilderWorldRestrictions.java @@ -39,7 +39,7 @@ public class MasterBuilderWorldRestrictions extends FreedomService public boolean doRestrict(Player player) { - if (!plugin.mbl.isMasterBuilder(player) && !FUtil.isExecutive(player.getName()) && player.getWorld().equals(plugin.wm.masterBuilderWorld.getWorld())) + if (!plugin.mbl.isMasterBuilder(player) && !FUtil.canManageMasterBuilders(player.getName()) && player.getWorld().equals(plugin.wm.masterBuilderWorld.getWorld())) { return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java index ea8f604b..c1586574 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java @@ -85,6 +85,11 @@ public class FUtil return ConfigEntry.SERVER_OWNERS.getStringList().contains(name) || ConfigEntry.SERVER_EXECUTIVES.getStringList().contains(name); } + public static boolean canManageMasterBuilders(String name) + { + return ConfigEntry.SERVER_OWNERS.getStringList().contains(name) || ConfigEntry.SERVER_EXECUTIVES.getStringList().contains(name) || ConfigEntry.SERVER_MASTER_BUILDER_MANAGEMENT.getStringList().contains(name); + } + public static List getPlayerList() { List names = new ArrayList<>();