mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-23 07:54:58 +00:00
partial
This commit is contained in:
parent
04aaeac9c9
commit
a730e9f67f
4 changed files with 89 additions and 58 deletions
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,20 +43,23 @@ public class TotalFreedomModBlockListener extends BlockListener
|
|||
@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())
|
||||
));
|
||||
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())
|
||||
));
|
||||
plugin.formatLocation(event.getBlock().getLocation())));
|
||||
}
|
||||
else if (is.getType() == Material.TNT)
|
||||
{
|
||||
|
@ -72,8 +75,7 @@ public class TotalFreedomModBlockListener extends BlockListener
|
|||
{
|
||||
log.info(String.format("%s placed TNT @ %s",
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 a new issue