Compare commits

...

204 Commits

Author SHA1 Message Date
FrozenCow 39db895b9d Fixed disable-webserver not being used (thanks for checking that Kilandor). 2011-02-24 00:58:40 +01:00
FrozenCow e6d2c4932a Reverted back to "== '13'" like flames suggested before. This seemed to raise incompatiblities for Firefox and Safari on Mac, not on Linux. 2011-02-24 00:38:46 +01:00
FrozenCow 00f55758c1 Changed version to 0.13. :D 2011-02-24 00:29:57 +01:00
FrozenCow ea64a55c04 Some dumb description changes in configuration. 2011-02-24 00:21:35 +01:00
FrozenCow fcbd76c591 Removed clock configuration. 2011-02-24 00:16:30 +01:00
FrozenCow 9a32485ca9 Small cleanup. 2011-02-24 00:16:10 +01:00
FrozenCow 20e954b905 Change for the inner nerd in me. 2011-02-24 00:06:36 +01:00
FrozenCow da4c456254 Merge remote-tracking branch 'flames/master' 2011-02-24 00:03:52 +01:00
FrozenCow 95bf263f11 Merge remote-tracking branch 'kilandor/master' 2011-02-24 00:02:15 +01:00
Jason Booth 774e013558 Fix jsonfile-interval should be 1 not 1000 2011-02-23 16:31:57 -06:00
Arthur Mayer b6ec0a2955 lechd updated override example 2011-02-23 23:28:28 +01:00
Arthur Mayer cdd30d95c5 lechd's new override style to let the sidebar always open and hides
also the icon
2011-02-23 23:03:26 +01:00
Arthur Mayer cc0bb3b509 fixed chat sending messages from web.
event.keyCode === '13', where the strict equal operator seem to break
safari, firefox and chrome (different value types? keydown event seem
not to provide either a string nor an integer)
2011-02-23 21:26:51 +01:00
FrozenCow 1d2cce6caa Simplified tile-mechanism again (a bit like hMod's version). 2011-02-23 14:06:13 +01:00
FrozenCow b7f6a5a39d Applied style-change of lechd. 2011-02-23 12:40:05 +01:00
FrozenCow 1cc43637ee Merge remote-tracking branch 'kilandor/master' into nowebserver
Conflicts:
	configuration.txt
	src/main/java/org/dynmap/DynmapPlayerListener.java
	src/main/java/org/dynmap/DynmapPlugin.java
	web/map.js
2011-02-22 17:58:39 +01:00
FrozenCow da7da17235 Applied some suggestions by JSLint. 2011-02-22 15:38:49 +01:00
FrozenCow b99f487567 Replaced onPlayerCommand by onCommand (server-consoles can now also be used to execute commands). 2011-02-22 14:51:40 +01:00
FrozenCow ccf6f2ac49 Player per world support @ client. 2011-02-22 14:49:03 +01:00
FrozenCow ca76b29fb9 Made Dynmap package not include subdirectory. 2011-02-22 14:09:14 +01:00
FrozenCow 40c7c9fa66 It's official, ima retard. 2011-02-22 09:17:38 +01:00
FrozenCow fae5014b4e Added commands to plugin.yml, removed disabledcommands and added fullrender <worldname>. 2011-02-22 00:42:37 +01:00
FrozenCow 0fbd0c0a44 Added commands to plugin.yml. 2011-02-21 22:39:21 +01:00
FrozenCow 8d0f509bfe Made MapTypes per World (instead of having MapTypes for all worlds). 2011-02-21 22:17:38 +01:00
FrozenCow 65f3ea4fe3 Used new Bukkit constructor format. 2011-02-21 16:22:16 +01:00
FrozenCow b097fb8321 Added entry for css overrides and cleaned up styles by lechd. 2011-02-20 23:55:16 +01:00
FrozenCow feb6d65d82 Merge remote-tracking branch 'flames/master' 2011-02-20 22:13:41 +01:00
FrozenCow cd4027495c New buttons and example override css by lechd. 2011-02-20 22:11:28 +01:00
Arthur Mayer 298c0f3391 corrected (hopefully) the chat response for show/hide commands 2011-02-20 20:06:07 +01:00
Arthur Mayer e15514291b only OPs can use fullrender. added response to chat for
hide/show/fillrender commands.
2011-02-20 19:49:05 +01:00
FrozenCow f80385e1af Added lechd's new images. 2011-02-20 18:47:18 +01:00
FrozenCow 618d1b05c9 Merge branch 'master' of https://github.com/flames/dynmap 2011-02-20 17:46:27 +01:00
alron aaa06bfc38 Automagic packages built. Love me for this. :) 2011-02-19 21:49:24 -08:00
Arthur Mayer ad07d68d7e added configuration option messagettl, TimeToLive for chatmessages, in
Milliseconds! 15seconds: messagettl: 15000
2011-02-20 02:11:44 +01:00
Arthur Mayer 02fb226350 removed forgotten comma 2011-02-20 02:02:45 +01:00
Arthur Mayer d7fe6072a5 a lot of changes. chat and ui related. thanks FrozenCow & lechd 2011-02-20 01:58:53 +01:00
Jason Booth 6ab82174a5 Added timestamp support to Update Tiles and Chat.
New web config to handle for jsonfile method
Modified webclient to handle timestamps to prevent duplication.
Removed duplicate code in JsonTimerTask.java
2011-02-19 18:55:01 -06:00
FrozenCow 83f334445b Made chatinput reset after send. 2011-02-19 21:16:14 +01:00
FrozenCow d5bd6ff038 Made sendmessage url relative. 2011-02-19 21:08:14 +01:00
Arthur Mayer 22cc46f4b8 many ui iprovements by lechd 2011-02-19 20:51:21 +01:00
FrozenCow 77539522f0 Merge branch 'master' of https://github.com/flames/dynmap 2011-02-19 16:31:36 +01:00
FrozenCow 2bd0052aa9 Added WebChat back to web. 2011-02-19 16:31:13 +01:00
FrozenCow c53e6058be Added debugging to configuration. Disabled by default. 2011-02-19 15:25:31 +01:00
Arthur Mayer 9b604d4e75 Merge remote branch 'choose_remote_name/master' into HEAD 2011-02-19 08:28:03 +01:00
Arthur Mayer 9d490cbcc8 removed my custom url, made it relative 2011-02-19 08:26:40 +01:00
FrozenCow 791341f210 Fixed httpserver thereby also more optimized. 2011-02-19 00:01:42 +01:00
FrozenCow 42d07d6ca2 Added quotes to login/out messages for yaml. 2011-02-19 00:01:21 +01:00
Arthur Mayer 61c6f4a086 corrected the json string in sendChat() 2011-02-18 20:15:18 +01:00
FrozenCow 723e7da8d3 Added stacktrace for errors. 2011-02-18 19:43:45 +01:00
FrozenCow d3cf795ebb Fixed stupid mistake with body of http requests. 2011-02-18 19:42:32 +01:00
Arthur Mayer 67baf5100c forgotten config change for chat 2011-02-18 18:46:48 +01:00
Arthur Mayer 56f126d5f2 uups. removed debug alert, added function call 2011-02-18 11:15:05 +01:00
Arthur Mayer 10f93c02c1 added chatSend() function 2011-02-18 10:21:55 +01:00
Arthur Mayer 5ddaf940ed chat interface added, config option changed from showchatballoons:
ture/false to showchat: balloons/modal
2011-02-18 07:08:29 +01:00
Arthur Mayer 7c917b729e added join and quit messages to chat 2011-02-18 05:30:49 +01:00
Arthur Mayer 00485ddcc2 fixed small bug/typo where players were not removed from player list
at quit game.
2011-02-18 01:28:58 +01:00
Arthur Mayer 55aeb3c583 added custom configuration to nether rendering, changed pom.xml, so
maven compiles dynmap.jar instead of dynamic-map.jar
2011-02-18 01:23:14 +01:00
FrozenCow 1388fa11e5 Some desperate attempts to make IE8 work. 2011-02-18 00:07:59 +01:00
FrozenCow b860c7dd0e Added pinning. 2011-02-18 00:07:51 +01:00
FrozenCow c67b2e5cc2 Added example to configuration. 2011-02-17 21:17:54 +01:00
FrozenCow 44748d7f07 Changed gui by lechd + map per world client-configuration. 2011-02-17 20:08:50 +01:00
Jason Booth 13099587e0 Fixed mistake with map updates only pulling interval+10 instead of interval+10000 2011-02-17 11:14:37 -06:00
Jason Booth 3916c363ae Fixed jsontimer-interval config not being used.
Change JsonTimerTask.java to use jsontimer-interval+10 to allow a buffer for late/delayed client requests(to prevent updated tiles info to be missing)
2011-02-17 10:05:07 -06:00
Jason Booth 77d9a88868 Fixed timer to be stopped onDisabled if it was started 2011-02-17 09:45:32 -06:00
Jason Booth e1f2ca26d6 Changed disable-webserver and jsonfile to default false 2011-02-17 09:38:08 -06:00
Jason Booth 3c1bde1092 Updated JsonTimerTask.java to be Multi-World Compatible 2011-02-17 09:33:27 -06:00
Jason Booth f7dbc89ab4 Merge branch 'master' of git://github.com/FrozenCow/dynmap
Conflicts:
	configuration.txt
	src/main/java/org/dynmap/DynmapPlugin.java
