Merge remote-tracking branch 'origin/untested'

This commit is contained in:
Steven Lawson 2013-07-11 18:40:42 -04:00
commit 1fcda4a8fc
6 changed files with 68 additions and 29 deletions

View File

@ -50,26 +50,24 @@ explosiveRadius: 4.0
# #
blocked_commands: blocked_commands:
# Disabled commands # Disabled commands
- 'n:b:/time:Server-side time changing is disabled. Please use /ptime to set your own personal time.' - n:b:/time:Server-side time changing is disabled. Please use /ptime to set your own personal time.
- 'n:b:/md:This server now uses DisguiseCraft instead of MobDisguise. Type /d to disguise and /u to undisguise.' - n:b:/md:This server now uses DisguiseCraft instead of MobDisguise. Type /d to disguise and /u to undisguise.
- 'n:b:/gamemode:Use /creative and /survival to set your gamemode.' - n:b:/gamemode:Use /creative and /survival to set your gamemode.
- 'n:b:/ban:_' - n:b:/ban:_
- 'n:b:/pardon:_' - n:b:/pardon:_
- 'n:b:/toggledownfall:_' - n:b:/toggledownfall:_
# Superadmin commands # Superadmin commands
- 's:b:/kick:_' - s:b:/kick:_
- 's:b:/socialspy:_' - s:b:/socialspy:_
- 's:b:/kill:_' - s:b:/kill:_
- 's:a:/stop' - s:b:/clearhistory:_
- 's:a:/reload' - s:a:/stop
- 's:a:/nuke' - s:a:/reload
- 's:a:/save-all' - s:a:/nuke
- 's:a:/save-on' - s:a:/save-all
- 's:a:/save-off' - s:a:/save-on
- 's:a:/clearhistory' - s:a:/save-off
- 's:a:/butcher'
- 's:a://butcher'
# Automatically wipe dropped objects: # Automatically wipe dropped objects:
auto_wipe: true auto_wipe: true
@ -125,5 +123,8 @@ host_sender_names:
# TwitterBot - Used to allow superadmins to verify themselves using twitter # TwitterBot - Used to allow superadmins to verify themselves using twitter
twitterbot_enabled: false twitterbot_enabled: false
twitterbot_url: 'http://tftwitter.darthcraft.net/' twitterbot_url:
twitterbot_secret: '' twitterbot_secret:
# Pet Protect - Prevent tamed pets from being killed.
pet_protect_enabled: true

View File

@ -0,0 +1,30 @@
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;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "Enable/disable tamed pet protection.", usage = "/<command> <on | off>")
public class Command_petprotect extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
TotalFreedomMod.petProtectEnabled = !TFM_Util.isStopCommand(args[0]);
TFM_Util.adminAction(
sender.getName(),
"Tamed pet protection is now " + (TotalFreedomMod.petProtectEnabled ? "enabled" : "disabled") + ".",
false);
return true;
}
}

View File

@ -50,6 +50,19 @@ public class TFM_EntityListener implements Listener
case LAVA: case LAVA:
{ {
if (!TotalFreedomMod.allowLavaDamage) if (!TotalFreedomMod.allowLavaDamage)
{
event.setCancelled(true);
return;
}
}
}
if (TotalFreedomMod.petProtectEnabled)
{
Entity entity = event.getEntity();
if (entity instanceof Tameable)
{
if (((Tameable) entity).isTamed())
{ {
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -90,7 +90,6 @@ public class TFM_PlayerListener implements Listener
event.setCancelled(true); event.setCancelled(true);
} }
} }
} }
break; break;
} }

View File

@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod;
import java.io.*; import java.io.*;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.URI;
import java.net.URL; import java.net.URL;
import java.nio.channels.Channels; import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel; import java.nio.channels.ReadableByteChannel;
@ -13,8 +12,6 @@ import java.util.jar.JarFile;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.*; import org.bukkit.*;
@ -305,8 +302,6 @@ public class TFM_Util
return TFM_Util.mobtypes.get(mobname); return TFM_Util.mobtypes.get(mobname);
} }
private static void copy(InputStream in, OutputStream out) throws IOException private static void copy(InputStream in, OutputStream out) throws IOException
{ {
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];

View File

@ -158,8 +158,7 @@ public class TotalFreedomMod extends JavaPlugin
try try
{ {
ClassLoader classLoader = TotalFreedomMod.class.getClassLoader(); ClassLoader classLoader = TotalFreedomMod.class.getClassLoader();
dispatcher = (TFM_Command) classLoader.loadClass(String.format("%s.%s%s", COMMAND_PATH, COMMAND_PREFIX, dispatcher = (TFM_Command) classLoader.loadClass(String.format("%s.%s%s", COMMAND_PATH, COMMAND_PREFIX, cmd.getName().toLowerCase())).newInstance();
cmd.getName().toLowerCase())).newInstance();
dispatcher.setup(this, sender, dispatcher.getClass()); dispatcher.setup(this, sender, dispatcher.getClass());
} }
catch (Throwable ex) catch (Throwable ex)
@ -232,8 +231,9 @@ public class TotalFreedomMod extends JavaPlugin
public static double autoProtectRadius = 25.0D; public static double autoProtectRadius = 25.0D;
public static List<String> host_sender_names = Arrays.asList("rcon", "remotebukkit"); public static List<String> host_sender_names = Arrays.asList("rcon", "remotebukkit");
public static boolean twitterbotEnabled = false; public static boolean twitterbotEnabled = false;
public static String twitterbotUrl = "http://tftwitter.darthcraft.net/"; public static String twitterbotUrl = "";
public static String twitterbotSecret = ""; public static String twitterbotSecret = "";
public static boolean petProtectEnabled = true;
public static void loadMainConfig() public static void loadMainConfig()
{ {
@ -280,6 +280,7 @@ public class TotalFreedomMod extends JavaPlugin
twitterbotEnabled = config.getBoolean("twitterbot_enabled", twitterbotEnabled); twitterbotEnabled = config.getBoolean("twitterbot_enabled", twitterbotEnabled);
twitterbotUrl = config.getString("twitterbot_url", twitterbotUrl); twitterbotUrl = config.getString("twitterbot_url", twitterbotUrl);
twitterbotSecret = config.getString("twitterbot_secret", twitterbotSecret); twitterbotSecret = config.getString("twitterbot_secret", twitterbotSecret);
petProtectEnabled = config.getBoolean("pet_protect_enabled", petProtectEnabled);
} }
catch (Exception ex) catch (Exception ex)
{ {