Community listing page, reviews here may not be monitored by the author.
Break Denyer
No reviews yet
Stops non-op players placing and breaking blocks on servers.
Community voices
Reviews
No reviews yet. Be the first to review this project!
Get it on
Available Platforms
About
Project Details
For authors
Embed Badge
If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.
Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.
Identifiers
Platform IDs
Resources
External Links
About
Description
This mod will prevent non-op players from breaking and placing blocks on server. This allows servers to be made in survival/adventure mode, but not have the risk of the players going around breaking all of the glass blocks, but still being able to kill mobs, craft weapons, etc.
Here is the code for this mod:
package thut.breakdeny;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.management.UserListOpsEntry;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
import net.minecraftforge.event.world.BlockEvent.PlaceEvent;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
@Mod(modid = BreakDeny.MODID, name = "Break Denyer", version = BreakDeny.VERSION, acceptableRemoteVersions = "*")
public class BreakDeny
{
public static final String MODID = "break_denyer";
public static final String VERSION = "1.0.0";
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
if (event.getSide() == Side.SERVER) MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void denyBreak(BreakEvent event)
{
EntityPlayer player = event.getPlayer();
if (!isOp(player)) event.setCanceled(true);
}
@SubscribeEvent
public void denyPlace(PlaceEvent event)
{
EntityPlayer player = event.player;
if (!isOp(player)) event.setCanceled(true);
}
private boolean isOp(EntityPlayer player)
{
if (player != null && !player.worldObj.isRemote)
{
UserListOpsEntry userentry = (UserListOpsEntry) ((EntityPlayerMP) player).mcServer.getConfigurationManager()
.getOppedPlayers().getEntry(player.getGameProfile());
if (userentry != null
|| !FMLCommonHandler.instance().getMinecraftServerInstance().isDedicatedServer()) { return true; }
}
return false;
}
}
Screenshots
Gallery
Versions
Files
Relations
Project Relations
More like this
Similar Mods
Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.
On ModDex
Community snapshot
By the numbers
Statistics
Want to reach Minecraft players?
We're looking for a server hosting partner to feature here and other parts of the site. Interested? Send us a message!
Get in touchGet it on
Available Platforms
On ModDex
Community snapshot
By the numbers
Statistics
Resources