mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Move unfreeze and unmute tasks to TFM_PlayerData. Resolves #352
Mass format & cleanup
This commit is contained in:
parent
9970277134
commit
c7a0604afc
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Thu Nov 13 21:12:26 CET 2014
|
||||
build.number=957
|
||||
#Thu Nov 20 23:19:02 CET 2014
|
||||
build.number=959
|
||||
|
@ -1,15 +1,14 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Freeze players (toggles on and off).", usage = "/<command> [target | purge]")
|
||||
@ -27,20 +26,6 @@ public class Command_fr extends TFM_Command
|
||||
TFM_Util.adminAction(sender.getName(), "Freezing all players", false);
|
||||
TotalFreedomMod.allPlayersFrozen = true;
|
||||
|
||||
if (TotalFreedomMod.freezePurgeTask != null)
|
||||
{
|
||||
TotalFreedomMod.freezePurgeTask.cancel();
|
||||
}
|
||||
TotalFreedomMod.freezePurgeTask = new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
TFM_Util.adminAction("FreezeTimer", "Unfreezing all players", false);
|
||||
TotalFreedomMod.allPlayersFrozen = false;
|
||||
}
|
||||
}.runTaskLater(plugin, 20L * 60L * 5L);
|
||||
|
||||
playerMsg("Players are now frozen.");
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
@ -54,10 +39,6 @@ public class Command_fr extends TFM_Command
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Unfreezing all players", false);
|
||||
TotalFreedomMod.allPlayersFrozen = false;
|
||||
if (TotalFreedomMod.freezePurgeTask != null)
|
||||
{
|
||||
TotalFreedomMod.freezePurgeTask.cancel();
|
||||
}
|
||||
playerMsg("Players are now free to move.");
|
||||
}
|
||||
}
|
||||
@ -66,10 +47,6 @@ public class Command_fr extends TFM_Command
|
||||
if (args[0].toLowerCase().equals("purge"))
|
||||
{
|
||||
TotalFreedomMod.allPlayersFrozen = false;
|
||||
if (TotalFreedomMod.freezePurgeTask != null)
|
||||
{
|
||||
TotalFreedomMod.freezePurgeTask.cancel();
|
||||
}
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
|
@ -69,17 +69,8 @@ public class Command_purgeall extends TFM_Command
|
||||
}
|
||||
}
|
||||
|
||||
// Clear auto-unmute and auto-unfreeze tasks
|
||||
if (TotalFreedomMod.mutePurgeTask != null)
|
||||
{
|
||||
TotalFreedomMod.mutePurgeTask.cancel();
|
||||
}
|
||||
|
||||
// Unfreeze all players
|
||||
TotalFreedomMod.allPlayersFrozen = false;
|
||||
if (TotalFreedomMod.freezePurgeTask != null)
|
||||
{
|
||||
TotalFreedomMod.freezePurgeTask.cancel();
|
||||
}
|
||||
|
||||
// Remove all mobs
|
||||
Command_mp.purgeMobs();
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -3,11 +3,9 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> [<player> [-s] | list | purge | all]", aliases = "mute")
|
||||
@ -54,10 +52,6 @@ public class Command_stfu extends TFM_Command
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (TotalFreedomMod.mutePurgeTask != null)
|
||||
{
|
||||
TotalFreedomMod.mutePurgeTask.cancel();
|
||||
}
|
||||
playerMsg("Unmuted " + count + " players.");
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("all"))
|
||||
@ -76,24 +70,6 @@ public class Command_stfu extends TFM_Command
|
||||
}
|
||||
}
|
||||
|
||||
if (TotalFreedomMod.mutePurgeTask != null)
|
||||
{
|
||||
TotalFreedomMod.mutePurgeTask.cancel();
|
||||
}
|
||||
|
||||
TotalFreedomMod.mutePurgeTask = new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
TFM_Util.adminAction("MuteTimer", "Unmuting all players", false);
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
TFM_PlayerData.getPlayerData(player).setMuted(false);
|
||||
}
|
||||
}
|
||||
}.runTaskLater(plugin, 20L * 60L * 5L);
|
||||
|
||||
playerMsg("Muted " + counter + " players.");
|
||||
}
|
||||
else
|
||||
|
@ -2,8 +2,8 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -112,13 +112,13 @@ public class Command_tag extends TFM_Command
|
||||
final String inputTag = StringUtils.join(args, " ", 1, args.length);
|
||||
final String outputTag = TFM_Util.colorize(StringUtils.replaceEachRepeatedly(StringUtils.strip(inputTag),
|
||||
new String[]
|
||||
{
|
||||
"" + ChatColor.COLOR_CHAR, "&k"
|
||||
},
|
||||
{
|
||||
"" + ChatColor.COLOR_CHAR, "&k"
|
||||
},
|
||||
new String[]
|
||||
{
|
||||
"", ""
|
||||
})) + ChatColor.RESET;
|
||||
{
|
||||
"", ""
|
||||
})) + ChatColor.RESET;
|
||||
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -10,13 +10,13 @@ import java.util.Map;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.AdminLevel;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandLoader;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandLoader.TFM_DynamicCommand;
|
||||
import static me.StevenLawson.TotalFreedomMod.HTTPD.HTMLGenerationTools.heading;
|
||||
import static me.StevenLawson.TotalFreedomMod.HTTPD.HTMLGenerationTools.paragraph;
|
||||
import static net.minecraft.util.org.apache.commons.lang3.StringEscapeUtils.escapeHtml4;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.PluginIdentifiableCommand;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import static me.StevenLawson.TotalFreedomMod.HTTPD.HTMLGenerationTools.*;
|
||||
import static net.minecraft.util.org.apache.commons.lang3.StringEscapeUtils.*;
|
||||
|
||||
public class Module_help extends TFM_HTTPD_Module
|
||||
{
|
||||
@ -41,8 +41,8 @@ public class Module_help extends TFM_HTTPD_Module
|
||||
responseBody
|
||||
.append(heading("Command Help", 1))
|
||||
.append(paragraph(
|
||||
"This page is an automatically generated listing of all plugin commands that are currently live on the server. "
|
||||
+ "Please note that it does not include vanilla server commands."));
|
||||
"This page is an automatically generated listing of all plugin commands that are currently live on the server. "
|
||||
+ "Please note that it does not include vanilla server commands."));
|
||||
|
||||
final Map<String, List<Command>> commandsByPlugin = new HashMap<String, List<Command>>();
|
||||
|
||||
|
@ -1,11 +1,37 @@
|
||||
package me.StevenLawson.TotalFreedomMod.HTTPD;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.io.SequenceInputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.TimeZone;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
|
||||
/**
|
||||
@ -790,9 +816,9 @@ public abstract class NanoHTTPD
|
||||
public enum Status
|
||||
{
|
||||
OK(200, "OK"), CREATED(201, "Created"), ACCEPTED(202, "Accepted"), NO_CONTENT(204, "No Content"), PARTIAL_CONTENT(206, "Partial Content"), REDIRECT(301,
|
||||
"Moved Permanently"), NOT_MODIFIED(304, "Not Modified"), BAD_REQUEST(400, "Bad Request"), UNAUTHORIZED(401,
|
||||
"Unauthorized"), FORBIDDEN(403, "Forbidden"), NOT_FOUND(404, "Not Found"), RANGE_NOT_SATISFIABLE(416,
|
||||
"Requested Range Not Satisfiable"), INTERNAL_ERROR(500, "Internal Server Error");
|
||||
"Moved Permanently"), NOT_MODIFIED(304, "Not Modified"), BAD_REQUEST(400, "Bad Request"), UNAUTHORIZED(401,
|
||||
"Unauthorized"), FORBIDDEN(403, "Forbidden"), NOT_FOUND(404, "Not Found"), RANGE_NOT_SATISFIABLE(416,
|
||||
"Requested Range Not Satisfiable"), INTERNAL_ERROR(500, "Internal Server Error");
|
||||
private final int requestStatus;
|
||||
private final String description;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Response;
|
||||
|
||||
public class TFM_HTTPD_PageBuilder
|
||||
{
|
||||
private static final String TEMPLATE =
|
||||
"<!DOCTYPE html>\r\n"
|
||||
private static final String TEMPLATE
|
||||
= "<!DOCTYPE html>\r\n"
|
||||
+ "<html>\r\n"
|
||||
+ "<head>\r\n"
|
||||
+ "<title>{$TITLE}</title>\r\n"
|
||||
@ -16,8 +16,8 @@ public class TFM_HTTPD_PageBuilder
|
||||
+ "<body>\r\n{$BODY}</body>\r\n"
|
||||
+ "</html>\r\n";
|
||||
private static final String STYLE = "<style type=\"text/css\">{$STYLE}</style>\r\n";
|
||||
private static final String SCRIPT =
|
||||
"<script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\"></script>\r\n"
|
||||
private static final String SCRIPT
|
||||
= "<script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\"></script>\r\n"
|
||||
+ "<script src=\"//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js\"></script>\r\n"
|
||||
+ "<script>\r\n{$SCRIPT}\r\n</script>\r\n";
|
||||
//
|
||||
|
@ -7,10 +7,25 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.*;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.Command_landmine;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Heartbeat;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Jumppads;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Player;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager.RollbackEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UuidManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -28,7 +43,16 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -581,7 +605,7 @@ public class TFM_PlayerListener implements Listener
|
||||
{
|
||||
if (!TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "You are muted, STFU!");
|
||||
player.sendMessage(ChatColor.RED + "You are muted, STFU! - You will be unmuted in 5 minutes.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -158,9 +158,9 @@ public class TFM_FrontDoor
|
||||
ClassLoader classLoader = TotalFreedomMod.class.getClassLoader();
|
||||
dispatcher = (TFM_Command) classLoader.loadClass(
|
||||
String.format("%s.%s%s",
|
||||
TFM_CommandHandler.COMMAND_PATH,
|
||||
TFM_CommandHandler.COMMAND_PREFIX,
|
||||
command.getName().toLowerCase())).newInstance();
|
||||
TFM_CommandHandler.COMMAND_PATH,
|
||||
TFM_CommandHandler.COMMAND_PREFIX,
|
||||
command.getName().toLowerCase())).newInstance();
|
||||
dispatcher.setup(TotalFreedomMod.plugin, player, dispatcher.getClass());
|
||||
|
||||
if (!dispatcher.run(player, player, command, commandName, args, true))
|
||||
|
@ -23,12 +23,15 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class TFM_PlayerData
|
||||
{
|
||||
public final static Map<Player, TFM_PlayerData> userinfo = new HashMap<Player, TFM_PlayerData>();
|
||||
public static final Map<Player, TFM_PlayerData> USER_INFO = new HashMap<Player, TFM_PlayerData>();
|
||||
public static final long AUTO_PURGE = 20L * 60L * 5L;
|
||||
//
|
||||
private final Player player;
|
||||
private final String ip;
|
||||
private final UUID uuid;
|
||||
private boolean isFrozen = false;
|
||||
private boolean isMuted = false;
|
||||
//
|
||||
private BukkitTask unmuteTask;
|
||||
private BukkitTask unfreezeTask;
|
||||
private boolean isHalted = false;
|
||||
private int messageCount = 0;
|
||||
private int totalBlockDestroy = 0;
|
||||
@ -46,10 +49,10 @@ public class TFM_PlayerData
|
||||
private EntityType mobThrowerEntity = EntityType.PIG;
|
||||
private double mobThrowerSpeed = 4.0;
|
||||
private List<LivingEntity> mobThrowerQueue = new ArrayList<LivingEntity>();
|
||||
private BukkitTask mp44ScheduleId = null;
|
||||
private BukkitTask mp44ScheduleTask = null;
|
||||
private boolean mp44Armed = false;
|
||||
private boolean mp44Firing = false;
|
||||
private BukkitTask lockupScheduleId = null;
|
||||
private BukkitTask lockupScheduleTask = null;
|
||||
private String lastMessage = "";
|
||||
private boolean inAdminchat = false;
|
||||
private boolean allCommandsBlocked = false;
|
||||
@ -68,14 +71,14 @@ public class TFM_PlayerData
|
||||
|
||||
public static TFM_PlayerData getPlayerData(Player player)
|
||||
{
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.userinfo.get(player);
|
||||
TFM_PlayerData playerdata = TFM_PlayerData.USER_INFO.get(player);
|
||||
|
||||
if (playerdata != null)
|
||||
{
|
||||
return playerdata;
|
||||
}
|
||||
|
||||
Iterator<Entry<Player, TFM_PlayerData>> it = userinfo.entrySet().iterator();
|
||||
Iterator<Entry<Player, TFM_PlayerData>> it = USER_INFO.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
Entry<Player, TFM_PlayerData> pair = it.next();
|
||||
@ -105,7 +108,7 @@ public class TFM_PlayerData
|
||||
}
|
||||
|
||||
playerdata = new TFM_PlayerData(player);
|
||||
TFM_PlayerData.userinfo.put(player, playerdata);
|
||||
TFM_PlayerData.USER_INFO.put(player, playerdata);
|
||||
|
||||
return playerdata;
|
||||
}
|
||||
@ -214,12 +217,30 @@ public class TFM_PlayerData
|
||||
|
||||
public boolean isFrozen()
|
||||
{
|
||||
return this.isFrozen;
|
||||
return unfreezeTask != null;
|
||||
}
|
||||
|
||||
public void setFrozen(boolean fr)
|
||||
{
|
||||
this.isFrozen = fr;
|
||||
cancel(unfreezeTask);
|
||||
unfreezeTask = null;
|
||||
|
||||
if (!fr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unfreezeTask = new BukkitRunnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
TFM_Util.adminAction("TotalFreedom", "Unfreezing " + player.getName(), false);
|
||||
setFrozen(false);
|
||||
}
|
||||
|
||||
}.runTaskLater(TotalFreedomMod.plugin, AUTO_PURGE);
|
||||
}
|
||||
|
||||
public void resetMsgCount()
|
||||
@ -315,16 +336,16 @@ public class TFM_PlayerData
|
||||
public void startArrowShooter(TotalFreedomMod plugin)
|
||||
{
|
||||
this.stopArrowShooter();
|
||||
this.mp44ScheduleId = new ArrowShooter(this.player).runTaskTimer(plugin, 1L, 1L);
|
||||
this.mp44ScheduleTask = new ArrowShooter(this.player).runTaskTimer(plugin, 1L, 1L);
|
||||
this.mp44Firing = true;
|
||||
}
|
||||
|
||||
public void stopArrowShooter()
|
||||
{
|
||||
if (this.mp44ScheduleId != null)
|
||||
if (this.mp44ScheduleTask != null)
|
||||
{
|
||||
this.mp44ScheduleId.cancel();
|
||||
this.mp44ScheduleId = null;
|
||||
this.mp44ScheduleTask.cancel();
|
||||
this.mp44ScheduleTask = null;
|
||||
}
|
||||
this.mp44Firing = false;
|
||||
}
|
||||
@ -371,12 +392,30 @@ public class TFM_PlayerData
|
||||
|
||||
public boolean isMuted()
|
||||
{
|
||||
return isMuted;
|
||||
return unmuteTask != null;
|
||||
}
|
||||
|
||||
public void setMuted(boolean muted)
|
||||
{
|
||||
this.isMuted = muted;
|
||||
cancel(unmuteTask);
|
||||
unmuteTask = null;
|
||||
|
||||
if (!muted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unmuteTask = new BukkitRunnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
TFM_Util.adminAction("TotalFreedom", "Unmutinging " + player.getName(), false);
|
||||
setMuted(false);
|
||||
}
|
||||
|
||||
}.runTaskLater(TotalFreedomMod.plugin, AUTO_PURGE);
|
||||
}
|
||||
|
||||
public boolean isHalted()
|
||||
@ -417,12 +456,12 @@ public class TFM_PlayerData
|
||||
|
||||
public BukkitTask getLockupScheduleID()
|
||||
{
|
||||
return this.lockupScheduleId;
|
||||
return this.lockupScheduleTask;
|
||||
}
|
||||
|
||||
public void setLockupScheduleID(BukkitTask id)
|
||||
{
|
||||
this.lockupScheduleId = id;
|
||||
this.lockupScheduleTask = id;
|
||||
}
|
||||
|
||||
public void setLastMessage(String message)
|
||||
@ -521,4 +560,20 @@ public class TFM_PlayerData
|
||||
TFM_Util.playerMsg(this.player, ChatColor.RED + "You have been warned at least twice now, make sure to read the rules at " + TFM_ConfigEntry.SERVER_BAN_URL.getString());
|
||||
}
|
||||
}
|
||||
|
||||
public void cancel(BukkitTask task)
|
||||
{
|
||||
if (task == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
task.cancel();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@ -12,6 +11,7 @@ import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -19,6 +19,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class TFM_ProtectedArea
|
||||
{
|
||||
|
||||
public static final double MAX_RADIUS = 50.0;
|
||||
private static final Map<String, SerializableProtectedRegion> PROTECTED_AREAS = new HashMap<String, SerializableProtectedRegion>();
|
||||
|
||||
@ -266,6 +267,7 @@ public class TFM_ProtectedArea
|
||||
|
||||
public static class SerializableProtectedRegion implements Serializable
|
||||
{
|
||||
|
||||
private final double x, y, z;
|
||||
private final double radius;
|
||||
private final String worldName;
|
||||
@ -311,6 +313,7 @@ public class TFM_ProtectedArea
|
||||
|
||||
public static class CantFindWorldException extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CantFindWorldException(String string)
|
||||
@ -318,5 +321,7 @@ public class TFM_ProtectedArea
|
||||
super(string);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -136,7 +136,6 @@ public class TFM_ServerInterface
|
||||
}
|
||||
|
||||
// Player is not an admin
|
||||
|
||||
// Server full check
|
||||
if (server.getOnlinePlayers().length >= server.getMaxPlayers())
|
||||
{
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.OfflinePlayer;
|
||||
|
||||
public class TFM_UuidManager
|
||||
{
|
||||
|
||||
private static final Map<String, UUID> UUID_CACHE = new HashMap<String, UUID>();
|
||||
|
||||
private TFM_UuidManager()
|
||||
|
@ -1,9 +1,5 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_Flatlands;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -11,9 +7,18 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandLoader;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.HTTPD.TFM_HTTPD_Manager;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.*;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_BlockListener;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_EntityListener;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_PlayerListener;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_ServerListener;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_TelnetListener;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_WeatherListener;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_Flatlands;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
@ -22,7 +27,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.mcstats.Metrics;
|
||||
|
||||
public class TotalFreedomMod extends JavaPlugin
|
||||
@ -49,8 +53,6 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
public static String pluginVersion;
|
||||
//
|
||||
public static boolean allPlayersFrozen = false;
|
||||
public static BukkitTask freezePurgeTask = null;
|
||||
public static BukkitTask mutePurgeTask = null;
|
||||
public static boolean lockdownEnabled = false;
|
||||
public static Map<Player, Double> fuckoffEnabledFor = new HashMap<Player, Double>();
|
||||
|
||||
|
@ -27,13 +27,6 @@
|
||||
*/
|
||||
package org.mcstats;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
@ -53,6 +46,12 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class Metrics
|
||||
{
|
||||
@ -362,7 +361,6 @@ public class Metrics
|
||||
int playersOnline = Bukkit.getServer().getOnlinePlayers().length;
|
||||
|
||||
// END server software specific section -- all code below does not use any code outside of this class / Java
|
||||
|
||||
// Construct the post data
|
||||
StringBuilder json = new StringBuilder(1024);
|
||||
json.append('{');
|
||||
@ -464,7 +462,6 @@ public class Metrics
|
||||
connection = url.openConnection();
|
||||
}
|
||||
|
||||
|
||||
byte[] uncompressed = json.toString().getBytes();
|
||||
byte[] compressed = gzip(json.toString());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user