mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +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);
|
preprocessLogEnabled = CONFIG.getBoolean("preprocess_log", false);
|
||||||
|
|
||||||
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.High, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_COMBUST, 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.ENTITY_DAMAGE, entityListener, Event.Priority.High, this);
|
||||||
pm.registerEvent(Event.Type.EXPLOSION_PRIME, 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_IGNITE, blockListener, Event.Priority.High, this);
|
||||||
pm.registerEvent(Event.Type.BLOCK_BURN, 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.BLOCK_PLACE, blockListener, Event.Priority.High, this);
|
||||||
|
|
||||||
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, 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);
|
pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Event.Priority.High, this);
|
||||||
|
|
||||||
@ -748,6 +751,12 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
sender.sendMessage(MSG_NO_PERMS);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,20 +43,23 @@ 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",
|
log.info(String.format("%s placed lava @ %s",
|
||||||
event.getPlayer().getName(),
|
event.getPlayer().getName(),
|
||||||
plugin.formatLocation(event.getBlock().getLocation())
|
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)
|
else if (is.getType() == Material.WATER || is.getType() == Material.STATIONARY_WATER)
|
||||||
{
|
{
|
||||||
log.info(String.format("%s placed water @ %s",
|
log.info(String.format("%s placed water @ %s",
|
||||||
event.getPlayer().getName(),
|
event.getPlayer().getName(),
|
||||||
plugin.formatLocation(event.getBlock().getLocation())
|
plugin.formatLocation(event.getBlock().getLocation())));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
else if (is.getType() == Material.TNT)
|
else if (is.getType() == Material.TNT)
|
||||||
{
|
{
|
||||||
@ -72,8 +75,7 @@ public class TotalFreedomModBlockListener extends BlockListener
|
|||||||
{
|
{
|
||||||
log.info(String.format("%s placed TNT @ %s",
|
log.info(String.format("%s placed TNT @ %s",
|
||||||
p.getName(),
|
p.getName(),
|
||||||
plugin.formatLocation(event.getBlock().getLocation())
|
plugin.formatLocation(event.getBlock().getLocation())));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package me.StevenLawson.TotalFreedomMod;
|
|||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
@ -23,7 +24,23 @@ class TotalFreedomModPlayerListener extends PlayerListener
|
|||||||
{
|
{
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,9 @@ commands:
|
|||||||
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>
|
||||||
|
status:
|
||||||
|
description: Show random server info.
|
||||||
|
usage: /<command>
|
||||||
stop:
|
stop:
|
||||||
description: Kicks everyone and stops the server.
|
description: Kicks everyone and stops the server.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
Loading…
Reference in New Issue
Block a user