mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Logstick stuff
This commit is contained in:
parent
d7450bf181
commit
650f732dd4
@ -58,6 +58,9 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
||||
@Getter
|
||||
@Setter
|
||||
private Boolean oldTags = null;
|
||||
@Getter
|
||||
@Setter
|
||||
private Boolean logStick = null;
|
||||
|
||||
public static final String CONFIG_FILENAME = "admins.yml";
|
||||
|
||||
@ -115,6 +118,7 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
||||
potionSpy = cs.getBoolean("potion_spy", false);
|
||||
acFormat = cs.getString("acformat", null);
|
||||
oldTags = cs.getBoolean("oldtags", false);
|
||||
logStick = cs.getBoolean("logstick", false);
|
||||
|
||||
}
|
||||
|
||||
@ -134,6 +138,7 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
||||
cs.set("potion_spy", potionSpy);
|
||||
cs.set("acformat", acFormat);
|
||||
cs.set("oldtags", oldTags);
|
||||
cs.set("logstick", logStick);
|
||||
}
|
||||
|
||||
public boolean isAtLeast(Rank pRank)
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage my admin entry", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin | settag <tag> | cleartag | setacformat <format> | clearacformat> | oldtags>")
|
||||
@CommandParameters(description = "Manage my admin entry", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin | settag <tag> | cleartag | setacformat <format> | clearacformat> | oldtags | logstick>")
|
||||
public class Command_myadmin extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -206,6 +206,14 @@ public class Command_myadmin extends FreedomCommand
|
||||
msg((target.getOldTags() ? "Enabled" : "Disabled") + " old tags.");
|
||||
return true;
|
||||
}
|
||||
case "logstick":
|
||||
{
|
||||
target.setLogStick(!target.getLogStick());
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
msg((target.getLogStick() ? "Enabled" : "Disabled") + " log-stick lookup.");
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
|
@ -11,10 +11,12 @@ import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.coreprotect.CoreProtectAPI.ParseResult;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -224,15 +226,19 @@ public class RollbackManager extends FreedomService
|
||||
|
||||
if (!event.hasItem()
|
||||
|| event.getItem().getType() != Material.STICK
|
||||
|| !plugin.al.isAdmin(player))
|
||||
|| !plugin.al.isAdmin(player)
|
||||
|| !plugin.al.getAdmin(player).getLogStick())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
final Location location = DepreciationAggregator.getTargetBlock(player, null, 5).getLocation();
|
||||
final List<RollbackEntry> entries = plugin.rb.getEntriesAtLocation(location);
|
||||
final Block block = DepreciationAggregator.getTargetBlock(player, null, 5);
|
||||
|
||||
if (plugin.cpb.isEnabled())
|
||||
{
|
||||
final List<String[]> entries = plugin.cpb.getCoreProtect().getAPI().blockLookup(block, 86400);
|
||||
|
||||
if (entries.isEmpty())
|
||||
{
|
||||
@ -241,9 +247,30 @@ public class RollbackManager extends FreedomService
|
||||
}
|
||||
|
||||
FUtil.playerMsg(player, "Block edits at ("
|
||||
+ ChatColor.WHITE + "x" + location.getBlockX()
|
||||
+ ", y" + location.getBlockY()
|
||||
+ ", z" + location.getBlockZ()
|
||||
+ ChatColor.WHITE + "x" + block.getX()
|
||||
+ ", y" + block.getY()
|
||||
+ ", z" + block.getZ()
|
||||
+ ChatColor.BLUE + ")" + ChatColor.WHITE + ":", ChatColor.BLUE);
|
||||
for (String[] entry : Lists.reverse(entries))
|
||||
{
|
||||
ParseResult parsedEntry = plugin.cpb.getCoreProtect().getAPI().parseResult(entry);
|
||||
FUtil.playerMsg(player, ChatColor.BLUE + parsedEntry.getActionString() + " of " + StringUtils.capitalize(parsedEntry.getType().name()) + " - " + parsedEntry.getPlayer());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final List<RollbackEntry> entries = plugin.rb.getEntriesAtLocation(block.getLocation());
|
||||
|
||||
if (entries.isEmpty())
|
||||
{
|
||||
FUtil.playerMsg(player, "No block edits at that location.");
|
||||
return;
|
||||
}
|
||||
|
||||
FUtil.playerMsg(player, "Block edits at ("
|
||||
+ ChatColor.WHITE + "x" + block.getX()
|
||||
+ ", y" + block.getY()
|
||||
+ ", z" + block.getZ()
|
||||
+ ChatColor.BLUE + ")" + ChatColor.WHITE + ":", ChatColor.BLUE);
|
||||
for (RollbackEntry entry : entries)
|
||||
{
|
||||
@ -251,6 +278,7 @@ public class RollbackManager extends FreedomService
|
||||
+ StringUtils.capitalize(entry.getMaterial().toString().toLowerCase()) + (entry.data == 0 ? "" : ":" + entry.data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<RollbackEntry> getEntriesByPlayer(String playerName)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user