2011-02-17 08:54:23 -06:00
FrozenCow 909207ac26 Organized imports. 2011-02-15 21:44:08 +01:00
FrozenCow 99605ba433 Make sure request-body is skipped if not read. 2011-02-15 21:06:14 +01:00
FrozenCow ada9637d72 Added sendmessage handler (for chatting back). 2011-02-15 21:00:36 +01:00
FrozenCow 2d693b1ebf Improved HTTP performance and POST/PUT compatbility. 2011-02-15 21:00:04 +01:00
FrozenCow e900aca2e0 Added helper classes for HTTP. 2011-02-15 14:19:43 +01:00
FrozenCow 060d1092f9 Made clock configurable and split clocks from map. 2011-02-15 13:50:04 +01:00
FrozenCow 38df91bafe Report world for players in updates. 2011-02-15 13:38:46 +01:00
FrozenCow 18ad2e1d79 Removed copyrights through flames' css. 2011-02-15 13:33:40 +01:00
FrozenCow 5fb098259a focuschatballoons now defaults to false. 2011-02-15 13:08:33 +01:00
Daniel Chesters 24c9dfed41 if focuschatballoons is at false, disableAutoPan should be at true 2011-02-14 21:53:07 +01:00
FrozenCow a1c86bfabb Removed depricated time-images. 2011-02-14 00:02:52 +01:00
FrozenCow 49d45c653d Made clock and timeofday interchangable. 2011-02-14 00:01:20 +01:00
FrozenCow 42391cc4d5 Readded getMinecraftTime. 2011-02-13 23:30:19 +01:00
FrozenCow 3980ebefa1 Revert "Removed Clock"
This reverts commit 9ca8f8dc64e9a28da81a538a3578c2b2a8b34c88.
2011-02-13 23:27:37 +01:00
lishid 058ab0eea7 Transparent compass now 2011-02-13 23:27:37 +01:00
lishid 6e8160e576 Removed Clock 2011-02-13 23:27:37 +01:00
lishid 51e7420bdb Dynamic Time of the day Added 2011-02-13 23:27:37 +01:00
lishid 60ea503053 Added/Modified images 2011-02-13 23:27:37 +01:00
lishid f894c4945b Added/Modified images 2011-02-13 23:27:37 +01:00
lishid 7241b2be81 Added compass and TimeOfDay 2011-02-13 23:27:37 +01:00
unknown b729f28df4 initial commit 2011-02-13 23:27:37 +01:00
FrozenCow 1fc2cdb636 Force making directories on tile-rendering (needs cleaner fix). 2011-02-13 23:23:15 +01:00
FrozenCow b63369675d Re-added flushing again (oops). 2011-02-13 23:22:57 +01:00
FrozenCow a81665d38d Fixed time being reported of the correct world. 2011-02-13 22:46:45 +01:00
FrozenCow db9ced3394 Fixed tiles not updating. 2011-02-13 22:42:08 +01:00
FrozenCow d5d737d385 Fixed 'unknown command' being shown after fullrender. 2011-02-13 22:34:38 +01:00
FrozenCow f3a1d53277 Added maximumheight to configuration for somewhat better nether rendering. 2011-02-13 22:33:33 +01:00
FrozenCow 9a2b9ccac0 Fixed HttpServer some more. 2011-02-13 22:30:24 +01:00
FrozenCow 835e566151 Some improvements to HttpServer. 2011-02-13 02:56:00 +01:00
FrozenCow 2380325975 Added automatically creating tiles directory. 2011-02-13 01:33:05 +01:00
FrozenCow 100f3e0590 Added multiworld update support along with client-side support. 2011-02-13 01:19:47 +01:00
FrozenCow 5b0171c459 Server-side multiworld support with several improvements overal. 2011-02-12 23:47:00 +01:00
FrozenCow 2fd91ef94b Changed tilepath to tilespath in configuration. 2011-02-11 06:28:17 -08:00
FrozenCow 403a2acc53 Added default player-faces. 2011-02-10 01:20:50 +01:00
Jason Booth 959040e5f4 Merge branch 'master' of git://github.com/FrozenCow/dynmap 2011-02-09 14:24:13 -06:00
Jason Booth 2f6930bc17 Removed System debug messages.
Added missing JsonTimerTask.java
2011-02-09 11:57:46 -06:00
Jason Booth fb01f6ecf7 New config to Disable Webserver
New feature and config to output JSON to file
2011-02-09 11:35:09 -06:00
FrozenCow 29517e9a24 Fixed handling invalid http requests. 2011-02-09 17:22:16 +01:00
FrozenCow d566fccb1e Fixed rendering zoomedout tiles. 2011-02-09 13:25:06 +01:00
FrozenCow b2f6ae5132 Disabled fullrender by default. 2011-02-09 01:03:31 +01:00
FrozenCow 5c209c2a5e Renamed y to z in DynmapChunk. 2011-02-09 00:42:16 +01:00
FrozenCow fb1b5df3d0 Made zoomed-rendering make use of existing tile-files instead of keeping those tiles in memory. 2011-02-08 23:38:57 +01:00
FrozenCow 38ee8657e8 Better exception handling. 2011-02-08 20:59:51 +01:00
FrozenCow 89c8d564a4 Made use of newly introduced unloadChunk in BukkitAPI + removal of unstable features. 2011-02-08 20:27:37 +01:00
FrozenCow b31bb14452 disabledcommands can now be empty. 2011-02-07 22:26:55 +01:00
FrozenCow 553eb7952d Added ability to disable commands in configuration. 2011-02-07 17:25:16 +01:00
FrozenCow 421b91058a Merge https://github.com/kosiini/dynmap 2011-02-07 17:01:39 +01:00
Janne Sinisalo 100a03274c Compile fix for multiworld
Updated getWorlds()[0] to getWorlds().get(0)
2011-02-07 17:42:11 +02:00
FrozenCow d2b7169884 Workaround for IE's retardness (not yet tested). 2011-02-06 15:09:15 +01:00
FrozenCow 3e398e9124 Made updates in JSON format. Combined chat and tile queues into one UpdateQueue. Fixed UpdateQueue. 2011-02-06 03:00:51 +01:00
FrozenCow 7c257af454 Fixed Json stringify. 2011-02-06 02:00:27 +01:00
FrozenCow a937d13086 Added reflection-support for stringifyJson. 2011-02-05 21:09:49 +01:00
FrozenCow d651d58d63 Moved stringifyJson to Json class. 2011-02-05 21:02:39 +01:00
FrozenCow 9a655676ab Moved FileHandler to handlers package. 2011-02-05 20:54:28 +01:00
FrozenCow debf5bcc57 Renamed WebServer to HttpServer and WebServerRequest to HttpServerConnection. 2011-02-05 20:53:42 +01:00
FrozenCow 2a79aea7bb Moved handlers to their own (independent) classes. 2011-02-05 20:51:20 +01:00
FrozenCow 883eba6890 Removed debugging + small fix. 2011-02-05 19:57:32 +01:00
FrozenCow 226cc5f86c More work on HttpServer. 2011-02-05 19:51:48 +01:00
FrozenCow bf0edea7e2 Initial http-server work. 2011-02-05 19:51:48 +01:00
FrozenCow 711341ec47 Oops, forgot comma. 2011-02-05 19:51:06 +01:00
FrozenCow 14a3d32205 Used colors.txt from lechd. 2011-02-05 17:49:11 +01:00
FrozenCow 9f555bd4bb Added 'loadChunks' to configuration. 2011-02-05 03:03:52 +01:00
FrozenCow 902cc87458 Added 'focuschatballoons' to config influenced by Incendia's suggestion. 2011-02-05 02:59:03 +01:00
FrozenCow 9951baf8b5 Made tiles use nearest-neighbor filtering in Firefox and IE as suggested by lechd. 2011-02-05 02:54:06 +01:00
FrozenCow 335109d8c7 Added pumpkin colors as suggested by lechd. 2011-02-05 02:53:22 +01:00
FrozenCow 3940b91d0e Applied Eclipse formatting. 2011-02-05 02:25:18 +01:00
FrozenCow 4f138a56da Removed comments. 2011-02-05 02:11:49 +01:00
FrozenCow c8cf39a440 Added unstable fullmap rendering. Also... messed up formatting by pressing ctrl+shift+f in eclipse, sigh 2011-02-05 02:01:04 +01:00
FrozenCow 138aed8c33 Added chunk loading to rendering. 2011-02-04 23:12:55 +01:00
FrozenCow fde56275fe Changed day/night time as suggested by lologarithm. 2011-02-02 11:58:14 +01:00
FrozenCow 13e829cda0 Updated Server.getTime to World.getTime (to reflect Bukkit's changes) 2011-02-02 11:40:49 +01:00
FrozenCow 455b5d3b3e Added showchatballoons, showplayerfacesonmap and showplayerfacesinmenu to configuration. 2011-02-01 15:16:54 +01:00
FrozenCow 8abf596ba6 Organized imports. 2011-02-01 14:23:13 +01:00
FrozenCow 1beb4fa466 Added server-to-client configuration and maptype-configuration: enables serverside configuration of maps and updaterate. 2011-02-01 14:17:08 +01:00
FrozenCow e47b4dc49f Small fixes to chat-balloons. 2011-01-26 01:05:00 +01:00
FrozenCow 3ff0b85ef7 Merge branch 'master' of https://github.com/NathanWolf/dynmap 2011-01-26 00:39:48 +01:00
FrozenCow 99ae8a8f3b Moved Web* to webpackage and added server-to-client configuration (server-side). 2011-01-26 00:38:36 +01:00
Nathan Wolf 18b36f96fe Finish the client-side chat bubble interface:
- Bubbles disappear automatically after some time
 - Each bubble shows the last 5 messages for each player
 - Some formatting to the bubble done, could be better (add high-res
player pic?)
2011-01-25 15:10:42 -08:00
FrozenCow 36d1a7676e Merge branch 'master' of https://github.com/NathanWolf/dynmap 2011-01-25 23:06:48 +01:00
Nathan Wolf f14e097c54 Adding chat message pop-ups! 2011-01-25 14:03:27 -08:00
FrozenCow 4de18ac700 Changed startup message (shows webserver-info, hides debug) 2011-01-25 22:59:22 +01:00
FrozenCow 98f03c588e Added ignores. 2011-01-25 22:56:35 +01:00
FrozenCow 5ee5fee232 Added getters/setters. 2011-01-25 18:43:11 +01:00
FrozenCow c2047fe7c4 Fixed webpath and tilepath accepting absolute paths. 2011-01-23 19:56:59 +01:00
FrozenCow 34093874bc Changed /map to /dynmap. 2011-01-23 12:07:23 +01:00
FrozenCow 676f6c5a3e Made it possible to change background color in style.css 2011-01-23 12:00:15 +01:00
FrozenCow 9ea9e347ea Changed proxy-url to /up/ as ktr suggested. 2011-01-22 14:55:50 -08:00
FrozenCow 75efba1425 Fixed comment in config.js. 2011-01-20 23:29:38 +01:00
FrozenCow 6419469be3 Added ability to hide players (/map hide, /map hide playername(s) and /map show). 2011-01-20 22:56:39 +01:00
FrozenCow 68412ae27d Changed '/map_render' to '/map render'. 2011-01-20 20:50:18 +01:00
FrozenCow bcb25468db Added aspx for proxying on IIS. 2011-01-20 20:48:00 +01:00
FrozenCow 78b243371d Fixed red and yellow colors for flowers. 2011-01-19 19:29:37 +01:00
FrozenCow 867f069822 Added new minecraft-blocks to colors. 2011-01-18 20:54:47 +01:00
FrozenCow 7dec76aadc Removed web from jar. 2011-01-18 20:54:32 +01:00
FrozenCow b27fcdbd4b Changed configuration to key/value instead of full YAML. 2011-01-18 20:08:05 +01:00
FrozenCow 9b8a90bf9f Added some of the configuration options. (not all yet) 2011-01-16 21:44:03 +01:00
FrozenCow 3aa48f2215 Added configuration and renamed Map to MapType. 2011-01-16 18:09:58 +01:00
FrozenCow ce60452a35 Fix to be compatible with latest Bukkit. 2011-01-16 11:51:56 +01:00
Arthur Mayer 08ba9de51c changed dependencie from java version 1.5 to 1.6 in maven project file 2011-01-16 00:35:38 +01:00
flames 9f1c8f548a reverted pom.xml back to its old version 2011-01-16 00:35:19 +01:00
FrozenCow 18a1f484d8 Fixed to be compatible with latest Dynmap. 2011-01-15 23:18:16 +01:00
FrozenCow 53e7ab73a0 Fix to reflect Bukkit's changes. Also fixes the threading-problems. 2011-01-15 21:44:27 +01:00
FrozenCow 6205aee3b6 Updated maven buildfile, removed depricated readmes. 2011-01-15 12:13:54 +01:00
FrozenCow 32567b8569 Removed hardcoded path, sigh. 2011-01-15 03:33:30 +01:00
FrozenCow b501f1d8cb More exception handling and messages. 2011-01-15 02:57:11 +01:00
FrozenCow b22a48d5cb Fixed small browser incompatibilities 2011-01-15 02:11:31 +01:00
FrozenCow b5deec79be Enabled hack for faster rendering when zoomed in, which also fixed a bug that was annoying to fix. 2011-01-15 00:02:03 +01:00
FrozenCow d594df93ee Fixed little bug. 2011-01-15 00:01:44 +01:00
FrozenCow 686b09bc9d Tiles will now also generate when destroying blocks. 2011-01-14 23:41:13 +01:00
FrozenCow dfc051743d Better way of handling inheriting in javascript. 2011-01-14 23:38:50 +01:00
FrozenCow dfe33efdc3 Made dynmap's javascript self-contained, which allows for multiple maps on a single page. 2011-01-14 20:08:23 +01:00
FrozenCow 77b0bc1664 More debug messages. 2011-01-14 20:05:12 +01:00
FrozenCow 2e1a9d0a0e Changed Color to ChatColor to reflect Bukkits changes. 2011-01-14 14:51:29 +01:00
FrozenCow ff5f96aa78 Small fix for loadColorSet. 2011-01-13 15:33:30 +01:00
FrozenCow 342a72f39f Made colors load from jar when not found in filesystem. 2011-01-13 11:18:54 +01:00
FrozenCow 4f0e89b1d8 Set tilePath to 'tiles/'. 2011-01-13 01:57:19 +01:00
FrozenCow c4cce7182a More cleanup. 2011-01-12 02:03:31 +01:00
FrozenCow d634aede92 Minor cleaups. 2011-01-12 01:45:56 +01:00
FrozenCow 27fb8a20f1 Abstracted clock and tile-updating a bit. 2011-01-12 01:28:45 +01:00
FrozenCow 8263918b8d Abstracted from cave+normal to kzedmaps. Can now have any configurable type of map. 2011-01-10 23:58:39 +01:00
FrozenCow 4b5e6e6f80 Cleaned up client-side tile logic. 2011-01-10 01:28:50 +01:00
FrozenCow c8a08b5af7 Commented debug-tile-grid. 2011-01-10 00:43:23 +01:00
FrozenCow ce7bfdb46e Small cleanup. 2011-01-10 00:38:18 +01:00
FrozenCow a08edc3fa9 Fixed zoomed tile/player not fitting unzoomed. 2011-01-10 00:31:44 +01:00
FrozenCow 2b2891bd0a Readded zoom-tiles. Still needs some work. 2011-01-09 01:12:35 +01:00
FrozenCow e1a3ac60e2 Cleanup/Refactoring. 2011-01-08 18:56:08 +01:00
FrozenCow 8860eb8c04 Splitted up MapManager. 2011-01-08 03:20:51 +01:00
FrozenCow 90afd9ef82 Restructured MapManager. 2011-01-07 15:36:50 +01:00
FrozenCow 6a7559f3ad Expanded internal webserver to also handle web and tiles, where web-files can be retrieved from filesystem or jar. Also some debugging changes. 2011-01-07 04:50:43 +01:00
flames b4fca31cd5 added configvariable bindaddress (thanks FrozenCow) 2011-01-07 02:52:59 +01:00
FrozenCow 8162817041 Reenabled time again by using Bukkit's getTime. 2011-01-06 16:37:54 +01:00
FrozenCow c5d5a85a17 Separated rendering from MapTile, removed separate cave logic (integrated in rendering) and temporarily removed/disabled zoom-rendering. 2011-01-06 03:30:50 +01:00
flames 225d28e177 Added maven build file 2011-01-06 01:50:45 +01:00
FrozenCow 4261f30dcd Made code better fit for Bukkit. 2011-01-05 21:19:11 +01:00
FrozenCow eafc8a858c Added seperate file for ant build parameters. 2011-01-05 21:17:27 +01:00
FrozenCow f0ec375834 Put classes in package to be more compatible with Bukkit. 2011-01-05 19:41:21 +01:00
FrozenCow 80f9435a1a Initial bukket work, now compileable 2011-01-03 23:15:58 +01:00
116 changed files with 5022 additions and 2803 deletions
+25
View File
@@ -0,0 +1,25 @@
# 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
+34
View File
@@ -0,0 +1,34 @@
<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>build</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>tar.bz2</format>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>README*</include>
<include>LICENSE*</include>
<include>NOTICE*</include>
<include>LICENSE*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/web</directory>
<outputDirectory>/dynmap/web</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/dynmap/</outputDirectory>
<includes>
<include>configuration.txt</include></includes></fileSet>
</fileSets>
<files>
<file>
<source>${project.build.directory}/${artifactId}-${version}.jar</source>
<outputDirectory>/</outputDirectory>
<destName>dynmap.jar</destName></file></files>
</assembly>
+15 -20
View File
@@ -1,46 +1,41 @@
<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="bukkit.jar" location="C:\Users\Bob\Desktop\minecraft_server\bukkit-0.0.1-SNAPSHOT.jar"/>
<property name="minecraft" location="C:\Users\Bob\Desktop\minecraft_server"/>
<property name="plugins" location="${minecraft}/plugins/"/>
<property name="http_root" location="/srv/http/dynmap/"/>
<property name="pluginname" value="dynmap"/>
<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>
<javac srcdir="${src}/main/java" destdir="${bin}" classpath="${bukkit.jar}" debug="on" includeantruntime="false" />
</target>
<target name="dist" depends="compile">
<mkdir dir="${dist}"/>
<jar jarfile="${dist}/map.jar" basedir="${bin}"/>
<jar jarfile="${dist}/${pluginname}.jar">
<fileset dir="${bin}"/>
<fileset file="${src}/main/resources/plugin.yml"/>
<zipfileset file="${src}/main/resources/colors.txt"/>
</jar>
</target>
<target name="deploy" depends="dist">
<copy file="${dist}/map.jar" todir="${plugins}"/>
<copy file="colors.txt" todir="${minecraft}"/>
<copy file="${dist}/${pluginname}.jar" todir="${plugins}"/>
<copy todir="${http_root}">
<fileset dir="web"/>
</copy>
</target>
<target name="release" depends="dist">
<delete file="dynmap.zip"/>
<zip destfile="dynmap.zip">
<delete file="${pluginname}.zip"/>
<zip destfile="${pluginname}.zip">
<zipfileset dir="." includes="README.md" fullpath="readme.txt"/>
<zipfileset dir="." includes="build.xml"/>
<zipfileset dir="${dist}" includes="*.jar"/>
@@ -53,4 +48,4 @@
<delete dir="${bin}"/>
<delete dir="${dist}"/>
</target>
</project>
</project>
+6
View File
@@ -0,0 +1,6 @@
<project name="dynmap_parameters" basedir=".">
<property name="bukkit.jar" location="../../bukkit.jar"/>
<property name="minecraft" location="../../"/>
<property name="plugins" location="${minecraft}/plugins/"/>
<property name="http_root" location="/srv/http/dynmap/"/>
</project>
+101
View File
@@ -0,0 +1,101 @@
# All paths in this configuration file are relative to Dynmap's data-folder: minecraft_server/plugins/dynmap/
# How often a tile gets rendered (in seconds).
renderinterval: 1
# The path where the tile-files are placed.
tilespath: web/tiles
# The path where the web-files are located.
webpath: web
# The network-interface the webserver will bind to (0.0.0.0 for all interfaces, 127.0.0.1 for only local access).
webserver-bindaddress: 0.0.0.0
# The TCP-port the webserver will listen on.
webserver-port: 8123
# Disables Webserver portion of Dynmap (Advanced users only)
disable-webserver: false
# Writes JSON to file in the webpath
jsonfile: false
# How often the json file gets written to(in seconds)
jsonfile-interval: 1
# The maptypes Dynmap will use to render.
worlds:
- name: world
maps:
- class: org.dynmap.kzedmap.KzedMap
renderers:
- class: org.dynmap.kzedmap.DefaultTileRenderer
prefix: t
maximumheight: 127
- class: org.dynmap.kzedmap.CaveTileRenderer
prefix: ct
maximumheight: 127
- name: nether
maps:
- class: org.dynmap.kzedmap.KzedMap
renderers:
- class: org.dynmap.kzedmap.DefaultTileRenderer
prefix: nt
maximumheight: 64
web:
# Handles the clientside updates differently only enable if using jsonfile
jsonfile: false
# Interval the browser should poll for updates.
updaterate: 2000
# showchat: modal/balloons
showchat: modal
messagettl: 15000
showplayerfacesonmap: true
showplayerfacesinmenu: true
focuschatballoons: false
joinmessage: "%playername% joined"
quitmessage: "%playername% quit"
defaultworld: world
worlds:
- title: World
name: world
maps:
- type: KzedMapType
title: Surface
name: surface
prefix: t
- type: KzedMapType
title: Cave
name: cave
prefix: ct
- title: Nether
name: nether
maps:
- type: KzedMapType
title: Surface
name: nether
prefix: nt
# Example:
#- title: Other World # With what name the world is displayed.
# name: world_other # The actual name of the world (equal to your directory-name).
# maps:
# - type: KzedMapType # The type (or perspective) of the map. At the moment, there are no others than KzedMapType.
# title: Surface # The name of the map that will be displayed.
# name: surface # The actual name of the map (should be unique for this world).
# prefix: t # The prefix of the tile-files that are generated.
# icon: block_other.png # Sets a custom icon for the map. (optional)
# - type: KzedMapType
# title: Cave
# name: cave
# prefix: ct
# Enables debugging.
#debuggers:
# - class: org.dynmap.debug.LogDebugger
# - class: org.dynmap.debug.BukkitPlayerDebugger
+47
View File
@@ -0,0 +1,47 @@
<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.bukkit</groupId>
<artifactId>dynmap</artifactId>
<version>0.13</version>
<name>DynamicMap</name>
<url>http://www.bukkit.org</url>
<build>
<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>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>build</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
-22
View File
@@ -1,22 +0,0 @@
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
@@ -1,114 +0,0 @@
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
@@ -1,13 +0,0 @@
/* 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
@@ -1,13 +0,0 @@
/* 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;
}
}
-151
View File
@@ -1,151 +0,0 @@
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(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
@@ -1,12 +0,0 @@
/* 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
@@ -1,53 +0,0 @@
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
@@ -1,145 +0,0 @@
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.
}
}
}
}
}
@@ -0,0 +1,108 @@
package org.dynmap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
public class AsynchronousQueue<T> {
protected static final Logger log = Logger.getLogger("Minecraft");
private Object lock = new Object();
private Thread thread;
private LinkedList<T> queue = new LinkedList<T>();
private Set<T> set = new HashSet<T>();
private Handler<T> handler;
private int dequeueTime;
public AsynchronousQueue(Handler<T> handler, int dequeueTime) {
this.handler = handler;
this.dequeueTime = dequeueTime;
}
public boolean push(T t) {
synchronized (lock) {
if (set.add(t)) {
queue.addLast(t);
return true;
}
return false;
}
}
private T pop() {
synchronized (lock) {
try {
T t = queue.removeFirst();
if (!set.remove(t)) {
// This should never happen.
}
return t;
} catch (NoSuchElementException e) {
return null;
}
}
}
public int size() {
return set.size();
}
public void start() {
synchronized (lock) {
thread = new Thread(new Runnable() {
@Override
public void run() {
running();
}
});
thread.start();
try {
thread.setPriority(Thread.MIN_PRIORITY);
} catch (SecurityException e) {
log.info("Failed to set minimum priority for worker thread!");
}
}
}
public void stop() {
synchronized (lock) {
if (thread == null)
return;
Thread oldThread = thread;
thread = null;
log.info("Stopping map renderer...");
try {
oldThread.join();
} catch (InterruptedException e) {
log.info("Waiting for map renderer to stop is interrupted");
}
}
}
private void running() {
try {
while (Thread.currentThread() == thread) {
T t = pop();
if (t != null) {
handler.handle(t);
}
sleep(dequeueTime);
}
} catch (Exception ex) {
log.log(Level.SEVERE, "Exception on rendering-thread", ex);
}
}
private void sleep(int time) {
try {
Thread.sleep(time);
} catch (InterruptedException e) {
}
}
}
+111
View File
@@ -0,0 +1,111 @@
package org.dynmap;
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;
}
}
}
+60
View File
@@ -0,0 +1,60 @@
package org.dynmap;
public class Client {
public static class Update {
public long timestamp;
public long servertime;
public Player[] players;
public Object[] updates;
}
public static class Player {
public String type = "player";
public String name;
public String world;
public double x, y, z;
public Player(String name, String world, double x, double y, double z) {
this.name = name;
this.world = world;
this.x = x;
this.y = y;
this.z = z;
}
}
public static class Stamped {
public long timestamp = System.currentTimeMillis();
}
public static class ChatMessage extends Stamped {
public String type = "chat";
public String playerName;
public String message;
public ChatMessage(String playerName, String message) {
this.playerName = playerName;
this.message = message;
}
}
public static class WebChatMessage extends Stamped {
public String type = "webchat";
public String playerName;
public String message;
public WebChatMessage(String playerName, String message) {
this.playerName = playerName;
this.message = message;
}
}
public static class Tile extends Stamped {
public String type = "tile";
public String name;
public Tile(String name) {
this.name = name;
}
}
}
@@ -0,0 +1,28 @@
package org.dynmap;
import org.bukkit.block.Block;
import org.bukkit.block.BlockDamageLevel;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPlaceEvent;
public class DynmapBlockListener extends BlockListener {
private MapManager mgr;
public DynmapBlockListener(MapManager mgr) {
this.mgr = mgr;
}
@Override
public void onBlockPlace(BlockPlaceEvent event) {
Block blockPlaced = event.getBlockPlaced();
mgr.touch(blockPlaced.getLocation());
}
public void onBlockDamage(BlockDamageEvent event) {
if (event.getDamageLevel() == BlockDamageLevel.BROKEN) {
Block blockBroken = event.getBlock();
mgr.touch(blockBroken.getLocation());
}
}
}

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