mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-24 03:25:24 +01:00
Added fire spread spreading enabling and disabling commands.
This commit is contained in:
parent
b9e84f7b4a
commit
ff8c48e69e
@ -1,4 +1,5 @@
|
|||||||
1.2
|
1.2
|
||||||
|
- /stopfire and /allowfire disable and enable fire spreading globally.
|
||||||
- Block lag fix slightly improved in accuracy for item drops.
|
- Block lag fix slightly improved in accuracy for item drops.
|
||||||
- Sponge updated to remove water when the sponge block is set. Sponge radius
|
- Sponge updated to remove water when the sponge block is set. Sponge radius
|
||||||
can now be controlled using the 'sponge-radius' parameter and the
|
can now be controlled using the 'sponge-radius' parameter and the
|
||||||
|
19
README.txt
19
README.txt
@ -147,6 +147,25 @@ WorldGuard on your server. You can either restart your server or use
|
|||||||
- log-database-table (def. "blacklist_events")
|
- log-database-table (def. "blacklist_events")
|
||||||
Database table to use.
|
Database table to use.
|
||||||
|
|
||||||
|
Commands
|
||||||
|
--------
|
||||||
|
|
||||||
|
- /stopfire and /allowfire
|
||||||
|
Disables and enables fire spread globally. Both commands require the
|
||||||
|
permission to use only "/stopfire. Re-enabling fire spread with this
|
||||||
|
command will not override other fire spread control features of
|
||||||
|
WorldGuard. Note that disabling fire does not disable fire damage
|
||||||
|
but fire at least won't spread.
|
||||||
|
|
||||||
|
Server Commands
|
||||||
|
---------------
|
||||||
|
|
||||||
|
- fire-stop and fire-allow
|
||||||
|
Disables and enables fire spread globally. Re-enabling fire spread
|
||||||
|
with this command will not override other fire spread control features
|
||||||
|
of WorldGuard. Note that disabling fire does not disable fire damage
|
||||||
|
but fire at least won't spread.
|
||||||
|
|
||||||
Blacklists
|
Blacklists
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
@ -53,6 +53,10 @@ public WorldGuard() {
|
|||||||
public void initialize() {
|
public void initialize() {
|
||||||
PluginLoader loader = etc.getLoader();
|
PluginLoader loader = etc.getLoader();
|
||||||
|
|
||||||
|
loader.addListener(PluginLoader.Hook.COMMAND, listener, this,
|
||||||
|
PluginListener.Priority.MEDIUM);
|
||||||
|
loader.addListener(PluginLoader.Hook.SERVERCOMMAND, listener, this,
|
||||||
|
PluginListener.Priority.MEDIUM);
|
||||||
loader.addListener(PluginLoader.Hook.EXPLODE, listener, this,
|
loader.addListener(PluginLoader.Hook.EXPLODE, listener, this,
|
||||||
PluginListener.Priority.HIGH);
|
PluginListener.Priority.HIGH);
|
||||||
loader.addListener(PluginLoader.Hook.IGNITE, listener, this,
|
loader.addListener(PluginLoader.Hook.IGNITE, listener, this,
|
||||||
@ -61,6 +65,8 @@ public void initialize() {
|
|||||||
PluginListener.Priority.HIGH);
|
PluginListener.Priority.HIGH);
|
||||||
loader.addListener(PluginLoader.Hook.LOGINCHECK, listener, this,
|
loader.addListener(PluginLoader.Hook.LOGINCHECK, listener, this,
|
||||||
PluginListener.Priority.HIGH);
|
PluginListener.Priority.HIGH);
|
||||||
|
loader.addListener(PluginLoader.Hook.LOGIN, listener, this,
|
||||||
|
PluginListener.Priority.MEDIUM);
|
||||||
loader.addListener(PluginLoader.Hook.BLOCK_CREATED, listener, this,
|
loader.addListener(PluginLoader.Hook.BLOCK_CREATED, listener, this,
|
||||||
PluginListener.Priority.HIGH);
|
PluginListener.Priority.HIGH);
|
||||||
loader.addListener(PluginLoader.Hook.BLOCK_DESTROYED, listener, this,
|
loader.addListener(PluginLoader.Hook.BLOCK_DESTROYED, listener, this,
|
||||||
@ -82,6 +88,9 @@ public void initialize() {
|
|||||||
public void enable() {
|
public void enable() {
|
||||||
logger.log(Level.INFO, "WorldGuard version " + getVersion() + " loaded");
|
logger.log(Level.INFO, "WorldGuard version " + getVersion() + " loaded");
|
||||||
listener.loadConfiguration();
|
listener.loadConfiguration();
|
||||||
|
|
||||||
|
etc.getInstance().addCommand("/stopfire", "Globally stop fire spread");
|
||||||
|
etc.getInstance().addCommand("/allowfire", "Globally re-enable fire spread");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,6 +103,9 @@ public void disable() {
|
|||||||
BlacklistEntry.forgetAllPlayers();
|
BlacklistEntry.forgetAllPlayers();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
etc.getInstance().removeCommand("/stopfire");
|
||||||
|
etc.getInstance().removeCommand("/allowfire");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,6 +63,11 @@ public class WorldGuardListener extends PluginListener {
|
|||||||
*/
|
*/
|
||||||
private LinkedList<int[]> blockRemoveQueue = new LinkedList<int[]>();
|
private LinkedList<int[]> blockRemoveQueue = new LinkedList<int[]>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop fire spread mode.
|
||||||
|
*/
|
||||||
|
private boolean stopFireSpread = false;
|
||||||
|
|
||||||
private boolean enforceOneSession;
|
private boolean enforceOneSession;
|
||||||
private boolean blockCreepers;
|
private boolean blockCreepers;
|
||||||
private boolean blockTNT;
|
private boolean blockTNT;
|
||||||
@ -238,6 +243,84 @@ public String onLoginChecks(String user) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called during the later login process
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
*/
|
||||||
|
public void onLogin(Player player) {
|
||||||
|
if (stopFireSpread) {
|
||||||
|
player.sendMessage(Colors.Yellow + "Fire spread is currently globally disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called before the command is parsed. Return true if you don't want the
|
||||||
|
* command to be parsed.
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @param split
|
||||||
|
* @return false if you want the command to be parsed.
|
||||||
|
*/
|
||||||
|
public boolean onCommand(Player player, String[] split) {
|
||||||
|
if (split[0].equalsIgnoreCase("/stopfire") &&
|
||||||
|
player.canUseCommand("/stopfire")) {
|
||||||
|
if (!stopFireSpread) {
|
||||||
|
etc.getServer().messageAll(Colors.Yellow
|
||||||
|
+ "Fire spread has been globally disabled by " + player.getName() + ".");
|
||||||
|
} else {
|
||||||
|
player.sendMessage(Colors.Yellow + "Fire spread was already globally disabled.");
|
||||||
|
}
|
||||||
|
stopFireSpread = true;
|
||||||
|
return true;
|
||||||
|
} else if (split[0].equalsIgnoreCase("/allowfire")
|
||||||
|
&& player.canUseCommand("/stopfire")) {
|
||||||
|
if (stopFireSpread) {
|
||||||
|
etc.getServer().messageAll(Colors.Yellow
|
||||||
|
+ "Fire spread has been globally re-enabled by " + player.getName() + ".");
|
||||||
|
} else {
|
||||||
|
player.sendMessage(Colors.Yellow + "Fire spread was already globally enabled.");
|
||||||
|
}
|
||||||
|
stopFireSpread = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called before the console command is parsed. Return true if you don't
|
||||||
|
* want the server command to be parsed by the server.
|
||||||
|
*
|
||||||
|
* @param split
|
||||||
|
* @return false if you want the command to be parsed.
|
||||||
|
*/
|
||||||
|
public boolean onConsoleCommand(String[] split) {
|
||||||
|
if (split[0].equalsIgnoreCase("fire-stop")) {
|
||||||
|
if (!stopFireSpread) {
|
||||||
|
etc.getServer().messageAll(Colors.Yellow
|
||||||
|
+ "Fire spread has been globally disabled by server console.");
|
||||||
|
logger.log(Level.INFO, "Fire spread is now globally disabled.");
|
||||||
|
} else {
|
||||||
|
logger.log(Level.INFO, "Fire spread was already globally disabled.");
|
||||||
|
}
|
||||||
|
stopFireSpread = true;
|
||||||
|
return true;
|
||||||
|
} else if (split[0].equalsIgnoreCase("fire-allow")) {
|
||||||
|
if (stopFireSpread) {
|
||||||
|
etc.getServer().messageAll(Colors.Yellow
|
||||||
|
+ "Fire spread has been globally re-enabled by server console.");
|
||||||
|
logger.log(Level.INFO, "Fire spread is now globally enabled.");
|
||||||
|
} else {
|
||||||
|
logger.log(Level.INFO, "Fire spread was already globally enabled.");
|
||||||
|
}
|
||||||
|
stopFireSpread = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player drops an item.
|
* Called when a player drops an item.
|
||||||
*
|
*
|
||||||
@ -539,6 +622,10 @@ public boolean onIgnite(Block block, Player player) {
|
|||||||
&& !player.canUseCommand("/lighter");
|
&& !player.canUseCommand("/lighter");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stopFireSpread && block.getStatus() == 3) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (disableAllFire && block.getStatus() == 3) {
|
if (disableAllFire && block.getStatus() == 3) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user