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

View File

@ -98,7 +98,7 @@ public class CoreProtectBridge extends FreedomService
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)
{
final CoreProtectAPI coreProtect = getCoreProtectAPI();
@ -118,7 +118,7 @@ public class CoreProtectBridge extends FreedomService
}.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)
{
final CoreProtectAPI coreProtect = getCoreProtectAPI();
@ -207,8 +207,8 @@ public class CoreProtectBridge extends FreedomService
return;
}
/* 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 */
/* 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 */
File databaseFile = getDatabase();
Connection connection = null;
try

View File

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

View File

@ -1,6 +1,7 @@
package me.totalfreedom.totalfreedommod.bridge;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import me.totalfreedom.totalfreedommod.FreedomService;
@ -14,7 +15,7 @@ public class WorldEditBridge extends FreedomService
private final WorldEditListener listener;
//
private WorldEditPlugin worldedit = null;
private WorldEditPlugin worldeditPlugin = null;
public WorldEditBridge(TotalFreedomMod plugin)
{
@ -34,6 +35,30 @@ public class WorldEditBridge extends FreedomService
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)
{
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)
{
try
@ -158,4 +159,21 @@ public class WorldEditBridge extends FreedomService
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,12 +39,9 @@ public class WorldGuardBridge extends FreedomService
try
{
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)
@ -72,9 +69,20 @@ public class WorldGuardBridge extends FreedomService
return false;
}
public boolean isPluginEnabled() {
Plugin wr = getWorldGuardPlugin();
return wr != null && wr.isEnabled();
public boolean isPluginEnabled()
{
try
{
WorldGuardPlugin wg = getWorldGuardPlugin();
if (wg != null)
{
return wg.isEnabled();
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
return false;
}
}