mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-29 04:57:37 +00:00
Add Pet Protection.
Cleaned up config file a bit.
This commit is contained in:
parent
3dc51715c5
commit
4903f009b3
@ -50,26 +50,24 @@ explosiveRadius: 4.0
|
||||
#
|
||||
blocked_commands:
|
||||
# Disabled commands
|
||||
- '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:/gamemode:Use /creative and /survival to set your gamemode.'
|
||||
- 'n:b:/ban:_'
|
||||
- 'n:b:/pardon:_'
|
||||
- 'n:b:/toggledownfall:_'
|
||||
- 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:/gamemode:Use /creative and /survival to set your gamemode.
|
||||
- n:b:/ban:_
|
||||
- n:b:/pardon:_
|
||||
- n:b:/toggledownfall:_
|
||||
|
||||
# Superadmin commands
|
||||
- 's:b:/kick:_'
|
||||
- 's:b:/socialspy:_'
|
||||
- 's:b:/kill:_'
|
||||
- 's:a:/stop'
|
||||
- 's:a:/reload'
|
||||
- 's:a:/nuke'
|
||||
- 's:a:/save-all'
|
||||
- 's:a:/save-on'
|
||||
- 's:a:/save-off'
|
||||
- 's:a:/clearhistory'
|
||||
- 's:a:/butcher'
|
||||
- 's:a://butcher'
|
||||
- s:b:/kick:_
|
||||
- s:b:/socialspy:_
|
||||
- s:b:/kill:_
|
||||
- s:b:/clearhistory:_
|
||||
- s:a:/stop
|
||||
- s:a:/reload
|
||||
- s:a:/nuke
|
||||
- s:a:/save-all
|
||||
- s:a:/save-on
|
||||
- s:a:/save-off
|
||||
|
||||
# Automatically wipe dropped objects:
|
||||
auto_wipe: true
|
||||
@ -125,5 +123,8 @@ host_sender_names:
|
||||
|
||||
# TwitterBot - Used to allow superadmins to verify themselves using twitter
|
||||
twitterbot_enabled: false
|
||||
twitterbot_url: 'http://tftwitter.darthcraft.net/'
|
||||
twitterbot_secret: ''
|
||||
twitterbot_url:
|
||||
twitterbot_secret:
|
||||
|
||||
# Pet Protect - Prevent tamed pets from being killed.
|
||||
pet_protect_enabled: true
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -50,6 +50,19 @@ public class TFM_EntityListener implements Listener
|
||||
case LAVA:
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -90,7 +90,6 @@ public class TFM_PlayerListener implements Listener
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
@ -13,8 +12,6 @@ import java.util.jar.JarFile;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
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.exception.ExceptionUtils;
|
||||
import org.bukkit.*;
|
||||
@ -305,8 +302,6 @@ public class TFM_Util
|
||||
return TFM_Util.mobtypes.get(mobname);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void copy(InputStream in, OutputStream out) throws IOException
|
||||
{
|
||||
byte[] buffer = new byte[1024];
|
||||
|
@ -158,8 +158,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
try
|
||||
{
|
||||
ClassLoader classLoader = TotalFreedomMod.class.getClassLoader();
|
||||
dispatcher = (TFM_Command) classLoader.loadClass(String.format("%s.%s%s", COMMAND_PATH, COMMAND_PREFIX,
|
||||
cmd.getName().toLowerCase())).newInstance();
|
||||
dispatcher = (TFM_Command) classLoader.loadClass(String.format("%s.%s%s", COMMAND_PATH, COMMAND_PREFIX, cmd.getName().toLowerCase())).newInstance();
|
||||
dispatcher.setup(this, sender, dispatcher.getClass());
|
||||
}
|
||||
catch (Throwable ex)
|
||||
@ -232,8 +231,9 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
public static double autoProtectRadius = 25.0D;
|
||||
public static List<String> host_sender_names = Arrays.asList("rcon", "remotebukkit");
|
||||
public static boolean twitterbotEnabled = false;
|
||||
public static String twitterbotUrl = "http://tftwitter.darthcraft.net/";
|
||||
public static String twitterbotUrl = "";
|
||||
public static String twitterbotSecret = "";
|
||||
public static boolean petProtectEnabled = true;
|
||||
|
||||
public static void loadMainConfig()
|
||||
{
|
||||
@ -280,6 +280,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
twitterbotEnabled = config.getBoolean("twitterbot_enabled", twitterbotEnabled);
|
||||
twitterbotUrl = config.getString("twitterbot_url", twitterbotUrl);
|
||||
twitterbotSecret = config.getString("twitterbot_secret", twitterbotSecret);
|
||||
petProtectEnabled = config.getBoolean("pet_protect_enabled", petProtectEnabled);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user