mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 02:05:41 +00:00
Signed-off-by: Lemon <minecraftoxlemonxo@gmail.com>
This commit is contained in:
parent
b801979f72
commit
8b425967a4
10
pom.xml
10
pom.xml
@ -142,9 +142,9 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>me.libraryaddict</groupId>
|
<groupId>me.libraryaddict</groupId>
|
||||||
<artifactId>LibsDisguise</artifactId>
|
<artifactId>LibsDisguises</artifactId>
|
||||||
<version>9.4.0-SNAPSHOT</version>
|
<scope>system</scope>
|
||||||
<scope>provided</scope>
|
<systemPath>${project.basedir}/lib/LibsDisguises.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -158,9 +158,9 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.dv8tion</groupId>
|
<groupId>net.dv8tion</groupId>
|
||||||
<artifactId>JDA</artifactId>
|
<artifactId>JDA</artifactId>
|
||||||
<version>3.4.0_317-withDependencies</version>
|
<version>3.5.0_327-withDependencies</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${project.basedir}/lib/JDA-3.4.0_317-withDependencies.jar</systemPath>
|
<systemPath>${project.basedir}/lib/JDA-3.5.0_327-withDependencies.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -1,36 +1,17 @@
|
|||||||
package me.totalfreedom.totalfreedommod;
|
package me.totalfreedom.totalfreedommod;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.fun.Trailer;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Properties;
|
|
||||||
import me.totalfreedom.totalfreedommod.admin.AdminList;
|
import me.totalfreedom.totalfreedommod.admin.AdminList;
|
||||||
import me.totalfreedom.totalfreedommod.banning.BanManager;
|
import me.totalfreedom.totalfreedommod.banning.BanManager;
|
||||||
import me.totalfreedom.totalfreedommod.banning.PermbanList;
|
import me.totalfreedom.totalfreedommod.banning.PermbanList;
|
||||||
import me.totalfreedom.totalfreedommod.blocking.BlockBlocker;
|
import me.totalfreedom.totalfreedommod.blocking.*;
|
||||||
import me.totalfreedom.totalfreedommod.blocking.EditBlocker;
|
|
||||||
import me.totalfreedom.totalfreedommod.blocking.EventBlocker;
|
|
||||||
import me.totalfreedom.totalfreedommod.blocking.InteractBlocker;
|
|
||||||
import me.totalfreedom.totalfreedommod.blocking.MobBlocker;
|
|
||||||
import me.totalfreedom.totalfreedommod.blocking.PVPBlocker;
|
|
||||||
import me.totalfreedom.totalfreedommod.blocking.PotionBlocker;
|
|
||||||
import me.totalfreedom.totalfreedommod.blocking.SignBlocker;
|
|
||||||
import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker;
|
import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker;
|
||||||
import me.totalfreedom.totalfreedommod.bridge.CoreProtectBridge;
|
import me.totalfreedom.totalfreedommod.bridge.*;
|
||||||
import me.totalfreedom.totalfreedommod.bridge.BukkitTelnetBridge;
|
|
||||||
import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge;
|
|
||||||
import me.totalfreedom.totalfreedommod.bridge.LibsDisguisesBridge;
|
|
||||||
import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
|
|
||||||
import me.totalfreedom.totalfreedommod.caging.Cager;
|
import me.totalfreedom.totalfreedommod.caging.Cager;
|
||||||
import me.totalfreedom.totalfreedommod.command.CommandLoader;
|
import me.totalfreedom.totalfreedommod.command.CommandLoader;
|
||||||
import me.totalfreedom.totalfreedommod.config.MainConfig;
|
import me.totalfreedom.totalfreedommod.config.MainConfig;
|
||||||
import me.totalfreedom.totalfreedommod.discord.Discord;
|
import me.totalfreedom.totalfreedommod.discord.Discord;
|
||||||
import me.totalfreedom.totalfreedommod.freeze.Freezer;
|
import me.totalfreedom.totalfreedommod.freeze.Freezer;
|
||||||
import me.totalfreedom.totalfreedommod.fun.ItemFun;
|
import me.totalfreedom.totalfreedommod.fun.*;
|
||||||
import me.totalfreedom.totalfreedommod.fun.Jumppads;
|
|
||||||
import me.totalfreedom.totalfreedommod.fun.Landminer;
|
|
||||||
import me.totalfreedom.totalfreedommod.fun.MP44;
|
|
||||||
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
|
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerList;
|
import me.totalfreedom.totalfreedommod.player.PlayerList;
|
||||||
import me.totalfreedom.totalfreedommod.rank.RankManager;
|
import me.totalfreedom.totalfreedommod.rank.RankManager;
|
||||||
@ -47,6 +28,11 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
import org.mcstats.Metrics;
|
import org.mcstats.Metrics;
|
||||||
import org.spigotmc.SpigotConfig;
|
import org.spigotmc.SpigotConfig;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -116,6 +102,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
public LibsDisguisesBridge ldb;
|
public LibsDisguisesBridge ldb;
|
||||||
public CoreProtectBridge cpb;
|
public CoreProtectBridge cpb;
|
||||||
public WorldEditBridge web;
|
public WorldEditBridge web;
|
||||||
|
public WorldGuardBridge wgb;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load()
|
public void load()
|
||||||
@ -225,6 +212,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
esb = bridges.registerService(EssentialsBridge.class);
|
esb = bridges.registerService(EssentialsBridge.class);
|
||||||
ldb = bridges.registerService(LibsDisguisesBridge.class);
|
ldb = bridges.registerService(LibsDisguisesBridge.class);
|
||||||
web = bridges.registerService(WorldEditBridge.class);
|
web = bridges.registerService(WorldEditBridge.class);
|
||||||
|
wgb = bridges.registerService(WorldGuardBridge.class);
|
||||||
bridges.start();
|
bridges.start();
|
||||||
|
|
||||||
timer.update();
|
timer.update();
|
||||||
|
@ -0,0 +1,80 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.bridge;
|
||||||
|
|
||||||
|
import com.sk89q.worldguard.bukkit.RegionContainer;
|
||||||
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class WorldGuardBridge extends FreedomService
|
||||||
|
{
|
||||||
|
|
||||||
|
private WorldGuardPlugin worldGuardPlugin;
|
||||||
|
|
||||||
|
public WorldGuardBridge(TotalFreedomMod plugin)
|
||||||
|
{
|
||||||
|
super(plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorldGuardPlugin getWorldGuardPlugin()
|
||||||
|
{
|
||||||
|
if (worldGuardPlugin == null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final Plugin worldGuard = server.getPluginManager().getPlugin("WorldGuard");
|
||||||
|
if (worldGuard != null)
|
||||||
|
{
|
||||||
|
if (worldGuard instanceof WorldGuardPlugin)
|
||||||
|
{
|
||||||
|
worldGuardPlugin = (WorldGuardPlugin) worldGuard;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
FLog.severe(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return worldGuardPlugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean wipeRegions(World world)
|
||||||
|
{
|
||||||
|
RegionContainer container = getWorldGuardPlugin().getRegionContainer();
|
||||||
|
RegionManager rm = container.get(world);
|
||||||
|
if (rm != null)
|
||||||
|
{
|
||||||
|
Map<String, ProtectedRegion> regions = rm.getRegions();
|
||||||
|
for (ProtectedRegion region : regions.values())
|
||||||
|
{
|
||||||
|
rm.removeRegion(region.getId());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPluginEnabled() {
|
||||||
|
Plugin wr = getWorldGuardPlugin();
|
||||||
|
|
||||||
|
return wr != null && wr.isEnabled();
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,14 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Toggle PVP mode for players.", usage = "/<command> [[-s] <player> [reason] | list | purge | all]", aliases = "pvpblock,pvpmode")
|
@CommandParameters(description = "Toggle PVP mode for players.", usage = "/<command> [[-s] <player> [reason] | list | purge | all]", aliases = "pvpblock,pvpmode")
|
||||||
@ -68,7 +68,7 @@ public class Command_blockpvp extends FreedomCommand
|
|||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (Player player : server.getOnlinePlayers())
|
for (Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (!plugin.al.isAdmin((CommandSender) player))
|
if (!plugin.al.isAdmin(player))
|
||||||
{
|
{
|
||||||
final FPlayer playerdata = plugin.pl.getPlayer(player);
|
final FPlayer playerdata = plugin.pl.getPlayer(player);
|
||||||
playerdata.setPvpBlocked(true);
|
playerdata.setPvpBlocked(true);
|
||||||
@ -83,7 +83,7 @@ public class Command_blockpvp extends FreedomCommand
|
|||||||
final boolean smite = args[0].equals("-s");
|
final boolean smite = args[0].equals("-s");
|
||||||
if (smite)
|
if (smite)
|
||||||
{
|
{
|
||||||
args = (String[]) ArrayUtils.subarray(args, 1, args.length);
|
args = ArrayUtils.subarray(args, 1, args.length);
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -109,11 +109,11 @@ public class Command_blockpvp extends FreedomCommand
|
|||||||
FUtil.adminAction(sender.getName(), "Enabling PVP for " + p.getName(), true);
|
FUtil.adminAction(sender.getName(), "Enabling PVP for " + p.getName(), true);
|
||||||
pd.setPvpBlocked(false);
|
pd.setPvpBlocked(false);
|
||||||
msg("Enabling PVP for " + p.getName());
|
msg("Enabling PVP for " + p.getName());
|
||||||
msg((CommandSender) p, "Your PVP have been enabled.", ChatColor.GREEN);
|
msg(p, "Your PVP have been enabled.", ChatColor.GREEN);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (plugin.al.isAdmin((CommandSender) p))
|
if (plugin.al.isAdmin(p))
|
||||||
{
|
{
|
||||||
msg(p.getName() + " is an admin, and cannot have their PVP disabled.");
|
msg(p.getName() + " is an admin, and cannot have their PVP disabled.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import java.util.List;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import java.util.ArrayList;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -i | -f]", aliases = "who")
|
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -i | -f | -v]", aliases = "who")
|
||||||
public class Command_list extends FreedomCommand
|
public class Command_list extends FreedomCommand
|
||||||
{
|
{
|
||||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) {
|
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) {
|
||||||
@ -23,15 +24,15 @@ public class Command_list extends FreedomCommand
|
|||||||
}
|
}
|
||||||
if (FUtil.isFromHostConsole(sender.getName()))
|
if (FUtil.isFromHostConsole(sender.getName()))
|
||||||
{
|
{
|
||||||
List<String> names = new ArrayList<String>();
|
List<String> names = new ArrayList<>();
|
||||||
for (Player player : server.getOnlinePlayers())
|
for (Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
names.add(player.getName());
|
names.add(player.getName());
|
||||||
}
|
}
|
||||||
msg("There are " + names.size() + "/" + server.getMaxPlayers() + " players online:\n" + StringUtils.join((Iterable)names, ", "), ChatColor.WHITE);
|
msg("There are " + names.size() + "/" + server.getMaxPlayers() + " players online:\n" + StringUtils.join(names, ", "), ChatColor.WHITE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ListFilter listFilter = null;
|
ListFilter listFilter;
|
||||||
if (args.length == 1)
|
if (args.length == 1)
|
||||||
{
|
{
|
||||||
String s = args[0];
|
String s = args[0];
|
||||||
@ -44,6 +45,7 @@ public class Command_list extends FreedomCommand
|
|||||||
}
|
}
|
||||||
case "-v":
|
case "-v":
|
||||||
{
|
{
|
||||||
|
checkRank(Rank.SUPER_ADMIN);
|
||||||
listFilter = ListFilter.VANISHED_ADMINS;
|
listFilter = ListFilter.VANISHED_ADMINS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -76,7 +78,7 @@ public class Command_list extends FreedomCommand
|
|||||||
.append(server.getMaxPlayers())
|
.append(server.getMaxPlayers())
|
||||||
.append(ChatColor.BLUE)
|
.append(ChatColor.BLUE)
|
||||||
.append(" players online.");
|
.append(" players online.");
|
||||||
List<String> n = new ArrayList<String>();
|
List<String> n = new ArrayList<>();
|
||||||
for (Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (listFilter == ListFilter.ADMINS && !plugin.al.isAdmin(p))
|
if (listFilter == ListFilter.ADMINS && !plugin.al.isAdmin(p))
|
||||||
@ -91,7 +93,7 @@ public class Command_list extends FreedomCommand
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (listFilter == ListFilter.IMPOSTORS && plugin.al.isAdminImpostor(p))
|
if (listFilter == ListFilter.IMPOSTORS && !plugin.al.isAdminImpostor(p))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -106,10 +108,11 @@ public class Command_list extends FreedomCommand
|
|||||||
final Displayable display = plugin.rm.getDisplay(p);
|
final Displayable display = plugin.rm.getDisplay(p);
|
||||||
n.add(display.getColoredTag() + p.getName());
|
n.add(display.getColoredTag() + p.getName());
|
||||||
}
|
}
|
||||||
String playerType = (listFilter == null) ? "players" : listFilter.toString().toLowerCase().replace('_', ' ');
|
String playerType = listFilter.toString().toLowerCase().replace('_', ' ');
|
||||||
onlineUsers.append("Connected ")
|
onlineUsers.append("Connected ")
|
||||||
.append(playerType + ": ")
|
.append(playerType)
|
||||||
.append(StringUtils.join((Iterable)n, ChatColor.WHITE + ", "));
|
.append(": ")
|
||||||
|
.append(StringUtils.join(n, ChatColor.WHITE + ", "));
|
||||||
if (senderIsConsole)
|
if (senderIsConsole)
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.stripColor(onlineStats.toString()));
|
sender.sendMessage(ChatColor.stripColor(onlineStats.toString()));
|
||||||
@ -130,6 +133,6 @@ public class Command_list extends FreedomCommand
|
|||||||
ADMINS,
|
ADMINS,
|
||||||
VANISHED_ADMINS,
|
VANISHED_ADMINS,
|
||||||
FAMOUS_PLAYERS,
|
FAMOUS_PLAYERS,
|
||||||
IMPOSTORS;
|
IMPOSTORS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,47 +1,26 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import com.sk89q.worldguard.bukkit.RegionContainer;
|
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
|
||||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
|
||||||
import java.util.Map;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TELNET_ADMIN, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.TELNET_ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Wipe all WorldGuard regions for a specified world.", usage = "/<command> <world>", aliases = "wiperegions")
|
@CommandParameters(description = "Wipe all WorldGuard regions for a specified world.", usage = "/<command> <world>", aliases = "wiperegions")
|
||||||
public class Command_wiperegions extends FreedomCommand
|
public class Command_wiperegions extends FreedomCommand {
|
||||||
{
|
|
||||||
|
|
||||||
public WorldGuardPlugin getWorldGuard()
|
|
||||||
{
|
|
||||||
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
|
|
||||||
|
|
||||||
if (plugin == null || !(plugin instanceof WorldGuardPlugin))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (WorldGuardPlugin) plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||||
{
|
if (!plugin.wgb.isPluginEnabled())
|
||||||
if (getWorldGuard() == null)
|
|
||||||
{
|
{
|
||||||
msg("WorldGuard is not installed.", ChatColor.GRAY);
|
msg("WorldGuard is not enabled.", ChatColor.GRAY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args.length != 1)
|
if (args.length != 1) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
World world = server.getWorld(args[0]);
|
World world = server.getWorld(args[0]);
|
||||||
@ -50,20 +29,12 @@ public class Command_wiperegions extends FreedomCommand
|
|||||||
msg("World : \"" + args[0] + "\" not found.", ChatColor.GRAY);
|
msg("World : \"" + args[0] + "\" not found.", ChatColor.GRAY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (world.equals(plugin.wm.adminworld.getWorld()) && !plugin.rm.getRank(sender).isAtLeast(Rank.SENIOR_ADMIN))
|
if (world.equals(plugin.wm.adminworld.getWorld()))
|
||||||
{
|
{
|
||||||
msg("You do not have permission to wipe adminworld.", ChatColor.RED);
|
checkRank(Rank.SENIOR_ADMIN);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
RegionContainer container = getWorldGuard().getRegionContainer();
|
if (plugin.wgb.wipeRegions(world))
|
||||||
RegionManager rm = container.get(world);
|
|
||||||
if (rm != null)
|
|
||||||
{
|
{
|
||||||
Map<String, ProtectedRegion> regions = rm.getRegions();
|
|
||||||
for (ProtectedRegion region : regions.values())
|
|
||||||
{
|
|
||||||
rm.removeRegion(region.getId());
|
|
||||||
}
|
|
||||||
FUtil.adminAction(sender.getName(), "Wiping regions for world: " + world.getName(), true);
|
FUtil.adminAction(sender.getName(), "Wiping regions for world: " + world.getName(), true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -73,5 +44,4 @@ public class Command_wiperegions extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.List;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import static org.bukkit.Bukkit.getServer;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||||
@CommandParameters(description = "Removes essentials playerdata", usage = "/<command>")
|
@CommandParameters(description = "Removes essentials playerdata", usage = "/<command>")
|
||||||
public class Command_wipeuserdata extends FreedomCommand
|
public class Command_wipeuserdata extends FreedomCommand
|
||||||
@ -25,13 +24,13 @@ public class Command_wipeuserdata extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUtil.adminAction(sender.getName(), "Wiping Essentials and Worlds playerdata", true);
|
FUtil.adminAction(sender.getName(), "Wiping Essentials and worlds playerdata", true);
|
||||||
|
|
||||||
for (World w : Bukkit.getWorlds())
|
for (World w : Bukkit.getWorlds())
|
||||||
{
|
{
|
||||||
if (w.getName().equals(plugin.wm.adminworld.getWorld()))
|
if (w.getName().equals(plugin.wm.adminworld.getWorld().getName()))
|
||||||
{
|
{
|
||||||
return true;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUtil.deleteFolder(new File(server.getPluginManager().getPlugin("Essentials").getDataFolder(), "userdata"));
|
FUtil.deleteFolder(new File(server.getPluginManager().getPlugin("Essentials").getDataFolder(), "userdata"));
|
||||||
|
@ -1,28 +1,26 @@
|
|||||||
package me.totalfreedom.totalfreedommod.discord;
|
package me.totalfreedom.totalfreedommod.discord;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import me.totalfreedom.totalfreedommod.discord.MessageListener;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
|
import net.dv8tion.jda.core.AccountType;
|
||||||
import net.dv8tion.jda.core.JDA;
|
import net.dv8tion.jda.core.JDA;
|
||||||
import net.dv8tion.jda.core.JDABuilder;
|
import net.dv8tion.jda.core.JDABuilder;
|
||||||
import net.dv8tion.jda.core.entities.MessageChannel;
|
|
||||||
import net.dv8tion.jda.core.AccountType;
|
import javax.security.auth.login.LoginException;
|
||||||
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
|
||||||
import javax.security.auth.login.LoginException;
|
|
||||||
|
|
||||||
public class Discord extends FreedomService
|
public class Discord extends FreedomService
|
||||||
{
|
{
|
||||||
public static HashMap<String, Admin> LINK_CODES = new HashMap<>();
|
public static HashMap<String, Admin> LINK_CODES = new HashMap<>();
|
||||||
public static List<String> VERIFY_CODES = new ArrayList();
|
public static List<String> VERIFY_CODES = new ArrayList();
|
||||||
public static JDA bot = null;
|
public static JDA bot = null;
|
||||||
public static Boolean enabled = false;
|
public Boolean enabled = false;
|
||||||
|
|
||||||
public Discord(TotalFreedomMod plugin)
|
public Discord(TotalFreedomMod plugin)
|
||||||
{
|
{
|
||||||
@ -52,10 +50,6 @@ public class Discord extends FreedomService
|
|||||||
{
|
{
|
||||||
FLog.warning("An invalid token for the discord verification bot, the bot will not enable.");
|
FLog.warning("An invalid token for the discord verification bot, the bot will not enable.");
|
||||||
}
|
}
|
||||||
catch (RateLimitedException e)
|
|
||||||
{
|
|
||||||
FLog.warning("The discord verification bot was ratelimited trying to login, please try again later.");
|
|
||||||
}
|
|
||||||
catch (IllegalArgumentException | InterruptedException e)
|
catch (IllegalArgumentException | InterruptedException e)
|
||||||
{
|
{
|
||||||
FLog.warning("Discord verification bot failed to start.");
|
FLog.warning("Discord verification bot failed to start.");
|
||||||
|
@ -14,14 +14,14 @@ public class MessageListener extends ListenerAdapter
|
|||||||
// Handle link code
|
// Handle link code
|
||||||
if (event.getMessage().getContentRaw().matches("[0-9][0-9][0-9][0-9][0-9]"))
|
if (event.getMessage().getContentRaw().matches("[0-9][0-9][0-9][0-9][0-9]"))
|
||||||
{
|
{
|
||||||
String code = event.getMessage().getRawContent();
|
String code = event.getMessage().getContentRaw();
|
||||||
if (Discord.LINK_CODES.get(code) != null)
|
if (Discord.LINK_CODES.get(code) != null)
|
||||||
{
|
{
|
||||||
Admin admin = Discord.LINK_CODES.get(code);
|
Admin admin = Discord.LINK_CODES.get(code);
|
||||||
admin.setDiscordID(event.getMessage().getAuthor().getId());
|
admin.setDiscordID(event.getMessage().getAuthor().getId());
|
||||||
Discord.LINK_CODES.remove(code);
|
Discord.LINK_CODES.remove(code);
|
||||||
event.getChannel().sendMessage("Link successful. Now this Discord account is linked with the Minecraft account `" + admin.getName() + "`.\n "
|
event.getChannel().sendMessage("Link successful. Now this Discord account is linked with the Minecraft account `" + admin.getName() + "`.\n "
|
||||||
+ "Now when you are an impostor on the server, you may use `/verify` to verify.").complete();;
|
+ "Now when you are an impostor on the server, you may use `/verify` to verify.").complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user