mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
No Message
This commit is contained in:
parent
c7427f492f
commit
18ddcc7560
@ -29,6 +29,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
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 = 1.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!";
|
||||||
@ -47,6 +48,7 @@ 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.save();
|
CONFIG.save();
|
||||||
CONFIG.load();
|
CONFIG.load();
|
||||||
}
|
}
|
||||||
@ -54,13 +56,15 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
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);
|
||||||
|
|
||||||
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.Highest, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_COMBUST, entityListener, Event.Priority.High, this);
|
pm.registerEvent(Event.Type.ENTITY_COMBUST, entityListener, Event.Priority.Highest, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Event.Priority.High, this);
|
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Event.Priority.Highest, this);
|
||||||
pm.registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Event.Priority.High, this);
|
pm.registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Event.Priority.Highest, this);
|
||||||
pm.registerEvent(Event.Type.BLOCK_BURN, blockListener, Event.Priority.High, this);
|
pm.registerEvent(Event.Type.BLOCK_BURN, blockListener, Event.Priority.Highest, this);
|
||||||
|
//pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Event.Priority.Highest, 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));
|
||||||
@ -501,14 +505,20 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
if (player == null || isUserSuperadmin(sender.getName()))
|
if (player == null || isUserSuperadmin(sender.getName()))
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.length == 2)
|
||||||
|
{
|
||||||
|
explosiveRadius = Double.parseDouble(args[1]);
|
||||||
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
this.allowExplosions = true;
|
this.allowExplosions = true;
|
||||||
|
//sender.sendMessage("Explosives are now enabled, radius set to " + explosiveRadius + " blocks.");
|
||||||
sender.sendMessage("Explosives are now enabled.");
|
sender.sendMessage("Explosives are now enabled.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -594,7 +604,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (sender_world.equals(p.getWorld().getName()))
|
if (sender_world.equals(p.getWorld().getName()) && !p.getName().equals(sender.getName()))
|
||||||
{
|
{
|
||||||
radar_data.add(new RadarData(p, sender_pos.distance(p.getLocation())));
|
radar_data.add(new RadarData(p, sender_pos.distance(p.getLocation())));
|
||||||
}
|
}
|
||||||
@ -623,11 +633,34 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (cmd.getName().equalsIgnoreCase("rd"))
|
||||||
|
{
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
sender.sendMessage("This command can only be used in-game.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sender.isOp())
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.GRAY + "Using WorldEdit to remove all entity drops.");
|
||||||
|
|
||||||
|
Bukkit.getServer().dispatchCommand(sender, "remove arrows -1");
|
||||||
|
Bukkit.getServer().dispatchCommand(sender, "remove items -1");
|
||||||
|
Bukkit.getServer().dispatchCommand(sender, "remove drops -1");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void tfBroadcastMessage(String message, ChatColor color)
|
public void tfBroadcastMessage(String message, ChatColor color)
|
||||||
{
|
{
|
||||||
log.info(message);
|
log.info(message);
|
||||||
|
|
||||||
@ -637,7 +670,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String implodeStringList(String glue, List<String> pieces)
|
public String implodeStringList(String glue, List<String> pieces)
|
||||||
{
|
{
|
||||||
StringBuilder output = new StringBuilder();
|
StringBuilder output = new StringBuilder();
|
||||||
for (int i = 0; i < pieces.size(); i++)
|
for (int i = 0; i < pieces.size(); i++)
|
||||||
@ -651,7 +684,16 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
return output.toString();
|
return output.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUserSuperadmin(String userName)
|
public String formatLocation(Location in_loc)
|
||||||
|
{
|
||||||
|
return String.format("%s: (%d, %d, %d)",
|
||||||
|
in_loc.getWorld().getName(),
|
||||||
|
Math.round(in_loc.getX()),
|
||||||
|
Math.round(in_loc.getY()),
|
||||||
|
Math.round(in_loc.getZ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUserSuperadmin(String userName)
|
||||||
{
|
{
|
||||||
return superadmins.contains(userName);
|
return superadmins.contains(userName);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod;
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
|
//import org.bukkit.ChatColor;
|
||||||
|
//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.inventory.ItemStack;
|
||||||
|
|
||||||
public class TotalFreedomModBlockListener extends BlockListener
|
public class TotalFreedomModBlockListener extends BlockListener
|
||||||
{
|
{
|
||||||
@ -32,4 +37,44 @@ public class TotalFreedomModBlockListener extends BlockListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public void onBlockPlace(BlockPlaceEvent event)
|
||||||
|
// {
|
||||||
|
// 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)
|
||||||
|
// {
|
||||||
|
// Player p = event.getPlayer();
|
||||||
|
//
|
||||||
|
// plugin.tfBroadcastMessage(String.format("%s placed lava @ %s",
|
||||||
|
// p.getName(),
|
||||||
|
// plugin.formatLocation(p.getLocation())
|
||||||
|
// ), ChatColor.GRAY);
|
||||||
|
// }
|
||||||
|
// else if (is.getType() == Material.WATER || is.getType() == Material.STATIONARY_WATER || is.getType() == Material.WATER_BUCKET)
|
||||||
|
// {
|
||||||
|
// Player p = event.getPlayer();
|
||||||
|
//
|
||||||
|
// plugin.tfBroadcastMessage(String.format("%s placed water @ %s",
|
||||||
|
// p.getName(),
|
||||||
|
// plugin.formatLocation(p.getLocation())
|
||||||
|
// ), ChatColor.GRAY);
|
||||||
|
// }
|
||||||
|
// else if (is.getType() == Material.TNT)
|
||||||
|
// {
|
||||||
|
// Player p = event.getPlayer();
|
||||||
|
//
|
||||||
|
// plugin.tfBroadcastMessage(String.format("%s placed TNT @ %s",
|
||||||
|
// p.getName(),
|
||||||
|
// plugin.formatLocation(p.getLocation())
|
||||||
|
// ), ChatColor.GRAY);
|
||||||
|
//
|
||||||
|
// if (!plugin.allowExplosions)
|
||||||
|
// {
|
||||||
|
// p.sendMessage(ChatColor.GRAY + "TNT is currently disabled.");
|
||||||
|
// event.setCancelled(true);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,8 @@ public class TotalFreedomModEntityListener extends EntityListener
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//event.setYield((float)plugin.explosiveRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,17 +11,17 @@ 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.
|
description: Superadmin command - Enable/disable explosives and set yield radius.
|
||||||
usage: /<command> [on|off]
|
usage: /<command> <on|off> [radius]
|
||||||
fire:
|
fire:
|
||||||
description: Superadmin command - Enable/disable fire.
|
description: Superadmin command - Enable/disable fire.
|
||||||
usage: /<command> [on|off]
|
usage: /<command> <on|off>
|
||||||
gtfo:
|
gtfo:
|
||||||
description: Superadmin command - Makes someone GTFO (deop and ip ban by username).
|
description: Superadmin command - Makes someone GTFO (deop and ip ban by username).
|
||||||
usage: /<command> [partialname]
|
usage: /<command> [partialname]
|
||||||
lavadmg:
|
lavadmg:
|
||||||
description: Superadmin command - Enable/disable lava damage.
|
description: Superadmin command - Enable/disable lava damage.
|
||||||
usage: /<command> [on|off]
|
usage: /<command> <on|off>
|
||||||
list:
|
list:
|
||||||
description: Lists the real names of all online players.
|
description: Lists the real names of all online players.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
@ -43,6 +43,9 @@ commands:
|
|||||||
radar:
|
radar:
|
||||||
description: Shows nearby people sorted by distance.
|
description: Shows nearby people sorted by distance.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
rd:
|
||||||
|
description: Removes drops, arrows, etc.
|
||||||
|
usage: /<command>
|
||||||
say:
|
say:
|
||||||
description: Broadcasts the given message as the console, includes sender.
|
description: Broadcasts the given message as the console, includes sender.
|
||||||
usage: /<command> <message>
|
usage: /<command> <message>
|
||||||
|
Loading…
Reference in New Issue
Block a user