mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 10:05:59 +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
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private Boolean oldTags = null;
|
private Boolean oldTags = null;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private Boolean logStick = null;
|
||||||
|
|
||||||
public static final String CONFIG_FILENAME = "admins.yml";
|
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);
|
potionSpy = cs.getBoolean("potion_spy", false);
|
||||||
acFormat = cs.getString("acformat", null);
|
acFormat = cs.getString("acformat", null);
|
||||||
oldTags = cs.getBoolean("oldtags", false);
|
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("potion_spy", potionSpy);
|
||||||
cs.set("acformat", acFormat);
|
cs.set("acformat", acFormat);
|
||||||
cs.set("oldtags", oldTags);
|
cs.set("oldtags", oldTags);
|
||||||
|
cs.set("logstick", logStick);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAtLeast(Rank pRank)
|
public boolean isAtLeast(Rank pRank)
|
||||||
|
@ -13,7 +13,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
@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
|
public class Command_myadmin extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -206,6 +206,14 @@ public class Command_myadmin extends FreedomCommand
|
|||||||
msg((target.getOldTags() ? "Enabled" : "Disabled") + " old tags.");
|
msg((target.getOldTags() ? "Enabled" : "Disabled") + " old tags.");
|
||||||
return true;
|
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:
|
default:
|
||||||
{
|
{
|
||||||
|
@ -11,10 +11,12 @@ import me.totalfreedom.totalfreedommod.FreedomService;
|
|||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
|
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
|
import net.coreprotect.CoreProtectAPI.ParseResult;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
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.block.Block;
|
||||||
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;
|
||||||
@ -224,31 +226,57 @@ public class RollbackManager extends FreedomService
|
|||||||
|
|
||||||
if (!event.hasItem()
|
if (!event.hasItem()
|
||||||
|| event.getItem().getType() != Material.STICK
|
|| event.getItem().getType() != Material.STICK
|
||||||
|| !plugin.al.isAdmin(player))
|
|| !plugin.al.isAdmin(player)
|
||||||
|
|| !plugin.al.getAdmin(player).getLogStick())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
final Location location = DepreciationAggregator.getTargetBlock(player, null, 5).getLocation();
|
final Block block = DepreciationAggregator.getTargetBlock(player, null, 5);
|
||||||
final List<RollbackEntry> entries = plugin.rb.getEntriesAtLocation(location);
|
|
||||||
|
|
||||||
if (entries.isEmpty())
|
if (plugin.cpb.isEnabled())
|
||||||
{
|
{
|
||||||
FUtil.playerMsg(player, "No block edits at that location.");
|
final List<String[]> entries = plugin.cpb.getCoreProtect().getAPI().blockLookup(block, 86400);
|
||||||
return;
|
|
||||||
|
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 (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
|
||||||
FUtil.playerMsg(player, "Block edits at ("
|
|
||||||
+ ChatColor.WHITE + "x" + location.getBlockX()
|
|
||||||
+ ", y" + location.getBlockY()
|
|
||||||
+ ", z" + location.getBlockZ()
|
|
||||||
+ ChatColor.BLUE + ")" + ChatColor.WHITE + ":", ChatColor.BLUE);
|
|
||||||
for (RollbackEntry entry : entries)
|
|
||||||
{
|
{
|
||||||
FUtil.playerMsg(player, " - " + ChatColor.BLUE + entry.author + " " + entry.getType() + " "
|
final List<RollbackEntry> entries = plugin.rb.getEntriesAtLocation(block.getLocation());
|
||||||
+ StringUtils.capitalize(entry.getMaterial().toString().toLowerCase()) + (entry.data == 0 ? "" : ":" + entry.data));
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
FUtil.playerMsg(player, " - " + ChatColor.BLUE + entry.author + " " + entry.getType() + " "
|
||||||
|
+ StringUtils.capitalize(entry.getMaterial().toString().toLowerCase()) + (entry.data == 0 ? "" : ":" + entry.data));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user