A simple fire antigrief plugin

This commit is contained in:
nossr50 2011-01-15 13:17:16 -08:00
parent 3793b72fae
commit 4e004558e5
5 changed files with 117 additions and 1 deletions

3
TODO
View File

@ -6,4 +6,5 @@ Bukkit TODO
-vGuilds for the guild and party system (noss) -vGuilds for the guild and party system (noss)
-vGroups for the groups system (Cere) -vGroups for the groups system (Cere)
-Finish up the hMod planned features -Finish up the hMod planned features
-Include updatr support with the new plugins -Include updatr support with the new plugins
-Port as many of vMinecrafts features as possible

View File

@ -0,0 +1,30 @@
package com.bukkit.nossr50.vStopFire;
import org.bukkit.Block;
import org.bukkit.BlockFace;
import org.bukkit.Material;
import org.bukkit.event.block.BlockCanBuildEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPhysicsEvent;
/**
* vPlayerSpawn block listener
* @author nossr50
*/
public class vBlockListener extends BlockListener {
private final vStopFire plugin;
public vBlockListener(final vStopFire plugin) {
this.plugin = plugin;
}
//This should stop fire from spreading but still allow players to light stuff up with flint and steel
public void onBlockIgnite(BlockIgniteEvent event) {
String cause = event.getCause().toString();
if(cause.equals("SPREAD"))
event.setCancelled(true);
if(!cause.equals("FLINT_AND_STEEL"))
event.setCancelled(true);
}
//put all Block related code here
}

View File

@ -0,0 +1,24 @@
package com.bukkit.nossr50.vStopFire;
import org.bukkit.Location;
import org.bukkit.Player;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerMoveEvent;
/**
* Handle events for all Player related events
* @author nossr50
*/
public class vPlayerListener extends PlayerListener {
private final vStopFire plugin;
public vPlayerListener(vStopFire instance) {
plugin = instance;
}
//Insert Player related code here
}

View File

@ -0,0 +1,58 @@
package com.bukkit.nossr50.vStopFire;
import java.io.File;
import java.util.HashMap;
import org.bukkit.Player;
import org.bukkit.Server;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginManager;
/**
* vStopFire for Bukkit
*
* @author nossr50
*/
public class vStopFire extends JavaPlugin {
private final vPlayerListener playerListener = new vPlayerListener(this);
private final vBlockListener blockListener = new vBlockListener(this);
private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
private final String name = "vStopFire";
public vStopFire(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
super(pluginLoader, instance, desc, folder, plugin, cLoader);
// NOTE: Event registration should be done in onEnable not here as all events are unregistered when a plugin is disabled
}
public void onEnable() {
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Priority.Normal, this);
PluginDescriptionFile pdfFile = this.getDescription();
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
}
public void onDisable() {
// TODO: Place any custom disable code here
// NOTE: All registered events are automatically unregistered when a plugin is disabled
// EXAMPLE: Custom code, here we just output some info so we can check all is well
System.out.println("Goodbye world!");
}
public boolean isDebugging(final Player player) {
if (debugees.containsKey(player)) {
return debugees.get(player);
} else {
return false;
}
}
public void setDebugging(final Player player, final boolean value) {
debugees.put(player, value);
}
}

3
vStopFire/plugin.yml Normal file
View File

@ -0,0 +1,3 @@
name: vStopFire
main: com.bukkit.nossr50.vStopFire.vStopFire
version: 1.0