[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
maxgates - If non-zero, will define the maximum amount of gates allowed on any network.
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
permdebug - Whether to show massive permission debug output
@ -196,6 +197,10 @@ createConflict=Gate conflicts with existing gate
=============
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]
- Minecraft 1.0.0 support
- New FileConfiguration implemented

View File

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

View File

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

View File

@ -6,7 +6,6 @@ import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.craftbukkit.CraftWorld;
/**
* SignPost.java
@ -72,16 +71,8 @@ public class SignPost {
final Sign sign = findSign();
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();
}
}, 5);*/
}
private void findParent() {
Sign sign = findSign();

View File

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

View File

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