diff --git a/colorschemes/ovocean.txt b/colorschemes/ovocean.txt index dc32ee04..794d8038 100644 --- a/colorschemes/ovocean.txt +++ b/colorschemes/ovocean.txt @@ -1,175 +1,175 @@ -Stone -1 119 104 84 255 104 95 80 255 96 87 72 255 77 68 53 255 -Grass -2 75 156 43 255 56 117 32 255 35 104 10 255 32 82 0 255 -Dirt -3 134 96 67 255 107 76 53 255 67 48 33 255 68 49 33 255 -Cobblestone -4 115 115 115 255 92 92 92 255 57 57 57 255 46 46 46 255 -Wooden Plank -5 157 128 79 255 125 102 63 255 78 64 39 255 62 51 31 255 -Sappling -6 120 120 120 0 96 96 96 0 60 60 60 0 48 48 48 0 -Bedrock -7 84 84 84 255 67 67 67 255 42 42 42 255 33 33 33 255 -Water -8 21 88 125 80 7 70 117 80 6 68 115 80 5 53 90 80 -Stationary Water -9 21 88 125 80 7 70 117 80 6 68 115 80 5 53 90 80 -Lava -10 255 90 0 255 204 72 0 255 127 45 0 255 102 36 0 255 -Stationary Lava -11 255 90 0 255 204 72 0 255 127 45 0 255 102 36 0 255 -Sand -12 214 182 111 255 203 171 100 255 186 154 83 255 173 141 70 255 -Gravel -13 136 126 126 255 108 100 100 255 68 63 63 255 54 50 50 255 -Gold Ore -14 143 140 125 255 114 112 100 255 71 70 62 255 57 56 50 255 -Iron Ore -15 136 130 127 255 108 104 101 255 68 65 63 255 54 52 50 255 -Coal Ore -16 115 115 115 255 92 92 92 255 57 57 57 255 46 46 46 255 -Wood -17 102 81 51 255 81 64 40 255 51 40 25 255 40 32 20 255 -Leaves -18 23 68 6 100 12 56 0 100 6 52 0 100 0 42 0 100 -Sponge -19 193 193 65 255 174 174 47 255 97 97 5 255 76 76 20 255 -Glass -20 255 255 255 64 204 204 204 64 127 127 127 64 102 102 102 64 -Lapis Lazuli Ore -21 23 68 196 255 18 56 158 255 14 43 122 255 14 43 78 255 -Lapis Lazuli Block -22 23 68 196 255 18 56 158 255 14 43 122 255 14 43 78 255 -Dispenser -23 96 96 96 255 76 76 76 255 48 48 48 255 38 38 38 255 -Sandstone -24 214 182 111 255 203 171 100 255 186 154 83 255 173 141 70 255 -Note Block -25 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255 -Aqua Green Cloth -26 43 192 117 255 38 168 101 255 34 150 90 255 29 130 78 255 -Cyan Cloth -27 43 192 192 255 36 185 185 255 29 130 130 255 22 99 99 255 -Blue Cloth -28 0 0 255 255 0 0 204 255 0 0 127 255 0 0 102 255 -Purple Cloth -29 101 101 188 255 95 95 175 255 86 86 160 255 78 78 145 255 -Indigo Cloth -30 113 41 186 255 99 38 165 255 85 32 142 255 72 27 119 255 -Violet Cloth -31 156 65 198 255 132 55 168 255 112 47 142 255 84 35 107 255 -Magenta Cloth -32 187 42 187 255 160 36 160 255 135 31 135 255 112 25 112 255 -Pink Cloth -33 192 43 117 255 168 38 103 255 142 32 87 255 127 29 78 255 -Black Cloth -34 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 -Wool -35 222 222 222 255 177 177 177 255 111 111 111 255 88 88 88 255 -Gray Cloth -36 125 125 125 255 114 114 114 255 104 104 104 255 86 86 86 255 -Yellow Flower -37 255 255 0 255 204 204 0 255 127 127 0 255 102 102 0 255 -Red Rose -38 255 0 0 255 204 0 0 255 127 0 0 255 102 0 0 255 -Brown Mushroom -39 204 153 120 32 145 109 85 32 114 86 67 32 73 64 58 32 -Red Mushroom -40 255 43 43 32 196 29 38 32 186 105 109 32 124 64 64 32 -Gold Block -41 232 245 46 255 185 196 36 255 116 122 23 255 92 98 18 255 -Iron Block -42 191 191 191 255 152 152 152 255 95 95 95 255 76 76 76 255 -Double Stone Slab -43 200 200 200 255 160 160 160 255 100 100 100 255 80 80 80 255 -Stone Slab -44 200 200 200 255 160 160 160 255 100 100 100 255 80 80 80 255 -Brick -45 170 86 62 255 136 68 49 255 85 43 31 255 68 34 24 255 -TNT -46 160 83 65 255 128 66 52 255 80 41 32 255 64 33 26 255 -Bookshelf -54 125 91 38 192 100 72 30 192 62 45 19 192 50 36 15 192 -Moss Stone -48 115 115 115 255 92 92 92 255 57 57 57 255 46 46 46 255 -Obsidian -49 26 11 43 255 20 8 34 255 13 5 21 255 10 4 17 255 -Torch -50 159 127 80 255 98 88 20 0 245 220 50 255 196 176 40 0 -Fire -51 255 170 30 200 204 136 24 200 127 85 15 200 102 68 12 200 -Monster Spawner -52 0 150 110 196 0 150 130 196 0 150 110 196 0 150 130 196 -Wooden Stair -53 157 128 79 255 125 102 63 255 78 64 39 255 62 51 31 255 -Chest -54 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255 - -Diamond Ore -56 129 140 143 255 103 112 114 255 64 70 71 255 51 56 57 255 -Diamond Block -57 45 166 152 255 36 132 121 255 22 83 76 255 18 66 60 255 -Workbench -58 114 88 56 255 91 70 44 255 57 44 28 255 45 35 22 255 -Crops -59 146 192 0 255 116 153 0 255 73 96 0 255 58 76 0 255 -Farmland -60 95 58 30 255 76 46 24 255 47 29 15 255 38 23 12 255 -Furnace -61 96 96 96 255 76 76 76 255 48 48 48 255 38 38 38 255 -Burning Furnace -62 96 96 96 255 76 76 76 255 48 48 48 255 38 38 38 255 -Sign Post -63 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255 -Wooden Door -64 136 109 67 255 108 87 53 255 68 54 33 255 54 43 26 255 -Ladder -65 181 140 64 32 144 112 51 32 90 70 32 32 72 56 25 32 -Minecart Tracks -66 150 134 102 180 120 107 81 180 75 67 51 180 60 53 40 180 -Cobblestone Stairs -67 115 115 115 255 92 92 92 255 57 57 57 255 46 46 46 255 - -Iron Door -71 191 191 191 255 152 152 152 255 95 95 95 255 76 76 76 255 - -Redstone Ore -73 131 107 107 255 104 85 85 255 65 53 53 255 52 42 42 255 -Glowing Redstone Ore -74 131 107 107 255 104 85 85 255 65 53 53 255 52 42 42 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 -Snow -78 255 255 255 255 204 204 204 255 127 127 127 255 102 102 102 255 -Ice -79 83 113 163 51 66 90 130 51 41 56 81 51 33 45 65 51 -Snow Block -80 250 250 250 255 200 200 200 255 125 125 125 255 100 100 100 255 -Cactus -81 25 120 25 255 20 96 20 255 12 60 12 255 10 48 10 255 -Clay -82 151 157 169 255 120 125 135 255 75 78 84 255 60 62 67 255 -Sugar Cane -83 193 234 150 255 154 187 120 255 96 117 75 255 77 93 60 255 -Jukebox -84 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255 -Fence -85 127 98 49 96 95 72 33 96 48 34 9 96 32 21 21 96 -Pumpkin -86 255 115 0 200 204 92 0 200 126 57 0 200 102 46 0 200 -Netherrack -87 166 89 89 255 141 80 62 255 135 15 15 255 96 6 6 255 -Soulsand -88 133 109 94 255 121 97 82 255 90 70 57 255 79 59 46 255 -Glowstone -89 249 212 156 255 255 188 94 255 192 143 70 255 122 91 44 255 -Portal -90 140 0 196 128 120 0 196 128 140 0 196 128 120 0 196 128 -Jack-o-lantern -91 255 115 0 255 204 92 0 255 126 57 0 255 102 46 0 255 -Cake Block -92 234 234 234 255 210 210 210 255 203 203 203 255 190 190 190 255 +Stone +1 119 104 84 255 104 95 80 255 96 87 72 255 77 68 53 255 +Grass +2 75 156 43 255 56 117 32 255 35 104 10 255 32 82 0 255 +Dirt +3 134 96 67 255 107 76 53 255 67 48 33 255 68 49 33 255 +Cobblestone +4 115 115 115 255 92 92 92 255 57 57 57 255 46 46 46 255 +Wooden Plank +5 157 128 79 255 125 102 63 255 78 64 39 255 62 51 31 255 +Sappling +6 120 120 120 0 96 96 96 0 60 60 60 0 48 48 48 0 +Bedrock +7 84 84 84 255 67 67 67 255 42 42 42 255 33 33 33 255 +Water +8 21 88 125 80 7 70 117 80 6 68 115 80 5 53 90 80 +Stationary Water +9 21 88 125 80 7 70 117 80 6 68 115 80 5 53 90 80 +Lava +10 255 90 0 255 204 72 0 255 127 45 0 255 102 36 0 255 +Stationary Lava +11 255 90 0 255 204 72 0 255 127 45 0 255 102 36 0 255 +Sand +12 214 182 111 255 203 171 100 255 186 154 83 255 173 141 70 255 +Gravel +13 136 126 126 255 108 100 100 255 68 63 63 255 54 50 50 255 +Gold Ore +14 143 140 125 255 114 112 100 255 71 70 62 255 57 56 50 255 +Iron Ore +15 136 130 127 255 108 104 101 255 68 65 63 255 54 52 50 255 +Coal Ore +16 115 115 115 255 92 92 92 255 57 57 57 255 46 46 46 255 +Wood +17 102 81 51 255 81 64 40 255 51 40 25 255 40 32 20 255 +Leaves +18 23 68 6 100 12 56 0 100 6 52 0 100 0 42 0 100 +Sponge +19 193 193 65 255 174 174 47 255 97 97 5 255 76 76 20 255 +Glass +20 255 255 255 64 204 204 204 64 127 127 127 64 102 102 102 64 +Lapis Lazuli Ore +21 23 68 196 255 18 56 158 255 14 43 122 255 14 43 78 255 +Lapis Lazuli Block +22 23 68 196 255 18 56 158 255 14 43 122 255 14 43 78 255 +Dispenser +23 96 96 96 255 76 76 76 255 48 48 48 255 38 38 38 255 +Sandstone +24 214 182 111 255 203 171 100 255 186 154 83 255 173 141 70 255 +Note Block +25 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255 +Aqua Green Cloth +26 43 192 117 255 38 168 101 255 34 150 90 255 29 130 78 255 +Cyan Cloth +27 43 192 192 255 36 185 185 255 29 130 130 255 22 99 99 255 +Blue Cloth +28 0 0 255 255 0 0 204 255 0 0 127 255 0 0 102 255 +Purple Cloth +29 101 101 188 255 95 95 175 255 86 86 160 255 78 78 145 255 +Indigo Cloth +30 113 41 186 255 99 38 165 255 85 32 142 255 72 27 119 255 +Violet Cloth +31 156 65 198 255 132 55 168 255 112 47 142 255 84 35 107 255 +Magenta Cloth +32 187 42 187 255 160 36 160 255 135 31 135 255 112 25 112 255 +Pink Cloth +33 192 43 117 255 168 38 103 255 142 32 87 255 127 29 78 255 +Black Cloth +34 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 +Wool +35 222 222 222 255 177 177 177 255 111 111 111 255 88 88 88 255 +Gray Cloth +36 125 125 125 255 114 114 114 255 104 104 104 255 86 86 86 255 +Yellow Flower +37 255 255 0 255 204 204 0 255 127 127 0 255 102 102 0 255 +Red Rose +38 255 0 0 255 204 0 0 255 127 0 0 255 102 0 0 255 +Brown Mushroom +39 204 153 120 32 145 109 85 32 114 86 67 32 73 64 58 32 +Red Mushroom +40 255 43 43 32 196 29 38 32 186 105 109 32 124 64 64 32 +Gold Block +41 232 245 46 255 185 196 36 255 116 122 23 255 92 98 18 255 +Iron Block +42 191 191 191 255 152 152 152 255 95 95 95 255 76 76 76 255 +Double Stone Slab +43 200 200 200 255 160 160 160 255 100 100 100 255 80 80 80 255 +Stone Slab +44 200 200 200 255 160 160 160 255 100 100 100 255 80 80 80 255 +Brick +45 170 86 62 255 136 68 49 255 85 43 31 255 68 34 24 255 +TNT +46 160 83 65 255 128 66 52 255 80 41 32 255 64 33 26 255 +Bookshelf +54 125 91 38 192 100 72 30 192 62 45 19 192 50 36 15 192 +Moss Stone +48 115 115 115 255 92 92 92 255 57 57 57 255 46 46 46 255 +Obsidian +49 26 11 43 255 20 8 34 255 13 5 21 255 10 4 17 255 +Torch +50 159 127 80 255 98 88 20 0 245 220 50 255 196 176 40 0 +Fire +51 255 170 30 200 204 136 24 200 127 85 15 200 102 68 12 200 +Monster Spawner +52 0 150 110 196 0 150 130 196 0 150 110 196 0 150 130 196 +Wooden Stair +53 157 128 79 255 125 102 63 255 78 64 39 255 62 51 31 255 +Chest +54 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255 + +Diamond Ore +56 129 140 143 255 103 112 114 255 64 70 71 255 51 56 57 255 +Diamond Block +57 45 166 152 255 36 132 121 255 22 83 76 255 18 66 60 255 +Workbench +58 114 88 56 255 91 70 44 255 57 44 28 255 45 35 22 255 +Crops +59 146 192 0 255 116 153 0 255 73 96 0 255 58 76 0 255 +Farmland +60 95 58 30 255 76 46 24 255 47 29 15 255 38 23 12 255 +Furnace +61 96 96 96 255 76 76 76 255 48 48 48 255 38 38 38 255 +Burning Furnace +62 96 96 96 255 76 76 76 255 48 48 48 255 38 38 38 255 +Sign Post +63 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255 +Wooden Door +64 136 109 67 255 108 87 53 255 68 54 33 255 54 43 26 255 +Ladder +65 181 140 64 32 144 112 51 32 90 70 32 32 72 56 25 32 +Minecart Tracks +66 150 134 102 180 120 107 81 180 75 67 51 180 60 53 40 180 +Cobblestone Stairs +67 115 115 115 255 92 92 92 255 57 57 57 255 46 46 46 255 + +Iron Door +71 191 191 191 255 152 152 152 255 95 95 95 255 76 76 76 255 + +Redstone Ore +73 131 107 107 255 104 85 85 255 65 53 53 255 52 42 42 255 +Glowing Redstone Ore +74 131 107 107 255 104 85 85 255 65 53 53 255 52 42 42 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 +Snow +78 255 255 255 255 204 204 204 255 127 127 127 255 102 102 102 255 +Ice +79 83 113 163 51 66 90 130 51 41 56 81 51 33 45 65 51 +Snow Block +80 250 250 250 255 200 200 200 255 125 125 125 255 100 100 100 255 +Cactus +81 25 120 25 255 20 96 20 255 12 60 12 255 10 48 10 255 +Clay +82 151 157 169 255 120 125 135 255 75 78 84 255 60 62 67 255 +Sugar Cane +83 193 234 150 255 154 187 120 255 96 117 75 255 77 93 60 255 +Jukebox +84 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255 +Fence +85 127 98 49 96 95 72 33 96 48 34 9 96 32 21 21 96 +Pumpkin +86 255 115 0 200 204 92 0 200 126 57 0 200 102 46 0 200 +Netherrack +87 166 89 89 255 141 80 62 255 135 15 15 255 96 6 6 255 +Soulsand +88 133 109 94 255 121 97 82 255 90 70 57 255 79 59 46 255 +Glowstone +89 249 212 156 255 255 188 94 255 192 143 70 255 122 91 44 255 +Portal +90 140 0 196 128 120 0 196 128 140 0 196 128 120 0 196 128 +Jack-o-lantern +91 255 115 0 255 204 92 0 255 126 57 0 255 102 46 0 255 +Cake Block +92 234 234 234 255 210 210 210 255 203 203 203 255 190 190 190 255 diff --git a/src/main/java/org/dynmap/DynmapPlugin.java b/src/main/java/org/dynmap/DynmapPlugin.java index c18c8f6c..f63085b8 100644 --- a/src/main/java/org/dynmap/DynmapPlugin.java +++ b/src/main/java/org/dynmap/DynmapPlugin.java @@ -134,9 +134,7 @@ public class DynmapPlugin extends JavaPlugin { messageHandler.onMessageReceived.addListener(new Listener() { @Override public void triggered(Message t) { - mapManager.pushUpdate(new Client.WebChatMessage(t.name, t.message)); - log.info("[WEB]" + t.name + ": " + t.message); - getServer().broadcastMessage("[WEB]" + t.name + ": " + t.message); + webChat(t.name, t.message); } }); webServer.handlers.put("/up/sendmessage", messageHandler); @@ -345,7 +343,7 @@ public class DynmapPlugin extends JavaPlugin { private void jsonConfig() { File outputFile; Map clientConfig = (Map) configuration.getProperty("web"); - File webpath = new File(configuration.getString("webpath", "web"), "dynmap_config.json"); + File webpath = new File(configuration.getString("webpath", "web"), "standalone/dynmap_config.json"); if (webpath.isAbsolute()) outputFile = webpath; else @@ -361,4 +359,11 @@ public class DynmapPlugin extends JavaPlugin { log.log(Level.SEVERE, "Exception while writing JSON-configuration-file.", ioe); } } + + public void webChat(String name, String message) + { + mapManager.pushUpdate(new Client.WebChatMessage(name, message)); + log.info("[WEB]" + name + ": " + message); + getServer().broadcastMessage("[WEB]" + name + ": " + message); + } } diff --git a/src/main/java/org/dynmap/JsonTimerTask.java b/src/main/java/org/dynmap/JsonTimerTask.java index d7f95e76..08981f1f 100644 --- a/src/main/java/org/dynmap/JsonTimerTask.java +++ b/src/main/java/org/dynmap/JsonTimerTask.java @@ -3,7 +3,9 @@ package org.dynmap; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; +import java.io.FileReader; import java.io.IOException; +import java.util.Iterator; import java.util.TimerTask; import java.util.logging.Level; import java.util.logging.Logger; @@ -13,7 +15,12 @@ import org.bukkit.Server; import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.util.config.Configuration; +import org.dynmap.Event; import org.dynmap.web.Json; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; class JsonTimerTask extends TimerTask { protected static final Logger log = Logger.getLogger("Minecraft"); @@ -22,6 +29,8 @@ class JsonTimerTask extends TimerTask { private Server server; private MapManager mapManager; private Configuration configuration; + private static final JSONParser parser = new JSONParser(); + private long lastTimestamp = 0; public JsonTimerTask(DynmapPlugin instance, Configuration config) { this.plugin = instance; @@ -31,8 +40,48 @@ class JsonTimerTask extends TimerTask { } public void run() { + long jsonInterval = configuration.getInt("jsonfile-interval", 1) * 1000; + long current = System.currentTimeMillis(); + File outputFile; + + //Handles Reading WebChat + if(configuration.getNode("web").getBoolean("allowwebchat", false)) + { + File webChatPath = new File(this.configuration.getString("webpath", "web"), "standalone/dynmap_webchat.json"); + if (webChatPath.isAbsolute()) + outputFile = webChatPath; + else { + outputFile = new File(plugin.getDataFolder(), webChatPath.toString()); + } + if(webChatPath.exists() && lastTimestamp != 0) + { + JSONArray jsonMsgs = null; + try { + FileReader inputFileReader = new FileReader(webChatPath); + jsonMsgs = (JSONArray) parser.parse(inputFileReader); + inputFileReader.close(); + } catch(IOException ex){ + log.log(Level.SEVERE, "Exception while reading JSON-file.", ex); + } catch(ParseException ex) { + log.log(Level.SEVERE, "Exception while parsing JSON-file.", ex); + } + + if(jsonMsgs != null) { + Iterator iter = jsonMsgs.iterator(); + while(iter.hasNext()) { + JSONObject o = (JSONObject)iter.next(); + if(Long.parseLong(String.valueOf(o.get("timestamp"))) >= (lastTimestamp)) + { + plugin.webChat(String.valueOf(o.get("name")), String.valueOf(o.get("message"))); + } + } + } + } + } + + //Handles Updates for (World world : this.server.getWorlds()) { - long current = System.currentTimeMillis(); + current = System.currentTimeMillis(); Client.Update update = new Client.Update(); @@ -47,14 +96,13 @@ class JsonTimerTask extends TimerTask { update.players[i] = new Client.Player(p.getName(), pl.getWorld().getName(), pl.getX(), pl.getY(), pl.getZ()); } - update.updates = mapManager.getWorldUpdates(world.getName(), current - (configuration.getInt("jsonfile-interval", 1) + 10000)); + update.updates = mapManager.getWorldUpdates(world.getName(), current - (jsonInterval + 10000)); - File webpath = new File(this.configuration.getString("webpath", "web"), "dynmap_" + world.getName() + ".json"); - File outputFile; - if (webpath.isAbsolute()) - outputFile = webpath; + File webWorldPath = new File(this.configuration.getString("webpath", "web"), "standalone/dynmap_" + world.getName() + ".json"); + if (webWorldPath.isAbsolute()) + outputFile = webWorldPath; else { - outputFile = new File(plugin.getDataFolder(), webpath.toString()); + outputFile = new File(plugin.getDataFolder(), webWorldPath.toString()); } try { FileOutputStream fos = new FileOutputStream(outputFile); @@ -66,5 +114,6 @@ class JsonTimerTask extends TimerTask { log.log(Level.SEVERE, "Exception while writing JSON-file.", ioe); } } + lastTimestamp = System.currentTimeMillis(); } } diff --git a/web/chat_style.css b/web/css/chat_style.css similarity index 100% rename from web/chat_style.css rename to web/css/chat_style.css diff --git a/web/dynmap_style.css b/web/css/dynmap_style.css similarity index 100% rename from web/dynmap_style.css rename to web/css/dynmap_style.css diff --git a/web/embedded_example.css b/web/css/embedded_example.css similarity index 100% rename from web/embedded_example.css rename to web/css/embedded_example.css diff --git a/web/override_example.css b/web/css/override_example.css similarity index 100% rename from web/override_example.css rename to web/css/override_example.css diff --git a/web/standalone.css b/web/css/standalone.css similarity index 100% rename from web/standalone.css rename to web/css/standalone.css diff --git a/web/index.html b/web/index.html index 6fa6557f..9c557d85 100644 --- a/web/index.html +++ b/web/index.html @@ -10,22 +10,22 @@ - - - - + + + + - + - - - - - - - - + + + + + + + +