mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Updates for v1.2 compatibility.
This commit is contained in:
parent
d60963cc7c
commit
6e2cbc8e9f
@ -38,12 +38,9 @@ tossmob_enabled: false
|
|||||||
|
|
||||||
# Moblimiter:
|
# Moblimiter:
|
||||||
mob_limiter_enabled: true
|
mob_limiter_enabled: true
|
||||||
|
# Max per world:
|
||||||
mob_limiter_max: 50
|
mob_limiter_max: 50
|
||||||
mob_limiter_disable_dragon: true
|
mob_limiter_disable_dragon: true
|
||||||
mob_limiter_disable_ghast: true
|
mob_limiter_disable_ghast: true
|
||||||
mob_limiter_disable_slime: true
|
mob_limiter_disable_slime: true
|
||||||
mob_limiter_disable_giant: true
|
mob_limiter_disable_giant: true
|
||||||
|
|
||||||
# Superadmins: Users that can always log in and use the most powerful commands:
|
|
||||||
# When online-mode = false, only superadmin_ips will be used.
|
|
||||||
# The superadmin lists have been moved to superadmin.yml
|
|
||||||
|
@ -23,6 +23,8 @@ public class Command_setexp extends TFM_Command
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -52,6 +54,11 @@ public class Command_setexp extends TFM_Command
|
|||||||
sender_p.setExperience(exp_amount);
|
sender_p.setExperience(exp_amount);
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.AQUA + "Experience points set to: " + sender_p.getExperience());
|
sender.sendMessage(ChatColor.AQUA + "Experience points set to: " + sender_p.getExperience());
|
||||||
|
*/
|
||||||
|
|
||||||
|
sender_p.setExp(1.0f);
|
||||||
|
|
||||||
|
sender.sendMessage(ChatColor.AQUA + "Level up!");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
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;
|
||||||
@ -10,7 +8,7 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.CreatureType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -33,7 +31,7 @@ public class Command_tossmob extends TFM_Command
|
|||||||
{
|
{
|
||||||
TFM_UserInfo playerData = TFM_UserInfo.getPlayerData(sender_p);
|
TFM_UserInfo playerData = TFM_UserInfo.getPlayerData(sender_p);
|
||||||
|
|
||||||
CreatureType creature = CreatureType.PIG;
|
EntityType creature = EntityType.PIG;
|
||||||
if (args.length >= 1)
|
if (args.length >= 1)
|
||||||
{
|
{
|
||||||
if (TFM_Util.isStopCommand(args[0]))
|
if (TFM_Util.isStopCommand(args[0]))
|
||||||
@ -46,7 +44,7 @@ public class Command_tossmob extends TFM_Command
|
|||||||
if (args[0].equalsIgnoreCase("list"))
|
if (args[0].equalsIgnoreCase("list"))
|
||||||
{
|
{
|
||||||
StringBuilder output = new StringBuilder("Supported mobs: ");
|
StringBuilder output = new StringBuilder("Supported mobs: ");
|
||||||
for (Entry<String, CreatureType> mob : TFM_Util.mobtypes.entrySet())
|
for (Entry<String, EntityType> mob : TFM_Util.mobtypes.entrySet())
|
||||||
{
|
{
|
||||||
output.append(mob.getKey()).append(", ");
|
output.append(mob.getKey()).append(", ");
|
||||||
}
|
}
|
||||||
@ -56,13 +54,13 @@ public class Command_tossmob extends TFM_Command
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
creature = TFM_Util.getCreatureType(args[0]);
|
creature = TFM_Util.getEntityType(args[0]);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.RED + args[0] + " is not a supported mob type. Using a pig instead.");
|
sender.sendMessage(ChatColor.RED + args[0] + " is not a supported mob type. Using a pig instead.");
|
||||||
sender.sendMessage(ChatColor.RED + "By the way, you can type /tossmob list to see all possible mobs.");
|
sender.sendMessage(ChatColor.RED + "By the way, you can type /tossmob list to see all possible mobs.");
|
||||||
creature = CreatureType.PIG;
|
creature = EntityType.PIG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,10 +8,13 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.*;
|
import org.bukkit.event.block.*;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class TFM_BlockListener extends BlockListener
|
public class TFM_BlockListener implements Listener
|
||||||
{
|
{
|
||||||
private TotalFreedomMod plugin;
|
private TotalFreedomMod plugin;
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
@ -21,7 +24,7 @@ public class TFM_BlockListener extends BlockListener
|
|||||||
this.plugin = instance;
|
this.plugin = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onBlockBurn(BlockBurnEvent event)
|
public void onBlockBurn(BlockBurnEvent event)
|
||||||
{
|
{
|
||||||
if (!TotalFreedomMod.allowFireSpread)
|
if (!TotalFreedomMod.allowFireSpread)
|
||||||
@ -31,7 +34,7 @@ public class TFM_BlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onBlockIgnite(BlockIgniteEvent event)
|
public void onBlockIgnite(BlockIgniteEvent event)
|
||||||
{
|
{
|
||||||
if (!TotalFreedomMod.allowFirePlace)
|
if (!TotalFreedomMod.allowFirePlace)
|
||||||
@ -41,7 +44,7 @@ public class TFM_BlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onBlockBreak(BlockBreakEvent event)
|
public void onBlockBreak(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
if (TotalFreedomMod.nukeMonitor)
|
if (TotalFreedomMod.nukeMonitor)
|
||||||
@ -91,7 +94,7 @@ public class TFM_BlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onBlockPlace(BlockPlaceEvent event)
|
public void onBlockPlace(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.*;
|
import org.bukkit.event.entity.*;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
||||||
|
|
||||||
public class TFM_EntityListener extends EntityListener
|
public class TFM_EntityListener implements Listener
|
||||||
{
|
{
|
||||||
private TotalFreedomMod plugin;
|
private TotalFreedomMod plugin;
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ public class TFM_EntityListener extends EntityListener
|
|||||||
this.plugin = instance;
|
this.plugin = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onEntityExplode(EntityExplodeEvent event)
|
public void onEntityExplode(EntityExplodeEvent event)
|
||||||
{
|
{
|
||||||
if (!TotalFreedomMod.allowExplosions)
|
if (!TotalFreedomMod.allowExplosions)
|
||||||
@ -28,7 +28,7 @@ public class TFM_EntityListener extends EntityListener
|
|||||||
event.setYield(0.0f);
|
event.setYield(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onExplosionPrime(ExplosionPrimeEvent event)
|
public void onExplosionPrime(ExplosionPrimeEvent event)
|
||||||
{
|
{
|
||||||
if (!TotalFreedomMod.allowExplosions)
|
if (!TotalFreedomMod.allowExplosions)
|
||||||
@ -40,7 +40,7 @@ public class TFM_EntityListener extends EntityListener
|
|||||||
event.setRadius((float) TotalFreedomMod.explosiveRadius);
|
event.setRadius((float) TotalFreedomMod.explosiveRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onEntityCombust(EntityCombustEvent event)
|
public void onEntityCombust(EntityCombustEvent event)
|
||||||
{
|
{
|
||||||
if (!TotalFreedomMod.allowFireSpread)
|
if (!TotalFreedomMod.allowFireSpread)
|
||||||
@ -50,17 +50,23 @@ public class TFM_EntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onEntityDamage(EntityDamageEvent event)
|
public void onEntityDamage(EntityDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.getCause() == DamageCause.LAVA && !TotalFreedomMod.allowLavaDamage)
|
switch (event.getCause())
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
case LAVA:
|
||||||
return;
|
{
|
||||||
|
if (!TotalFreedomMod.allowLavaDamage)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onCreatureSpawn(CreatureSpawnEvent event)
|
public void onCreatureSpawn(CreatureSpawnEvent event)
|
||||||
{
|
{
|
||||||
if (TotalFreedomMod.mobLimiterEnabled)
|
if (TotalFreedomMod.mobLimiterEnabled)
|
||||||
@ -104,14 +110,11 @@ public class TFM_EntityListener extends EntityListener
|
|||||||
{
|
{
|
||||||
int mobcount = 0;
|
int mobcount = 0;
|
||||||
|
|
||||||
for (World world : Bukkit.getWorlds())
|
for (Entity ent : event.getLocation().getWorld().getLivingEntities())
|
||||||
{
|
{
|
||||||
for (Entity ent : world.getLivingEntities())
|
if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime || ent instanceof EnderDragon)
|
||||||
{
|
{
|
||||||
if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime || ent instanceof EnderDragon)
|
mobcount++;
|
||||||
{
|
|
||||||
mobcount++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -16,11 +17,14 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class TFM_PlayerListener extends PlayerListener
|
public class TFM_PlayerListener implements Listener
|
||||||
{
|
{
|
||||||
private TotalFreedomMod plugin;
|
private TotalFreedomMod plugin;
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
@ -30,7 +34,7 @@ public class TFM_PlayerListener extends PlayerListener
|
|||||||
this.plugin = instance;
|
this.plugin = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event)
|
public void onPlayerInteract(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -106,7 +110,7 @@ public class TFM_PlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerMove(PlayerMoveEvent event)
|
public void onPlayerMove(PlayerMoveEvent event)
|
||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
@ -243,7 +247,7 @@ public class TFM_PlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerChat(PlayerChatEvent event)
|
public void onPlayerChat(PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
@ -261,9 +265,27 @@ public class TFM_PlayerListener extends PlayerListener
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Pattern.compile("^mad(?:geek)?(?:1450)?[\\?\\.\\!]?$").matcher(event.getMessage().toLowerCase()).find())
|
||||||
|
{
|
||||||
|
List<Player> matches = Bukkit.matchPlayer("Madgeek1450");
|
||||||
|
if (!matches.isEmpty())
|
||||||
|
{
|
||||||
|
//TFM_Util.bcastMsg("<" + matches.get(0).getDisplayName() + "> Bitch says Madgeek...");
|
||||||
|
|
||||||
|
p.setGameMode(GameMode.SURVIVAL);
|
||||||
|
p.setFoodLevel(0);
|
||||||
|
p.setHealth(1);
|
||||||
|
|
||||||
|
TNTPrimed tnt1 = p.getWorld().spawn(p.getLocation(), TNTPrimed.class);
|
||||||
|
tnt1.setFuseTicks(40);
|
||||||
|
tnt1.setPassenger(p);
|
||||||
|
tnt1.setVelocity(new Vector(0.0, 2.0, 0.0));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
String command = event.getMessage();
|
String command = event.getMessage();
|
||||||
@ -340,7 +362,7 @@ public class TFM_PlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent event)
|
public void onPlayerDropItem(PlayerDropItemEvent event)
|
||||||
{
|
{
|
||||||
if (TotalFreedomMod.autoEntityWipe)
|
if (TotalFreedomMod.autoEntityWipe)
|
||||||
@ -356,7 +378,7 @@ public class TFM_PlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerKick(PlayerKickEvent event)
|
public void onPlayerKick(PlayerKickEvent event)
|
||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
@ -373,7 +395,7 @@ public class TFM_PlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerQuit(PlayerQuitEvent event)
|
public void onPlayerQuit(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
@ -390,7 +412,7 @@ public class TFM_PlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerJoin(PlayerJoinEvent event)
|
public void onPlayerJoin(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.weather.*;
|
import org.bukkit.event.weather.*;
|
||||||
|
|
||||||
public class TFM_WeatherListener extends WeatherListener
|
public class TFM_WeatherListener implements Listener
|
||||||
{
|
{
|
||||||
private TotalFreedomMod plugin;
|
private TotalFreedomMod plugin;
|
||||||
|
|
||||||
@ -12,7 +15,7 @@ public class TFM_WeatherListener extends WeatherListener
|
|||||||
this.plugin = instance;
|
this.plugin = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onThunderChange(ThunderChangeEvent event)
|
public void onThunderChange(ThunderChangeEvent event)
|
||||||
{
|
{
|
||||||
if (event.toThunderState() && TotalFreedomMod.disableWeather)
|
if (event.toThunderState() && TotalFreedomMod.disableWeather)
|
||||||
@ -22,7 +25,7 @@ public class TFM_WeatherListener extends WeatherListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onWeatherChange(WeatherChangeEvent event)
|
public void onWeatherChange(WeatherChangeEvent event)
|
||||||
{
|
{
|
||||||
if (event.toWeatherState() && TotalFreedomMod.disableWeather)
|
if (event.toWeatherState() && TotalFreedomMod.disableWeather)
|
||||||
|
@ -26,7 +26,7 @@ public class TFM_UserInfo
|
|||||||
private boolean is_orbiting = false;
|
private boolean is_orbiting = false;
|
||||||
private double orbit_strength = 10.0;
|
private double orbit_strength = 10.0;
|
||||||
private boolean mob_thrower_enabled = false;
|
private boolean mob_thrower_enabled = false;
|
||||||
private CreatureType mob_thrower_creature = CreatureType.PIG;
|
private EntityType mob_thrower_creature = EntityType.PIG;
|
||||||
private double mob_thrower_speed = 4.0;
|
private double mob_thrower_speed = 4.0;
|
||||||
private List<LivingEntity> mob_thrower_queue = new ArrayList<LivingEntity>();
|
private List<LivingEntity> mob_thrower_queue = new ArrayList<LivingEntity>();
|
||||||
private int mp44_schedule_id = -1;
|
private int mp44_schedule_id = -1;
|
||||||
@ -228,7 +228,7 @@ public class TFM_UserInfo
|
|||||||
this.freecam_place_count = 0;
|
this.freecam_place_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableMobThrower(CreatureType mob_thrower_creature, double mob_thrower_speed)
|
public void enableMobThrower(EntityType mob_thrower_creature, double mob_thrower_speed)
|
||||||
{
|
{
|
||||||
this.mob_thrower_enabled = true;
|
this.mob_thrower_enabled = true;
|
||||||
this.mob_thrower_creature = mob_thrower_creature;
|
this.mob_thrower_creature = mob_thrower_creature;
|
||||||
@ -240,7 +240,7 @@ public class TFM_UserInfo
|
|||||||
this.mob_thrower_enabled = false;
|
this.mob_thrower_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CreatureType mobThrowerCreature()
|
public EntityType mobThrowerCreature()
|
||||||
{
|
{
|
||||||
return this.mob_thrower_creature;
|
return this.mob_thrower_creature;
|
||||||
}
|
}
|
||||||
|
@ -38,33 +38,32 @@ public class TFM_Util
|
|||||||
{
|
{
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
private static Map<String, Integer> eject_tracker = new HashMap<String, Integer>();
|
private static Map<String, Integer> eject_tracker = new HashMap<String, Integer>();
|
||||||
public static final Map<String, CreatureType> mobtypes = new HashMap<String, CreatureType>();
|
public static final Map<String, EntityType> mobtypes = new HashMap<String, EntityType>();
|
||||||
public static final List<String> stop_commands = new ArrayList<String>();
|
public static final List<String> stop_commands = new ArrayList<String>();
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
mobtypes.put("chicken", CreatureType.CHICKEN);
|
mobtypes.put("chicken", EntityType.CHICKEN);
|
||||||
mobtypes.put("cow", CreatureType.COW);
|
mobtypes.put("cow", EntityType.COW);
|
||||||
mobtypes.put("creeper", CreatureType.CREEPER);
|
mobtypes.put("creeper", EntityType.CREEPER);
|
||||||
mobtypes.put("ghast", CreatureType.GHAST);
|
mobtypes.put("ghast", EntityType.GHAST);
|
||||||
mobtypes.put("giant", CreatureType.GIANT);
|
mobtypes.put("giant", EntityType.GIANT);
|
||||||
mobtypes.put("monster", CreatureType.MONSTER);
|
mobtypes.put("pig", EntityType.PIG);
|
||||||
mobtypes.put("pig", CreatureType.PIG);
|
mobtypes.put("pigzombie", EntityType.PIG_ZOMBIE);
|
||||||
mobtypes.put("pigzombie", CreatureType.PIG_ZOMBIE);
|
mobtypes.put("sheep", EntityType.SHEEP);
|
||||||
mobtypes.put("sheep", CreatureType.SHEEP);
|
mobtypes.put("skeleton", EntityType.SKELETON);
|
||||||
mobtypes.put("skeleton", CreatureType.SKELETON);
|
mobtypes.put("slime", EntityType.SLIME);
|
||||||
mobtypes.put("slime", CreatureType.SLIME);
|
mobtypes.put("spider", EntityType.SPIDER);
|
||||||
mobtypes.put("spider", CreatureType.SPIDER);
|
mobtypes.put("squid", EntityType.SQUID);
|
||||||
mobtypes.put("squid", CreatureType.SQUID);
|
mobtypes.put("zombie", EntityType.ZOMBIE);
|
||||||
mobtypes.put("zombie", CreatureType.ZOMBIE);
|
mobtypes.put("wolf", EntityType.WOLF);
|
||||||
mobtypes.put("wolf", CreatureType.WOLF);
|
mobtypes.put("cavespider", EntityType.CAVE_SPIDER);
|
||||||
mobtypes.put("cavespider", CreatureType.CAVE_SPIDER);
|
mobtypes.put("enderman", EntityType.ENDERMAN);
|
||||||
mobtypes.put("enderman", CreatureType.ENDERMAN);
|
mobtypes.put("silverfish", EntityType.SILVERFISH);
|
||||||
mobtypes.put("silverfish", CreatureType.SILVERFISH);
|
mobtypes.put("enderdragon", EntityType.ENDER_DRAGON);
|
||||||
mobtypes.put("enderdragon", CreatureType.ENDER_DRAGON);
|
mobtypes.put("villager", EntityType.VILLAGER);
|
||||||
mobtypes.put("villager", CreatureType.VILLAGER);
|
mobtypes.put("blaze", EntityType.BLAZE);
|
||||||
mobtypes.put("blaze", CreatureType.BLAZE);
|
mobtypes.put("mushroomcow", EntityType.MUSHROOM_COW);
|
||||||
mobtypes.put("mushroomcow", CreatureType.MUSHROOM_COW);
|
|
||||||
|
|
||||||
stop_commands.add("stop");
|
stop_commands.add("stop");
|
||||||
stop_commands.add("off");
|
stop_commands.add("off");
|
||||||
@ -410,7 +409,7 @@ public class TFM_Util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CreatureType getCreatureType(String mobname) throws Exception
|
public static EntityType getEntityType(String mobname) throws Exception
|
||||||
{
|
{
|
||||||
mobname = mobname.toLowerCase().trim();
|
mobname = mobname.toLowerCase().trim();
|
||||||
|
|
||||||
@ -552,7 +551,7 @@ public class TFM_Util
|
|||||||
{
|
{
|
||||||
player_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
player_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
||||||
|
|
||||||
Integer num_kicks = eject_tracker.get(player_ip);
|
Integer num_kicks = TFM_Util.eject_tracker.get(player_ip);
|
||||||
if (num_kicks == null)
|
if (num_kicks == null)
|
||||||
{
|
{
|
||||||
num_kicks = new Integer(0);
|
num_kicks = new Integer(0);
|
||||||
@ -560,23 +559,27 @@ public class TFM_Util
|
|||||||
|
|
||||||
num_kicks = new Integer(num_kicks.intValue() + 1);
|
num_kicks = new Integer(num_kicks.intValue() + 1);
|
||||||
|
|
||||||
if (num_kicks <= 1)
|
TFM_Util.eject_tracker.put(player_ip, num_kicks);
|
||||||
|
|
||||||
|
if (num_kicks.intValue() <= 1)
|
||||||
{
|
{
|
||||||
method = EjectMethod.STRIKE_ONE;
|
method = EjectMethod.STRIKE_ONE;
|
||||||
}
|
}
|
||||||
else if (num_kicks == 2)
|
else if (num_kicks.intValue() == 2)
|
||||||
{
|
{
|
||||||
method = EjectMethod.STRIKE_TWO;
|
method = EjectMethod.STRIKE_TWO;
|
||||||
}
|
}
|
||||||
else if (num_kicks >= 3)
|
else if (num_kicks.intValue() >= 3)
|
||||||
{
|
{
|
||||||
method = EjectMethod.STRIKE_THREE;
|
method = EjectMethod.STRIKE_THREE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("autoEject -> name: " + p.getName() + " - player_ip: " + player_ip + " - method: " + method.toString());
|
||||||
|
|
||||||
p.setOp(false);
|
p.setOp(false);
|
||||||
p.setGameMode(GameMode.SURVIVAL);
|
p.setGameMode(GameMode.SURVIVAL);
|
||||||
p.getInventory().clear();
|
p.getInventory().clear();
|
||||||
|
@ -17,7 +17,6 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -214,6 +213,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
PluginManager pm = this.getServer().getPluginManager();
|
PluginManager pm = this.getServer().getPluginManager();
|
||||||
|
|
||||||
|
/*
|
||||||
pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Event.Priority.High, this);
|
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_COMBUST, entityListener, Event.Priority.High, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Event.Priority.High, this);
|
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Event.Priority.High, this);
|
||||||
@ -236,5 +236,11 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
pm.registerEvent(Event.Type.WEATHER_CHANGE, weatherListener, Event.Priority.High, this);
|
pm.registerEvent(Event.Type.WEATHER_CHANGE, weatherListener, Event.Priority.High, this);
|
||||||
pm.registerEvent(Event.Type.THUNDER_CHANGE, weatherListener, Event.Priority.High, this);
|
pm.registerEvent(Event.Type.THUNDER_CHANGE, weatherListener, Event.Priority.High, this);
|
||||||
|
*/
|
||||||
|
|
||||||
|
pm.registerEvents(entityListener, this);
|
||||||
|
pm.registerEvents(blockListener, this);
|
||||||
|
pm.registerEvents(playerListener, this);
|
||||||
|
pm.registerEvents(weatherListener, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user