Compare commits

..

1 Commits

Author SHA1 Message Date
FrozenCow 37c5fca2ab 'Fixed' onBlockCreate like k-zed's repo. 2011-01-04 18:24:43 +01:00
63 changed files with 3188 additions and 4760 deletions
-25
View File
@@ -1,25 +0,0 @@
# Eclipse stuff
/.classpath
/.project
/.settings
# netbeans
/nbproject
# we use maven!
/build.xml
# maven
/target
# vim
.*.sw[a-p]
# various other potential build files
/build
/bin
/dist
/manifest.mf
# Mac filesystem dust
/.DS_Store
-201
View File
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+56
View File
@@ -0,0 +1,56 @@
<project name="dynmap" default="dist" basedir=".">
<!-- Change the following two properties to the correct jar files -->
<property name="minecraftserver.jar" location="../../minecraft_server.jar"/>
<property name="hmod.jar" location="../../Minecraft_Mod.jar"/>
<property name="minecraft" location="../../"/>
<property name="plugins" location="${minecraft}/plugins/"/>
<property name="http_root" location="/srv/http/dynmap/"/>
<property name="src" location="src"/>
<property name="bin" location="bin"/>
<property name="dist" location="dist"/>
<property name="web" location="web"/>
<target name="init">
<mkdir dir="${bin}"/>
</target>
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${bin}" includeantruntime="false">
<classpath>
<pathelement location="${hmod.jar}"/>
<pathelement location="${minecraftserver.jar}"/>
</classpath>
</javac>
</target>
<target name="dist" depends="compile">
<mkdir dir="${dist}"/>
<jar jarfile="${dist}/map.jar" basedir="${bin}"/>
</target>
<target name="deploy" depends="dist">
<copy file="${dist}/map.jar" todir="${plugins}"/>
<copy file="colors.txt" todir="${minecraft}"/>
<copy todir="${http_root}">
<fileset dir="web"/>
</copy>
</target>
<target name="release" depends="dist">
<delete file="dynmap.zip"/>
<zip destfile="dynmap.zip">
<zipfileset dir="." includes="README.md" fullpath="readme.txt"/>
<zipfileset dir="." includes="build.xml"/>
<zipfileset dir="${dist}" includes="*.jar"/>
<zipfileset dir="${src}" includes="*.java" prefix="src/"/>
<zipfileset dir="${web}" includes="**" prefix="web/"/>
</zip>
</target>
<target name="clean">
<delete dir="${bin}"/>
<delete dir="${dist}"/>
</target>
</project>
+72
View File
@@ -0,0 +1,72 @@
1 120 120 120 255 96 96 96 255 60 60 60 255 48 48 48 255
2 117 176 73 255 93 140 58 255 58 88 36 255 46 70 29 255
3 134 96 67 255 107 76 53 255 67 48 33 255 53 38 26 255
4 115 115 115 255 92 92 92 255 57 57 57 255 46 46 46 255
48 115 115 115 255 92 92 92 255 57 57 57 255 46 46 46 255
5 157 128 79 255 125 102 63 255 78 64 39 255 62 51 31 255
6 120 120 120 0 96 96 96 0 60 60 60 0 48 48 48 0
7 84 84 84 255 67 67 67 255 42 42 42 255 33 33 33 255
8 38 92 255 51 30 73 204 51 19 46 127 51 15 36 102 51
9 38 92 255 51 30 73 204 51 19 46 127 51 15 36 102 51
10 255 90 0 255 204 72 0 255 127 45 0 255 102 36 0 255
11 255 90 0 255 204 72 0 255 127 45 0 255 102 36 0 255
12 218 210 158 255 174 168 126 255 109 105 79 255 87 84 63 255
13 136 126 126 255 108 100 100 255 68 63 63 255 54 50 50 255
14 143 140 125 255 114 112 100 255 71 70 62 255 57 56 50 255
15 136 130 127 255 108 104 101 255 68 65 63 255 54 52 50 255
16 115 115 115 255 92 92 92 255 57 57 57 255 46 46 46 255
17 102 81 51 255 81 64 40 255 51 40 25 255 40 32 20 255
18 60 192 41 100 48 153 32 100 30 96 20 100 24 76 16 100
20 255 255 255 64 204 204 204 64 127 127 127 64 102 102 102 64
35 222 222 222 255 177 177 177 255 111 111 111 255 88 88 88 255
37 255 0 0 255 204 0 0 255 127 0 0 255 102 0 0 255
38 255 255 0 0 204 204 0 0 127 127 0 0 102 102 0 0
41 232 245 46 255 185 196 36 255 116 122 23 255 92 98 18 255
42 191 191 191 255 152 152 152 255 95 95 95 255 76 76 76 255
43 200 200 200 255 160 160 160 255 100 100 100 255 80 80 80 255
44 200 200 200 255 160 160 160 255 100 100 100 255 80 80 80 255
45 170 86 62 255 136 68 49 255 85 43 31 255 68 34 24 255
46 160 83 65 255 128 66 52 255 80 41 32 255 64 33 26 255
49 26 11 43 255 20 8 34 255 13 5 21 255 10 4 17 255
51 255 170 30 200 204 136 24 200 127 85 15 200 102 68 12 200
53 157 128 79 255 125 102 63 255 78 64 39 255 62 51 31 255
54 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255
56 129 140 143 255 103 112 114 255 64 70 71 255 51 56 57 255
57 45 166 152 255 36 132 121 255 22 83 76 255 18 66 60 255
58 114 88 56 255 91 70 44 255 57 44 28 255 45 35 22 255
59 146 192 0 255 116 153 0 255 73 96 0 255 58 76 0 255
60 95 58 30 255 76 46 24 255 47 29 15 255 38 23 12 255
61 96 96 96 255 76 76 76 255 48 48 48 255 38 38 38 255
62 96 96 96 255 76 76 76 255 48 48 48 255 38 38 38 255
63 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255
64 136 109 67 255 108 87 53 255 68 54 33 255 54 43 26 255
65 181 140 64 32 144 112 51 32 90 70 32 32 72 56 25 32
66 150 134 102 180 120 107 81 180 75 67 51 180 60 53 40 180
67 115 115 115 255 92 92 92 255 57 57 57 255 46 46 46 255
71 191 191 191 255 152 152 152 255 95 95 95 255 76 76 76 255
73 131 107 107 255 104 85 85 255 65 53 53 255 52 42 42 255
74 131 107 107 255 104 85 85 255 65 53 53 255 52 42 42 255
78 255 255 255 255 204 204 204 255 127 127 127 255 102 102 102 255
79 83 113 163 51 66 90 130 51 41 56 81 51 33 45 65 51
80 250 250 250 255 200 200 200 255 125 125 125 255 100 100 100 255
81 25 120 25 255 20 96 20 255 12 60 12 255 10 48 10 255
82 151 157 169 255 120 125 135 255 75 78 84 255 60 62 67 255
83 193 234 150 255 154 187 120 255 96 117 75 255 77 93 60 255
redstone torch off
75 159 127 80 255 72 56 25 0 181 140 64 255 144 112 51 0
redstone torch on
76 159 127 80 255 102 0 0 0 255 0 0 255 204 0 0 0
torch
50 159 127 80 255 98 88 20 0 245 220 50 255 196 176 40 0
fence
85 172 136 82 255 172 136 82 0 91 70 37 255 91 70 37 0
netherstone
87 166 89 89 255 141 80 62 255 135 15 15 255 96 6 6 255
slowsand
88 133 109 94 255 121 97 82 255 90 70 57 255 79 59 46 255
lightstone
89 249 212 156 255 255 188 94 255 192 143 70 255 122 91 44 255
portal
90 99 66 222 128 99 66 222 128 99 66 222 128 99 66 222 128
-6
View File
@@ -1,6 +0,0 @@
dynmap.render # Render current chunk
dynmap.fullrender # Issue a full render
dynmap.hide.self # Hide self from map
dynmap.hide.others # Hide others from map
dynmap.show.self # Reveal self on map
dynmap.show.others # Reveal others on map
-188
View File
@@ -1,188 +0,0 @@
<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>org.dynmap</groupId>
<artifactId>dynmap</artifactId>
<version>0.70.3</version>
<name>dynmap</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<BUILD_NUMBER>dev</BUILD_NUMBER>
</properties>
<url>http://github.com/webbukkit/dynmap/</url>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/webbukkit/dynmap/issues</url>
</issueManagement>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>*.yml</include>
<include>*.txt</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>*.yml</exclude>
<exclude>*.txt</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals><goal>unpack</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.dynmap</groupId>
<artifactId>DynmapCore</artifactId>
<version>${project.version}</version>
<classifier>bin</classifier>
<type>zip</type>
<outputDirectory>${project.build.directory}/core</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>org.dynmap:dynmap-api:jar:*</include>
<include>org.dynmap:DynmapCore:jar:*</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/package.xml</descriptor>
</descriptors>
<!-- Hack for bug in maven-assembly: http://jira.codehaus.org/browse/MASSEMBLY-449 -->
<archiverConfig>
<fileMode>420</fileMode> <!-- 420(dec) = 644(oct) -->
<directoryMode>493</directoryMode> <!-- 493(dec) = 755(oct) -->
<defaultDirectoryMode>493</defaultDirectoryMode>
</archiverConfig>
</configuration>
<executions>
<execution>
<id>build</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<releases>
</releases>
<snapshots>
</snapshots>
<id>spout-repo</id>
<url>http://repo.spout.org</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.nijikokun.bukkit</groupId>
<artifactId>Permissions</artifactId>
<version>[2.5.4,)</version>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>[1.2.5-R4.0,1.7)</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.dynmap</groupId>
<artifactId>dynmap-api</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.dynmap</groupId>
<artifactId>DynmapCore</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.getspout</groupId>
<artifactId>spoutpluginapi</artifactId>
<version>dev-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ru.tehkode</groupId>
<artifactId>PermissionsEx</artifactId>
<version>1.19.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/PermissionsEx.jar</systemPath>
</dependency>
<dependency>
<groupId>de.bananaco</groupId>
<artifactId>bPermissions</artifactId>
<version>2.9.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/bpermissions.jar</systemPath>
</dependency>
<dependency>
<groupId>com.platymuus.bukkit.permissions</groupId>
<artifactId>PermissionsBukkit</artifactId>
<version>1.6</version>
<scope>system</scope>
<systemPath>${project.basedir}/PermissionsBukkit.jar</systemPath>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.2.5-R5.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
+22
View File
@@ -0,0 +1,22 @@
Commands
--------------------------------------------------
/map_wait [wait] - set wait between tile renders (ms)
/map_stat - query number of tiles in render queue
/map_regen - regenerate entire map (currently buggy)
/map_debug - send map debugging messages
/map_nodebug - disable map debugging messages
/map_regenzoom - regenerates zoom-out tiles
/addsign [name] - adds a named sign to the map
/removesign [name] - removes a named sign to the map
/listsigns - list all named signs
/tpsign [name] - teleport to a named sign
server.properties
--------------------------------------------------
map-colorsetpath - point to colors.txt
map-tilepath - point to web/tiles folder
map-signspath - point to signs.txt file (do not need to create the file, one will be created when you create a sign)
map-serverport - the port the web server runs on (default is 8123)
map-showmarkers - a list of which markers to show on the map, comma separated if multiple (spawn, homes, warps, signs, players, all, none)
map-generateportraits - whether player-portraits are generated by the server (0, 1, default: 0)
+114
View File
@@ -0,0 +1,114 @@
import java.util.HashMap;
public class Cache<K, V>
{
private final int size;
private int len;
private CacheNode head;
private CacheNode tail;
private class CacheNode
{
public CacheNode prev;
public CacheNode next;
public K key;
public V value;
public CacheNode(K key, V value)
{
this.key = key;
this.value = value;
prev = null;
next = null;
}
public void unlink()
{
if(prev == null) {
head = next;
} else {
prev.next = next;
}
if(next == null) {
tail = prev;
} else {
next.prev = prev;
}
prev = null;
next = null;
len --;
}
public void append()
{
if(tail == null) {
head = this;
tail = this;
} else {
tail.next = this;
prev = tail;
tail = this;
}
len ++;
}
}
private HashMap<K, CacheNode> map;
public Cache(int size)
{
this.size = size;
len = 0;
head = null;
tail = null;
map = new HashMap<K, CacheNode>();
}
/* returns value for key, if key exists in the cache
* otherwise null */
public V get(K key)
{
CacheNode n = map.get(key);
if(n == null)
return null;
return n.value;
}
/* puts a new key-value pair in the cache
* if the key existed already, the value is updated, and the old value is returned
* if the key didn't exist, it is added; the oldest value (now pushed out of the
* cache) may be returned, or null if the cache isn't yet full */
public V put(K key, V value)
{
CacheNode n = map.get(key);
if(n == null) {
V ret = null;
if(len >= size) {
CacheNode first = head;
first.unlink();
map.remove(first.key);
ret = first.value;
}
CacheNode add = new CacheNode(key, value);
add.append();
map.put(key, add);
return ret;
} else {
n.unlink();
V old = n.value;
n.value = value;
n.append();
return old;
}
}
}
+13
View File
@@ -0,0 +1,13 @@
/* FlatFileSource class wrapper to expose protected properties */
import java.util.List;
public class DMFlatFileSource extends FlatFileSource {
public List<Warp> getAllWarps() {
return this.warps;
}
public List<Warp> getAllHomes() {
return this.homes;
}
}
+13
View File
@@ -0,0 +1,13 @@
/* MySQLSource class wrapper to expose protected properties */
import java.util.List;
public class DMMySQLSource extends MySQLSource {
public List<Warp> getAllWarps() {
return this.warps;
}
public List<Warp> getAllHomes() {
return this.homes;
}
}
+155
View File
@@ -0,0 +1,155 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.logging.Logger;
public class MapListener extends PluginListener {
private static final Logger log = Logger.getLogger("Minecraft");
private MapManager mgr;
public MapListener(MapManager mgr)
{
this.mgr = mgr;
}
@Override
public boolean onBlockCreate(Player player, Block blockPlaced, Block blockClicked, int itemInHand)
{
if(blockPlaced == null) {
mgr.debug(player.getName() + " touched a null block");
return false;
}
if(mgr.touch(blockPlaced.getX(), blockPlaced.getY(), blockPlaced.getZ()))
mgr.debug(player.getName() + " touch " + blockPlaced.getX() + "," + blockPlaced.getY() + "," + blockPlaced.getZ() + " from onBlockCreate");
return false;
}
@Override
public boolean onBlockDestroy(Player player, Block block)
{
int x = block.getX();
int y = block.getY();
int z = block.getZ();
if(x == 0 && y == 0 && z == 0)
return false;
if(mgr.touch(x, y, z))
mgr.debug(player.getName() + " touch " + x + "," + y + "," + z + " from onBlockBreak");
return false;
}
@Override
public void onLogin(Player player)
{
mgr.getPlayerImage(player);
}
@Override
public boolean onCommand(Player player, String[] split)
{
if(!player.canUseCommand(split[0]))
return false;
if(split[0].equals("/map_wait")) {
if(split.length < 2) {
mgr.renderWait = 1000;
} else {
try {
mgr.renderWait = Integer.parseInt(split[1]);
} catch(NumberFormatException e) {
player.sendMessage(Colors.Rose + "Invalid number");
}
}
return true;
}
if(split[0].equals("/map_regen")) {
mgr.regenerate((int) player.getX(), (int) player.getY(), (int) player.getZ());
player.sendMessage(Colors.Rose + "Map regeneration in progress");
return true;
}
if(split[0].equals("/map_stat")) {
player.sendMessage(Colors.Rose + "Stale tiles: " + mgr.getStaleCount() + " Recent updates: " + mgr.getRecentUpdateCount());
return true;
}
if(split[0].equals("/map_debug")) {
mgr.debugPlayer = player.getName();
return true;
}
if(split[0].equals("/map_nodebug")) {
mgr.debugPlayer = null;
return true;
}
if(split[0].equals("/addsign")) {
if(split.length < 2)
{
player.sendMessage("Map> " + Colors.Red + "Usage: /addsign [name]");
}
else
{
if (mgr.addSign(player, split[1], player.getX(), player.getY(), player.getZ()))
{
player.sendMessage("Map> " + Colors.White + "Sign \"" + split[1] + "\" added successfully");
}
}
return true;
}
if(split[0].equals("/removesign")) {
if(split.length < 2)
{
player.sendMessage("Map> " + Colors.Red + "Usage: /removesign [name]");
}
else
{
if (mgr.removeSign(player, split[1]))
{
player.sendMessage("Map> " + Colors.White + "Sign \"" + split[1] + "\" removed successfully");
}
}
return true;
}
if(split[0].equals("/listsigns")) {
String msg = "";
Collection<Warp> values = mgr.signs.values();
Iterator<Warp> it = values.iterator();
while(it.hasNext())
{
Warp sign = it.next();
String line = " - " + sign.Name + "\t";
msg += line;
}
player.sendMessage("" + Colors.White + msg);
return true;
}
if(split[0].equals("/tpsign")) {
if(split.length < 2)
{
player.sendMessage("Map> " + Colors.Red + "Usage: /tpsign [name]");
}
else
{
if (mgr.teleportToSign(player, split[1]))
{
//player.sendMessage("Map> " + Colors.White + "");
}
}
return true;
}
if(split[0].equals("/map_regenzoom")) {
mgr.regenerateZoom((int) player.getX(), (int) player.getY(), (int) player.getZ());
player.sendMessage(Colors.Rose + "regenerateZoom done");
return true;
}
return false;
}
}
+944
View File
File diff suppressed because it is too large Load Diff
+519
View File
File diff suppressed because it is too large Load Diff
+12
View File
@@ -0,0 +1,12 @@
/* this class stores a tile update */
public class TileUpdate {
public long at;
public MapTile tile;
public TileUpdate(long at, MapTile tile)
{
this.at = at;
this.tile = tile;
}
}
+53
View File
@@ -0,0 +1,53 @@
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.logging.Logger;
public class WebServer extends Thread {
public static final String VERSION = "Huncraft";
protected static final Logger log = Logger.getLogger("Minecraft");
private ServerSocket sock = null;
private boolean running = false;
private MapManager mgr;
public WebServer(int port, MapManager mgr) throws IOException
{
this.mgr = mgr;
sock = new ServerSocket(port, 5, InetAddress.getByName("127.0.0.1"));
running = true;
start();
log.info("map WebServer started on port " + port);
}
public void run()
{
while (running) {
try {
Socket socket = sock.accept();
WebServerRequest requestThread = new WebServerRequest(socket, mgr);
requestThread.start();
}
catch (IOException e) {
log.info("map WebServer.run() stops with IOException");
break;
}
}
log.info("map WebServer run() exiting");
}
public void shutdown()
{
try {
if(sock != null) {
sock.close();
}
} catch(IOException e) {
log.info("map stop() got IOException while closing socket");
}
running = false;
}
}
+145
View File
@@ -0,0 +1,145 @@
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Socket;
import java.util.Date;
import java.util.List;
import java.util.logging.Logger;
public class WebServerRequest extends Thread {
protected static final Logger log = Logger.getLogger("Minecraft");
private Socket sock;
private MapManager mgr;
public WebServerRequest(Socket socket, MapManager mgr)
{
sock = socket;
this.mgr = mgr;
}
private static void sendHeader(BufferedOutputStream out, int code, String contentType, long contentLength, long lastModified) throws IOException
{
out.write(("HTTP/1.0 " + code + " OK\r\n" +
"Date: " + new Date().toString() + "\r\n" +
"Server: JibbleWebServer/1.0\r\n" +
"Content-Type: " + contentType + "\r\n" +
"Expires: Thu, 01 Dec 1994 16:00:00 GMT\r\n" +
((contentLength != -1) ? "Content-Length: " + contentLength + "\r\n" : "") +
"Last-modified: " + new Date(lastModified).toString() + "\r\n" +
"\r\n").getBytes());
}
private static void sendError(BufferedOutputStream out, int code, String message) throws IOException
{
message = message + "<hr>" + WebServer.VERSION;
sendHeader(out, code, "text/html", message.length(), System.currentTimeMillis());
out.write(message.getBytes());
out.flush();
out.close();
}
public void run()
{
InputStream reader = null;
try {
sock.setSoTimeout(30000);
BufferedReader in = new BufferedReader(new InputStreamReader(sock.getInputStream()));
BufferedOutputStream out = new BufferedOutputStream(sock.getOutputStream());
String request = in.readLine();
if (request == null || !request.startsWith("GET ") || !(request.endsWith(" HTTP/1.0") || request.endsWith("HTTP/1.1"))) {
// Invalid request type (no "GET")
sendError(out, 500, "Invalid Method.");
return;
}
String path = request.substring(4, request.length() - 9);
int current = (int) (System.currentTimeMillis() / 1000);
long cutoff = 0;
if(path.charAt(0) == '/') {
try {
cutoff = ((long) Integer.parseInt(path.substring(1))) * 1000;
} catch(NumberFormatException e) {
}
}
sendHeader(out, 200, "text/plain", -1, System.currentTimeMillis());
StringBuilder sb = new StringBuilder();
sb.append(current + " " + etc.getServer().getRelativeTime() + "\n");
if (mgr.showPlayers) {
for(Player player : etc.getServer().getPlayerList()) {
sb.append(player.getName() + " player " + player.getX() + " " + player.getY() + " " + player.getZ() + "\n");
}
}
if (mgr.showSigns) {
for(Warp sign : mgr.signs.values())
{
sb.append(sign.Name + " sign " + sign.Location.x + " " + sign.Location.y + " " + sign.Location.z + "\n");
}
}
if (mgr.showWarps) {
List<Warp> warps = mgr.loadWarps();
if (warps != null) {
for(Warp warp : warps) {
sb.append(warp.Name + " warp " + warp.Location.x + " " + warp.Location.y + " " + warp.Location.z + "\n");
}
}
}
if (mgr.showHomes) {
List<Warp> homes = mgr.loadHomes();
if (homes != null) {
for(Warp warp : homes) {
sb.append(warp.Name + " home " + warp.Location.x + " " + warp.Location.y + " " + warp.Location.z + "\n");
}
}
}
if (mgr.showSpawn) {
Location spawnLocation = etc.getServer().getSpawnLocation();
sb.append("Spawn spawn " + spawnLocation.x + " " + spawnLocation.y + " " + spawnLocation.z + "\n");
}
synchronized(mgr.lock) {
for(TileUpdate tu : mgr.tileUpdates) {
if(tu.at >= cutoff) {
sb.append(tu.tile.px + "_" + tu.tile.py + " " + tu.tile.zpx + "_" + tu.tile.zpy + " t\n");
}
}
for(TileUpdate tu : mgr.caveTileUpdates) {
if(tu.at >= cutoff) {
sb.append(tu.tile.px + "_" + tu.tile.py + " " + tu.tile.zpx + "_" + tu.tile.zpy + " c\n");
}
}
}
out.write(sb.toString().getBytes());
out.flush();
out.close();
}
catch (IOException e) {
if (reader != null) {
try {
reader.close();
}
catch (Exception anye) {
// Do nothing.
}
}
}
}
}
-32
View File
@@ -1,32 +0,0 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}/core</directory>
<outputDirectory>/dynmap</outputDirectory>
<excludes>
<exclude>web/version.js</exclude></excludes></fileSet>
<fileSet>
<directory>${project.build.directory}/core/web</directory>
<outputDirectory>/dynmap/web</outputDirectory>
<includes>
<include>version.js</include></includes>
<filtered>true</filtered></fileSet>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/dynmap</outputDirectory>
<includes>
<include>LICENSE</include></includes></fileSet>
</fileSets>
<files>
<file>
<source>${project.build.directory}/${artifactId}-${version}.jar</source>
<outputDirectory>/</outputDirectory>
<destName>dynmap.jar</destName>
</file>
</files>
</assembly>

Some files were not shown because too many files have changed in this diff Show More