Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
lagnat committed Mar 13, 2016
1 parent 4b98b8f commit 57574ca
Show file tree
Hide file tree
Showing 10 changed files with 785 additions and 0 deletions.
50 changes: 50 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.allocinit</groupId>
<artifactId>SkyJot</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>BlockHunt</name>

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>plugin.yml</include>
</includes>
</resource>
</resources>

<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
39 changes: 39 additions & 0 deletions src/main/java/com/allocinit/skyjot/Character.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.allocinit.skyjot;

import java.util.ArrayList;
import java.util.List;


public class Character
{
private List<Integer []> path = new ArrayList<>();
private int width = 0;

public Character(String... rows)
{
for (int i = 0; i < rows.length; i++)
{
String row = rows [rows.length - i - 1];

for (int j = 0; j < row.length(); j++)
{
if (j >= width)
width = j + 1;

char dot = row.charAt(j);
if (dot != ' ')
path.add(new Integer [] { j, i });
}
}
}

public int getWidth()
{
return width;
}

public List<Integer []> getPath()
{
return path;
}
}
40 changes: 40 additions & 0 deletions src/main/java/com/allocinit/skyjot/DirectionHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.allocinit.skyjot;

import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;

class DirectionHelper
{
private double xAdd;
private double zAdd;

public DirectionHelper()
{
}

public void setFromPlayerView(Player player)
{
Vector direction = player.getLocation().getDirection();

direction.setY(0);

if (Math.abs(direction.getX()) < Math.abs(direction.getZ()))
{
xAdd = direction.getZ() > 0 ? -1 : 1;
zAdd = 0;
}
else
{
zAdd = direction.getX() < 0 ? -1 : 1;
xAdd = 0;
}
}

public void move(Location loc, int xoff, int yoff)
{
loc.setX(loc.getX() + xoff * xAdd);
loc.setZ(loc.getZ() + xoff * zAdd);
loc.setY(loc.getY() + yoff);
}
}
Loading

0 comments on commit 57574ca

Please sign in to comment.