Fixed a bug with worlds in subfolders
Fixed gates being destroyed with explosions Added stargate.destroy.owner
This commit is contained in:
parent
a9461846de
commit
432ab3bbc8
9
README
9
README
@ -21,7 +21,9 @@ Known Issues
|
|||||||
=============
|
=============
|
||||||
- stargate.use - Allow this player/group to use stargates.
|
- stargate.use - Allow this player/group to use stargates.
|
||||||
- stargate.create - Allow this player/group to create new stargates.
|
- stargate.create - Allow this player/group to create new stargates.
|
||||||
- stargate.destroy - Allow this player/group to destroy existing stargates.
|
- stargate.destroy - Allow this player/group to destroy existing stargates. (Deprecated)
|
||||||
|
- stargate.destroy.all - Allow this player/group to destroy any existing stargate (Replaces stargate.destroy)
|
||||||
|
- stargate.destroy.owner - Allow this player/group to destroy any stargate that they are the owner of.
|
||||||
- stargate.hidden - Allow this player/group to see all hidden stargates.
|
- stargate.hidden - Allow this player/group to see all hidden stargates.
|
||||||
- stargate.private - Allow this player/group to use all private stargates.
|
- stargate.private - Allow this player/group to use all private stargates.
|
||||||
|
|
||||||
@ -78,10 +80,15 @@ other-side-blocked-message - The message when the gate you're dialing is open
|
|||||||
teleport-message - The message when you are teleported
|
teleport-message - The message when you are teleported
|
||||||
portal-folder - The folder your portal databases are saved in
|
portal-folder - The folder your portal databases are saved in
|
||||||
gate-folder - The folder containing your .gate files
|
gate-folder - The folder containing your .gate files
|
||||||
|
destroyexplosion - Whether to destroy a stargate with explosions, or stop an explosion if it contains a gates controls.
|
||||||
|
|
||||||
=============
|
=============
|
||||||
Changes
|
Changes
|
||||||
=============
|
=============
|
||||||
|
[Version 0.25]
|
||||||
|
- Fixed a bug with worlds in subfolders
|
||||||
|
- Fixed gates being destroyed with explosions
|
||||||
|
- Added stargate.destroy.owner
|
||||||
[Version 0.24]
|
[Version 0.24]
|
||||||
- Fixed a loading bug in which invalid gates caused file truncation
|
- Fixed a loading bug in which invalid gates caused file truncation
|
||||||
[Version 0.23]
|
[Version 0.23]
|
||||||
|
@ -23,6 +23,8 @@ import org.bukkit.event.block.BlockPhysicsEvent;
|
|||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.block.BlockRightClickEvent;
|
import org.bukkit.event.block.BlockRightClickEvent;
|
||||||
import org.bukkit.event.block.SignChangeEvent;
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.entity.EntityListener;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleListener;
|
import org.bukkit.event.vehicle.VehicleListener;
|
||||||
@ -52,6 +54,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
private final pListener playerListener = new pListener();
|
private final pListener playerListener = new pListener();
|
||||||
private final vListener vehicleListener = new vListener();
|
private final vListener vehicleListener = new vListener();
|
||||||
private final wListener worldListener = new wListener();
|
private final wListener worldListener = new wListener();
|
||||||
|
private final eListener entityListener = new eListener();
|
||||||
public static Logger log;
|
public static Logger log;
|
||||||
private Configuration config;
|
private Configuration config;
|
||||||
private PluginManager pm;
|
private PluginManager pm;
|
||||||
@ -65,6 +68,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
private static String invMsg = "Invalid Destination";
|
private static String invMsg = "Invalid Destination";
|
||||||
private static String blockMsg = "Destination Blocked";
|
private static String blockMsg = "Destination Blocked";
|
||||||
private static String defNetwork = "central";
|
private static String defNetwork = "central";
|
||||||
|
private static boolean destroyExplosion = false;
|
||||||
private static int activeLimit = 10;
|
private static int activeLimit = 10;
|
||||||
private static int openLimit = 10;
|
private static int openLimit = 10;
|
||||||
|
|
||||||
@ -115,6 +119,8 @@ public class Stargate extends JavaPlugin {
|
|||||||
|
|
||||||
pm.registerEvent(Event.Type.WORLD_LOADED, worldListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.WORLD_LOADED, worldListener, Priority.Normal, this);
|
||||||
|
|
||||||
|
pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Priority.Normal, this);
|
||||||
|
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new SGThread(), 0L, 100L);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new SGThread(), 0L, 100L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +135,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
invMsg = config.getString("not-selected-message", invMsg);
|
invMsg = config.getString("not-selected-message", invMsg);
|
||||||
blockMsg = config.getString("other-side-blocked-message", blockMsg);
|
blockMsg = config.getString("other-side-blocked-message", blockMsg);
|
||||||
defNetwork = config.getString("default-gate-network", defNetwork).trim();
|
defNetwork = config.getString("default-gate-network", defNetwork).trim();
|
||||||
|
destroyExplosion = config.getBoolean("destroyexplosion", destroyExplosion);
|
||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,6 +149,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
config.setProperty("not-selected-message", invMsg);
|
config.setProperty("not-selected-message", invMsg);
|
||||||
config.setProperty("other-side-blocked-message", blockMsg);
|
config.setProperty("other-side-blocked-message", blockMsg);
|
||||||
config.setProperty("default-gate-network", defNetwork);
|
config.setProperty("default-gate-network", defNetwork);
|
||||||
|
config.setProperty("destroyexplosion", destroyExplosion);
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,6 +173,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
File newFile = new File(portalFolder, getServer().getWorlds().get(0).getName() + ".db");
|
File newFile = new File(portalFolder, getServer().getWorlds().get(0).getName() + ".db");
|
||||||
if (!newFile.exists()) {
|
if (!newFile.exists()) {
|
||||||
|
newFile.getParentFile().mkdirs();
|
||||||
// Migrate not-so-old stargate db
|
// Migrate not-so-old stargate db
|
||||||
File oldishFile = new File("plugins/Stargate/stargate.db");
|
File oldishFile = new File("plugins/Stargate/stargate.db");
|
||||||
if (oldishFile.exists()) {
|
if (oldishFile.exists()) {
|
||||||
@ -417,15 +426,15 @@ public class Stargate extends JavaPlugin {
|
|||||||
Portal portal = Portal.getByBlock(block);
|
Portal portal = Portal.getByBlock(block);
|
||||||
if (portal == null) return;
|
if (portal == null) return;
|
||||||
|
|
||||||
if (!hasPerm(player, "stargate.destroy", player.isOp())) {
|
if (hasPerm(player, "stargate.destroy", player.isOp()) || hasPerm(player, "stargate.destroy.all", player.isOp()) ||
|
||||||
event.setCancelled(true);
|
( portal.getOwner().equalsIgnoreCase(player.getName()) && hasPerm(player, "stargate.destroy.owner", false) )) {
|
||||||
return;
|
portal.unregister();
|
||||||
|
if (!dmgMsg.isEmpty()) {
|
||||||
|
player.sendMessage(ChatColor.RED + dmgMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
portal.unregister();
|
event.setCancelled(true);
|
||||||
if (!dmgMsg.isEmpty()) {
|
|
||||||
player.sendMessage(ChatColor.RED + dmgMsg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -457,6 +466,24 @@ public class Stargate extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class eListener extends EntityListener {
|
||||||
|
@Override
|
||||||
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
|
if (event.isCancelled()) return;
|
||||||
|
for (Block b : event.blockList()) {
|
||||||
|
if (b.getTypeId() != Material.WALL_SIGN.getId() && b.getTypeId() != Material.STONE_BUTTON.getId()) continue;
|
||||||
|
Portal portal = Portal.getByBlock(b);
|
||||||
|
if (portal == null) continue;
|
||||||
|
if (destroyExplosion) {
|
||||||
|
portal.unregister();
|
||||||
|
} else {
|
||||||
|
b.setType(b.getType());
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class SGThread implements Runnable {
|
private class SGThread implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
long time = System.currentTimeMillis() / 1000;
|
long time = System.currentTimeMillis() / 1000;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: Stargate
|
name: Stargate
|
||||||
main: net.TheDgtl.Stargate.Stargate
|
main: net.TheDgtl.Stargate.Stargate
|
||||||
version: 0.24
|
version: 0.25
|
||||||
description: Stargate mod for Bukkit
|
description: Stargate mod for Bukkit
|
||||||
author: Drakia
|
author: Drakia
|
||||||
website: http://www.thedgtl.net
|
website: http://www.thedgtl.net
|
Loading…
Reference in New Issue
Block a user