mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Fixed nonstandard formatting in recent commits.
Cleaned up the halt and permban commands. Nobody cares about the "count" when you first load the plugin. Lets not include that.
This commit is contained in:
parent
322f233ce0
commit
30c65d49ed
@ -26,7 +26,7 @@ public class Command_glist extends TFM_Command
|
|||||||
{
|
{
|
||||||
if (args[0].equalsIgnoreCase("purge"))
|
if (args[0].equalsIgnoreCase("purge"))
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Purging the banlist", true);
|
//Purge does not clear the banlist! This is not for clearing bans! This is for clearing the yaml file that stores the player/IP database!
|
||||||
TFM_UserList.getInstance(plugin).purge();
|
TFM_UserList.getInstance(plugin).purge();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -11,55 +10,54 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class Command_halt extends TFM_Command
|
public class Command_halt extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if(!(TFM_Util.isUserSuperadmin(sender) || senderIsConsole))
|
if (!(TFM_Util.isUserSuperadmin(sender) || senderIsConsole))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("all"))
|
if (args[0].equalsIgnoreCase("all"))
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Halting all non-Superadmins", true);
|
TFM_Util.adminAction(sender.getName(), "Halting all non-superadmins.", true);
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for(Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if(!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_Util.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
halt(p, sender);
|
setHalted(p, true);
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TFM_Util.playerMsg(sender, "Halted " + counter + " players.");
|
TFM_Util.playerMsg(sender, "Halted " + counter + " players.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("purge"))
|
if (args[0].equalsIgnoreCase("purge"))
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Unhalting all players", true);
|
TFM_Util.adminAction(sender.getName(), "Unhalting all players.", true);
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for(Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if(TFM_UserInfo.getPlayerData(p).isHalted())
|
if (TFM_UserInfo.getPlayerData(p).isHalted())
|
||||||
{
|
{
|
||||||
unhalt(p, sender);
|
setHalted(p, false);
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TFM_Util.playerMsg(sender, "Unhalted " + counter + " players.");
|
TFM_Util.playerMsg(sender, "Unhalted " + counter + " players.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("list"))
|
if (args[0].equalsIgnoreCase("list"))
|
||||||
{
|
{
|
||||||
TFM_Util.playerMsg(sender, "Halted players:");
|
|
||||||
TFM_UserInfo info;
|
TFM_UserInfo info;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (Player hp : server.getOnlinePlayers())
|
for (Player hp : server.getOnlinePlayers())
|
||||||
@ -67,72 +65,75 @@ public class Command_halt extends TFM_Command
|
|||||||
info = TFM_UserInfo.getPlayerData(hp);
|
info = TFM_UserInfo.getPlayerData(hp);
|
||||||
if (info.isHalted())
|
if (info.isHalted())
|
||||||
{
|
{
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
TFM_Util.playerMsg(sender, "Halted players:");
|
||||||
|
}
|
||||||
TFM_Util.playerMsg(sender, "- " + hp.getName());
|
TFM_Util.playerMsg(sender, "- " + hp.getName());
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
TFM_Util.playerMsg(sender, "- none");
|
TFM_Util.playerMsg(sender, "There are currently no halted players.");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player p;
|
Player p;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
p = getPlayer(args[0]);
|
p = getPlayer(args[0]);
|
||||||
}
|
}
|
||||||
catch(CantFindPlayerException ex)
|
catch (CantFindPlayerException ex)
|
||||||
{
|
{
|
||||||
sender.sendMessage(ex.getMessage());
|
sender.sendMessage(ex.getMessage());
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!TFM_UserInfo.getPlayerData(p).isHalted())
|
if (!TFM_UserInfo.getPlayerData(p).isHalted())
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Halting " + p.getName(), true);
|
TFM_Util.adminAction(sender.getName(), "Halting " + p.getName(), true);
|
||||||
halt(p, sender);
|
setHalted(p, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Unhalting " + p.getName(), true);
|
TFM_Util.adminAction(sender.getName(), "Unhalting " + p.getName(), true);
|
||||||
|
setHalted(p, false);
|
||||||
unhalt(p, sender);
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private void setHalted(Player p, boolean is_halted)
|
||||||
public void halt(Player p, CommandSender sender)
|
{
|
||||||
{
|
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
|
||||||
|
if (is_halted)
|
||||||
p.setOp(false);
|
{
|
||||||
p.setGameMode(GameMode.SURVIVAL);
|
p.setOp(false);
|
||||||
p.setFlying(false);
|
p.setGameMode(GameMode.SURVIVAL);
|
||||||
p.setDisplayName(p.getName());
|
p.setFlying(false);
|
||||||
p.closeInventory();
|
p.setDisplayName(p.getName());
|
||||||
p.setTotalExperience(0);
|
p.closeInventory();
|
||||||
|
p.setTotalExperience(0);
|
||||||
playerdata.stopOrbiting();
|
|
||||||
playerdata.setFrozen(true);
|
playerdata.stopOrbiting();
|
||||||
playerdata.setMuted(true);
|
playerdata.setFrozen(true);
|
||||||
playerdata.setHalted(true);
|
playerdata.setMuted(true);
|
||||||
|
playerdata.setHalted(true);
|
||||||
TFM_Util.playerMsg(p, "You have been halted, don't move!");
|
|
||||||
}
|
TFM_Util.playerMsg(p, "You have been halted, don't move!");
|
||||||
|
}
|
||||||
public void unhalt(Player p, CommandSender sender)
|
else
|
||||||
{
|
{
|
||||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
p.setOp(true);
|
||||||
|
p.setGameMode(GameMode.CREATIVE);
|
||||||
p.setOp(true);
|
playerdata.setFrozen(false);
|
||||||
p.setGameMode(GameMode.CREATIVE);
|
playerdata.setMuted(false);
|
||||||
playerdata.setFrozen(false);
|
playerdata.setHalted(false);
|
||||||
playerdata.setMuted(false);
|
TFM_Util.playerMsg(p, "You are no longer halted.");
|
||||||
playerdata.setHalted(false);
|
}
|
||||||
TFM_Util.playerMsg(p, "You are no longer halted.");
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,77 +2,71 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class Command_permban extends TFM_Command
|
public class Command_permban extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if(!sender.isOp())
|
if (!sender.isOp())
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args.length != 1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("list"))
|
|
||||||
{
|
|
||||||
TFM_Util.playerMsg(sender, "Permanently banned players:");
|
|
||||||
int count = 0;
|
|
||||||
for (String pbp : TotalFreedomMod.permbanned_players)
|
|
||||||
{
|
|
||||||
TFM_Util.playerMsg(sender, "- " + pbp);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
if (count == 0)
|
|
||||||
{
|
|
||||||
TFM_Util.playerMsg(sender, "- none");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TFM_Util.playerMsg(sender, "Total: " + count);
|
|
||||||
}
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
TFM_Util.playerMsg(sender, "Permanently banned IPs:");
|
|
||||||
for (String pbp : TotalFreedomMod.permbanned_ips)
|
|
||||||
{
|
|
||||||
TFM_Util.playerMsg(sender, "- " + pbp);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
if (count == 0)
|
|
||||||
{
|
|
||||||
TFM_Util.playerMsg(sender, "- none");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TFM_Util.playerMsg(sender, "Total: " + count);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!senderIsConsole)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
return false;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
if (args[0].equalsIgnoreCase("list"))
|
||||||
if(args[0].equalsIgnoreCase("reload"))
|
{
|
||||||
{
|
if (TotalFreedomMod.permbanned_players.size() > 0)
|
||||||
plugin.loadPermbanConfig();
|
{
|
||||||
return true;
|
TFM_Util.playerMsg(sender, "No permanently banned player names.");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// no command executed
|
{
|
||||||
return false;
|
TFM_Util.playerMsg(sender, TotalFreedomMod.permbanned_players.size() + " permanently banned players:");
|
||||||
|
|
||||||
|
for (String player_name : TotalFreedomMod.permbanned_players)
|
||||||
|
{
|
||||||
|
TFM_Util.playerMsg(sender, "- " + player_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TotalFreedomMod.permbanned_ips.size() > 0)
|
||||||
|
{
|
||||||
|
TFM_Util.playerMsg(sender, "No permanently banned IPs.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TFM_Util.playerMsg(sender, TotalFreedomMod.permbanned_ips.size() + " permanently banned IPs:");
|
||||||
|
|
||||||
|
for (String ip_address : TotalFreedomMod.permbanned_ips)
|
||||||
|
{
|
||||||
|
TFM_Util.playerMsg(sender, "- " + ip_address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!senderIsConsole)
|
||||||
|
{
|
||||||
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("reload"))
|
||||||
|
{
|
||||||
|
plugin.loadPermbanConfig();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
public class Command_rank extends TFM_Command
|
public class Command_rank extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -14,10 +13,10 @@ public class Command_rank extends TFM_Command
|
|||||||
{
|
{
|
||||||
if (senderIsConsole && args.length < 1)
|
if (senderIsConsole && args.length < 1)
|
||||||
{
|
{
|
||||||
for(Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
sender.sendMessage(p.getName() + " is " + TFM_Util.getRank(p));
|
sender.sendMessage(p.getName() + " is " + TFM_Util.getRank(p));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ public class Command_whitelist extends TFM_Command
|
|||||||
if (args[0].equalsIgnoreCase("purge"))
|
if (args[0].equalsIgnoreCase("purge"))
|
||||||
{
|
{
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
Set whitelisted = MinecraftServer.getServer().getServerConfigurationManager().getWhitelisted();
|
Set whitelisted = MinecraftServer.getServer().getServerConfigurationManager().getWhitelisted();
|
||||||
TFM_Util.adminAction(sender.getName(), "Removing all players from the whitelist.", false);
|
TFM_Util.adminAction(sender.getName(), "Removing all players from the whitelist.", false);
|
||||||
TFM_Util.playerMsg(sender, "Removed " + whitelisted.size() + " players from the whitelist.");
|
TFM_Util.playerMsg(sender, "Removed " + whitelisted.size() + " players from the whitelist.");
|
||||||
whitelisted.clear();
|
whitelisted.clear();
|
||||||
|
@ -691,6 +691,26 @@ public class TFM_PlayerListener implements Listener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (String test_player : TotalFreedomMod.permbanned_players)
|
||||||
|
{
|
||||||
|
if (test_player.equalsIgnoreCase(player_name))
|
||||||
|
{
|
||||||
|
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, ChatColor.RED + "Your username is permanently banned from this server.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String test_ip : TotalFreedomMod.permbanned_ips)
|
||||||
|
{
|
||||||
|
//TODO: Add support for wildcards in permbanned_ips list.
|
||||||
|
//TODO: Create generic wildcard IP matching method since we do this several times already in this project.
|
||||||
|
if (test_ip.equalsIgnoreCase(player_ip))
|
||||||
|
{
|
||||||
|
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, ChatColor.RED + "Your IP address is permanently banned from this server.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (server.getOnlinePlayers().length >= server.getMaxPlayers())
|
if (server.getOnlinePlayers().length >= server.getMaxPlayers())
|
||||||
{
|
{
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_FULL, "Sorry, but this server is full.");
|
event.disallow(PlayerLoginEvent.Result.KICK_FULL, "Sorry, but this server is full.");
|
||||||
@ -720,25 +740,6 @@ public class TFM_PlayerListener implements Listener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(String test_player : TotalFreedomMod.permbanned_players)
|
|
||||||
{
|
|
||||||
if(test_player.equalsIgnoreCase(player_name))
|
|
||||||
{
|
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, ChatColor.RED + "Your username is permanently banned from this server.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(String test_ip : TotalFreedomMod.permbanned_ips)
|
|
||||||
{
|
|
||||||
if(test_ip.equalsIgnoreCase(player_ip))
|
|
||||||
{
|
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, ChatColor.RED + "Your IP-address is permanently banned from this server.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -37,14 +37,13 @@ public class TFM_UserInfo
|
|||||||
private int mp44_schedule_id = -1;
|
private int mp44_schedule_id = -1;
|
||||||
private boolean mp44_armed = false;
|
private boolean mp44_armed = false;
|
||||||
private boolean mp44_firing = false;
|
private boolean mp44_firing = false;
|
||||||
|
|
||||||
public static Map<Player, TFM_UserInfo> userinfo = new HashMap<Player, TFM_UserInfo>();
|
public static Map<Player, TFM_UserInfo> userinfo = new HashMap<Player, TFM_UserInfo>();
|
||||||
|
|
||||||
private TFM_UserInfo(Player player)
|
private TFM_UserInfo(Player player)
|
||||||
{
|
{
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TFM_UserInfo getPlayerData(Player p)
|
public static TFM_UserInfo getPlayerData(Player p)
|
||||||
{
|
{
|
||||||
TFM_UserInfo playerdata = TFM_UserInfo.userinfo.get(p);
|
TFM_UserInfo playerdata = TFM_UserInfo.userinfo.get(p);
|
||||||
@ -55,7 +54,7 @@ public class TFM_UserInfo
|
|||||||
}
|
}
|
||||||
return playerdata;
|
return playerdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOrbiting()
|
public boolean isOrbiting()
|
||||||
{
|
{
|
||||||
return this.is_orbiting;
|
return this.is_orbiting;
|
||||||
@ -66,7 +65,7 @@ public class TFM_UserInfo
|
|||||||
this.is_orbiting = true;
|
this.is_orbiting = true;
|
||||||
this.orbit_strength = orbit_strength;
|
this.orbit_strength = orbit_strength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopOrbiting()
|
public void stopOrbiting()
|
||||||
{
|
{
|
||||||
this.is_orbiting = false;
|
this.is_orbiting = false;
|
||||||
@ -94,7 +93,7 @@ public class TFM_UserInfo
|
|||||||
{
|
{
|
||||||
return this.user_caged;
|
return this.user_caged;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CageLayer
|
public enum CageLayer
|
||||||
{
|
{
|
||||||
INNER, OUTER
|
INNER, OUTER
|
||||||
@ -187,7 +186,7 @@ public class TFM_UserInfo
|
|||||||
{
|
{
|
||||||
this.block_destroy_total = 0;
|
this.block_destroy_total = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void incrementBlockPlaceCount()
|
public void incrementBlockPlaceCount()
|
||||||
{
|
{
|
||||||
this.block_place_total++;
|
this.block_place_total++;
|
||||||
@ -239,7 +238,7 @@ public class TFM_UserInfo
|
|||||||
this.mob_thrower_creature = mob_thrower_creature;
|
this.mob_thrower_creature = mob_thrower_creature;
|
||||||
this.mob_thrower_speed = mob_thrower_speed;
|
this.mob_thrower_speed = mob_thrower_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableMobThrower()
|
public void disableMobThrower()
|
||||||
{
|
{
|
||||||
this.mob_thrower_enabled = false;
|
this.mob_thrower_enabled = false;
|
||||||
@ -254,12 +253,12 @@ public class TFM_UserInfo
|
|||||||
{
|
{
|
||||||
return this.mob_thrower_speed;
|
return this.mob_thrower_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean mobThrowerEnabled()
|
public boolean mobThrowerEnabled()
|
||||||
{
|
{
|
||||||
return this.mob_thrower_enabled;
|
return this.mob_thrower_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enqueueMob(LivingEntity mob)
|
public void enqueueMob(LivingEntity mob)
|
||||||
{
|
{
|
||||||
mob_thrower_queue.add(mob);
|
mob_thrower_queue.add(mob);
|
||||||
@ -272,14 +271,14 @@ public class TFM_UserInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startArrowShooter(TotalFreedomMod plugin)
|
public void startArrowShooter(TotalFreedomMod plugin)
|
||||||
{
|
{
|
||||||
this.stopArrowShooter();
|
this.stopArrowShooter();
|
||||||
this.mp44_schedule_id = plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new ArrowShooter(this.player), 1L, 1L);
|
this.mp44_schedule_id = plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new ArrowShooter(this.player), 1L, 1L);
|
||||||
mp44_firing = true;
|
mp44_firing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopArrowShooter()
|
public void stopArrowShooter()
|
||||||
{
|
{
|
||||||
if (this.mp44_schedule_id != -1)
|
if (this.mp44_schedule_id != -1)
|
||||||
@ -289,11 +288,11 @@ public class TFM_UserInfo
|
|||||||
}
|
}
|
||||||
mp44_firing = false;
|
mp44_firing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ArrowShooter implements Runnable
|
class ArrowShooter implements Runnable
|
||||||
{
|
{
|
||||||
private Player _player;
|
private Player _player;
|
||||||
|
|
||||||
public ArrowShooter(Player player)
|
public ArrowShooter(Player player)
|
||||||
{
|
{
|
||||||
this._player = player;
|
this._player = player;
|
||||||
@ -306,24 +305,24 @@ public class TFM_UserInfo
|
|||||||
shot_arrow.setVelocity(shot_arrow.getVelocity().multiply(2.0));
|
shot_arrow.setVelocity(shot_arrow.getVelocity().multiply(2.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void armMP44()
|
public void armMP44()
|
||||||
{
|
{
|
||||||
mp44_armed = true;
|
mp44_armed = true;
|
||||||
this.stopArrowShooter();
|
this.stopArrowShooter();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disarmMP44()
|
public void disarmMP44()
|
||||||
{
|
{
|
||||||
mp44_armed = false;
|
mp44_armed = false;
|
||||||
this.stopArrowShooter();
|
this.stopArrowShooter();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMP44Armed()
|
public boolean isMP44Armed()
|
||||||
{
|
{
|
||||||
return this.mp44_armed;
|
return this.mp44_armed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean toggleMP44Firing()
|
public boolean toggleMP44Firing()
|
||||||
{
|
{
|
||||||
this.mp44_firing = !this.mp44_firing;
|
this.mp44_firing = !this.mp44_firing;
|
||||||
@ -339,14 +338,14 @@ public class TFM_UserInfo
|
|||||||
{
|
{
|
||||||
this.is_muted = is_muted;
|
this.is_muted = is_muted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHalted()
|
public boolean isHalted()
|
||||||
{
|
{
|
||||||
return is_halted;
|
return is_halted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHalted(boolean is_halted)
|
public void setHalted(boolean is_halted)
|
||||||
{
|
{
|
||||||
this.is_halted = is_halted;
|
this.is_halted = is_halted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,20 +23,22 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
public class TotalFreedomMod extends JavaPlugin
|
public class TotalFreedomMod extends JavaPlugin
|
||||||
{
|
{
|
||||||
private final Server server = Bukkit.getServer();
|
private final Server server = Bukkit.getServer();
|
||||||
|
|
||||||
public static final long HEARTBEAT_RATE = 5L; //Seconds
|
public static final long HEARTBEAT_RATE = 5L; //Seconds
|
||||||
|
|
||||||
public static final String CONFIG_FILE = "config.yml";
|
public static final String CONFIG_FILE = "config.yml";
|
||||||
public static final String SUPERADMIN_FILE = "superadmin.yml";
|
public static final String SUPERADMIN_FILE = "superadmin.yml";
|
||||||
public static final String PERMBAN_FILE = "permban.yml";
|
public static final String PERMBAN_FILE = "permban.yml";
|
||||||
|
|
||||||
public static final String COMMAND_PATH = "me.StevenLawson.TotalFreedomMod.Commands";
|
public static final String COMMAND_PATH = "me.StevenLawson.TotalFreedomMod.Commands";
|
||||||
public static final String COMMAND_PREFIX = "Command_";
|
public static final String COMMAND_PREFIX = "Command_";
|
||||||
|
|
||||||
public static final String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command.";
|
public static final String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command.";
|
||||||
public static final String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
|
public static final String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
|
||||||
public static final String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
|
public static final String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
|
||||||
public static final String CAKE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake.";
|
public static final String CAKE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake.";
|
||||||
public static final String NOT_FROM_CONSOLE = "This command may not be used from the console.";
|
public static final String NOT_FROM_CONSOLE = "This command may not be used from the console.";
|
||||||
|
|
||||||
public static boolean allPlayersFrozen = false;
|
public static boolean allPlayersFrozen = false;
|
||||||
public static Map<Player, Double> fuckoffEnabledFor = new HashMap<Player, Double>();
|
public static Map<Player, Double> fuckoffEnabledFor = new HashMap<Player, Double>();
|
||||||
|
|
||||||
@ -55,7 +57,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
TotalFreedomMod.pluginName = this.getDescription().getName();
|
TotalFreedomMod.pluginName = this.getDescription().getName();
|
||||||
|
|
||||||
setAppProperties();
|
setAppProperties();
|
||||||
|
|
||||||
loadMainConfig();
|
loadMainConfig();
|
||||||
loadSuperadminConfig();
|
loadSuperadminConfig();
|
||||||
loadPermbanConfig();
|
loadPermbanConfig();
|
||||||
@ -141,7 +143,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean allowFirePlace = false;
|
public static boolean allowFirePlace = false;
|
||||||
public static Boolean allowFireSpread = false;
|
public static Boolean allowFireSpread = false;
|
||||||
public static Boolean allowLavaDamage = false;
|
public static Boolean allowLavaDamage = false;
|
||||||
@ -207,10 +209,10 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
allowFliudSpread = config.getBoolean("allow_fluid_spread", allowFliudSpread);
|
allowFliudSpread = config.getBoolean("allow_fluid_spread", allowFliudSpread);
|
||||||
adminOnlyMode = config.getBoolean("admin_only_mode", adminOnlyMode);
|
adminOnlyMode = config.getBoolean("admin_only_mode", adminOnlyMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> superadmins = new ArrayList<String>();
|
public static List<String> superadmins = new ArrayList<String>();
|
||||||
public static List<String> superadmin_ips = new ArrayList<String>();
|
public static List<String> superadmin_ips = new ArrayList<String>();
|
||||||
|
|
||||||
public void loadSuperadminConfig()
|
public void loadSuperadminConfig()
|
||||||
{
|
{
|
||||||
TFM_Util.createDefaultConfiguration(SUPERADMIN_FILE, getFile());
|
TFM_Util.createDefaultConfiguration(SUPERADMIN_FILE, getFile());
|
||||||
@ -233,23 +235,19 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_Log.info("Loaded " + superadmins.size() + " superadmins");
|
|
||||||
TFM_Log.info("Loaded " + superadmin_ips.size() + " superadmin IPs");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> permbanned_players = new ArrayList<String>();
|
public static List<String> permbanned_players = new ArrayList<String>();
|
||||||
public static List<String> permbanned_ips = new ArrayList<String>();
|
public static List<String> permbanned_ips = new ArrayList<String>();
|
||||||
|
|
||||||
public void loadPermbanConfig()
|
public void loadPermbanConfig()
|
||||||
{
|
{
|
||||||
TFM_Util.createDefaultConfiguration(PERMBAN_FILE, getFile());
|
TFM_Util.createDefaultConfiguration(PERMBAN_FILE, getFile());
|
||||||
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), PERMBAN_FILE));
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), PERMBAN_FILE));
|
|
||||||
|
permbanned_players = new ArrayList<String>();
|
||||||
|
permbanned_ips = new ArrayList<String>();
|
||||||
|
|
||||||
permbanned_players = new ArrayList<String>();
|
|
||||||
permbanned_ips = new ArrayList<String>();
|
|
||||||
|
|
||||||
for (String user : config.getKeys(false))
|
for (String user : config.getKeys(false))
|
||||||
{
|
{
|
||||||
permbanned_players.add(user.toLowerCase().trim());
|
permbanned_players.add(user.toLowerCase().trim());
|
||||||
@ -264,9 +262,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_Log.info("Loaded " + permbanned_players.size() + " permanently banned players");
|
|
||||||
TFM_Log.info("Loaded " + permbanned_ips.size() + " permanently banned IPs");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerEventHandlers()
|
private void registerEventHandlers()
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Permanent bans
|
# Permanent Bans
|
||||||
# Only to be modified by markbyron
|
|
||||||
#
|
#
|
||||||
|
|
||||||
badplayer1:
|
badplayer1:
|
||||||
- 123.123.123.123
|
- 123.123.123.123
|
||||||
- 321.321.321.321
|
- 321.321.321.321
|
||||||
badplayer2:
|
badplayer2:
|
||||||
- 111.111.111.111
|
- 111.111.111.111
|
||||||
|
@ -75,7 +75,7 @@ commands:
|
|||||||
usage: /<command> <partialname>
|
usage: /<command> <partialname>
|
||||||
halt:
|
halt:
|
||||||
description: Superadmin command - Halts a player
|
description: Superadmin command - Halts a player
|
||||||
usage: /<command> <<partialname> | all | purge>
|
usage: /<command> <<partialname> | all | purge | list>
|
||||||
kicknoob:
|
kicknoob:
|
||||||
description: Superadmin command - Kick all non-superadmins on server.
|
description: Superadmin command - Kick all non-superadmins on server.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
Loading…
Reference in New Issue
Block a user