From 591b8644cb2aa2347f465052c1a16ab611e12408 Mon Sep 17 00:00:00 2001 From: ZeroEpoch1969 <13510767+ZeroEpoch1969@users.noreply.github.com> Date: Wed, 10 Jul 2019 19:13:57 -0700 Subject: [PATCH] fuck you super there is development --- TotalFreedomMod.iml | 7 +- pom.xml | 2 +- .../totalfreedommod/EntityWiper.java | 2 +- .../totalfreedommod/LoginProcess.java | 10 +++ .../totalfreedommod/TotalFreedomMod.java | 6 ++ .../totalfreedommod/banning/Ban.java | 26 ++++++-- .../blocking/BlockBlocker.java | 1 - .../blocking/EventBlocker.java | 2 + .../blocking/InteractBlocker.java | 7 ++ .../totalfreedommod/command/Command_cuck.java | 58 ++++++++++++++++ .../command/Command_curse.java | 66 +++++++++++++++++++ .../command/Command_explosivearrows.java | 31 +++++++++ .../command/Command_moblimiter.java | 2 +- .../totalfreedommod/command/Command_tag.java | 2 +- .../totalfreedommod/config/ConfigEntry.java | 2 + .../discord/MessageListener.java | 2 +- .../totalfreedommod/fun/CurseListener.java | 61 +++++++++++++++++ .../totalfreedommod/fun/ItemFun.java | 24 +++++++ .../totalfreedommod/httpd/HTTPDaemon.java | 2 + .../httpd/module/Module_activitylog.java | 31 +++++++++ src/main/resources/activitylog.yml | 3 + src/main/resources/config.yml | 8 ++- 22 files changed, 341 insertions(+), 14 deletions(-) create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_cuck.java create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_curse.java create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_explosivearrows.java create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/fun/CurseListener.java create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_activitylog.java create mode 100644 src/main/resources/activitylog.yml diff --git a/TotalFreedomMod.iml b/TotalFreedomMod.iml index 93d12628..94a3e6af 100644 --- a/TotalFreedomMod.iml +++ b/TotalFreedomMod.iml @@ -12,8 +12,9 @@ + - + @@ -62,7 +63,9 @@ - + + + diff --git a/pom.xml b/pom.xml index 7dbde0fa..977b2e59 100644 --- a/pom.xml +++ b/pom.xml @@ -102,7 +102,7 @@ org.spigotmc spigot - 1.13.1-R0.1-SNAPSHOT + 1.13.2-R0.1-SNAPSHOT provided diff --git a/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java b/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java index 73054738..357823da 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java @@ -128,7 +128,7 @@ public class EntityWiper extends FreedomService { int removed = 0; - boolean wipeExpl = ConfigEntry.ALLOW_EXPLOSIONS.getBoolean(); + boolean wipeExpl = !ConfigEntry.ALLOW_EXPLOSIONS.getBoolean(); Iterator entities = world.getEntities().iterator(); // Organise the entities in the world diff --git a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java index 2530bbb6..7ac363b1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java @@ -188,6 +188,16 @@ public class LoginProcess extends FreedomService final Player player = event.getPlayer(); final FPlayer fPlayer = plugin.pl.getPlayer(player); + if (!ConfigEntry.SERVER_TABLIST_HEADER.getString().isEmpty()) + { + player.setPlayerListHeader(FUtil.colorize(ConfigEntry.SERVER_TABLIST_HEADER.getString()).replace("\\n", "\n")); + } + + if (!ConfigEntry.SERVER_TABLIST_FOOTER.getString().isEmpty()) + { + player.setPlayerListFooter(FUtil.colorize(ConfigEntry.SERVER_TABLIST_FOOTER.getString()).replace("\\n", "\n")); + } + for (Player p : Command_vanish.VANISHED) { if (!plugin.al.isAdmin(player)) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java index ff28c11f..4dc3c983 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java @@ -3,6 +3,7 @@ package me.totalfreedom.totalfreedommod; import java.io.File; import java.io.InputStream; import java.util.Properties; +import me.totalfreedom.totalfreedommod.admin.ActivityLog; import me.totalfreedom.totalfreedommod.admin.AdminList; import me.totalfreedom.totalfreedommod.amp.AMP; import me.totalfreedom.totalfreedommod.banning.BanManager; @@ -27,6 +28,7 @@ import me.totalfreedom.totalfreedommod.command.CommandLoader; import me.totalfreedom.totalfreedommod.config.MainConfig; import me.totalfreedom.totalfreedommod.discord.Discord; import me.totalfreedom.totalfreedommod.freeze.Freezer; +import me.totalfreedom.totalfreedommod.fun.CurseListener; import me.totalfreedom.totalfreedommod.fun.ItemFun; import me.totalfreedom.totalfreedommod.fun.Jumppads; import me.totalfreedom.totalfreedommod.fun.Landminer; @@ -75,6 +77,7 @@ public class TotalFreedomMod extends AeroPlugin public WorldManager wm; public LogViewer lv; public AdminList al; + public ActivityLog acl; public RankManager rm; public CommandLoader cl; public CommandBlocker cb; @@ -111,6 +114,7 @@ public class TotalFreedomMod extends AeroPlugin public EntityWiper ew; public FrontDoor fd; public ServerPing sp; + public CurseListener cul; public ItemFun it; public Landminer lm; public MobStacker ms; @@ -182,6 +186,7 @@ public class TotalFreedomMod extends AeroPlugin wm = services.registerService(WorldManager.class); lv = services.registerService(LogViewer.class); al = services.registerService(AdminList.class); + acl = services.registerService(ActivityLog.class); rm = services.registerService(RankManager.class); cl = services.registerService(CommandLoader.class); cb = services.registerService(CommandBlocker.class); @@ -229,6 +234,7 @@ public class TotalFreedomMod extends AeroPlugin pv = services.registerService(PlayerVerification.class); // Fun + cul = services.registerService(CurseListener.class); it = services.registerService(ItemFun.class); lm = services.registerService(Landminer.class); ms = services.registerService(MobStacker.class); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/banning/Ban.java b/src/main/java/me/totalfreedom/totalfreedommod/banning/Ban.java index 5be4d336..9ee8d200 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/banning/Ban.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/banning/Ban.java @@ -1,7 +1,9 @@ package me.totalfreedom.totalfreedommod.banning; import com.google.common.collect.Lists; +import java.text.DateFormat; import java.text.SimpleDateFormat; +import java.time.Instant; import java.util.Arrays; import java.util.Date; import java.util.HashSet; @@ -36,6 +38,9 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable private String by = null; @Getter @Setter + private Date at = null; + @Getter + @Setter private String reason = null; // Unformatted, &[0-9,a-f] instead of ChatColor @Getter @Setter @@ -45,7 +50,7 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable { } - public Ban(String username, String ip, String by, Date expire, String reason) + public Ban(String username, String ip, String by, Date at, Date expire, String reason) { this(username, new String[] @@ -53,11 +58,12 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable ip }, by, + at, expire, reason); } - public Ban(String username, String[] ips, String by, Date expire, String reason) + public Ban(String username, String[] ips, String by, Date at, Date expire, String reason) { this.username = username; if (ips != null) @@ -66,6 +72,7 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable } dedupeIps(); this.by = by; + this.at = at; this.expiryUnix = FUtil.getUnixTime(expire); this.reason = reason; } @@ -82,12 +89,12 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable return new Ban(null, new String[] { Ips.getIp(player) - }, by.getName(), expiry, reason); + }, by.getName(), Date.from(Instant.now()), expiry, reason); } public static Ban forPlayerIp(String ip, CommandSender by, Date expiry, String reason) { - return new Ban(null, ip, by.getName(), expiry, reason); + return new Ban(null, ip, by.getName(), Date.from(Instant.now()), expiry, reason); } // @@ -102,6 +109,7 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable return new Ban(player, (String[])null, by.getName(), + Date.from(Instant.now()), expiry, reason); } @@ -118,6 +126,7 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable return new Ban(player.getName(), Ips.getIp(player), by.getName(), + Date.from(Instant.now()), expiry, reason); } @@ -127,6 +136,7 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable return new Ban(player.getName(), FUtil.getFuzzyIp(Ips.getIp(player)), by.getName(), + Date.from(Instant.now()), expiry, reason); } @@ -181,6 +191,12 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable .append(by); } + if (at != null) + { + message.append("\n").append(ChatColor.RED).append("Issued: ").append(ChatColor.GOLD) + .append(DATE_FORMAT.format(at)); + } + if (getExpiryUnix() != 0) { message.append("\n").append(ChatColor.RED).append("Expires: ").append(ChatColor.GOLD) @@ -234,6 +250,7 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable this.ips.clear(); this.ips.addAll(cs.getStringList("ips")); this.by = cs.getString("by", null); + this.at = FUtil.stringToDate(cs.getString("at", null)); this.reason = cs.getString("reason", null); this.expiryUnix = cs.getLong("expiry_unix", 0); dedupeIps(); @@ -246,6 +263,7 @@ public class Ban implements ConfigLoadable, ConfigSavable, Validatable cs.set("username", username); cs.set("ips", ips.isEmpty() ? null : ips); cs.set("by", by); + cs.set("at", FUtil.dateToString(at)); cs.set("reason", reason); cs.set("expiry_unix", expiryUnix > 0 ? expiryUnix : null); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java index 22f11f76..39576af8 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java @@ -8,7 +8,6 @@ import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.Groups; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java index 60a0bafa..3efdf873 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java @@ -3,7 +3,9 @@ package me.totalfreedom.totalfreedommod.blocking; import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; +import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.Groups; +import org.bukkit.Material; import org.bukkit.attribute.Attribute; import org.bukkit.attribute.AttributeModifier; import org.bukkit.block.ShulkerBox; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java index 028623fd..2adf299e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java @@ -3,6 +3,7 @@ package me.totalfreedom.totalfreedommod.blocking; import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; +import me.totalfreedom.totalfreedommod.util.FLog; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -54,6 +55,12 @@ public class InteractBlocker extends FreedomService { final Player player = event.getPlayer(); + if (event.getClickedBlock() != null && event.getClickedBlock().getType().equals(Material.STRUCTURE_BLOCK)) + { + event.setCancelled(true); + event.getPlayer().closeInventory(); + } + switch (event.getMaterial()) { case WATER_BUCKET: diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cuck.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cuck.java new file mode 100644 index 00000000..b1011c8f --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cuck.java @@ -0,0 +1,58 @@ +package me.totalfreedom.totalfreedommod.command; + +import java.util.Collections; +import java.util.List; +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; +import org.bukkit.ChatColor; + +@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH) +@CommandParameters(description = "Cuck someone", usage = "/ ") +public class Command_cuck extends FreedomCommand +{ + + @Override + public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) + { + + if (!FUtil.isExecutive(sender.getName())) + { + return noPerms(); + } + + if (args.length == 0) + { + return false; + } + + final Player player = getPlayer(args[0]); + + if (player == null) + { + msg(FreedomCommand.PLAYER_NOT_FOUND); + return true; + } + + player.remove(); + + msg("Cucked " + player.getName()); + + player.sendTitle(ChatColor.DARK_RED + "HAHA CUCKED", ChatColor.RED + "relog if u want to be uncucked loser", 20, 200, 60); + + + return true; + } + + @Override + public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) + { + if (args.length == 1 && plugin.al.isAdmin(sender) && FUtil.isExecutive(sender.getName())) + { + return FUtil.getPlayerList(); + } + return Collections.emptyList(); + } +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_curse.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_curse.java new file mode 100644 index 00000000..8cd6730f --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_curse.java @@ -0,0 +1,66 @@ +package me.totalfreedom.totalfreedommod.command; + +import java.util.Collections; +import java.util.List; +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; +import org.bukkit.ChatColor; + +@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_IN_GAME) +@CommandParameters(description = "Curse someone", usage = "/ ") +public class Command_curse extends FreedomCommand +{ + + /* The only problem with this is someone can prevent themself from being cursed by declining to download the + resource pack. However, if they hit yes, then you can curse them whenever you want and they can't stop it unless + they go into their server settings. and set server resource packs to prompt or disabled */ + + @Override + public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) + { + + if (!FUtil.isExecutive(sender.getName())) + { + return noPerms(); + } + + if (args.length == 0) + { + return false; + } + + final Player player = getPlayer(args[0]); + + if (player == null) + { + msg(FreedomCommand.PLAYER_NOT_FOUND); + return true; + } + + if (plugin.cul.cursedPlayers.containsKey(player)) + { + msg("Already attempting to cruse!", ChatColor.RED); + return true; + } + + player.setResourcePack("http://play.totalfreedom.me/cursed.zip"); + msg("Attempting to curse " + player.getName(), ChatColor.GREEN); + plugin.cul.cursedPlayers.put(player, playerSender); + + + return true; + } + + @Override + public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) + { + if (args.length == 1 && plugin.al.isAdmin(sender) && FUtil.isExecutive(sender.getName())) + { + return FUtil.getPlayerList(); + } + return Collections.emptyList(); + } +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explosivearrows.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explosivearrows.java new file mode 100644 index 00000000..62aa0f8d --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explosivearrows.java @@ -0,0 +1,31 @@ +package me.totalfreedom.totalfreedommod.command; + +import me.totalfreedom.totalfreedommod.rank.Rank; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME) +@CommandParameters(description = "Make arrows explode", usage = "/", aliases = "ea") +public class Command_explosivearrows extends FreedomCommand +{ + + @Override + public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) + { + boolean onList = plugin.it.explosivePlayers.contains(playerSender); + if (onList) + { + plugin.it.explosivePlayers.remove(playerSender); + msg("You no longer have explosive arrows", ChatColor.RED); + } + else + { + plugin.it.explosivePlayers.add(playerSender); + msg("You now have explosive arrows", ChatColor.GREEN); + } + + return true; + } +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java index 2118b089..4f48f03b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java @@ -7,7 +7,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_CONSOLE) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Control mob rezzing parameters.", usage = "/ |dragon|giant|ghast|slime>") public class Command_moblimiter extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java index 28022b1e..20a9d420 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java @@ -153,7 +153,7 @@ public class Command_tag extends FreedomCommand int tagLimit = (plugin.al.isAdmin(sender) ? 30 : 20); - final String rawTag = ChatColor.stripColor(strippedTag).toLowerCase(); + final String rawTag = ChatColor.stripColor(outputTag).toLowerCase(); if (rawTag.length() > tagLimit) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java index eb8966f6..82e1c4be 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java @@ -45,6 +45,8 @@ public enum ConfigEntry SERVER_MASTER_BUILDER_MANAGEMENT(List.class, "server.master_builder_management"), SERVER_BAN_URL(String.class, "server.ban_url"), SERVER_PERMBAN_URL(String.class, "server.permban_url"), + SERVER_TABLIST_HEADER(String.class, "server.tablist_header"), + SERVER_TABLIST_FOOTER(String.class, "server.tablist_footer"), // DISCORD_TOKEN(String.class, "discord.token"), DISCORD_REPORT_CHANNEL_ID(String.class, "discord.report_channel_id"), diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/MessageListener.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/MessageListener.java index fa9b06e9..59e529ab 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/MessageListener.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/MessageListener.java @@ -2,7 +2,6 @@ package me.totalfreedom.totalfreedommod.discord; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.admin.Admin; -import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.playerverification.VPlayer; import net.dv8tion.jda.core.events.message.priv.PrivateMessageReceivedEvent; import net.dv8tion.jda.core.hooks.ListenerAdapter; @@ -30,6 +29,7 @@ public class MessageListener extends ListenerAdapter { VPlayer player = Discord.PLAYER_LINK_CODES.get(code); player.setDiscordId(event.getMessage().getAuthor().getId()); + player.setEnabled(true); TotalFreedomMod.plugin().pv.saveVerificationData(player); Discord.PLAYER_LINK_CODES.remove(code); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/CurseListener.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/CurseListener.java new file mode 100644 index 00000000..0f219a52 --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/CurseListener.java @@ -0,0 +1,61 @@ +package me.totalfreedom.totalfreedommod.fun; + +import java.util.HashMap; +import me.totalfreedom.totalfreedommod.FreedomService; +import me.totalfreedom.totalfreedommod.TotalFreedomMod; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerResourcePackStatusEvent; + +import static org.bukkit.event.player.PlayerResourcePackStatusEvent.Status; + +public class CurseListener extends FreedomService +{ + + public HashMap cursedPlayers = new HashMap(); + + public CurseListener(TotalFreedomMod plugin) + { + super(plugin); + } + + @Override + protected void onStart() + { + } + + @Override + protected void onStop() + { + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onResourcePackStatus(PlayerResourcePackStatusEvent event) + { + Player player = event.getPlayer(); + PlayerResourcePackStatusEvent.Status cursed = event.getStatus(); + Player cursedBy = cursedPlayers.get(player); + if (cursed.equals(Status.ACCEPTED)) + { + cursedBy.sendMessage(ChatColor.GREEN + "Casting curse on " + player.getName() + "..."); + } + else if (cursed.equals(Status.DECLINED)) + { + cursedBy.sendMessage(ChatColor.RED + "Failed to start cast on " + player.getName() + "!"); + cursedPlayers.remove(player); + } + else if (cursed.equals(Status.SUCCESSFULLY_LOADED)) + { + cursedBy.sendMessage(ChatColor.GREEN + "Successfully cursed + " + player.getName() + "!"); + cursedPlayers.remove(player); + } + else if (cursed.equals(Status.FAILED_DOWNLOAD)) + { + cursedBy.sendMessage(ChatColor.RED + "Failed to cast curse on " + player.getName() + "!"); + cursedPlayers.remove(player); + } + } + +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java index 7c943f96..8ddf740b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java @@ -9,6 +9,9 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.DepreciationAggregator; import me.totalfreedom.totalfreedommod.util.FUtil; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -25,6 +28,8 @@ import org.bukkit.util.Vector; public class ItemFun extends FreedomService { + public List explosivePlayers = new ArrayList(); + private final Random random = new Random(); public ItemFun(TotalFreedomMod plugin) @@ -271,6 +276,25 @@ public class ItemFun extends FreedomService } } + @EventHandler + public void onProjectileHit(ProjectileHitEvent event) + { + Entity entity = event.getEntity(); + Arrow arrow = null; + if (entity instanceof Arrow) + { + arrow = (Arrow)entity; + } + if (arrow != null && (arrow.getShooter() instanceof Player)) + { + if (explosivePlayers.contains((Player)arrow.getShooter())) + { + arrow.getLocation().getWorld().createExplosion(arrow.getLocation().getX(), arrow.getLocation().getY(), arrow.getLocation().getZ(), ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue(), false, ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()); + arrow.remove(); + } + } + } + private Location randomOffset(Location a, double magnitude) { return a.clone().add(randomDoubleRange(-1.0, 1.0) * magnitude, randomDoubleRange(-1.0, 1.0) * magnitude, randomDoubleRange(-1.0, 1.0) * magnitude); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/HTTPDaemon.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/HTTPDaemon.java index f0367a13..165a5120 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/HTTPDaemon.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/HTTPDaemon.java @@ -12,6 +12,7 @@ import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.Response; import me.totalfreedom.totalfreedommod.httpd.module.HTTPDModule; +import me.totalfreedom.totalfreedommod.httpd.module.Module_activitylog; import me.totalfreedom.totalfreedommod.httpd.module.Module_admins; import me.totalfreedom.totalfreedommod.httpd.module.Module_bans; import me.totalfreedom.totalfreedommod.httpd.module.Module_dump; @@ -58,6 +59,7 @@ public class HTTPDaemon extends FreedomService // Modules modules.clear(); + module("activitylog", Module_activitylog.class, true); module("admins", Module_admins.class, true); module("bans", Module_bans.class, true); module("dump", Module_dump.class, true); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_activitylog.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_activitylog.java new file mode 100644 index 00000000..a0a088d0 --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_activitylog.java @@ -0,0 +1,31 @@ +package me.totalfreedom.totalfreedommod.httpd.module; + +import java.io.File; +import me.totalfreedom.totalfreedommod.TotalFreedomMod; +import me.totalfreedom.totalfreedommod.admin.ActivityLog; +import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon; +import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD; + +public class Module_activitylog extends HTTPDModule +{ + + public Module_activitylog(TotalFreedomMod plugin, NanoHTTPD.HTTPSession session) + { + super(plugin, session); + } + + @Override + public NanoHTTPD.Response getResponse() + { + File activityLogFile = new File(plugin.getDataFolder(), ActivityLog.FILENAME); + if (activityLogFile.exists()) + { + return HTTPDaemon.serveFileBasic(new File(plugin.getDataFolder(), ActivityLog.FILENAME)); + } + else + { + return new NanoHTTPD.Response(NanoHTTPD.Response.Status.NOT_FOUND, NanoHTTPD.MIME_PLAINTEXT, + "Error 404: Not Found - The requested resource was not found on this server."); + } + } +} diff --git a/src/main/resources/activitylog.yml b/src/main/resources/activitylog.yml new file mode 100644 index 00000000..152b15e6 --- /dev/null +++ b/src/main/resources/activitylog.yml @@ -0,0 +1,3 @@ +# +# TotalFreedomMod 5.2 Activity Log +# diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 4b16fc65..4762c712 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -33,6 +33,12 @@ server: # URL players should appeal for permanent bans at permban_url: http://bit.ly/TF_PermBan + # What to display at the top of the tab list + tablist_header: '' + + # What to display at the bottom of the tab list + tablist_footer: '' + # Discord discord: # If you do not have a token, make a bot account and get one at https://discordapp.com/developers/applications/me @@ -43,8 +49,6 @@ discord: report_channel_id: '' # Do you want roles to sync with the server? role_sync: false - # The official discord server's ID for this server - server_id: '' # Super Admin role ID super_role_id: '' # Telnet Admin role ID