[Version 0.7.1]

- Added destMemory option
 - Switched to sign.update() as Bukkit implemented my fix
 - Threw in a catch for a null from location for portal events
This commit is contained in:
Steven Scott 2011-11-24 20:08:29 -08:00
parent 61e42034dd
commit 7f7b18bd4a
6 changed files with 29 additions and 15 deletions

5
README
View File

@ -154,6 +154,7 @@ freegatesgreen - Enable to make gates that won't cost the player money show up a
toowner - Whether the money from gate-use goes to the owner or nobody toowner - Whether the money from gate-use goes to the owner or nobody
maxgates - If non-zero, will define the maximum amount of gates allowed on any network. maxgates - If non-zero, will define the maximum amount of gates allowed on any network.
lang - The language to use (Included languages: en, de) lang - The language to use (Included languages: en, de)
destMemory - Whether to set the first destination as the last used destination for all gates
debug - Whether to show massive debug output debug - Whether to show massive debug output
permdebug - Whether to show massive permission debug output permdebug - Whether to show massive permission debug output
@ -196,6 +197,10 @@ createConflict=Gate conflicts with existing gate
============= =============
Changes Changes
============= =============
[Version 0.7.1]
- Added destMemory option
- Switched to sign.update() as Bukkit implemented my fix
- Threw in a catch for a null from location for portal events
[Version 0.7.0] [Version 0.7.0]
- Minecraft 1.0.0 support - Minecraft 1.0.0 support
- New FileConfiguration implemented - New FileConfiguration implemented

View File

@ -13,6 +13,8 @@ destroyexplosion: false
maxgates: 0 maxgates: 0
# The language file to load for messages # The language file to load for messages
lang: en lang: en
# Whether to remember the cursor location between uses
destMemory: false
# Stargate economy options # Stargate economy options

View File

@ -60,6 +60,7 @@ public class Portal {
// Gate information // Gate information
private String name; private String name;
private String destination; private String destination;
private String lastDest = "";
private String network; private String network;
private Gate gate; private Gate gate;
private String owner = ""; private String owner = "";
@ -432,7 +433,6 @@ public class Portal {
destinations.clear(); destinations.clear();
destination = ""; destination = "";
drawSign();
Stargate.activeList.add(this); Stargate.activeList.add(this);
activePlayer = player; activePlayer = player;
String network = getNetwork(); String network = getNetwork();
@ -451,6 +451,10 @@ public class Portal {
destinations.add(portal.getName()); destinations.add(portal.getName());
} }
} }
if (Stargate.destMemory && destinations.contains(lastDest)) {
destination = lastDest;
}
drawSign();
} }
public void deactivate() { public void deactivate() {
@ -489,10 +493,12 @@ public class Portal {
} }
public void cycleDestination(Player player, int dir) { public void cycleDestination(Player player, int dir) {
Boolean activate = false;
if (!isActive() || getActivePlayer() != player) { if (!isActive() || getActivePlayer() != player) {
activate(player); activate(player);
Stargate.debug("cycleDestination", "Network Size: " + allPortalsNet.get(network.toLowerCase()).size()); Stargate.debug("cycleDestination", "Network Size: " + allPortalsNet.get(network.toLowerCase()).size());
Stargate.debug("cycleDestination", "Player has access to: " + destinations.size()); Stargate.debug("cycleDestination", "Player has access to: " + destinations.size());
activate = true;
} }
if (destinations.size() == 0) { if (destinations.size() == 0) {
@ -500,7 +506,7 @@ public class Portal {
return; return;
} }
if (destinations.size() > 0) { if (!activate || lastDest.isEmpty()) {
int index = destinations.indexOf(destination); int index = destinations.indexOf(destination);
index += dir; index += dir;
if (index >= destinations.size()) if (index >= destinations.size())
@ -508,6 +514,7 @@ public class Portal {
else if (index < 0) else if (index < 0)
index = destinations.size() - 1; index = destinations.size() - 1;
destination = destinations.get(index); destination = destinations.get(index);
lastDest = destination;
} }
openTime = System.currentTimeMillis() / 1000; openTime = System.currentTimeMillis() / 1000;
drawSign(); drawSign();

View File

@ -6,7 +6,6 @@ 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
@ -72,16 +71,8 @@ public class SignPost {
final Sign sign = findSign(); final Sign sign = findSign();
if (sign == null) return; if (sign == null) return;
// 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() {
sign.update(); sign.update();
} }
}, 5);*/
}
private void findParent() { private void findParent() {
Sign sign = findSign(); Sign sign = findSign();

View File

@ -81,6 +81,7 @@ public class Stargate extends JavaPlugin {
private static String langName = "en"; private static String langName = "en";
private static int activeTime = 10; private static int activeTime = 10;
private static int openTime = 10; private static int openTime = 10;
public static boolean destMemory = false;
// Used for debug // Used for debug
public static boolean debug = false; public static boolean debug = false;
@ -148,9 +149,10 @@ public class Stargate extends JavaPlugin {
} }
public void loadConfig() { public void loadConfig() {
// Copy default values if required, save config reloadConfig();
newConfig = this.getConfig();
// Copy default values if required
newConfig.options().copyDefaults(true); newConfig.options().copyDefaults(true);
this.saveConfig();
// Load values into variables // Load values into variables
portalFolder = newConfig.getString("portal-folder"); portalFolder = newConfig.getString("portal-folder");
@ -159,6 +161,7 @@ public class Stargate extends JavaPlugin {
destroyExplosion = newConfig.getBoolean("destroyexplosion"); destroyExplosion = newConfig.getBoolean("destroyexplosion");
maxGates = newConfig.getInt("maxgates"); maxGates = newConfig.getInt("maxgates");
langName = newConfig.getString("lang"); langName = newConfig.getString("lang");
destMemory = newConfig.getBoolean("destMemory");
// Debug // Debug
debug = newConfig.getBoolean("debug"); debug = newConfig.getBoolean("debug");
permDebug = newConfig.getBoolean("permdebug"); permDebug = newConfig.getBoolean("permdebug");
@ -170,6 +173,8 @@ public class Stargate extends JavaPlugin {
iConomyHandler.toOwner = newConfig.getBoolean("toowner"); iConomyHandler.toOwner = newConfig.getBoolean("toowner");
iConomyHandler.chargeFreeDestination = newConfig.getBoolean("chargefreedestination"); iConomyHandler.chargeFreeDestination = newConfig.getBoolean("chargefreedestination");
iConomyHandler.freeGatesGreen = newConfig.getBoolean("freegatesgreen"); iConomyHandler.freeGatesGreen = newConfig.getBoolean("freegatesgreen");
this.saveConfig();
} }
public void reloadGates() { public void reloadGates() {
@ -629,6 +634,10 @@ public class Stargate extends JavaPlugin {
public void onPlayerPortal(PlayerPortalEvent event) { public void onPlayerPortal(PlayerPortalEvent event) {
// Do a quick check for a stargate // Do a quick check for a stargate
Location from = event.getFrom(); Location from = event.getFrom();
if (from == null) {
Stargate.debug("onPlayerPortal", "From location is null. Stupid Bukkit");
return;
}
World world = from.getWorld(); World world = from.getWorld();
int cX = from.getBlockX(); int cX = from.getBlockX();
int cY = from.getBlockY(); int cY = from.getBlockY();

View File

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