sIgNifICanT buG FixEs (#105)

- Ignore totalfreedom.iml (people who clone from Git get this instead of TotalFreedomMod)
- Essentials check before running /denick
- Revise grammar in /invis
- WorldEdit check for /setl (since W/E is no longer a required dependency)
- WorldEdit check for /gtfo
- WorldEdit check for /unban
- Refactor -> LibsDisguiseBridge: isPluginEnabled -> isEnabled
- Remove unneccesary ChatColor in /wiperegions
- Use BlockData in Trailer
- Revise /wiewarps grammar
This commit is contained in:
Telesphoreo 2018-07-28 00:11:48 -07:00 committed by Seth
parent ed9200689c
commit 9c2f181ab9
24 changed files with 141 additions and 110 deletions

3
.gitignore vendored
View File

@ -21,6 +21,9 @@ manifest.mf
*.iws *.iws
/.idea /.idea
# Ignore this file for people who clone from Git
totalfreedom.iml
# Maven excludes # Maven excludes
/target /target

View File

@ -10,7 +10,6 @@
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.coreprotect:coreprotect:2.15.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.0" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.13-R0.1-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.13-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" />
@ -26,6 +25,7 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TotalFreedom:BukkitTelnet:4.5-pre1" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TotalFreedom:BukkitTelnet:4.5-pre1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.5" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.5" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.5" level="project" />
<orderEntry type="library" name="Maven: org.bstats:bstats-bukkit:1.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-LibsDisguises:c213295f95" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-LibsDisguises:c213295f95" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib:4.4.0-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib:4.4.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT" level="project" />

View File

@ -124,5 +124,4 @@ public class AntiSpam extends FreedomService
event.setCancelled(true); event.setCancelled(true);
} }
} }
} }

View File

@ -51,7 +51,6 @@ public class AutoKick extends FreedomService
private void autoKickCheck() private void autoKickCheck()
{ {
final boolean doAwayKickCheck final boolean doAwayKickCheck
= plugin.esb.isEssentialsEnabled() = plugin.esb.isEssentialsEnabled()
&& ((server.getOnlinePlayers().size() / server.getMaxPlayers()) > autoKickThreshold); && ((server.getOnlinePlayers().size() / server.getMaxPlayers()) > autoKickThreshold);

View File

@ -1,17 +1,18 @@
package me.totalfreedom.totalfreedommod; package me.totalfreedom.totalfreedommod;
import java.text.DecimalFormat;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.LingeringPotionSplashEvent;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.LingeringPotionSplashEvent;
import org.bukkit.event.entity.PotionSplashEvent; import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.projectiles.ProjectileSource; import org.bukkit.projectiles.ProjectileSource;
import java.text.DecimalFormat;
public class Monitors extends FreedomService public class Monitors extends FreedomService
{ {

View File

@ -14,6 +14,7 @@ import me.totalfreedom.totalfreedommod.discord.Discord;
import me.totalfreedom.totalfreedommod.freeze.Freezer; import me.totalfreedom.totalfreedommod.freeze.Freezer;
import me.totalfreedom.totalfreedommod.fun.*; import me.totalfreedom.totalfreedommod.fun.*;
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon; import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilderList; import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilderList;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilderWorldRestrictions; import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilderWorldRestrictions;
import me.totalfreedom.totalfreedommod.player.PlayerList; import me.totalfreedom.totalfreedommod.player.PlayerList;
@ -153,6 +154,8 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
backups.createBackups(TotalFreedomMod.CONFIG_FILENAME, true); backups.createBackups(TotalFreedomMod.CONFIG_FILENAME, true);
backups.createBackups(AdminList.CONFIG_FILENAME); backups.createBackups(AdminList.CONFIG_FILENAME);
backups.createBackups(PermbanList.CONFIG_FILENAME); backups.createBackups(PermbanList.CONFIG_FILENAME);
backups.createBackups(MasterBuilder.CONFIG_FILENAME);
backups.createBackups(PunishmentList.CONFIG_FILENAME);
config = new MainConfig(this); config = new MainConfig(this);
config.load(); config.load();
@ -340,5 +343,4 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
{ {
return new CleanroomChunkGenerator(id); return new CleanroomChunkGenerator(id);
} }
} }

View File

@ -98,7 +98,7 @@ public class CoreProtectBridge extends FreedomService
return coreProtect != null && coreProtect.isEnabled(); return coreProtect != null && coreProtect.isEnabled();
} }
// Rollback the specifed player's edits that were in the last 24 hours. // Rollback the specified player's edits that were in the last 24 hours.
public void rollback(final String name) public void rollback(final String name)
{ {
final CoreProtectAPI coreProtect = getCoreProtectAPI(); final CoreProtectAPI coreProtect = getCoreProtectAPI();
@ -118,7 +118,7 @@ public class CoreProtectBridge extends FreedomService
}.runTaskAsynchronously(plugin); }.runTaskAsynchronously(plugin);
} }
// Reverts a rollback for the specifed player's edits that were in the last 24 hours. // Reverts a rollback for the specified player's edits that were in the last 24 hours.
public void restore(final String name) public void restore(final String name)
{ {
final CoreProtectAPI coreProtect = getCoreProtectAPI(); final CoreProtectAPI coreProtect = getCoreProtectAPI();
@ -207,8 +207,8 @@ public class CoreProtectBridge extends FreedomService
return; return;
} }
/* As CoreProtect doesn't have an api method for deleting all of the data for a specific world /* As CoreProtect doesn't have an API method for deleting all of the data for a specific world
we have to do this manually via sql */ we have to do this manually via SQL */
File databaseFile = getDatabase(); File databaseFile = getDatabase();
Connection connection = null; Connection connection = null;
try try

