7 Commits

11 changed files with 97 additions and 43 deletions

View File

@ -1,3 +1,6 @@
## 2.1.2
* Fixed a bug where players got teleported one block beside the real portal.
* Fixed a bug where gates with no location caused multiply exceptions.
## 2.1.1
* Made the list command more reliable.
* Error messages will be displayed less frequent.

View File

@ -1,5 +1,5 @@
name: Craft Inc. Gates
version: 2.1.1
version: 2.1.2
description: A plugin to create gates for fast traveling.
softdepend: [Vault]
author: tomco, s1m0ne

68
pom.xml
View File

@ -5,41 +5,79 @@
<groupId>de.craftinc</groupId>
<artifactId>CraftIncGates</artifactId>
<packaging>jar</packaging>
<version>1.1.1</version>
<version>2.1.2</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.2.1</version>
<executions>
<execution>
<id>Run Test Bukkit Server</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/scripts/test-deployment.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>RELEASE</version>
<version>1.5.2-R0.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.5.2-R0.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>Vault</artifactId>
<version>1.2.23-SNAPSHOT</version>
<version>1.2.26-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<directory>target</directory>
<outputDirectory>target/classes</outputDirectory>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>resources</directory>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>bukkit-repo</id>

View File

@ -177,7 +177,7 @@ public abstract class BaseGate
throw new Exception("Gate got closed. It has no exit.");
}
if (gateBlockLocations.size() == 0) {
if (gateBlockLocations == null || gateBlockLocations.size() == 0) {
setOpen(false);
throw new Exception("Gate got closed. The frame is missing or broken.");
}

View File

@ -142,8 +142,10 @@ public class Gate extends BaseGate implements ConfigurationSerializable
retVal.put(exitYawKey, exit.getYaw());
}
retVal.put(locationPitchKey, location.getPitch());
retVal.put(locationYawKey, location.getYaw());
if (location != null) {
retVal.put(locationPitchKey, location.getPitch());
retVal.put(locationYawKey, location.getYaw());
}
List<Map<String, Object>> serializedGateBlocks = new ArrayList<Map<String, Object>>();

View File

@ -142,7 +142,7 @@ public abstract class BaseCommand
*/
protected boolean hasPermission()
{
if (Plugin.permission == null) // fallback <20> use the standard bukkit permission system
if (Plugin.permission == null) // fallback <20> use the standard bukkit permission system
{
return this.sender.hasPermission(this.requiredPermission);
}
@ -156,7 +156,7 @@ public abstract class BaseCommand
}
else
{
// sender is no player <20> there is no information about the senders locations
// sender is no player <20> there is no information about the senders locations
return Plugin.permission.has(this.sender, this.requiredPermission);
}
@ -205,17 +205,23 @@ public abstract class BaseCommand
{
return false;
}
boolean permAtLocation = Plugin.permission.has(this.gate.getLocation().getWorld(), p.getName(), this.requiredPermission);
boolean permAtLocation;
if (this.gate.getLocation() == null) {
permAtLocation = true;
}
else {
permAtLocation = Plugin.permission.has(this.gate.getLocation().getWorld(), p.getName(), this.requiredPermission);
}
boolean permAtExit;
if (this.gate.getExit() == null)
{
if (this.gate.getExit() == null) {
permAtExit = true;
}
else
{
else {
permAtExit = Plugin.permission.has(this.gate.getExit().getWorld(), p.getName(), this.requiredPermission);
}

View File

@ -42,12 +42,14 @@ public class CommandCreate extends BaseLocationCommand
}
catch (Exception e)
{
sendMessage(ChatColor.RED + "Creating the gate failed!" + e.getMessage() + "See server log for more information");
sendMessage(ChatColor.RED + "Creating the gate failed!" + e.getMessage() + " See server log for more information");
return;
}
Location playerLocation = getValidPlayerLocation();
Plugin.log("player location:" + playerLocation);
if (playerLocation != null)
{
try
@ -62,8 +64,7 @@ public class CommandCreate extends BaseLocationCommand
}
else
{
sendMessage(ChatColor.GREEN + "Gate with id \"" + id + "\" was created.");
sendMessage("Now you should build a frame and:");
sendMessage("Now you should build a frame and execute:");
sendMessage(new CommandSetLocation().getUsageTemplate(true, true));
}
}

View File

@ -18,7 +18,7 @@ public class CommandInfo extends BaseCommand
requiredParameters.add("id");
helpDescription = "Prints detailed informations about a certain gate.";
helpDescription = "Print detailed informations about a certain gate.";
requiredPermission = Plugin.permissionInfo;
@ -49,12 +49,12 @@ public class CommandInfo extends BaseCommand
if (gate.getLocation() != null)
sendMessage(ChatColor.DARK_AQUA + "from: " + ChatColor.AQUA + "( " + gate.getLocation().getBlockX() + " | " + gate.getLocation().getBlockY() + " | " + gate.getLocation().getBlockZ() + " ) in " + gate.getLocation().getWorld().getName());
else
sendMessage(ChatColor.DARK_AQUA + "NOTE: this gate has no 'from' location");
sendMessage(ChatColor.DARK_AQUA + "NOTE: this gate has no location");
if (gate.getExit() != null)
sendMessage(ChatColor.DARK_AQUA + "to: " + ChatColor.AQUA + "( " + gate.getExit().getBlockX() + " | " + gate.getExit().getBlockY() + " | " + gate.getExit().getBlockZ() + " ) in " + gate.getExit().getWorld().getName());
else
sendMessage(ChatColor.DARK_AQUA + "NOTE: this gate has no 'to' location");
sendMessage(ChatColor.DARK_AQUA + "NOTE: this gate has no exit");
}
}

View File

@ -144,10 +144,12 @@ public class CommandList extends BaseCommand
for (Gate gate : gatesCopy) {
boolean permissionAtGateLocation = Plugin.permission.has(gate.getLocation().getWorld(), p.getName(), this.requiredPermission);
if (!permissionAtGateLocation) {
gates.remove(gate);
continue;
if (gate.getLocation() != null) {
boolean permissionAtGateLocation = Plugin.permission.has(gate.getLocation().getWorld(), p.getName(), this.requiredPermission);
if (!permissionAtGateLocation) {
gates.remove(gate);
continue;
}
}
if (gate.getExit() != null) {

View File

@ -51,10 +51,13 @@ public class GateUtil
}
// Check if the gate is open and useable
if (g.getLocation() == null) {
continue;
}
World gateWorld = g.getLocation().getWorld();
if (!g.isOpen() || !gateWorld.equals(playerWorld))
{
if (!g.isOpen() || !gateWorld.equals(playerWorld)) {
continue;
}

View File

@ -2,7 +2,6 @@ package de.craftinc.gates.util;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.World;
@ -90,13 +89,13 @@ public class LocationUtil
if (l1.getWorld() != l2.getWorld() && (l1.getWorld() == null || !l1.getWorld().equals(l2.getWorld()))) {
return false;
}
if (new Double(l1.getX()).longValue() != new Double(l2.getX()).longValue()) {
if (l1.getBlockX() != l2.getBlockX()) {
return false;
}
if (new Double(l1.getY()).longValue() != new Double(l2.getY()).longValue()) {
if (l1.getBlockY() != l2.getBlockY()) {
return false;
}
if (new Double(l1.getZ()).longValue() != new Double(l2.getZ()).longValue()) {
if (l1.getBlockZ() != l2.getBlockZ()) {
return false;
}