mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Fixed explosion radius.
Added /mp - mob purge.
This commit is contained in:
parent
c769f98c8a
commit
bb2e32519b
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod;
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -23,13 +24,16 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
private final TotalFreedomModEntityListener entityListener = new TotalFreedomModEntityListener(this);
|
private final TotalFreedomModEntityListener entityListener = new TotalFreedomModEntityListener(this);
|
||||||
private final TotalFreedomModBlockListener blockListener = new TotalFreedomModBlockListener(this);
|
private final TotalFreedomModBlockListener blockListener = new TotalFreedomModBlockListener(this);
|
||||||
//private final TotalFreedomModPlayerListener playerListener = new TotalFreedomModPlayerListener(this);
|
//private final TotalFreedomModPlayerListener playerListener = new TotalFreedomModPlayerListener(this);
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
protected static Configuration CONFIG;
|
protected static Configuration CONFIG;
|
||||||
private List<String> superadmins = new ArrayList<String>();
|
private List<String> superadmins = new ArrayList<String>();
|
||||||
public Boolean allowExplosions = false;
|
public Boolean allowExplosions = false;
|
||||||
public Boolean allowLavaDamage = false;
|
public Boolean allowLavaDamage = false;
|
||||||
public Boolean allowFire = false;
|
public Boolean allowFire = false;
|
||||||
public double explosiveRadius = 2.0;
|
public double explosiveRadius = 4.0;
|
||||||
|
|
||||||
public final static String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command.";
|
public final static String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command.";
|
||||||
public final static String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
|
public final static String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
|
||||||
public final static String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
|
public final static String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
|
||||||
@ -37,8 +41,8 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
CONFIG = getConfiguration();
|
CONFIG = getConfiguration();
|
||||||
CONFIG.load();
|
File configfile = new File("plugins/TotalFreedomMod/config.yml");
|
||||||
if (CONFIG.getString("superadmins", null) == null) //Generate config file:
|
if (!configfile.exists())
|
||||||
{
|
{
|
||||||
log.log(Level.INFO, "[Total Freedom Mod] - Generating default config file (plugins/TotalFreedomMod/config.yml)...");
|
log.log(Level.INFO, "[Total Freedom Mod] - Generating default config file (plugins/TotalFreedomMod/config.yml)...");
|
||||||
CONFIG.setProperty("superadmins", new String[]
|
CONFIG.setProperty("superadmins", new String[]
|
||||||
@ -48,23 +52,24 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
CONFIG.setProperty("allow_explosions", false);
|
CONFIG.setProperty("allow_explosions", false);
|
||||||
CONFIG.setProperty("allow_lava_damage", false);
|
CONFIG.setProperty("allow_lava_damage", false);
|
||||||
CONFIG.setProperty("allow_fire", false);
|
CONFIG.setProperty("allow_fire", false);
|
||||||
CONFIG.setProperty("explosiveRadius", 2.0);
|
CONFIG.setProperty("explosiveRadius", 4.0);
|
||||||
CONFIG.save();
|
CONFIG.save();
|
||||||
CONFIG.load();
|
|
||||||
}
|
}
|
||||||
|
CONFIG.load();
|
||||||
superadmins = CONFIG.getStringList("superadmins", null);
|
superadmins = CONFIG.getStringList("superadmins", null);
|
||||||
allowExplosions = CONFIG.getBoolean("allow_explosions", false);
|
allowExplosions = CONFIG.getBoolean("allow_explosions", false);
|
||||||
allowLavaDamage = CONFIG.getBoolean("allow_lava_damage", false);
|
allowLavaDamage = CONFIG.getBoolean("allow_lava_damage", false);
|
||||||
allowFire = CONFIG.getBoolean("allow_fire", false);
|
allowFire = CONFIG.getBoolean("allow_fire", false);
|
||||||
explosiveRadius = CONFIG.getDouble("explosiveRadius", 2.0);
|
explosiveRadius = CONFIG.getDouble("explosiveRadius", 4.0);
|
||||||
|
|
||||||
PluginManager pm = this.getServer().getPluginManager();
|
PluginManager pm = this.getServer().getPluginManager();
|
||||||
pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Event.Priority.Highest, this);
|
pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Event.Priority.High, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_COMBUST, entityListener, Event.Priority.Highest, this);
|
pm.registerEvent(Event.Type.ENTITY_COMBUST, entityListener, Event.Priority.High, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Event.Priority.Highest, this);
|
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Event.Priority.High, this);
|
||||||
pm.registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Event.Priority.Highest, this);
|
pm.registerEvent(Event.Type.EXPLOSION_PRIME, entityListener, Event.Priority.High, this);
|
||||||
pm.registerEvent(Event.Type.BLOCK_BURN, blockListener, Event.Priority.Highest, this);
|
pm.registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Event.Priority.High, this);
|
||||||
//pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Event.Priority.Highest, this);
|
pm.registerEvent(Event.Type.BLOCK_BURN, blockListener, Event.Priority.High, this);
|
||||||
|
pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Event.Priority.High, this);
|
||||||
|
|
||||||
log.log(Level.INFO, "[Total Freedom Mod] - Enabled! - Version: " + this.getDescription().getVersion() + " by Madgeek1450");
|
log.log(Level.INFO, "[Total Freedom Mod] - Enabled! - Version: " + this.getDescription().getVersion() + " by Madgeek1450");
|
||||||
log.log(Level.INFO, "[Total Freedom Mod] - Loaded superadmins: " + implodeStringList(", ", superadmins));
|
log.log(Level.INFO, "[Total Freedom Mod] - Loaded superadmins: " + implodeStringList(", ", superadmins));
|
||||||
@ -627,7 +632,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.YELLOW + String.format("%s - %d blocks away @ ", i.player.getName(), Math.round(i.distance), formatLocation(i.location)));
|
sender.sendMessage(ChatColor.YELLOW + String.format("%s - %d blocks away @ %s.", i.player.getName(), Math.round(i.distance), formatLocation(i.location)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -655,6 +660,27 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (cmd.getName().equalsIgnoreCase("mp"))
|
||||||
|
{
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
sender.sendMessage("This command can only be used in-game.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sender.isOp())
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.GRAY + "Using MobLimiter to purge all mobs.");
|
||||||
|
|
||||||
|
Bukkit.getServer().dispatchCommand(sender, "moblimiter purge");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod;
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
//import org.bukkit.ChatColor;
|
import java.util.logging.Logger;
|
||||||
//import org.bukkit.Material;
|
import org.bukkit.ChatColor;
|
||||||
//import org.bukkit.entity.Player;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.block.BlockBurnEvent;
|
import org.bukkit.event.block.BlockBurnEvent;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
import org.bukkit.event.block.BlockListener;
|
import org.bukkit.event.block.BlockListener;
|
||||||
//import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
//import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class TotalFreedomModBlockListener extends BlockListener
|
public class TotalFreedomModBlockListener extends BlockListener
|
||||||
{
|
{
|
||||||
public static TotalFreedomMod plugin;
|
public static TotalFreedomMod plugin;
|
||||||
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
TotalFreedomModBlockListener(TotalFreedomMod instance)
|
TotalFreedomModBlockListener(TotalFreedomMod instance)
|
||||||
{
|
{
|
||||||
@ -38,43 +40,41 @@ public class TotalFreedomModBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onBlockPlace(BlockPlaceEvent event)
|
public void onBlockPlace(BlockPlaceEvent event)
|
||||||
// {
|
{
|
||||||
// ItemStack is = new ItemStack(event.getBlockPlaced().getType(), 1, (short) 0, event.getBlockPlaced().getData());
|
ItemStack is = new ItemStack(event.getBlockPlaced().getType(), 1, (short) 0, event.getBlockPlaced().getData());
|
||||||
// if (is.getType() == Material.LAVA || is.getType() == Material.STATIONARY_LAVA || is.getType() == Material.LAVA_BUCKET)
|
if (is.getType() == Material.LAVA || is.getType() == Material.STATIONARY_LAVA)
|
||||||
// {
|
{
|
||||||
// Player p = event.getPlayer();
|
log.info(String.format("%s placed lava @ %s",
|
||||||
//
|
event.getPlayer().getName(),
|
||||||
// plugin.tfBroadcastMessage(String.format("%s placed lava @ %s",
|
plugin.formatLocation(event.getBlock().getLocation())
|
||||||
// p.getName(),
|
));
|
||||||
// plugin.formatLocation(p.getLocation())
|
}
|
||||||
// ), ChatColor.GRAY);
|
else if (is.getType() == Material.WATER || is.getType() == Material.STATIONARY_WATER)
|
||||||
// }
|
{
|
||||||
// else if (is.getType() == Material.WATER || is.getType() == Material.STATIONARY_WATER || is.getType() == Material.WATER_BUCKET)
|
log.info(String.format("%s placed water @ %s",
|
||||||
// {
|
event.getPlayer().getName(),
|
||||||
// Player p = event.getPlayer();
|
plugin.formatLocation(event.getBlock().getLocation())
|
||||||
//
|
));
|
||||||
// plugin.tfBroadcastMessage(String.format("%s placed water @ %s",
|
}
|
||||||
// p.getName(),
|
else if (is.getType() == Material.TNT)
|
||||||
// plugin.formatLocation(p.getLocation())
|
{
|
||||||
// ), ChatColor.GRAY);
|
Player p = event.getPlayer();
|
||||||
// }
|
|
||||||
// else if (is.getType() == Material.TNT)
|
if (!plugin.allowExplosions)
|
||||||
// {
|
{
|
||||||
// Player p = event.getPlayer();
|
p.sendMessage(ChatColor.GRAY + "TNT is currently disabled.");
|
||||||
//
|
event.setCancelled(true);
|
||||||
// plugin.tfBroadcastMessage(String.format("%s placed TNT @ %s",
|
return;
|
||||||
// p.getName(),
|
}
|
||||||
// plugin.formatLocation(p.getLocation())
|
else
|
||||||
// ), ChatColor.GRAY);
|
{
|
||||||
//
|
log.info(String.format("%s placed TNT @ %s",
|
||||||
// if (!plugin.allowExplosions)
|
p.getName(),
|
||||||
// {
|
plugin.formatLocation(event.getBlock().getLocation())
|
||||||
// p.sendMessage(ChatColor.GRAY + "TNT is currently disabled.");
|
));
|
||||||
// event.setCancelled(true);
|
}
|
||||||
// return;
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.entity.EntityListener;
|
import org.bukkit.event.entity.EntityListener;
|
||||||
|
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||||
|
|
||||||
public class TotalFreedomModEntityListener extends EntityListener
|
public class TotalFreedomModEntityListener extends EntityListener
|
||||||
{
|
{
|
||||||
@ -23,8 +24,18 @@ public class TotalFreedomModEntityListener extends EntityListener
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
event.setYield((float)plugin.explosiveRadius);
|
@Override
|
||||||
|
public void onExplosionPrime(ExplosionPrimeEvent event)
|
||||||
|
{
|
||||||
|
if (!plugin.allowExplosions)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setRadius((float)plugin.explosiveRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: TotalFreedomMod
|
name: TotalFreedomMod
|
||||||
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
||||||
version: 1.2.0
|
version: 1.3
|
||||||
description: Plugin for the Total Freedom server
|
description: Plugin for the Total Freedom server
|
||||||
author: StevenLawson / Madgeek1450
|
author: StevenLawson / Madgeek1450
|
||||||
commands:
|
commands:
|
||||||
@ -11,7 +11,7 @@ commands:
|
|||||||
description: Superadmin command - Deop everyone on the server.
|
description: Superadmin command - Deop everyone on the server.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
explosives:
|
explosives:
|
||||||
description: Superadmin command - Enable/disable explosives and set yield radius.
|
description: Superadmin command - Enable/disable explosives and set effect radius.
|
||||||
usage: /<command> <on|off> [radius]
|
usage: /<command> <on|off> [radius]
|
||||||
fire:
|
fire:
|
||||||
description: Superadmin command - Enable/disable fire.
|
description: Superadmin command - Enable/disable fire.
|
||||||
@ -28,9 +28,12 @@ commands:
|
|||||||
listreal:
|
listreal:
|
||||||
description: Lists the real names of all online players.
|
description: Lists the real names of all online players.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
opall:
|
mp:
|
||||||
description: Superadmin command - Op everyone on the server.
|
description: Use moblimiter to purge all mobs.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
opall:
|
||||||
|
description: Superadmin command - Op everyone on the server, optionally change everyone's gamemode at the same time.
|
||||||
|
usage: /<command> [-c|-s]
|
||||||
opme:
|
opme:
|
||||||
description: Superadmin command - Automatically ops user.
|
description: Superadmin command - Automatically ops user.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
@ -44,7 +47,7 @@ commands:
|
|||||||
description: Shows nearby people sorted by distance.
|
description: Shows nearby people sorted by distance.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
rd:
|
rd:
|
||||||
description: Removes drops, arrows, etc.
|
description: Use WorldEdit to remove drops, arrows, and primed TNT.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
say:
|
say:
|
||||||
description: Broadcasts the given message as the console, includes sender.
|
description: Broadcasts the given message as the console, includes sender.
|
||||||
|
Loading…
Reference in New Issue
Block a user