mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
More stuff for discord and mb changes
This commit is contained in:
parent
92ad950155
commit
59ee519955
@ -35,7 +35,6 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-WorldEdit:0909dc1972" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-bukkit:0909dc1972" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:dummypermscompat:1.8" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:1.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.papermc:paperlib:1.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-core:0909dc1972" level="project" />
|
||||
@ -59,25 +58,19 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.json:json:20160810" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.trove4j:trove4j:3.0.3" level="project" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.coreprotect:coreprotect:2.16.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/CoreProtect-2.16.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.coreprotect:coreprotect:2.16.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-core:7.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-jdk14:1.7.26" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-WorldGuard:50fd4cb470" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldGuard:worldguard-core:50fd4cb470" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-core:7.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.intake:intake:4.2-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:squirrelid:0.2.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.flywaydb:flyway-core:3.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.khelekore:prtree:1.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.opencsv:opencsv:2.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldGuard:worldguard-legacy:50fd4cb470" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:commandbook:2.3" level="project" />
|
||||
</component>
|
||||
</module>
|
5
pom.xml
5
pom.xml
@ -158,9 +158,8 @@
|
||||
<dependency>
|
||||
<groupId>net.coreprotect</groupId>
|
||||
<artifactId>coreprotect</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/CoreProtect-2.16.0.jar</systemPath>
|
||||
<version>2.16.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -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++;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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"),
|
||||
//
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<String> getPlayerList()
|
||||
{
|
||||
List<String> names = new ArrayList<>();
|
||||
|
Loading…
Reference in New Issue
Block a user