Skip to content

Commit

Permalink
# This is a combination of 27 commits.
Browse files Browse the repository at this point in the history
# The first commit's message is:
Readd /uall and /dtoggle. Resolves #1793

# The 2nd commit message will be skipped:

#	Update Command_disguisetoggle.java

# The 3rd commit message will be skipped:

#	Update LibsDisguisesBridge.java

# The 4th commit message will be skipped:

#	Update Command_disguisetoggle.java

# The 5th commit message will be skipped:

#	Update LibsDisguisesBridge.java

# The 6th commit message will be skipped:

#	Update Command_undisguiseall.java

# The 7th commit message will be skipped:

#	Check for errors, and add soft depend

# The 8th commit message will be skipped:

#	Add uall

# The 9th commit message will be skipped:

#	Fix Dtoggle

# The 10th commit message will be skipped:

#	Fix Dtoggle part 2

# The 11th commit message will be skipped:

#	Formatting

# The 12th commit message will be skipped:

#	More formatting

# The 13th commit message will be skipped:

#	Remove unused import

# The 14th commit message will be skipped:

#	Fix possible NPE

# The 15th commit message will be skipped:

#	Fixes

# The 16th commit message will be skipped:

#	fixes

# The 17th commit message will be skipped:

#	fixes

# The 18th commit message will be skipped:

#	Update LibsDisguisesBridge.java

# The 19th commit message will be skipped:

#	Update Command_disguisetoggle.java

# The 20th commit message will be skipped:

#	Update Command_undisguiseall.java

# The 21st commit message will be skipped:

#	Add space

# The 22nd commit message will be skipped:

#	Add space

# The 23rd commit message will be skipped:

#	Resolves #1644 (#1716)
#
#	Fix /doom breaking blocks

# The 24th commit message will be skipped:

#	Block structure blocks from being placed

# The 25th commit message will be skipped:

#	Improved wildcard command blocking. Fixes #1842

# The 26th commit message will be skipped:

#	Update the target IP when using /myadmin -o. Fixes #1841

# The 27th commit message will be skipped:

#	Block sign interaction. Fixes #1831
  • Loading branch information
CreeperSeth authored and JeromSar committed Aug 26, 2016
1 parent 662cef4 commit 524dd1d
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 1 deletion.
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@
<scope>system</scope>
<systemPath>${project.basedir}/lib/TF-Essentials-2.1.jar</systemPath>
</dependency>

<dependency>
<groupId>me.libaryaddict.disguise</groupId>
<artifactId>LibsDisguises</artifactId>
<version>9.0.9</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/LibsDisguises-9.0.9.jar</systemPath>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker;
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.command.CommandLoader;
Expand Down Expand Up @@ -101,6 +102,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
public ServiceManager<TotalFreedomMod> bridges;
public BukkitTelnetBridge btb;
public EssentialsBridge esb;
public LibsDisguisesBridge ldb;
public WorldEditBridge web;

@Override
Expand Down Expand Up @@ -201,6 +203,7 @@ public void enable()
bridges = new ServiceManager<>(plugin);
btb = bridges.registerService(BukkitTelnetBridge.class);
esb = bridges.registerService(EssentialsBridge.class);
ldb = bridges.registerService(LibsDisguisesBridge.class);
web = bridges.registerService(WorldEditBridge.class);
bridges.start();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
package me.totalfreedom.totalfreedommod.bridge;

import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.DisguiseAPI;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.bukkit.entity.Player;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;

public class LibsDisguisesBridge extends FreedomService
{

private LibsDisguises libsDisguisesPlugin = null;

public LibsDisguisesBridge(TotalFreedomMod plugin)
{
super(plugin);
}

@Override
protected void onStart()
{
}

@Override
protected void onStop()
{
}

public LibsDisguises getLibsDisguisesPlugin()
{
if (libsDisguisesPlugin == null)
{
try
{
final Plugin libsDisguises = server.getPluginManager().getPlugin("LibsDisguises");
if (libsDisguises != null)
{
if (libsDisguises instanceof LibsDisguises)
{
libsDisguisesPlugin = (LibsDisguises) libsDisguises;
}
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
}
return libsDisguisesPlugin;
}

public Boolean isDisguised(Player player)
{
try
{
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
if (libsDisguises != null)
{
return DisguiseAPI.isDisguised(player);
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
return null;
}

public void undisguiseAll(boolean admins)
{
try
{
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();

if (libsDisguises == null)
{
return;
}

for (Player player : server.getOnlinePlayers())
{
if (DisguiseAPI.isDisguised(player))
{
if (!admins && plugin.al.isAdmin(player))
{
continue;
}
DisguiseAPI.undisguiseToAll(player);
}
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
}

public boolean setPluginEnabled(boolean enabled)
{
Plugin ld = getLibsDisguisesPlugin();

if (ld == null)
{
return false;
}

if (enabled)
{
server.getPluginManager().enablePlugin(ld);
}
else
{
server.getPluginManager().disablePlugin(ld);
}

return true;
}

public boolean isPluginEnabled()
{
Plugin ld = getLibsDisguisesPlugin();

if (ld == null)
{
return false;
}

return ld.isEnabled();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package me.totalfreedom.totalfreedommod.command;

import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Toggle the disguise plugin", usage = "/<command>", aliases = "dtoggle")
public class Command_disguisetoggle extends FreedomCommand
{

@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (plugin.ldb.getLibsDisguisesPlugin() == null)
{
msg(ChatColor.RED + "LibsDisguises is not enabled.");
return true;
}

boolean newState = !plugin.ldb.isPluginEnabled();
FUtil.adminAction(sender.getName(), (newState ? "Enabling" : "Disabling") + " disguises", false);

if (!newState)
{
plugin.ldb.undisguiseAll(true);
}
plugin.ldb.setPluginEnabled(newState);

msg("Disguises are now " + (newState ? "enabled." : "disabled."));

return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package me.totalfreedom.totalfreedommod.command;

import me.libraryaddict.disguise.DisallowedDisguises;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Undisguise all players on the server", usage = "/<command>", aliases = "uall")
public class Command_undisguiseall extends FreedomCommand
{

@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!plugin.ldb.isPluginEnabled())
{
msg("LibsDisguises is not enabled.");
return true;
}

if (DisallowedDisguises.disabled)
{
msg("Disguises are not enabled.");
return true;
}

FUtil.adminAction(sender.getName(), "Undisguising all non-admins", true);

plugin.ldb.undisguiseAll(false);

return true;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ main: me.totalfreedom.totalfreedommod.TotalFreedomMod
version: ${tfm.build.version}
description: Plugin for the Total Freedom server.
depend: [Aero, WorldEdit]
softdepend: [BukkitTelnet, Essentials]
softdepend: [BukkitTelnet, Essentials, LibsDisguises]
authors: [Madgeek1450, Prozza]

# plugin.yml is no longer used to define commands.

0 comments on commit 524dd1d

Please sign in to comment.