mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Release update.
This commit is contained in:
parent
bb3c08b9c5
commit
e621290fae
@ -35,6 +35,10 @@ disable_weather: true
|
||||
landmines_enabled: false
|
||||
mp44_enabled: false
|
||||
|
||||
# Moblimiter:
|
||||
mob_limiter_enabled: true
|
||||
mob_limiter_max: 50
|
||||
|
||||
# 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
|
||||
|
@ -0,0 +1,62 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.ExperienceOrb;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_addexp extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!sender.isOp())
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int exp_amount;
|
||||
|
||||
try
|
||||
{
|
||||
exp_amount = Integer.parseInt(args[0]);
|
||||
|
||||
if (exp_amount < 0)
|
||||
{
|
||||
sender.sendMessage(ChatColor.AQUA + "Invalid exp amount (MUST BE POSITIVE).");
|
||||
return true;
|
||||
}
|
||||
else if (exp_amount > 2000)
|
||||
{
|
||||
sender.sendMessage(ChatColor.AQUA + "Invalid exp amount (MAX = 2000).");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
sender.sendMessage(ChatColor.AQUA + "Invalid exp amount.");
|
||||
return true;
|
||||
}
|
||||
|
||||
ExperienceOrb exp_orb = sender_p.getWorld().spawn(sender_p.getLocation(), ExperienceOrb.class);
|
||||
exp_orb.setExperience(exp_amount);
|
||||
|
||||
sender.sendMessage(ChatColor.AQUA + String.valueOf(exp_amount) + " exp added.");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.*;
|
||||
@ -23,7 +24,7 @@ public class TFM_EntityListener extends EntityListener
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
event.setYield(0.0f);
|
||||
}
|
||||
|
||||
@ -69,11 +70,26 @@ public class TFM_EntityListener extends EntityListener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (event.getCause() == DamageCause.LAVA && !TotalFreedomMod.allowLavaDamage)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event)
|
||||
{
|
||||
if (TotalFreedomMod.mobLimiterEnabled)
|
||||
{
|
||||
if (TotalFreedomMod.mobLimiterMax > 0)
|
||||
{
|
||||
if (TFM_Util.getMobAmount(event.getEntity().getWorld()) > TotalFreedomMod.mobLimiterMax)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -580,4 +580,18 @@ public class TFM_Util
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int getMobAmount(World world)
|
||||
{
|
||||
List<LivingEntity> mobs = world.getLivingEntities();
|
||||
for (int j = 0; j < mobs.size(); j++)
|
||||
{
|
||||
if (!Creature.class.isInstance(mobs.get(j)))
|
||||
{
|
||||
mobs.remove(j);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
return mobs.size();
|
||||
}
|
||||
}
|
||||
|
@ -135,6 +135,8 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
public static Boolean disableWeather = true;
|
||||
public static boolean landminesEnabled = false;
|
||||
public static boolean mp44Enabled = false;
|
||||
public static boolean mobLimiterEnabled = true;
|
||||
public static int mobLimiterMax = 50;
|
||||
|
||||
public void loadMainConfig()
|
||||
{
|
||||
@ -159,6 +161,8 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
disableWeather = config.getBoolean("disable_weather", disableWeather);
|
||||
landminesEnabled = config.getBoolean("landmines_enabled", landminesEnabled);
|
||||
mp44Enabled = config.getBoolean("mp44_enabled", mp44Enabled);
|
||||
mobLimiterEnabled = config.getBoolean("mob_limiter_enabled", mobLimiterEnabled);
|
||||
mobLimiterMax = config.getInt("mob_limiter_max", mobLimiterMax);
|
||||
}
|
||||
|
||||
public static List<String> superadmins = new ArrayList<String>();
|
||||
@ -201,6 +205,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
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);
|
||||
|
@ -4,6 +4,9 @@ version: 2.2
|
||||
description: Plugin for the Total Freedom server.
|
||||
author: StevenLawson / Madgeek1450
|
||||
commands:
|
||||
addexp:
|
||||
description: Add levels to your survival level.
|
||||
usage: /<command> [level]
|
||||
cage:
|
||||
description: Superadmin command - Place a cage around someone.
|
||||
usage: /<command> <partialname> [off | outermaterial] [water | lava]
|
||||
|
Loading…
Reference in New Issue
Block a user