mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Merge branch 'master' of github.com:StevenLawson/TotalFreedomMod
This commit is contained in:
commit
1adfb29409
@ -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;
|
||||
}
|
||||
}
|
@ -20,9 +20,9 @@ public class Command_mp extends TFM_Command
|
||||
int removed = 0;
|
||||
for (World world : Bukkit.getWorlds())
|
||||
{
|
||||
for (Entity ent : world.getEntities())
|
||||
for (Entity ent : world.getLivingEntities())
|
||||
{
|
||||
if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime)
|
||||
if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime || ent instanceof EnderDragon)
|
||||
{
|
||||
ent.remove();
|
||||
removed++;
|
||||
|
@ -1,8 +1,16 @@
|
||||
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.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
@ -23,7 +31,7 @@ public class TFM_EntityListener extends EntityListener
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
event.setYield(0.0f);
|
||||
}
|
||||
|
||||
@ -69,11 +77,46 @@ 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 (event.getEntity() instanceof Ghast || event.getEntity() instanceof Slime || event.getEntity() instanceof EnderDragon)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (TotalFreedomMod.mobLimiterMax > 0)
|
||||
{
|
||||
int mobcount = 0;
|
||||
|
||||
for (World world : Bukkit.getWorlds())
|
||||
{
|
||||
for (Entity ent : world.getLivingEntities())
|
||||
{
|
||||
if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime || ent instanceof EnderDragon)
|
||||
{
|
||||
mobcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mobcount > TotalFreedomMod.mobLimiterMax)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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