Revert local repo

This commit is contained in:
Steven Scott 2011-11-21 20:09:05 -08:00
parent 1713654cdf
commit 52225ac12d
3 changed files with 46 additions and 50 deletions

View File

@ -6,6 +6,7 @@ import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
import org.bukkit.craftbukkit.CraftWorld;
/** /**
* SignPost.java * SignPost.java
@ -71,11 +72,15 @@ public class SignPost {
final Sign sign = findSign(); final Sign sign = findSign();
if (sign == null) return; if (sign == null) return;
Stargate.server.getScheduler().scheduleSyncDelayedTask(Stargate.stargate, new Runnable() { // TODO: Hackish workaround for signs not updating. Fix when Bukkit fixes
CraftWorld cw = (CraftWorld)sign.getWorld();
cw.getHandle().notify(sign.getX(), sign.getY(), sign.getZ());
/*Stargate.server.getScheduler().scheduleSyncDelayedTask(Stargate.stargate, new Runnable() {
public void run() { public void run() {
sign.update(); sign.update();
} }
}); }, 5);*/
} }
private void findParent() { private void findParent() {

View File

@ -14,6 +14,7 @@ import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
@ -43,7 +44,6 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.config.Configuration;
// Permissions // Permissions
import com.nijikokun.bukkit.Permissions.Permissions; import com.nijikokun.bukkit.Permissions.Permissions;
@ -66,7 +66,7 @@ public class Stargate extends JavaPlugin {
private final sListener serverListener = new sListener(); private final sListener serverListener = new sListener();
public static Logger log; public static Logger log;
private Configuration config; private FileConfiguration newConfig;
private PluginManager pm; private PluginManager pm;
public static Server server; public static Server server;
public static Stargate stargate; public static Stargate stargate;
@ -97,7 +97,7 @@ public class Stargate extends JavaPlugin {
public void onEnable() { public void onEnable() {
PluginDescriptionFile pdfFile = this.getDescription(); PluginDescriptionFile pdfFile = this.getDescription();
pm = getServer().getPluginManager(); pm = getServer().getPluginManager();
config = this.getConfiguration(); newConfig = this.getConfig();
log = Logger.getLogger("Minecraft"); log = Logger.getLogger("Minecraft");
Stargate.server = getServer(); Stargate.server = getServer();
Stargate.stargate = this; Stargate.stargate = this;
@ -112,7 +112,7 @@ public class Stargate extends JavaPlugin {
pm.registerEvent(Event.Type.BLOCK_FROMTO, blockListener, Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_FROMTO, blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_PHYSICS, blockListener, Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_PHYSICS, blockListener, Priority.Normal, this);
this.reloadConfig(); this.loadConfig();
this.migrate(); this.migrate();
this.reloadGates(); this.reloadGates();
lang = new LangLoader(langFolder, Stargate.langName); lang = new LangLoader(langFolder, Stargate.langName);
@ -147,50 +147,29 @@ public class Stargate extends JavaPlugin {
getServer().getScheduler().scheduleSyncRepeatingTask(this, new SGThread(), 0L, 100L); getServer().getScheduler().scheduleSyncRepeatingTask(this, new SGThread(), 0L, 100L);
} }
public void reloadConfig() { public void loadConfig() {
config.load(); // Copy default values if required, save config
portalFolder = config.getString("portal-folder", portalFolder); newConfig.options().copyDefaults(true);
gateFolder = config.getString("gate-folder", gateFolder); this.saveConfig();
defNetwork = config.getString("default-gate-network", defNetwork).trim();
destroyExplosion = config.getBoolean("destroyexplosion", destroyExplosion); // Load values into variables
maxGates = config.getInt("maxgates", maxGates); portalFolder = newConfig.getString("portal-folder");
langName = config.getString("lang", langName); gateFolder = newConfig.getString("gate-folder");
defNetwork = newConfig.getString("default-gate-network").trim();
destroyExplosion = newConfig.getBoolean("destroyexplosion");
maxGates = newConfig.getInt("maxgates");
langName = newConfig.getString("lang");
// Debug // Debug
debug = config.getBoolean("debug", debug); debug = newConfig.getBoolean("debug");
permDebug = config.getBoolean("permdebug", permDebug); permDebug = newConfig.getBoolean("permdebug");
// iConomy // iConomy
iConomyHandler.useiConomy = config.getBoolean("useiconomy", iConomyHandler.useiConomy); iConomyHandler.useiConomy = newConfig.getBoolean("useiconomy");
iConomyHandler.createCost = config.getInt("createcost", iConomyHandler.createCost); iConomyHandler.createCost = newConfig.getInt("createcost");
iConomyHandler.destroyCost = config.getInt("destroycost", iConomyHandler.destroyCost); iConomyHandler.destroyCost = newConfig.getInt("destroycost");
iConomyHandler.useCost = config.getInt("usecost", iConomyHandler.useCost); iConomyHandler.useCost = newConfig.getInt("usecost");
iConomyHandler.toOwner = config.getBoolean("toowner", iConomyHandler.toOwner); iConomyHandler.toOwner = newConfig.getBoolean("toowner");
iConomyHandler.chargeFreeDestination = config.getBoolean("chargefreedestination", iConomyHandler.chargeFreeDestination); iConomyHandler.chargeFreeDestination = newConfig.getBoolean("chargefreedestination");
iConomyHandler.freeGatesGreen = config.getBoolean("freegatesgreen", iConomyHandler.freeGatesGreen); iConomyHandler.freeGatesGreen = newConfig.getBoolean("freegatesgreen");
saveConfig();
}
public void saveConfig() {
if (!debug)
config.removeProperty("debug");
if (!permDebug)
config.removeProperty("permdebug");
config.setProperty("portal-folder", portalFolder);
config.setProperty("gate-folder", gateFolder);
config.setProperty("default-gate-network", defNetwork);
config.setProperty("destroyexplosion", destroyExplosion);
config.setProperty("maxgates", maxGates);
config.setProperty("lang", langName);
// iConomy
config.setProperty("useiconomy", iConomyHandler.useiConomy);
config.setProperty("createcost", iConomyHandler.createCost);
config.setProperty("destroycost", iConomyHandler.destroyCost);
config.setProperty("usecost", iConomyHandler.useCost);
config.setProperty("toowner", iConomyHandler.toOwner);
config.setProperty("chargefreedestination", iConomyHandler.chargeFreeDestination);
config.setProperty("freegatesgreen", iConomyHandler.freeGatesGreen);
config.save();
} }
public void reloadGates() { public void reloadGates() {
@ -760,6 +739,11 @@ public class Stargate extends JavaPlugin {
if ((block.getType() == Material.STONE_BUTTON)) { if ((block.getType() == Material.STONE_BUTTON)) {
Portal portal = Portal.getByBlock(block); Portal portal = Portal.getByBlock(block);
if (portal == null) return; if (portal == null) return;
// Cancel item use
event.setUseItemInHand(Result.DENY);
event.setUseInteractedBlock(Result.DENY);
if (!Stargate.canAccessNetwork(player, portal.getNetwork())) { if (!Stargate.canAccessNetwork(player, portal.getNetwork())) {
Stargate.sendMessage(player, Stargate.getString("denyMsg")); Stargate.sendMessage(player, Stargate.getString("denyMsg"));
return; return;
@ -776,6 +760,9 @@ public class Stargate extends JavaPlugin {
Portal portal = Portal.getByBlock(block); Portal portal = Portal.getByBlock(block);
if (portal == null) return; if (portal == null) return;
event.setUseInteractedBlock(Result.DENY);
event.setCancelled(true);
if (!Stargate.canAccessNetwork(player, portal.getNetwork())) { if (!Stargate.canAccessNetwork(player, portal.getNetwork())) {
Stargate.sendMessage(player, Stargate.getString("denyMsg")); Stargate.sendMessage(player, Stargate.getString("denyMsg"));
return; return;
@ -791,6 +778,10 @@ public class Stargate extends JavaPlugin {
if (block.getType() == Material.STONE_BUTTON) { if (block.getType() == Material.STONE_BUTTON) {
Portal portal = Portal.getByBlock(block); Portal portal = Portal.getByBlock(block);
if (portal == null) return; if (portal == null) return;
event.setUseInteractedBlock(Result.DENY);
event.setCancelled(true);
if (!Stargate.canAccessNetwork(player, portal.getNetwork())) { if (!Stargate.canAccessNetwork(player, portal.getNetwork())) {
Stargate.sendMessage(player, Stargate.getString("denyMsg")); Stargate.sendMessage(player, Stargate.getString("denyMsg"));
return; return;
@ -1062,7 +1053,7 @@ public class Stargate extends JavaPlugin {
Gate.clearGates(); Gate.clearGates();
// Reload data // Reload data
reloadConfig(); loadConfig();
reloadGates(); reloadGates();
lang.setLang(langName); lang.setLang(langName);
lang.reload(); lang.reload();

View File

@ -1,6 +1,6 @@
name: Stargate name: Stargate
main: net.TheDgtl.Stargate.Stargate main: net.TheDgtl.Stargate.Stargate
version: 0.6.10 version: 0.7.0
description: Stargate mod for Bukkit description: Stargate mod for Bukkit
author: Drakia author: Drakia
website: http://www.thedgtl.net website: http://www.thedgtl.net