View File

@ -7,6 +7,7 @@ import me.totalfreedom.libsdisguise.TF_DisguiseAPI;
import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FLog;
import net.coreprotect.CoreProtect;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
@ -124,15 +125,10 @@ public class LibsDisguisesBridge extends FreedomService
return !DisallowedDisguises.disabled; return !DisallowedDisguises.disabled;
} }
public boolean isPluginEnabled() public boolean isEnabled()
{ {
Plugin ld = getLibsDisguisesPlugin(); final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
if (ld == null) return libsDisguises != null && libsDisguises.isEnabled();
{
return false;
}
return ld.isEnabled();
} }
} }

View File

@ -1,6 +1,7 @@
package me.totalfreedom.totalfreedommod.bridge; package me.totalfreedom.totalfreedommod.bridge;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitPlayer; import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.FreedomService;
@ -14,7 +15,7 @@ public class WorldEditBridge extends FreedomService
private final WorldEditListener listener; private final WorldEditListener listener;
// //
private WorldEditPlugin worldedit = null; private WorldEditPlugin worldeditPlugin = null;
public WorldEditBridge(TotalFreedomMod plugin) public WorldEditBridge(TotalFreedomMod plugin)
{ {
@ -34,6 +35,30 @@ public class WorldEditBridge extends FreedomService
listener.unregister(); listener.unregister();
} }
private WorldEditPlugin getWorldEditPlugin()
{
if (worldeditPlugin == null)
{
try
{
Plugin we = server.getPluginManager().getPlugin("WorldEdit");
if (we != null)
{
if (we instanceof WorldEditPlugin)
{
worldeditPlugin = (WorldEditPlugin) we;
}
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
}
return worldeditPlugin;
}
public void undo(Player player, int count) public void undo(Player player, int count)
{ {
try try
@ -80,30 +105,6 @@ public class WorldEditBridge extends FreedomService
} }
} }
private WorldEditPlugin getWorldEditPlugin()
{
if (worldedit == null)
{
try
{
Plugin we = server.getPluginManager().getPlugin("WorldEdit");
if (we != null)
{
if (we instanceof WorldEditPlugin)
{
worldedit = (WorldEditPlugin) we;
}
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
}
return worldedit;
}
public void setLimit(Player player, int limit) public void setLimit(Player player, int limit)
{ {
try try
@ -158,4 +159,21 @@ public class WorldEditBridge extends FreedomService
return null; return null;
} }
} }
public boolean isWorldEditEnabled()
{
try
{
WorldEditPlugin worldedit = getWorldEditPlugin();
if (worldedit != null)
{
return worldedit.isEnabled();
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
return false;
}
} }

View File

