mirror of
https://github.com/TotalFreedomMC/TotalFreedomMod.git
synced 2024-06-20 21:10:39 +00:00
![Video](/assets/img/avatar_default.png)
* Three fixes * Fixes /tempban throwing a NullPointerException when trying to get a player who isn't on the server but was in the past * Fixes /tempban banning players for 24 hours regardless of the duration defined * Fixes /list -t throwing a NullPointerException when performed from a non-player source (such as Telnet) * Removes hubworld entriely * Configurable blacklists for tag, muted commands, and wildcard Changes: * Moves globally blocked commands to the `global` subsection of the original `blocked_commands` section. You *will* need to update your configurations * /wildcard's command blacklist is now configurable under the `wildcard` section in `blocked_commands`. * The commands muted players can't use are now configurable under the `muted` section in `blocked_commands`. * Removes some commented-out globally blocked command entries. Co-authored-by: Ryan <Wild1145@users.noreply.github.com>
54 lines
1.5 KiB
Java
54 lines
1.5 KiB
Java
package me.totalfreedom.totalfreedommod.bridge;
|
|
|
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
|
import com.sk89q.worldguard.WorldGuard;
|
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
|
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
|
import java.util.Map;
|
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
|
import org.bukkit.World;
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
public class WorldGuardBridge extends FreedomService
|
|
{
|
|
@Override
|
|
public void onStart()
|
|
{
|
|
plugin.wr.protectWorld(plugin.wm.masterBuilderWorld.getWorld());
|
|
}
|
|
|
|
@Override
|
|
public void onStop()
|
|
{
|
|
}
|
|
|
|
public RegionManager getRegionManager(World world)
|
|
{
|
|
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
|
return container.get(BukkitAdapter.adapt(world));
|
|
}
|
|
|
|
public int wipeRegions(World world)
|
|
{
|
|
int count = 0;
|
|
RegionManager regionManager = getRegionManager(world);
|
|
if (regionManager != null)
|
|
{
|
|
Map<String, ProtectedRegion> regions = regionManager.getRegions();
|
|
for (ProtectedRegion region : regions.values())
|
|
{
|
|
regionManager.removeRegion(region.getId());
|
|
count++;
|
|
}
|
|
}
|
|
return count;
|
|
}
|
|
|
|
public boolean isEnabled()
|
|
{
|
|
Plugin plugin = server.getPluginManager().getPlugin("WorldGuard");
|
|
|
|
return plugin != null && plugin.isEnabled();
|
|
}
|
|
} |