mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-18 13:26:12 +00:00
293ea04c56
* rename everything containing staff back to admin (as requested by ryan i've renamed commands like slconfig to saconfig but left "slconfig" as an alias) * format almost every file correctly * a few other improvements
61 lines
1.7 KiB
Java
61 lines
1.7 KiB
Java
package me.totalfreedom.totalfreedommod.blocking;
|
|
|
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
|
import me.totalfreedom.totalfreedommod.util.FSync;
|
|
import org.bukkit.ChatColor;
|
|
import org.bukkit.event.EventHandler;
|
|
import org.bukkit.event.EventPriority;
|
|
import org.bukkit.event.block.BlockBreakEvent;
|
|
import org.bukkit.event.block.BlockPlaceEvent;
|
|
|
|
public class EditBlocker extends FreedomService
|
|
{
|
|
@Override
|
|
public void onStart()
|
|
{
|
|
}
|
|
|
|
@Override
|
|
public void onStop()
|
|
{
|
|
}
|
|
|
|
@EventHandler(priority = EventPriority.LOW)
|
|
public void onBlockPlace(BlockPlaceEvent event)
|
|
{
|
|
FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer());
|
|
if (!fPlayer.isEditBlocked())
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (plugin.al.isAdminSync(event.getPlayer()))
|
|
{
|
|
fPlayer.setEditBlocked(false);
|
|
return;
|
|
}
|
|
|
|
FSync.playerMsg(event.getPlayer(), ChatColor.RED + "Your ability to place blocks has been disabled!");
|
|
event.setCancelled(true);
|
|
}
|
|
|
|
@EventHandler(priority = EventPriority.LOW)
|
|
public void onBlockBreak(BlockBreakEvent event)
|
|
{
|
|
FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer());
|
|
if (!fPlayer.isEditBlocked())
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (plugin.al.isAdminSync(event.getPlayer()))
|
|
{
|
|
fPlayer.setEditBlocked(false);
|
|
return;
|
|
}
|
|
|
|
FSync.playerMsg(event.getPlayer(), ChatColor.RED + "Your ability to destroy blocks has been disabled!");
|
|
event.setCancelled(true);
|
|
}
|
|
} |