@ -39,14 +39,11 @@ public class WorldGuardBridge extends FreedomService
try try
{ {
final Plugin worldGuard = server.getPluginManager().getPlugin("WorldGuard"); final Plugin worldGuard = server.getPluginManager().getPlugin("WorldGuard");
if (worldGuard != null) if (worldGuard != null && worldGuard instanceof WorldGuardPlugin)
{
if (worldGuard instanceof WorldGuardPlugin)
{ {
worldGuardPlugin = (WorldGuardPlugin) worldGuard; worldGuardPlugin = (WorldGuardPlugin) worldGuard;
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
FLog.severe(ex); FLog.severe(ex);
@ -72,9 +69,20 @@ public class WorldGuardBridge extends FreedomService
return false; return false;
} }
public boolean isPluginEnabled() { public boolean isPluginEnabled()
Plugin wr = getWorldGuardPlugin(); {
try
return wr != null && wr.isEnabled(); {
WorldGuardPlugin wg = getWorldGuardPlugin();
if (wg != null)
{
return wg.isEnabled();
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
return false;
} }
} }

View File

@ -14,6 +14,12 @@ public class Command_denick extends FreedomCommand
@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.esb.isEssentialsEnabled())
{
msg("Essentials is not enabled on this server.");
return true;
}
FUtil.adminAction(sender.getName(), "Removing all nicknames", false); FUtil.adminAction(sender.getName(), "Removing all nicknames", false);
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())

View File

@ -16,7 +16,7 @@ public class Command_disguisetoggle extends FreedomCommand
@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.ldb.isPluginEnabled()) if (!plugin.ldb.isEnabled())
{ {
msg(ChatColor.RED + "LibsDisguises is not enabled."); msg(ChatColor.RED + "LibsDisguises is not enabled.");
return true; return true;

View File

@ -2,12 +2,11 @@ package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.banning.Ban; import me.totalfreedom.totalfreedommod.banning.Ban;
import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.Punishment;
import me.totalfreedom.totalfreedommod.punishments.PunishmentType; import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
import java.util.ArrayList; import me.totalfreedom.totalfreedommod.rank.Rank;
import java.util.List; import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -17,6 +16,9 @@ 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.util.ArrayList;
import java.util.List;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true) @CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "Bans a player", usage = "/<command> <username> [reason] [-nrb]", aliases = "ban") @CommandParameters(description = "Bans a player", usage = "/<command> <username> [reason] [-nrb]", aliases = "ban")
public class Command_gtfo extends FreedomCommand public class Command_gtfo extends FreedomCommand
@ -102,9 +104,12 @@ public class Command_gtfo extends FreedomCommand
{ {
// Undo WorldEdits // Undo WorldEdits
try try
{
if (plugin.web.isWorldEditEnabled())
{ {
plugin.web.undo(player, 15); plugin.web.undo(player, 15);
} }
}
catch (NoClassDefFoundError | NullPointerException ex) catch (NoClassDefFoundError | NullPointerException ex)
{ {
} }

View File

@ -1,7 +1,5 @@
package me.totalfreedom.totalfreedommod.command; package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
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.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -10,11 +8,13 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import java.util.ArrayList;
import java.util.List;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Shows (optionally clears) invisisible players", usage = "/<command> (clear)") @CommandParameters(description = "Shows (optionally clears) invisible players", usage = "/<command> (clear)")
public class Command_invis extends FreedomCommand public class Command_invis extends FreedomCommand
{ {
@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)
{ {
@ -24,7 +24,7 @@ public class Command_invis extends FreedomCommand
{ {
if (args[0].equalsIgnoreCase("clear")) if (args[0].equalsIgnoreCase("clear"))
{ {
FUtil.adminAction(sender.getName(), "Clearing all invis potion effect from all players", true); FUtil.adminAction(sender.getName(), "Clearing all invisibility potion effects from all players", true);
clear = true; clear = true;
} }
else else
@ -51,18 +51,17 @@ public class Command_invis extends FreedomCommand
if (players.isEmpty()) if (players.isEmpty())
{ {
sender.sendMessage("There are no invisible players"); msg("There are no invisible players");
return true; return true;
} }
if (clear) if (clear)
{ {
sender.sendMessage("Cleared " + clears + " players"); msg("Cleared " + clears + " players");
} }
else else
{ {
sender.sendMessage("Invisible players (" + players.size() + "): " + StringUtils.join(players, ", ")); msg("Invisible players (" + players.size() + "): " + StringUtils.join(players, ", "));
} }
return true; return true;
} }
} }

View File

@ -41,7 +41,6 @@ public class Command_nickclean extends FreedomCommand
} }
} }
} }
return true; return true;
} }
} }

View File

@ -146,7 +146,6 @@ public class Command_plugincontrol extends FreedomCommand
} }
} }
} }
return null; return null;
} }
} }

View File

