Updated to work with 1.2, hopefully.

This commit is contained in:
Jacob Brunson 2012-03-04 20:32:19 -06:00
parent b71432ac33
commit 6d15e17bb2
9 changed files with 25 additions and 40 deletions

Binary file not shown.

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jardesc>
<jar path="C:/Users/Olof Larsson/Desktop/devserver/plugins/AncientGates.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/AncientGates/localexport.jardesc" exportErrors="false" exportWarnings="true" includeDirectoryEntries="false" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>
<manifest generateManifest="true" manifestLocation="/Vampire/MANIFEST.MF" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
<sealing sealJar="false">
<packagesToSeal/>
<packagesToUnSeal/>
</sealing>
</manifest>
<selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false">
<file path="/AncientGates/README.md"/>
<file path="/AncientGates/plugin.yml"/>
<javaElement handleIdentifier="=AncientGates/src"/>
<file path="/AncientGates/LGPL.txt"/>
<file path="/AncientGates/gson-license.txt"/>
<file path="/AncientGates/LICENCE.txt"/>
</selectedElements>
</jardesc>

View File

@ -1,5 +1,5 @@
name: AncientGates
version: 1.0.1
version: 1.1
main: org.mcteam.ancientgates.Plugin
commands:
gate:

View File

@ -5,6 +5,7 @@ import java.lang.reflect.Type;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.WorldCreator;
import org.mcteam.ancientgates.gson.JsonDeserializationContext;
import org.mcteam.ancientgates.gson.JsonDeserializer;
import org.mcteam.ancientgates.gson.JsonElement;
@ -63,7 +64,7 @@ public class MyLocationTypeAdapter implements JsonDeserializer<Location>, JsonSe
private World getWorld(String name) {
World world = Plugin.instance.getServer().getWorld(name);
if (world == null) {
world = Plugin.instance.getServer().createWorld(name, Environment.NORMAL);
world = Plugin.instance.getServer().createWorld(new WorldCreator(name).environment(Environment.NORMAL));
}
return world;
}

View File

@ -75,8 +75,8 @@ public class Plugin extends JavaPlugin {
// Register events
PluginManager pm = this.getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_MOVE, this.playerListener, Event.Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_PHYSICS, this.blockListener, Event.Priority.Normal, this);
pm.registerEvents(this.playerListener, this);
pm.registerEvents(this.blockListener, this);
log("Enabled");
}
@ -98,8 +98,7 @@ public class Plugin extends JavaPlugin {
if (this.baseCommand != null) {
return this.baseCommand;
}
Map<String, Object> Commands = (Map<String, Object>)this.getDescription().getCommands();
Map<String, Map<String, Object>> Commands = this.getDescription().getCommands();
this.baseCommand = Commands.keySet().iterator().next();
return this.baseCommand;
}

View File

@ -19,7 +19,7 @@ public class CommandSetFrom extends BaseCommand {
// The player might stand in a halfblock or a sign or whatever
// Therefore we load som extra locations and blocks
Block playerBlock = player.getLocation().getBlock();
Block upBlock = playerBlock.getFace(BlockFace.UP);
Block upBlock = playerBlock.getRelative(BlockFace.UP);
if (playerBlock.getType() == Material.AIR) {
gate.setFrom(playerBlock.getLocation());

View File

@ -3,11 +3,14 @@ package org.mcteam.ancientgates.listeners;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPhysicsEvent;
public class PluginBlockListener extends BlockListener {
@Override
public class PluginBlockListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockPhysics(BlockPhysicsEvent event) {
if (event.isCancelled()) {
return;
@ -23,19 +26,19 @@ public class PluginBlockListener extends BlockListener {
}
public boolean isBlockInPortal(Block block) {
if (block.getFace(BlockFace.UP).getType() == Material.AIR) {
if (block.getRelative(BlockFace.UP).getType() == Material.AIR) {
return false;
}
if (block.getFace(BlockFace.DOWN).getType() == Material.AIR) {
if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR) {
return false;
}
if ( block.getFace(BlockFace.NORTH).getType() != Material.AIR && block.getFace(BlockFace.SOUTH).getType() != Material.AIR ) {
if ( block.getRelative(BlockFace.NORTH).getType() != Material.AIR && block.getRelative(BlockFace.SOUTH).getType() != Material.AIR ) {
return true;
}
if ( block.getFace(BlockFace.WEST).getType() != Material.AIR && block.getFace(BlockFace.EAST).getType() != Material.AIR ) {
if ( block.getRelative(BlockFace.WEST).getType() != Material.AIR && block.getRelative(BlockFace.EAST).getType() != Material.AIR ) {
return true;
}

View File

@ -8,7 +8,9 @@ import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.mcteam.ancientgates.Conf;
import org.mcteam.ancientgates.Gate;
@ -16,15 +18,16 @@ import org.mcteam.ancientgates.Plugin;
import org.mcteam.ancientgates.util.GeometryUtil;
public class PluginPlayerListener extends PlayerListener {
@Override
public class PluginPlayerListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerMove(PlayerMoveEvent event) {
if (event.isCancelled()) {
return;
}
Block blockTo = event.getTo().getBlock();
Block blockToUp = blockTo.getFace(BlockFace.UP);
Block blockToUp = blockTo.getRelative(BlockFace.UP);
if (blockTo.getType() != Material.PORTAL && blockToUp.getType() != Material.PORTAL) {
return;

View File

@ -68,7 +68,7 @@ public class FloodUtil {
// ... And flood away !
for (BlockFace face : expandFaces) {
Block potentialBlock = startBlock.getFace(face);
Block potentialBlock = startBlock.getRelative(face);
foundBlocks = getAirFloodBlocks(potentialBlock, foundBlocks, expandFaces, limit);
}
}