Merge branch 'master' of git://github.com/DrAgonmoray/minecraft-ancient-gates
Conflicts: src/org/mcteam/ancientgates/MyLocationTypeAdapter.java src/org/mcteam/ancientgates/Plugin.java src/org/mcteam/ancientgates/commands/CommandSetFrom.java src/org/mcteam/ancientgates/listeners/PluginBlockListener.java src/org/mcteam/ancientgates/listeners/PluginPlayerListener.java src/org/mcteam/ancientgates/util/FloodUtil.java
This commit is contained in:
commit
7346044eea
@ -2,6 +2,10 @@
|
|||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Tim/minecraft/bukkit/1000/bukkit-0.0.1-SNAPSHOT.jar" sourcepath="/Bukkit"/>
|
<classpathentry kind="lib" path="/Volumes/Data HD/Users/tobi/Code/bukkit-1.1-R5-20120224.051137-12.jar" sourcepath="/Users/tobi/Desktop/Bukkit">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="javadoc_location" value="http://jd.bukkit.org/apidocs/"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
74
build.xml
Normal file
74
build.xml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- You may freely edit this file. See commented blocks below for -->
|
||||||
|
<!-- some examples of how to customize the build. -->
|
||||||
|
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||||
|
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||||
|
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||||
|
<!-- the Compile on Save feature is turned off for the project. -->
|
||||||
|
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||||
|
<!-- in the project's Project Properties dialog box.-->
|
||||||
|
<project name="AncientGates" default="default" basedir=".">
|
||||||
|
<description>Builds, tests, and runs the project AncientGates.</description>
|
||||||
|
<import file="nbproject/build-impl.xml"/>
|
||||||
|
<!--
|
||||||
|
|
||||||
|
There exist several targets which are by default empty and which can be
|
||||||
|
used for execution of your tasks. These targets are usually executed
|
||||||
|
before and after some main targets. They are:
|
||||||
|
|
||||||
|
-pre-init: called before initialization of project properties
|
||||||
|
-post-init: called after initialization of project properties
|
||||||
|
-pre-compile: called before javac compilation
|
||||||
|
-post-compile: called after javac compilation
|
||||||
|
-pre-compile-single: called before javac compilation of single file
|
||||||
|
-post-compile-single: called after javac compilation of single file
|
||||||
|
-pre-compile-test: called before javac compilation of JUnit tests
|
||||||
|
-post-compile-test: called after javac compilation of JUnit tests
|
||||||
|
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||||
|
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||||
|
-pre-jar: called before JAR building
|
||||||
|
-post-jar: called after JAR building
|
||||||
|
-post-clean: called after cleaning build products
|
||||||
|
|
||||||
|
(Targets beginning with '-' are not intended to be called on their own.)
|
||||||
|
|
||||||
|
Example of inserting an obfuscator after compilation could look like this:
|
||||||
|
|
||||||
|
<target name="-post-compile">
|
||||||
|
<obfuscate>
|
||||||
|
<fileset dir="${build.classes.dir}"/>
|
||||||
|
</obfuscate>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
For list of available properties check the imported
|
||||||
|
nbproject/build-impl.xml file.
|
||||||
|
|
||||||
|
|
||||||
|
Another way to customize the build is by overriding existing main targets.
|
||||||
|
The targets of interest are:
|
||||||
|
|
||||||
|
-init-macrodef-javac: defines macro for javac compilation
|
||||||
|
-init-macrodef-junit: defines macro for junit execution
|
||||||
|
-init-macrodef-debug: defines macro for class debugging
|
||||||
|
-init-macrodef-java: defines macro for class execution
|
||||||
|
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||||
|
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||||
|
run: execution of project
|
||||||
|
-javadoc-build: Javadoc generation
|
||||||
|
test-report: JUnit report generation
|
||||||
|
|
||||||
|
An example of overriding the target for project execution could look like this:
|
||||||
|
|
||||||
|
<target name="run" depends="AncientGates-impl.jar">
|
||||||
|
<exec dir="bin" executable="launcher.exe">
|
||||||
|
<arg file="${dist.jar}"/>
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
Notice that the overridden target depends on the jar target and not only on
|
||||||
|
the compile target as the regular run target does. Again, for a list of available
|
||||||
|
properties which you can use, check the target you are overriding in the
|
||||||
|
nbproject/build-impl.xml file.
|
||||||
|
|
||||||
|
-->
|
||||||
|
</project>
|
@ -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>
|
|
@ -1,5 +1,5 @@
|
|||||||
name: AncientGates
|
name: AncientGates
|
||||||
version: 1.0.1
|
version: 1.1
|
||||||
main: org.mcteam.ancientgates.Plugin
|
main: org.mcteam.ancientgates.Plugin
|
||||||
commands:
|
commands:
|
||||||
gate:
|
gate:
|
||||||
|
@ -4,8 +4,8 @@ import java.lang.reflect.Type;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
|
|
||||||
import org.mcteam.ancientgates.gson.JsonDeserializationContext;
|
import org.mcteam.ancientgates.gson.JsonDeserializationContext;
|
||||||
import org.mcteam.ancientgates.gson.JsonDeserializer;
|
import org.mcteam.ancientgates.gson.JsonDeserializer;
|
||||||
import org.mcteam.ancientgates.gson.JsonElement;
|
import org.mcteam.ancientgates.gson.JsonElement;
|
||||||
@ -63,10 +63,9 @@ public class MyLocationTypeAdapter implements JsonDeserializer<Location>, JsonSe
|
|||||||
|
|
||||||
private World getWorld(String name) {
|
private World getWorld(String name) {
|
||||||
World world = Plugin.instance.getServer().getWorld(name);
|
World world = Plugin.instance.getServer().getWorld(name);
|
||||||
|
if (world == null) {
|
||||||
if (world == null)
|
world = Plugin.instance.getServer().createWorld(new WorldCreator(name).environment(Environment.NORMAL));
|
||||||
world = Plugin.instance.getServer().createWorld(new WorldCreator(name));
|
}
|
||||||
|
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,27 +7,12 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.mcteam.ancientgates.commands.*;
|
||||||
import org.mcteam.ancientgates.commands.BaseCommand;
|
|
||||||
import org.mcteam.ancientgates.commands.CommandClose;
|
|
||||||
import org.mcteam.ancientgates.commands.CommandCreate;
|
|
||||||
import org.mcteam.ancientgates.commands.CommandCreateSetFrom;
|
|
||||||
import org.mcteam.ancientgates.commands.CommandDelete;
|
|
||||||
import org.mcteam.ancientgates.commands.CommandHelp;
|
|
||||||
import org.mcteam.ancientgates.commands.CommandInfo;
|
|
||||||
import org.mcteam.ancientgates.commands.CommandList;
|
|
||||||
import org.mcteam.ancientgates.commands.CommandOpen;
|
|
||||||
import org.mcteam.ancientgates.commands.CommandRename;
|
|
||||||
import org.mcteam.ancientgates.commands.CommandSetFrom;
|
|
||||||
import org.mcteam.ancientgates.commands.CommandSetTo;
|
|
||||||
|
|
||||||
import org.mcteam.ancientgates.gson.Gson;
|
import org.mcteam.ancientgates.gson.Gson;
|
||||||
import org.mcteam.ancientgates.gson.GsonBuilder;
|
import org.mcteam.ancientgates.gson.GsonBuilder;
|
||||||
|
|
||||||
@ -35,7 +20,8 @@ import org.mcteam.ancientgates.listeners.PluginBlockListener;
|
|||||||
import org.mcteam.ancientgates.listeners.PluginPlayerListener;
|
import org.mcteam.ancientgates.listeners.PluginPlayerListener;
|
||||||
|
|
||||||
|
|
||||||
public class Plugin extends JavaPlugin {
|
public class Plugin extends JavaPlugin
|
||||||
|
{
|
||||||
public static Plugin instance;
|
public static Plugin instance;
|
||||||
|
|
||||||
public PluginPlayerListener playerListener = new PluginPlayerListener();
|
public PluginPlayerListener playerListener = new PluginPlayerListener();
|
||||||
@ -52,7 +38,8 @@ public class Plugin extends JavaPlugin {
|
|||||||
// Commands
|
// Commands
|
||||||
public List<BaseCommand> commands = new ArrayList<BaseCommand>();
|
public List<BaseCommand> commands = new ArrayList<BaseCommand>();
|
||||||
|
|
||||||
public Plugin() {
|
public Plugin()
|
||||||
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,8 +95,7 @@ public class Plugin extends JavaPlugin {
|
|||||||
if (this.baseCommand != null) {
|
if (this.baseCommand != null) {
|
||||||
return this.baseCommand;
|
return this.baseCommand;
|
||||||
}
|
}
|
||||||
|
Map<String, Map<String, Object>> Commands = (Map<String, Map<String, Object>>) this.getDescription().getCommands();
|
||||||
Map<String, Object> Commands = (Map<String, Object>)this.getDescription().getCommands();
|
|
||||||
this.baseCommand = Commands.keySet().iterator().next();
|
this.baseCommand = Commands.keySet().iterator().next();
|
||||||
return this.baseCommand;
|
return this.baseCommand;
|
||||||
}
|
}
|
||||||
|
@ -1,54 +1,47 @@
|
|||||||
package org.mcteam.ancientgates.listeners;
|
package org.mcteam.ancientgates.listeners;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class PluginBlockListener implements Listener
|
public class PluginBlockListener implements Listener
|
||||||
{
|
{
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onBlockPhysics(BlockPhysicsEvent event)
|
public void onBlockPhysics(BlockPhysicsEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (event.getBlock().getType() != Material.PORTAL) {
|
||||||
if (event.getBlock().getType() != Material.PORTAL)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isBlockInPortal(event.getBlock())) {
|
||||||
if (isBlockInPortal(event.getBlock()))
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isBlockInPortal(Block block)
|
public boolean isBlockInPortal(Block block)
|
||||||
{
|
{
|
||||||
if (block.getRelative(BlockFace.UP).getType() == Material.AIR)
|
if (block.getRelative(BlockFace.UP).getType() == Material.AIR)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
|
if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
if ( block.getRelative(BlockFace.NORTH).getType() != Material.AIR && block.getRelative(BlockFace.SOUTH).getType() != Material.AIR )
|
if ( block.getRelative(BlockFace.NORTH).getType() != Material.AIR && block.getRelative(BlockFace.SOUTH).getType() != Material.AIR )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
if ( block.getRelative(BlockFace.WEST).getType() != Material.AIR && block.getRelative(BlockFace.EAST).getType() != Material.AIR )
|
if ( block.getRelative(BlockFace.WEST).getType() != Material.AIR && block.getRelative(BlockFace.EAST).getType() != Material.AIR )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ import org.bukkit.World;
|
|||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
|
||||||
@ -22,7 +22,8 @@ import org.mcteam.ancientgates.util.GeometryUtil;
|
|||||||
|
|
||||||
public class PluginPlayerListener implements Listener
|
public class PluginPlayerListener implements Listener
|
||||||
{
|
{
|
||||||
@EventHandler
|
|
||||||
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerMove(PlayerMoveEvent event)
|
public void onPlayerMove(PlayerMoveEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
@ -34,9 +35,7 @@ public class PluginPlayerListener implements Listener
|
|||||||
|
|
||||||
// Check if player is standing inside a portal
|
// Check if player is standing inside a portal
|
||||||
if (blockTo.getType() != Material.PORTAL && blockToUp.getType() != Material.PORTAL)
|
if (blockTo.getType() != Material.PORTAL && blockToUp.getType() != Material.PORTAL)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Ok so a player walks into a portal block
|
// Ok so a player walks into a portal block
|
||||||
@ -71,14 +70,14 @@ public class PluginPlayerListener implements Listener
|
|||||||
{
|
{
|
||||||
nearestGate = gate;
|
nearestGate = gate;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (shortestDistance == -1 || shortestDistance > distance) {
|
/*if (shortestDistance == -1 || shortestDistance > distance) {
|
||||||
nearestGate = gate;
|
nearestGate = gate;
|
||||||
shortestDistance = distance;
|
shortestDistance = distance;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nearestGate != null)
|
if (nearestGate != null)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ public class FloodUtil {
|
|||||||
if (foundBlocks.size() > limit)
|
if (foundBlocks.size() > limit)
|
||||||
{
|
{
|
||||||
Plugin.log(Level.ALL, "exceeding gate size limit.");
|
Plugin.log(Level.ALL, "exceeding gate size limit.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foundBlocks.contains(startBlock))
|
if (foundBlocks.contains(startBlock))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user