@ -8,13 +8,17 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Sets everyone's Worldedit block modification limit to the default limit or to a custom limit.", usage = "/<command> [limit]", aliases = "setl,swl") @CommandParameters(description = "Sets everyone's WorldEdit block modification limit to the default limit or to a custom limit.", usage = "/<command> [limit]", aliases = "setl,swl")
public class Command_setlimit extends FreedomCommand public class Command_setlimit extends FreedomCommand
{ {
@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.web.isWorldEditEnabled())
{
msg("WorldEdit is not enabled on this server.");
return true;
}
int amount = 100000; int amount = 100000;
if (args.length > 0) if (args.length > 0)
{ {
@ -28,7 +32,7 @@ public class Command_setlimit extends FreedomCommand
return true; return true;
} }
} }
FUtil.adminAction(sender.getName(), "Setting everyone's Worldedit block modification limit to " + amount + ".", true); FUtil.adminAction(sender.getName(), "Setting everyone's WorldEdit block modification limit to " + amount + ".", true);
for (final Player player : server.getOnlinePlayers()) for (final Player player : server.getOnlinePlayers())
{ {
plugin.web.setLimit(player, amount); plugin.web.setLimit(player, amount);

View File

@ -47,9 +47,12 @@ public class Command_unban extends FreedomCommand
{ {
// Redo WorldEdits // Redo WorldEdits
try try
{
if (plugin.web.isWorldEditEnabled())
{ {
plugin.web.redo(player, 15); plugin.web.redo(player, 15);
} }
}
catch (NoClassDefFoundError | NullPointerException ex) catch (NoClassDefFoundError | NullPointerException ex)
{ {
} }

View File

@ -15,7 +15,7 @@ public class Command_undisguiseall extends FreedomCommand
@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.ldb.isPluginEnabled()) if (!plugin.ldb.isEnabled())
{ {
msg("LibsDisguises is not enabled."); msg("LibsDisguises is not enabled.");
return true; return true;

View File

@ -1,6 +1,5 @@
package me.totalfreedom.totalfreedommod.command; package me.totalfreedom.totalfreedommod.command;
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.ChatColor; import org.bukkit.ChatColor;
@ -10,23 +9,27 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@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>")
public class Command_wiperegions extends FreedomCommand { public class Command_wiperegions extends FreedomCommand
{
@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 (!plugin.wgb.isPluginEnabled())
{ {
msg("WorldGuard is not enabled.", ChatColor.GRAY); msg("WorldGuard is not enabled.");
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]);
if (world == null) if (world == null)
{ {
msg("World : \"" + args[0] + "\" not found.", ChatColor.GRAY); msg("World : \"" + args[0] + "\" not found.");
return true; return true;
} }
if (world.equals(plugin.wm.adminworld.getWorld())) if (world.equals(plugin.wm.adminworld.getWorld()))
@ -40,7 +43,7 @@ public class Command_wiperegions extends FreedomCommand {
} }
else else
{ {
msg(ChatColor.RED + "No regions have been found for world: \"" + world.getName() + "\"."); msg(ChatColor.RED + "No regions were found in: \"" + world.getName() + "\".");
return true; return true;
} }
} }

View File

@ -1,24 +1,25 @@
package me.totalfreedom.totalfreedommod.command; package me.totalfreedom.totalfreedommod.command;
import java.io.File; import com.earth2me.essentials.Essentials;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
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 com.earth2me.essentials.Essentials;
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 warps", usage = "/<command>") @CommandParameters(description = "Removes Essentials warps", usage = "/<command>")
public class Command_wipewarps extends FreedomCommand public class Command_wipewarps extends FreedomCommand
{ {
@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.esb.isEssentialsEnabled()) if (!plugin.esb.isEssentialsEnabled())
{ {
msg("Essentials is not enabled on this server"); msg("Essentials is not enabled on this server.");
return true; return true;
} }

View File

@ -7,6 +7,7 @@ import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -66,7 +67,7 @@ public class Trailer extends FreedomService
} }
fromBlock.setType(MaterialGroup.WOOL_COLORS.get(random.nextInt(MaterialGroup.WOOL_COLORS.size()))); fromBlock.setType(MaterialGroup.WOOL_COLORS.get(random.nextInt(MaterialGroup.WOOL_COLORS.size())));
byte data = DepreciationAggregator.getData_Block(fromBlock); BlockData data = fromBlock.getBlockData();
Material material = Material.getMaterial(String.valueOf(fromBlock.getType())); Material material = Material.getMaterial(String.valueOf(fromBlock.getType()));
for (int x = -1; x <= 1; x++) for (int x = -1; x <= 1; x++)
{ {

View File

@ -56,6 +56,11 @@ public class PlayerData implements ConfigLoadable, ConfigSavable, Validatable
cs.set("last_join", lastJoinUnix); cs.set("last_join", lastJoinUnix);
} }
public String getUsername()
{
return username;
}
public List<String> getIps() public List<String> getIps()
{ {
return Collections.unmodifiableList(ips); return Collections.unmodifiableList(ips);

View File

@ -24,26 +24,6 @@ public class DepreciationAggregator
return server.getOfflinePlayer(name); return server.getOfflinePlayer(name);
} }
public static byte getData_MaterialData(MaterialData md)
{
return md.getData();
}
public static void setData_MaterialData(MaterialData md, byte data)
{
md.setData(data);
}
public static byte getData_Block(Block block)
{
return block.getData();
}
public static org.bukkit.material.Lever makeLeverWithData(byte data)
{
return new org.bukkit.material.Lever(Material.LEVER, data);
}
public static String getName_EntityType(EntityType et) public static String getName_EntityType(EntityType et)
{ {
return et.getName(); return et.getName();