mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
partial
This commit is contained in:
parent
04aaeac9c9
commit
a730e9f67f
@ -73,13 +73,16 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
preprocessLogEnabled = CONFIG.getBoolean("preprocess_log", false);
|
||||
|
||||
PluginManager pm = this.getServer().getPluginManager();
|
||||
|
||||
pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Event.Priority.High, this);
|
||||
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.BLOCK_IGNITE, blockListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_BURN, blockListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Event.Priority.High, this);
|
||||
|
||||
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Event.Priority.High, this);
|
||||
|
||||
@ -199,7 +202,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
onlineUsers.append(ChatColor.WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sender.sendMessage(onlineStats.toString());
|
||||
sender.sendMessage(onlineUsers.toString());
|
||||
|
||||
@ -748,6 +751,12 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
sender.sendMessage(MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("status"))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Server is currently running with 'online-mode=" + (Bukkit.getOnlineMode() ? "true" : "false") + "'.");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -12,69 +12,71 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class TotalFreedomModBlockListener extends BlockListener
|
||||
{
|
||||
public static TotalFreedomMod plugin;
|
||||
public static TotalFreedomMod plugin;
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
TotalFreedomModBlockListener(TotalFreedomMod instance)
|
||||
{
|
||||
plugin = instance;
|
||||
}
|
||||
TotalFreedomModBlockListener(TotalFreedomMod instance)
|
||||
{
|
||||
plugin = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockBurn(BlockBurnEvent event)
|
||||
{
|
||||
if (!plugin.allowFire)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockBurn(BlockBurnEvent event)
|
||||
{
|
||||
if (!plugin.allowFire)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockIgnite(BlockIgniteEvent event)
|
||||
{
|
||||
if (!plugin.allowFire)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockIgnite(BlockIgniteEvent event)
|
||||
{
|
||||
if (!plugin.allowFire)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
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)
|
||||
{
|
||||
log.info(String.format("%s placed lava @ %s",
|
||||
event.getPlayer().getName(),
|
||||
plugin.formatLocation(event.getBlock().getLocation())
|
||||
));
|
||||
}
|
||||
else if (is.getType() == Material.WATER || is.getType() == Material.STATIONARY_WATER)
|
||||
{
|
||||
log.info(String.format("%s placed water @ %s",
|
||||
event.getPlayer().getName(),
|
||||
plugin.formatLocation(event.getBlock().getLocation())
|
||||
));
|
||||
}
|
||||
else if (is.getType() == Material.TNT)
|
||||
{
|
||||
Player p = event.getPlayer();
|
||||
@Override
|
||||
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());
|
||||
if (is.getType() == Material.LAVA || is.getType() == Material.STATIONARY_LAVA)
|
||||
{
|
||||
log.info(String.format("%s placed lava @ %s",
|
||||
event.getPlayer().getName(),
|
||||
plugin.formatLocation(event.getBlock().getLocation())));
|
||||
|
||||
event.getItemInHand().setType(Material.COOKIE);
|
||||
event.getItemInHand().setAmount(1);
|
||||
}
|
||||
else if (is.getType() == Material.WATER || is.getType() == Material.STATIONARY_WATER)
|
||||
{
|
||||
log.info(String.format("%s placed water @ %s",
|
||||
event.getPlayer().getName(),
|
||||
plugin.formatLocation(event.getBlock().getLocation())));
|
||||
}
|
||||
else if (is.getType() == Material.TNT)
|
||||
{
|
||||
Player p = event.getPlayer();
|
||||
|
||||
if (!plugin.allowExplosions)
|
||||
{
|
||||
p.sendMessage(ChatColor.GRAY + "TNT is currently disabled.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (!plugin.allowExplosions)
|
||||
{
|
||||
p.sendMessage(ChatColor.GRAY + "TNT is currently disabled.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.info(String.format("%s placed TNT @ %s",
|
||||
p.getName(),
|
||||
plugin.formatLocation(event.getBlock().getLocation())
|
||||
));
|
||||
p.getName(),
|
||||
plugin.formatLocation(event.getBlock().getLocation())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
@ -23,7 +24,23 @@ class TotalFreedomModPlayerListener extends PlayerListener
|
||||
{
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
log.info("Right Click Block: " + event.getMaterial() + " - " + event.getItem());
|
||||
if (event.getMaterial() == Material.WATER_BUCKET)
|
||||
{
|
||||
log.info(String.format("%s placed water @ %s",
|
||||
event.getPlayer().getName(),
|
||||
plugin.formatLocation(event.getClickedBlock().getLocation())));
|
||||
}
|
||||
else if (event.getMaterial() == Material.LAVA_BUCKET)
|
||||
{
|
||||
log.info(String.format("%s tried to placed lava @ %s",
|
||||
event.getPlayer().getName(),
|
||||
plugin.formatLocation(event.getClickedBlock().getLocation())));
|
||||
|
||||
event.getPlayer().getItemInHand().setType(Material.COOKIE);
|
||||
event.getPlayer().getItemInHand().setAmount(1);
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +49,7 @@ class TotalFreedomModPlayerListener extends PlayerListener
|
||||
{
|
||||
String command = event.getMessage();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
|
||||
if (plugin.preprocessLogEnabled)
|
||||
{
|
||||
log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", player.getName(), ChatColor.stripColor(player.getDisplayName()), command));
|
||||
|
@ -55,6 +55,9 @@ commands:
|
||||
say:
|
||||
description: Broadcasts the given message as the console, includes sender.
|
||||
usage: /<command> <message>
|
||||
status:
|
||||
description: Show random server info.
|
||||
usage: /<command>
|
||||
stop:
|
||||
description: Kicks everyone and stops the server.
|
||||
usage: /<command>
|
||||
|
Loading…
Reference in New Issue
Block a user