mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Added: gadmin
Changed: lava cookiefication
This commit is contained in:
parent
a730e9f67f
commit
0f6a1d6687
@ -25,9 +25,7 @@ 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>();
|
||||||
private List<String> superadmin_ips = new ArrayList<String>();
|
private List<String> superadmin_ips = new ArrayList<String>();
|
||||||
@ -36,7 +34,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public Boolean allowFire = false;
|
public Boolean allowFire = false;
|
||||||
public double explosiveRadius = 4.0;
|
public double explosiveRadius = 4.0;
|
||||||
public Boolean preprocessLogEnabled = false;
|
public Boolean preprocessLogEnabled = false;
|
||||||
|
|
||||||
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!";
|
||||||
@ -753,6 +750,92 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (cmd.getName().equalsIgnoreCase("gadmin"))
|
||||||
|
{
|
||||||
|
if (args.length == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String mode = args[0].toLowerCase();
|
||||||
|
|
||||||
|
if (player == null || isUserSuperadmin(sender))
|
||||||
|
{
|
||||||
|
if (mode.equals("list"))
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.GOLD + "[Real Name]:[Display Name] - Hash:");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
String hash = p.getUniqueId().toString().substring(0, 4);
|
||||||
|
if (mode.equals("list"))
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.GOLD + String.format("[%s]:[%s] - %s",
|
||||||
|
p.getName(),
|
||||||
|
ChatColor.stripColor(p.getDisplayName()),
|
||||||
|
hash));
|
||||||
|
}
|
||||||
|
else if (hash.equalsIgnoreCase(args[1]))
|
||||||
|
{
|
||||||
|
if (mode.equals("kick"))
|
||||||
|
{
|
||||||
|
p.kickPlayer("Kicked by Administrator");
|
||||||
|
}
|
||||||
|
else if (mode.equals("nameban"))
|
||||||
|
{
|
||||||
|
Bukkit.getOfflinePlayer(p.getName()).setBanned(true);
|
||||||
|
tfBroadcastMessage(String.format("Banning Name: %s.", p.getName()), ChatColor.RED);
|
||||||
|
p.kickPlayer("Username banned by Administrator.");
|
||||||
|
}
|
||||||
|
else if (mode.equals("ipban"))
|
||||||
|
{
|
||||||
|
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
||||||
|
tfBroadcastMessage(String.format("Banning IP: %s.", p.getName(), user_ip), ChatColor.RED);
|
||||||
|
Bukkit.banIP(user_ip);
|
||||||
|
p.kickPlayer("IP address banned by Administrator.");
|
||||||
|
}
|
||||||
|
else if (mode.equals("ban"))
|
||||||
|
{
|
||||||
|
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
||||||
|
tfBroadcastMessage(String.format("Banning Name: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED);
|
||||||
|
Bukkit.banIP(user_ip);
|
||||||
|
Bukkit.getOfflinePlayer(p.getName()).setBanned(true);
|
||||||
|
p.kickPlayer("IP and username banned by Administrator.");
|
||||||
|
}
|
||||||
|
else if (mode.equals("op"))
|
||||||
|
{
|
||||||
|
tfBroadcastMessage(String.format("(%s: Opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
||||||
|
p.setOp(false);
|
||||||
|
p.sendMessage(YOU_ARE_OP);
|
||||||
|
}
|
||||||
|
else if (mode.equals("deop"))
|
||||||
|
{
|
||||||
|
tfBroadcastMessage(String.format("(%s: De-opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
||||||
|
p.setOp(false);
|
||||||
|
p.sendMessage(YOU_ARE_NOT_OP);
|
||||||
|
}
|
||||||
|
else if (mode.equals("ci"))
|
||||||
|
{
|
||||||
|
p.getInventory().clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mode.equals("list"))
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.RED + "Invalid hash.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if (cmd.getName().equalsIgnoreCase("status"))
|
else if (cmd.getName().equalsIgnoreCase("status"))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "Server is currently running with 'online-mode=" + (Bukkit.getOnlineMode() ? "true" : "false") + "'.");
|
sender.sendMessage(ChatColor.GRAY + "Server is currently running with 'online-mode=" + (Bukkit.getOnlineMode() ? "true" : "false") + "'.");
|
||||||
|
@ -43,23 +43,32 @@ public class TotalFreedomModBlockListener extends BlockListener
|
|||||||
@Override
|
@Override
|
||||||
public void onBlockPlace(BlockPlaceEvent event)
|
public void onBlockPlace(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
log.info("Got onBlockPlace by " + event.getPlayer().getName());
|
|
||||||
|
|
||||||
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)
|
if (is.getType() == Material.LAVA || is.getType() == Material.STATIONARY_LAVA)
|
||||||
{
|
{
|
||||||
log.info(String.format("%s placed lava @ %s",
|
Player player = event.getPlayer();
|
||||||
event.getPlayer().getName(),
|
|
||||||
plugin.formatLocation(event.getBlock().getLocation())));
|
|
||||||
|
|
||||||
event.getItemInHand().setType(Material.COOKIE);
|
int slot = player.getInventory().getHeldItemSlot();
|
||||||
event.getItemInHand().setAmount(1);
|
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
|
||||||
|
player.getInventory().setItem(slot, heldItem);
|
||||||
|
|
||||||
|
player.sendMessage(ChatColor.GOLD + "LAVA NO FUN, YOU EAT COOKIE INSTEAD, NO?");
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (is.getType() == Material.WATER || is.getType() == Material.STATIONARY_WATER)
|
else if (is.getType() == Material.WATER || is.getType() == Material.STATIONARY_WATER)
|
||||||
{
|
{
|
||||||
log.info(String.format("%s placed water @ %s",
|
Player player = event.getPlayer();
|
||||||
event.getPlayer().getName(),
|
|
||||||
plugin.formatLocation(event.getBlock().getLocation())));
|
int slot = player.getInventory().getHeldItemSlot();
|
||||||
|
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
|
||||||
|
player.getInventory().setItem(slot, heldItem);
|
||||||
|
|
||||||
|
player.sendMessage(ChatColor.GOLD + "Does this look like a waterpark to you?");
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (is.getType() == Material.TNT)
|
else if (is.getType() == Material.TNT)
|
||||||
{
|
{
|
||||||
@ -67,7 +76,14 @@ public class TotalFreedomModBlockListener extends BlockListener
|
|||||||
|
|
||||||
if (!plugin.allowExplosions)
|
if (!plugin.allowExplosions)
|
||||||
{
|
{
|
||||||
p.sendMessage(ChatColor.GRAY + "TNT is currently disabled.");
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
int slot = player.getInventory().getHeldItemSlot();
|
||||||
|
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
|
||||||
|
player.getInventory().setItem(slot, heldItem);
|
||||||
|
|
||||||
|
player.sendMessage(ChatColor.GRAY + "TNT is currently disabled.");
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class TotalFreedomModEntityListener extends EntityListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setRadius((float)plugin.explosiveRadius);
|
event.setRadius((float) plugin.explosiveRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,6 +8,7 @@ import org.bukkit.event.block.Action;
|
|||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
class TotalFreedomModPlayerListener extends PlayerListener
|
class TotalFreedomModPlayerListener extends PlayerListener
|
||||||
{
|
{
|
||||||
@ -26,20 +27,29 @@ class TotalFreedomModPlayerListener extends PlayerListener
|
|||||||
{
|
{
|
||||||
if (event.getMaterial() == Material.WATER_BUCKET)
|
if (event.getMaterial() == Material.WATER_BUCKET)
|
||||||
{
|
{
|
||||||
log.info(String.format("%s placed water @ %s",
|
Player player = event.getPlayer();
|
||||||
event.getPlayer().getName(),
|
|
||||||
plugin.formatLocation(event.getClickedBlock().getLocation())));
|
int slot = player.getInventory().getHeldItemSlot();
|
||||||
|
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
|
||||||
|
player.getInventory().setItem(slot, heldItem);
|
||||||
|
|
||||||
|
player.sendMessage(ChatColor.GOLD + "Does this look like a waterpark to you?");
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (event.getMaterial() == Material.LAVA_BUCKET)
|
else if (event.getMaterial() == Material.LAVA_BUCKET)
|
||||||
{
|
{
|
||||||
log.info(String.format("%s tried to placed lava @ %s",
|
Player player = event.getPlayer();
|
||||||
event.getPlayer().getName(),
|
|
||||||
plugin.formatLocation(event.getClickedBlock().getLocation())));
|
|
||||||
|
|
||||||
event.getPlayer().getItemInHand().setType(Material.COOKIE);
|
int slot = player.getInventory().getHeldItemSlot();
|
||||||
event.getPlayer().getItemInHand().setAmount(1);
|
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
|
||||||
|
player.getInventory().setItem(slot, heldItem);
|
||||||
|
|
||||||
|
player.sendMessage(ChatColor.GOLD + "LAVA NO FUN, YOU EAT COOKIE INSTEAD, NO?");
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,15 +65,38 @@ class TotalFreedomModPlayerListener extends PlayerListener
|
|||||||
log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", player.getName(), ChatColor.stripColor(player.getDisplayName()), command));
|
log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", player.getName(), ChatColor.stripColor(player.getDisplayName()), command));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.startsWith("/stop") && !command.equals("/stop"))
|
command = command.toLowerCase();
|
||||||
|
|
||||||
|
boolean block_command = false;
|
||||||
|
|
||||||
|
if (command.matches("^/stop"))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
if (!plugin.isUserSuperadmin(player))
|
||||||
player.sendMessage(ChatColor.RED + "Piss off.");
|
{
|
||||||
|
block_command = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (command.startsWith("/zeus") || command.startsWith("/vulcan"))
|
else if (command.matches("^/reload"))
|
||||||
{
|
{
|
||||||
|
if (!plugin.isUserSuperadmin(player))
|
||||||
|
{
|
||||||
|
block_command = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (command.matches("^/zeus"))
|
||||||
|
{
|
||||||
|
block_command = true;
|
||||||
|
}
|
||||||
|
else if (command.matches("^/vulcan"))
|
||||||
|
{
|
||||||
|
block_command = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (block_command)
|
||||||
|
{
|
||||||
|
player.sendMessage(ChatColor.RED + "That command is prohibited.");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.sendMessage(ChatColor.RED + "Piss off.");
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,9 @@ commands:
|
|||||||
fire:
|
fire:
|
||||||
description: Superadmin command - Enable/disable fire.
|
description: Superadmin command - Enable/disable fire.
|
||||||
usage: /<command> <on|off>
|
usage: /<command> <on|off>
|
||||||
|
gadmin:
|
||||||
|
description: Superadmin command - Use admin commands on someone by hash. Use mode 'list' to get a player's hash. Other modes are kick, nameban, ipban, ban, op, deop, ci
|
||||||
|
usage: /<command> [list | <kick|nameban|ipban|ban|op|deop|ci> <targethash>]
|
||||||
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]
|
||||||
@ -59,7 +62,7 @@ commands:
|
|||||||
description: Show random server info.
|
description: Show random server info.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
stop:
|
stop:
|
||||||
description: Kicks everyone and stops the server.
|
description: Superadmin command - Kicks everyone and stops the server.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
survival:
|
survival:
|
||||||
description: Quickly change your own gamemode to survival, or define someone's username to change theirs.
|
description: Quickly change your own gamemode to survival, or define someone's username to change theirs.
|
||||||
|
Loading…
Reference in New Issue
Block a user