mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Misc new stuff
Standardized method of getting server instance. Added "flatlands" generation via CleanroomGenerator.
This commit is contained in:
parent
8a88eaea4d
commit
376f5a4edd
@ -7,6 +7,7 @@ allow_fire_spread: false
|
||||
allow_lava_damage: false
|
||||
allow_lava_place: false
|
||||
allow_water_place: false
|
||||
allow_fluid_spread: false
|
||||
|
||||
# Explosion management:
|
||||
allow_explosions: false
|
||||
@ -44,3 +45,8 @@ mob_limiter_disable_dragon: true
|
||||
mob_limiter_disable_ghast: true
|
||||
mob_limiter_disable_slime: true
|
||||
mob_limiter_disable_giant: true
|
||||
|
||||
# Flatlands
|
||||
generate_flatlands: true
|
||||
# Flatlands generation parameters, uses CleanroomGenerator syntax - http://dev.bukkit.org/server-mods/cleanroomgenerator/
|
||||
flatlands_generation_params: 16,stone,32,dirt,1,grass
|
||||
|
157
src/me/StevenLawson/TotalFreedomMod/CleanroomChunkGenerator.java
Normal file
157
src/me/StevenLawson/TotalFreedomMod/CleanroomChunkGenerator.java
Normal file
@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Cleanroom Generator
|
||||
* Copyright (C) 2011 nvx
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
import static java.lang.System.arraycopy;
|
||||
|
||||
public class CleanroomChunkGenerator extends ChunkGenerator
|
||||
{
|
||||
private byte[] chunk = new byte[32768];
|
||||
|
||||
public CleanroomChunkGenerator()
|
||||
{
|
||||
this("64,stone");
|
||||
}
|
||||
|
||||
public CleanroomChunkGenerator(String id)
|
||||
{
|
||||
byte[] layer = new byte[128];
|
||||
if (id != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
int y = 0;
|
||||
|
||||
if ((id.length() > 0) && (id.charAt(0) == '.')) // Is the first character a '.'? If so, skip bedrock generation.
|
||||
{
|
||||
id = id.substring(1); // Skip bedrock then and remove the .
|
||||
} else // Guess not, bedrock at layer0 it is then.
|
||||
{
|
||||
layer[y++] = (byte)Material.BEDROCK.getId();
|
||||
}
|
||||
|
||||
if (id.length() > 0)
|
||||
{
|
||||
String tokens[] = id.split("[,]");
|
||||
|
||||
if ((tokens.length % 2) != 0) throw new Exception();
|
||||
|
||||
for (int i = 0; i < tokens.length; i += 2)
|
||||
{
|
||||
int height = Integer.parseInt(tokens[i]);
|
||||
if ((height <= 0) || (height > 127))
|
||||
{
|
||||
System.out.println("Invalid height '" + tokens[i] + "'. Using 64 instead.");
|
||||
height = 64;
|
||||
}
|
||||
|
||||
if ((height + y) > 127)
|
||||
{
|
||||
System.out.println("Maximum height reached, ignoring additional layers.");
|
||||
break;
|
||||
}
|
||||
|
||||
Material mat = Material.matchMaterial(tokens[i + 1]);
|
||||
if (mat == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Mabe it's an integer?
|
||||
mat = Material.getMaterial(Integer.parseInt(tokens[i + 1]));
|
||||
} catch (Exception e)
|
||||
{
|
||||
// Well, I guess it wasn't an integer after all... Awkward...
|
||||
}
|
||||
|
||||
if (mat == null)
|
||||
{
|
||||
System.out.println("Invalid Block ID '" + tokens[i + 1] + "'. Defaulting to stone.");
|
||||
mat = Material.STONE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mat.isBlock())
|
||||
{
|
||||
System.out.println("Error, '" + tokens[i + 1] + "' is not a block. Defaulting to stone.");
|
||||
mat = Material.STONE;
|
||||
}
|
||||
|
||||
Arrays.fill(layer, y, y + height, (byte)mat.getId());
|
||||
y += height;
|
||||
}
|
||||
}
|
||||
} catch(Exception e)
|
||||
{
|
||||
System.out.println("Error parsing CleanroomGenerator ID '" + id + "'. using defaults '64,1': " + e.toString());
|
||||
e.printStackTrace();
|
||||
layer[0] = (byte)Material.BEDROCK.getId();
|
||||
Arrays.fill(layer, 1, 65, (byte)Material.STONE.getId());
|
||||
Arrays.fill(layer, 65, 128, (byte)Material.AIR.getId()); // Just in case...
|
||||
}
|
||||
} else
|
||||
{
|
||||
layer[0] = (byte)Material.BEDROCK.getId();
|
||||
Arrays.fill(layer, 1, 65, (byte)Material.STONE.getId());
|
||||
}
|
||||
|
||||
for (int xz = 0; xz < 256; xz++)
|
||||
{
|
||||
arraycopy(layer, 0, chunk, xz * 128, layer.length);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] generate(World world, Random random, int cx, int cz)
|
||||
{
|
||||
return chunk.clone(); // Can't get more efficient than that...
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlockPopulator> getDefaultPopulators(World world)
|
||||
{
|
||||
// This is the default, but just in case default populators change to stock minecraft populators by default...
|
||||
return new ArrayList<BlockPopulator>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getFixedSpawnLocation(World world, Random random)
|
||||
{
|
||||
if (!world.isChunkLoaded(0, 0))
|
||||
{
|
||||
world.loadChunk(0, 0);
|
||||
}
|
||||
|
||||
if ((world.getHighestBlockYAt(0, 0) <= 0) && (world.getBlockAt(0, 0, 0).getType() == Material.AIR)) // SPACE!
|
||||
{
|
||||
return new Location(world, 0, 64, 0); // Lets allow people to drop a little before hitting the void then shall we?
|
||||
}
|
||||
|
||||
return new Location(world, 0, world.getHighestBlockYAt(0, 0), 0);
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
import java.util.Random;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -26,7 +25,7 @@ public class Command_cake extends TFM_Command
|
||||
output.append("§").append(color_code).append(word).append(" ");
|
||||
}
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
ItemStack heldItem = new ItemStack(Material.CAKE, 1);
|
||||
p.getInventory().setItem(p.getInventory().firstEmpty(), heldItem);
|
||||
|
@ -19,7 +19,7 @@ public class Command_cmdlist extends TFM_Command
|
||||
{
|
||||
List<String> commands = new ArrayList<String>();
|
||||
|
||||
for (Plugin p : plugin.getServer().getPluginManager().getPlugins())
|
||||
for (Plugin p : server.getPluginManager().getPlugins())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
@ -18,7 +17,7 @@ public class Command_deopall extends TFM_Command
|
||||
{
|
||||
TFM_Util.bcastMsg(String.format("(%s: De-opping all players on server)", sender.getName()), ChatColor.YELLOW);
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
p.setOp(false);
|
||||
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||
@ -30,7 +29,7 @@ public class Command_deopall extends TFM_Command
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Purging ops.txt.");
|
||||
|
||||
for (OfflinePlayer p : Bukkit.getOperators())
|
||||
for (OfflinePlayer p : server.getOperators())
|
||||
{
|
||||
p.setOp(false);
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
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;
|
||||
|
||||
public class Command_fluidspread extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
TotalFreedomMod.allowFliudSpread = true;
|
||||
sender.sendMessage("Lava and water spread is now enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
TotalFreedomMod.allowFliudSpread = false;
|
||||
sender.sendMessage("Lava and water spread is now disabled.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -33,6 +33,20 @@ public class Command_fr extends TFM_Command
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args[0].toLowerCase().equals("reset"))
|
||||
{
|
||||
TotalFreedomMod.allPlayersFrozen = false;
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||
playerdata.setFrozen(false);
|
||||
}
|
||||
|
||||
TFM_Util.bcastMsg("All global and player freezes have been lifted.", ChatColor.AQUA);
|
||||
}
|
||||
else
|
||||
{
|
||||
Player p;
|
||||
try
|
||||
@ -52,6 +66,7 @@ public class Command_fr extends TFM_Command
|
||||
p.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
|
@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -28,7 +27,7 @@ public class Command_gadmin extends TFM_Command
|
||||
sender.sendMessage(ChatColor.GRAY + "[ Real Name ] : [ Display Name ] - Hash:");
|
||||
}
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
String hash = p.getUniqueId().toString().substring(0, 4);
|
||||
if (mode.equals("list"))
|
||||
@ -46,7 +45,7 @@ public class Command_gadmin extends TFM_Command
|
||||
}
|
||||
else if (mode.equals("nameban"))
|
||||
{
|
||||
Bukkit.getOfflinePlayer(p.getName()).setBanned(true);
|
||||
server.getOfflinePlayer(p.getName()).setBanned(true);
|
||||
TFM_Util.bcastMsg(String.format("Banning Name: %s.", p.getName()), ChatColor.RED);
|
||||
p.kickPlayer("Username banned by Administrator.");
|
||||
}
|
||||
@ -59,7 +58,7 @@ public class Command_gadmin extends TFM_Command
|
||||
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
|
||||
}
|
||||
TFM_Util.bcastMsg(String.format("Banning IP: %s.", p.getName(), user_ip), ChatColor.RED);
|
||||
Bukkit.banIP(user_ip);
|
||||
server.banIP(user_ip);
|
||||
p.kickPlayer("IP address banned by Administrator.");
|
||||
}
|
||||
else if (mode.equals("ban"))
|
||||
@ -71,8 +70,8 @@ public class Command_gadmin extends TFM_Command
|
||||
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
|
||||
}
|
||||
TFM_Util.bcastMsg(String.format("Banning Name: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED);
|
||||
Bukkit.banIP(user_ip);
|
||||
Bukkit.getOfflinePlayer(p.getName()).setBanned(true);
|
||||
server.banIP(user_ip);
|
||||
server.getOfflinePlayer(p.getName()).setBanned(true);
|
||||
p.kickPlayer("IP and username banned by Administrator.");
|
||||
}
|
||||
else if (mode.equals("op"))
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -50,7 +49,7 @@ public class Command_gcmd extends TFM_Command
|
||||
try
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Sending command as " + p.getName() + ": " + outcommand);
|
||||
if (Bukkit.getServer().dispatchCommand(p, outcommand))
|
||||
if (server.dispatchCommand(p, outcommand))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Command sent.");
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -36,7 +35,13 @@ public class Command_gtfo extends TFM_Command
|
||||
TFM_Util.bcastMsg(p.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
|
||||
|
||||
//Undo WorldEdits:
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("/undo %d %s", 15, p.getName()));
|
||||
if (senderIsConsole)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
server.dispatchCommand(sender, String.format("/undo %d %s", 15, p.getName()));
|
||||
}
|
||||
|
||||
//Deop
|
||||
p.setOp(false);
|
||||
@ -66,10 +71,10 @@ public class Command_gtfo extends TFM_Command
|
||||
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
|
||||
}
|
||||
TFM_Util.bcastMsg(String.format("Banning: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED);
|
||||
Bukkit.banIP(user_ip);
|
||||
server.banIP(user_ip);
|
||||
|
||||
//Ban Username:
|
||||
Bukkit.getOfflinePlayer(p.getName()).setBanned(true);
|
||||
server.getOfflinePlayer(p.getName()).setBanned(true);
|
||||
|
||||
//Kick Player:
|
||||
p.kickPlayer("GTFO");
|
||||
|
@ -19,7 +19,7 @@ public class Command_kicknoob extends TFM_Command
|
||||
|
||||
sender.sendMessage("Disconnecting all non-superadmins.");
|
||||
|
||||
for (Player p : plugin.getServer().getOnlinePlayers())
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (!TFM_Util.isUserSuperadmin(p, plugin))
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -16,11 +15,11 @@ public class Command_list extends TFM_Command
|
||||
|
||||
if (senderIsConsole)
|
||||
{
|
||||
onlineStats.append(String.format("There are %d out of a maximum %d players online.", Bukkit.getOnlinePlayers().length, Bukkit.getMaxPlayers()));
|
||||
onlineStats.append(String.format("There are %d out of a maximum %d players online.", server.getOnlinePlayers().length, server.getMaxPlayers()));
|
||||
|
||||
onlineUsers.append("Connected players: ");
|
||||
boolean first = true;
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
@ -50,13 +49,13 @@ public class Command_list extends TFM_Command
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(Bukkit.getOnlinePlayers().length);
|
||||
onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(Bukkit.getMaxPlayers());
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length);
|
||||
onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers());
|
||||
onlineStats.append(ChatColor.BLUE).append(" players online.");
|
||||
|
||||
onlineUsers.append("Connected players: ");
|
||||
boolean first = true;
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
@ -18,7 +17,7 @@ public class Command_mp extends TFM_Command
|
||||
sender.sendMessage(ChatColor.GRAY + "Purging all mobs...");
|
||||
|
||||
int removed = 0;
|
||||
for (World world : Bukkit.getWorlds())
|
||||
for (World world : server.getWorlds())
|
||||
{
|
||||
for (Entity ent : world.getLivingEntities())
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
@ -34,7 +33,7 @@ public class Command_opall extends TFM_Command
|
||||
}
|
||||
}
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
p.setOp(true);
|
||||
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -21,7 +20,7 @@ public class Command_qdeop extends TFM_Command
|
||||
if (sender.isOp() || senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
boolean matched_player = false;
|
||||
for (Player p : Bukkit.matchPlayer(args[0]))
|
||||
for (Player p : server.matchPlayer(args[0]))
|
||||
{
|
||||
matched_player = true;
|
||||
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -21,7 +20,7 @@ public class Command_qop extends TFM_Command
|
||||
if (sender.isOp() || senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
boolean matched_player = false;
|
||||
for (Player p : Bukkit.matchPlayer(args[0]))
|
||||
for (Player p : server.matchPlayer(args[0]))
|
||||
{
|
||||
matched_player = true;
|
||||
|
||||
|
@ -5,6 +5,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@ -18,6 +19,15 @@ public class Command_saconfig extends TFM_Command
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (args[0].equals("list"))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GOLD + "Superadmins: " + TFM_Util.implodeStringList(", ", TotalFreedomMod.superadmins));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!senderIsConsole || sender.getName().equalsIgnoreCase("remotebukkit"))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -11,7 +10,7 @@ public class Command_status extends TFM_Command
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Server is currently running with 'online-mode=" + (Bukkit.getOnlineMode() ? "true" : "false") + "'.");
|
||||
sender.sendMessage(ChatColor.GRAY + "Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -17,12 +16,12 @@ public class Command_stop extends TFM_Command
|
||||
{
|
||||
TFM_Util.bcastMsg("Server is going offline.", ChatColor.GRAY);
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
p.kickPlayer("Server is going offline, come back in a few minutes.");
|
||||
}
|
||||
|
||||
Bukkit.shutdown();
|
||||
server.shutdown();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_RunSystemCommand;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -35,7 +34,7 @@ public class Command_terminal extends TFM_Command
|
||||
}
|
||||
|
||||
sender.sendMessage("Running system command: " + command);
|
||||
Bukkit.getScheduler().scheduleAsyncDelayedTask(plugin, new TFM_RunSystemCommand(command, plugin));
|
||||
server.getScheduler().scheduleAsyncDelayedTask(plugin, new TFM_RunSystemCommand(command, plugin));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
@ -19,7 +18,7 @@ public class Command_tfbanlist extends TFM_Command
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
for (OfflinePlayer p : Bukkit.getBannedPlayers())
|
||||
for (OfflinePlayer p : server.getBannedPlayers())
|
||||
{
|
||||
p.setBanned(false);
|
||||
}
|
||||
@ -38,7 +37,7 @@ public class Command_tfbanlist extends TFM_Command
|
||||
StringBuilder banned_players = new StringBuilder();
|
||||
banned_players.append("Banned Players: ");
|
||||
boolean first = true;
|
||||
for (OfflinePlayer p : Bukkit.getBannedPlayers())
|
||||
for (OfflinePlayer p : server.getBannedPlayers())
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
|
@ -4,7 +4,6 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -21,9 +20,9 @@ public class Command_tfipbanlist extends TFM_Command
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
for (String ip : Bukkit.getIPBans())
|
||||
for (String ip : server.getIPBans())
|
||||
{
|
||||
Bukkit.unbanIP(ip);
|
||||
server.unbanIP(ip);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + "IP Ban list has been purged.");
|
||||
@ -37,7 +36,7 @@ public class Command_tfipbanlist extends TFM_Command
|
||||
}
|
||||
}
|
||||
|
||||
List<String> ip_bans = Arrays.asList(Bukkit.getIPBans().toArray(new String[0]));
|
||||
List<String> ip_bans = Arrays.asList(server.getIPBans().toArray(new String[0]));
|
||||
Collections.sort(ip_bans);
|
||||
|
||||
StringBuilder banned_ips = new StringBuilder();
|
||||
|
@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
import java.util.Arrays;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -23,11 +22,11 @@ public class Command_wildcard extends TFM_Command
|
||||
|
||||
String base_command = TFM_Util.implodeStringList(" ", Arrays.asList(args));
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
String out_command = base_command.replaceAll("\\x3f", p.getName());
|
||||
sender.sendMessage("Running Command: " + out_command);
|
||||
Bukkit.getServer().dispatchCommand(sender, out_command);
|
||||
server.dispatchCommand(sender, out_command);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -0,0 +1,71 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.io.File;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_wipeflatlands extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.bcastMsg("Flatlands is being wiped.", ChatColor.RED);
|
||||
|
||||
server.getScheduler().scheduleAsyncDelayedTask(plugin, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
World flatlands = server.getWorld("flatlands");
|
||||
|
||||
if (flatlands != null)
|
||||
{
|
||||
for (Player p : flatlands.getPlayers())
|
||||
{
|
||||
p.teleport(server.getWorlds().get(0).getSpawnLocation());
|
||||
}
|
||||
|
||||
if (server.unloadWorld(flatlands, false))
|
||||
{
|
||||
File flatlands_folder = new File("./flatlands");
|
||||
|
||||
if (flatlands_folder.exists())
|
||||
{
|
||||
TFM_Util.deleteFolder(flatlands_folder);
|
||||
}
|
||||
|
||||
if (flatlands_folder.exists())
|
||||
{
|
||||
sender.sendMessage("Old Flatlands folder could not be deleted.");
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_Util.generateFlatlands();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Flatlands could not be unloaded.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Flatlands is not loaded.");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -3,8 +3,8 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
|
||||
public class TFM_Command
|
||||
{
|
||||
protected TotalFreedomMod plugin;
|
||||
protected Server server;
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
public TFM_Command()
|
||||
@ -28,11 +29,12 @@ public class TFM_Command
|
||||
public void setPlugin(TotalFreedomMod plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.server = plugin.getServer();
|
||||
}
|
||||
|
||||
public Player getPlayer(String partialname) throws CantFindPlayerException
|
||||
{
|
||||
List<Player> matches = Bukkit.matchPlayer(partialname);
|
||||
List<Player> matches = server.matchPlayer(partialname);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
throw new CantFindPlayerException(partialname);
|
||||
|
@ -7,6 +7,7 @@ import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -16,12 +17,14 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class TFM_BlockListener implements Listener
|
||||
{
|
||||
private TotalFreedomMod plugin;
|
||||
private final TotalFreedomMod plugin;
|
||||
private final Server server;
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
public TFM_BlockListener(TotalFreedomMod instance)
|
||||
{
|
||||
this.plugin = instance;
|
||||
this.server = plugin.getServer();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@ -223,4 +226,13 @@ public class TFM_BlockListener implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onBlockFromTo(BlockFromToEvent event)
|
||||
{
|
||||
if (!TotalFreedomMod.allowFliudSpread)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -9,11 +10,13 @@ import org.bukkit.event.entity.*;
|
||||
|
||||
public class TFM_EntityListener implements Listener
|
||||
{
|
||||
private TotalFreedomMod plugin;
|
||||
private final TotalFreedomMod plugin;
|
||||
private final Server server;
|
||||
|
||||
public TFM_EntityListener(TotalFreedomMod instance)
|
||||
{
|
||||
this.plugin = instance;
|
||||
this.server = plugin.getServer();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@ -126,4 +129,13 @@ public class TFM_EntityListener implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onEntityDeath(EntityDeathEvent event)
|
||||
{
|
||||
if (TotalFreedomMod.autoEntityWipe)
|
||||
{
|
||||
event.setDroppedExp(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,11 +9,11 @@ import me.StevenLawson.TotalFreedomMod.TFM_LandmineData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
@ -26,12 +26,14 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class TFM_PlayerListener implements Listener
|
||||
{
|
||||
private TotalFreedomMod plugin;
|
||||
private final TotalFreedomMod plugin;
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
private final Server server;
|
||||
|
||||
public TFM_PlayerListener(TotalFreedomMod instance)
|
||||
{
|
||||
this.plugin = instance;
|
||||
this.server = plugin.getServer();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@ -268,7 +270,7 @@ public class TFM_PlayerListener implements Listener
|
||||
|
||||
if (Pattern.compile("^mad(?:geek)?(?:1450)?[\\?\\.\\!]?$").matcher(event.getMessage().toLowerCase()).find())
|
||||
{
|
||||
List<Player> matches = Bukkit.matchPlayer("Madgeek1450");
|
||||
List<Player> matches = server.matchPlayer("Madgeek1450");
|
||||
if (!matches.isEmpty())
|
||||
{
|
||||
//TFM_Util.bcastMsg("<" + matches.get(0).getDisplayName() + "> Bitch says Madgeek...");
|
||||
@ -417,7 +419,7 @@ public class TFM_PlayerListener implements Listener
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!Bukkit.getOnlineMode())
|
||||
if (!server.getOnlineMode())
|
||||
{
|
||||
Player p = event.getPlayer();
|
||||
if (TotalFreedomMod.superadmins.contains(p.getName().toLowerCase()))
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -8,11 +9,13 @@ import org.bukkit.event.weather.*;
|
||||
|
||||
public class TFM_WeatherListener implements Listener
|
||||
{
|
||||
private TotalFreedomMod plugin;
|
||||
private final TotalFreedomMod plugin;
|
||||
private final Server server;
|
||||
|
||||
public TFM_WeatherListener(TotalFreedomMod instance)
|
||||
{
|
||||
this.plugin = instance;
|
||||
this.server = plugin.getServer();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
|
@ -1,22 +1,24 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TFM_Heartbeat implements Runnable
|
||||
{
|
||||
private TotalFreedomMod plugin;
|
||||
private final TotalFreedomMod plugin;
|
||||
private final Server server;
|
||||
|
||||
public TFM_Heartbeat(TotalFreedomMod instance)
|
||||
{
|
||||
this.plugin = instance;
|
||||
this.server = plugin.getServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||
playerdata.resetMsgCount();
|
||||
@ -33,7 +35,7 @@ public class TFM_Heartbeat implements Runnable
|
||||
{
|
||||
try
|
||||
{
|
||||
for (World world : Bukkit.getWorlds())
|
||||
for (World world : server.getWorlds())
|
||||
{
|
||||
if (world.getTime() > 12000L)
|
||||
{
|
||||
@ -48,7 +50,7 @@ public class TFM_Heartbeat implements Runnable
|
||||
|
||||
if (TotalFreedomMod.disableWeather)
|
||||
{
|
||||
for (World world : Bukkit.getWorlds())
|
||||
for (World world : server.getWorlds())
|
||||
{
|
||||
if (world.getWeatherDuration() > 0)
|
||||
{
|
||||
|
@ -5,17 +5,20 @@ import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Server;
|
||||
|
||||
public class TFM_RunSystemCommand implements Runnable
|
||||
{
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
private String command;
|
||||
private TotalFreedomMod plugin;
|
||||
private final String command;
|
||||
private final TotalFreedomMod plugin;
|
||||
private final Server server;
|
||||
|
||||
public TFM_RunSystemCommand(String command, TotalFreedomMod plugin)
|
||||
{
|
||||
this.command = command;
|
||||
this.plugin = plugin;
|
||||
this.server = plugin.getServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -271,7 +271,7 @@ public class TFM_UserInfo
|
||||
public void startArrowShooter(TotalFreedomMod plugin)
|
||||
{
|
||||
this.stopArrowShooter();
|
||||
this.mp44_schedule_id = Bukkit.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;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,8 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -608,4 +610,19 @@ public class TFM_Util
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void generateFlatlands()
|
||||
{
|
||||
generateFlatlands(TotalFreedomMod.flatlandsGenerationParams);
|
||||
}
|
||||
|
||||
public static void generateFlatlands(String genParams)
|
||||
{
|
||||
WorldCreator flatlands = new WorldCreator("flatlands");
|
||||
flatlands.generateStructures(false);
|
||||
flatlands.type(WorldType.NORMAL);
|
||||
flatlands.environment(World.Environment.NORMAL);
|
||||
flatlands.generator(new CleanroomChunkGenerator(genParams));
|
||||
Bukkit.getServer().createWorld(flatlands);
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import me.StevenLawson.TotalFreedomMod.Commands.TFM_Command;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -23,6 +24,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
public class TotalFreedomMod extends JavaPlugin
|
||||
{
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
private final Server server = Bukkit.getServer();
|
||||
|
||||
public static final long HEARTBEAT_RATE = 5L; //Seconds
|
||||
public static final String CONFIG_FILE = "config.yml";
|
||||
@ -46,17 +48,22 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
|
||||
registerEventHandlers();
|
||||
|
||||
Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
||||
server.getScheduler().scheduleAsyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
||||
|
||||
log.log(Level.INFO, "[" + getDescription().getName() + "] - Enabled! - Version: " + getDescription().getVersion() + " by Madgeek1450");
|
||||
|
||||
TFM_Util.deleteFolder(new File("./_deleteme"));
|
||||
|
||||
if (generateFlatlands)
|
||||
{
|
||||
TFM_Util.generateFlatlands(flatlandsGenerationParams);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
Bukkit.getScheduler().cancelTasks(this);
|
||||
server.getScheduler().cancelTasks(this);
|
||||
log.log(Level.INFO, "[" + getDescription().getName() + "] - Disabled.");
|
||||
}
|
||||
|
||||
@ -144,6 +151,9 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
public static boolean mobLimiterDisableSlime = true;
|
||||
public static boolean mobLimiterDisableGiant = true;
|
||||
public static boolean tossmobEnabled = false;
|
||||
public static boolean generateFlatlands = true;
|
||||
public static String flatlandsGenerationParams = "16,stone,32,dirt,1,grass";
|
||||
public static boolean allowFliudSpread = false;
|
||||
|
||||
public void loadMainConfig()
|
||||
{
|
||||
@ -174,7 +184,10 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
mobLimiterDisableGhast = config.getBoolean("mob_limiter_disable_ghast", mobLimiterDisableGhast);
|
||||
mobLimiterDisableSlime = config.getBoolean("mob_limiter_disable_slime", mobLimiterDisableSlime);
|
||||
mobLimiterDisableGiant = config.getBoolean("mob_limiter_disable_giant", mobLimiterDisableGiant);
|
||||
tossmobEnabled = config.getBoolean("mp44_enabled", tossmobEnabled);
|
||||
tossmobEnabled = config.getBoolean("tossmob_enabled", tossmobEnabled);
|
||||
generateFlatlands = config.getBoolean("generate_flatlands", generateFlatlands);
|
||||
flatlandsGenerationParams = config.getString("flatlands_generation_params", flatlandsGenerationParams);
|
||||
allowFliudSpread = config.getBoolean("allow_fluid_spread", allowFliudSpread);
|
||||
}
|
||||
|
||||
public static List<String> superadmins = new ArrayList<String>();
|
||||
@ -211,32 +224,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
|
||||
private void registerEventHandlers()
|
||||
{
|
||||
PluginManager pm = this.getServer().getPluginManager();
|
||||
|
||||
/*
|
||||
pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_COMBUST, entityListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.EXPLOSION_PRIME, entityListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Event.Priority.Normal, this);
|
||||
|
||||
pm.registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_BURN, blockListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Event.Priority.Normal, this);
|
||||
|
||||
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Event.Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Event.Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, playerListener, Event.Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_KICK, playerListener, Event.Priority.Monitor, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Event.Priority.Monitor, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Event.Priority.Monitor, this);
|
||||
|
||||
pm.registerEvent(Event.Type.WEATHER_CHANGE, weatherListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.THUNDER_CHANGE, weatherListener, Event.Priority.High, this);
|
||||
*/
|
||||
PluginManager pm = server.getPluginManager();
|
||||
|
||||
pm.registerEvents(entityListener, this);
|
||||
pm.registerEvents(blockListener, this);
|
||||
|
@ -43,11 +43,14 @@ commands:
|
||||
flatlands:
|
||||
description: Goto the flatlands.
|
||||
usage: /<command>
|
||||
fluidspread:
|
||||
description: Superadmin command - Enable/disable fluid spread.
|
||||
usage: /<command> <on | off>
|
||||
fr:
|
||||
description: Superadmin command - Freeze all players (toggles on and off).
|
||||
usage: /<command>
|
||||
description: Superadmin command - Freeze players (toggles on and off).
|
||||
usage: /<command> [target | reset]
|
||||
fuckoff:
|
||||
description: Lawl
|
||||
description: You'll never even see it coming.
|
||||
usage: /<command>
|
||||
gadmin:
|
||||
description: Superadmin command - Use admin commands on someone by hash. Use mode 'list' to get a player's hash. Other modes are kick, nameban, ipban, ban, op, deop, ci
|
||||
@ -70,9 +73,9 @@ commands:
|
||||
lavaplace:
|
||||
description: Superadmin command - Enable/disable lava placement.
|
||||
usage: /<command> <on | off>
|
||||
levelup:
|
||||
description: Level up!
|
||||
usage: /<command>
|
||||
# levelup:
|
||||
# description: Level up!
|
||||
# usage: /<command>
|
||||
list:
|
||||
description: Lists the real names of all online players.
|
||||
usage: /<command>
|
||||
@ -120,7 +123,7 @@ commands:
|
||||
usage: /<command>
|
||||
saconfig:
|
||||
description: Owner command - Manage superadmins.
|
||||
usage: /<command> <add|delete> <username>
|
||||
usage: /<command> <list | <add|delete> <username>>
|
||||
say:
|
||||
description: Broadcasts the given message as the console, includes sender name.
|
||||
usage: /<command> <message>
|
||||
@ -157,6 +160,9 @@ commands:
|
||||
wildcard:
|
||||
description: Superadmin command - Run any command on all users, username placeholder = ?.
|
||||
usage: /<command> [fluff] ? [fluff] ?
|
||||
# wipeflatlands:
|
||||
# description: Console Command - Wipe the flatlands map.
|
||||
# usage: /<command>
|
||||
ziptool:
|
||||
description: Owner command - Zip and unzip files.
|
||||
usage: /<command> <zip <directory>> | <unzip <file>>
|
||||
|
Loading…
Reference in New Issue
Block a user