Compare commits

...

35 Commits

Author SHA1 Message Date
Mike Primm 2401eff676 Add current/max player count on player list 2012-07-30 21:42:59 -05:00
Mike Primm b5700bd462 Switch player position to be based on eye/head position - fix hideifundercover problem when in minecarts 2012-07-30 21:00:52 -05:00
Mike Primm 5d9677b350 Add configuration settings for optional URL overrides 2012-07-30 20:35:46 -05:00
Mike Primm cf77737f85 Add API to test for player info protection 2012-07-29 11:01:59 -05:00
Mike Primm 8a03a29f0a Add Player Visibility Set API support 2012-07-28 22:56:12 -05:00
Mike Primm 8031110a59 Bump to 0.60 2012-07-22 19:07:21 -05:00
Mike Primm cf0c60d877 Add setting for IC2 Nuclear Control rendering support 2012-07-22 18:37:31 -05:00
Mike Primm 0a4761f525 Add Ender Storage configuration option 2012-07-22 16:49:08 -05:00
Mike Primm ab46d250b1 Add tubestuff configuration option 2012-07-22 00:08:48 -05:00
Mike Primm df8013489d Add skin-url setting: allow custom source URL for skins 2012-07-21 01:39:14 -05:00
Mike Primm 133d3078d7 Cleanup warnings 2012-07-21 00:35:41 -05:00
Mike Primm 2a056033b8 Add setting for enabling IronChest support 2012-07-17 01:19:29 -05:00
Mike Primm a5428b56f1 Handle exceptions from Bukkit on chunk loads - keep from being killed by them... 2012-07-16 00:51:13 -05:00
Mike Primm ff79c2f4fc Add 'blockredstone' trigger (default to disabled) 2012-07-11 02:09:51 -05:00
Mike Primm 18462b5caf Add LICENSE 2012-07-06 12:14:25 -05:00
Mike Primm ebfa3eaec1 Bump to 0.50 (I'd like to get to 1.0 someday...) 2012-07-01 09:10:01 -05:00
Mike Primm 96673f0fb3 More protection against exceptions for blocks at top of world 2012-05-23 08:13:47 -05:00
Mike Primm fc451fd002 Prevent traps by stupid mods that think BlockBreak events are good to send without blocks.... 2012-05-22 23:53:29 -05:00
Mike Primm 2f1b1789fd Bump to 0.40 2012-05-20 18:45:40 -05:00
Mike Primm 01b054e972 Make logo component position settable, allow more than one instance 2012-05-19 22:12:01 -05:00
Mike Primm 5d35205cae Handle chunk cache loading in platform module 2012-05-19 15:50:20 -05:00
Mike Primm 58c7d6378c Add IC2 Compact Solars support setting 2012-05-11 22:35:07 -05:00
Mike Primm d95213e7dd Fix hideifundercover on The End 2012-05-09 00:29:04 -05:00
Mike Primm 4f5063155e Add forestry-support flag to configuration.txt 2012-05-08 22:40:08 -05:00
Mike Primm 2d4e233005 Bump to 0.39 2012-05-06 17:25:48 -05:00
Mike Primm afc0d9bd6b Bump to 0.38 2012-04-22 18:10:39 -05:00
Mike Primm 267b423ff1 Update POM to use Bukkit 1.2.5-R1.0 2012-04-17 21:57:59 -05:00
Mike Primm d523ce8a41 Add 'protected-player-info' option - require login + privilege to see players other than self 2012-04-16 22:54:31 -05:00
Mike Primm ee7e6eedc8 Disable blockphysics and blockfromto by default - fires too much in recent CB versions, and just not needed 99% of the time 2012-04-13 23:20:36 -05:00
Mike Primm 4d6d156e9c Declare world permission nodes 2012-04-11 01:19:12 -05:00
Mike Primm 177310a949 Add lctrees-support setting (enable LC Trees++ support) 2012-04-09 18:05:07 -05:00
Mike Primm 0707953718 Fix handling of unknown biomes (For Trees++) 2012-04-09 18:03:32 -05:00
Mike Primm 8546b2205e Bump to 0.37 2012-04-04 01:04:26 -05:00
Mike Primm d154f23bab Add 'chatlengthlimit' setting - control max chat message length 2012-04-03 23:23:29 -05:00
Mike Primm 0b38a4cec8 Bump to 0.36.3 2012-04-03 13:36:44 -05:00
13 changed files with 441 additions and 90 deletions
+201
View File
@@ -0,0 +1,201 @@
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.
+2 -2
View File
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.dynmap</groupId>
<artifactId>dynmap</artifactId>
<version>0.36.2</version>
<version>0.60</version>
<name>dynmap</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -133,7 +133,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>[1.1-R5-SNAPSHOT,1.7)</version>
<version>[1.2.5-R4.0,1.7)</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
+5
View File
@@ -16,6 +16,11 @@
<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>
@@ -6,6 +6,8 @@ import java.util.List;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import org.dynmap.DynmapChunk;
import org.dynmap.DynmapLocation;
import org.dynmap.DynmapWorld;
@@ -13,16 +15,20 @@ import org.dynmap.utils.MapChunkCache;
public class BukkitWorld extends DynmapWorld {
private World world;
private World.Environment env;
private boolean skylight;
public BukkitWorld(World w) {
super(w.getName(), w.getMaxHeight(), w.getSeaLevel());
world = w;
env = world.getEnvironment();
skylight = (env == World.Environment.NORMAL);
new Permission("dynmap.world." + getName(), "Dynmap access for world " + getName(), PermissionDefault.OP);
}
/* Test if world is nether */
@Override
public boolean isNether() {
return world.getEnvironment() == World.Environment.NETHER;
return env == World.Environment.NETHER;
}
/* Get world spawn location */
@Override
@@ -66,7 +72,7 @@ public class BukkitWorld extends DynmapWorld {
/* Test if sky light level is requestable */
@Override
public boolean canGetSkyLightLevel() {
return true;
return skylight;
}
/* Return sky light level */
@Override
@@ -78,7 +84,7 @@ public class BukkitWorld extends DynmapWorld {
*/
@Override
public String getEnvironment() {
return world.getEnvironment().name().toLowerCase();
return env.name().toLowerCase();
}
/**
* Get map chunk cache for world
+121 -37
View File
@@ -36,6 +36,7 @@ import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.block.SignChangeEvent;
@@ -57,6 +58,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.dynmap.DynmapAPI;
import org.dynmap.DynmapChunk;
import org.dynmap.DynmapCore;
import org.dynmap.DynmapLocation;
import org.dynmap.DynmapWebChatEvent;
@@ -77,7 +79,7 @@ import org.dynmap.common.DynmapPlayer;
import org.dynmap.common.DynmapServerInterface;
import org.dynmap.common.DynmapListenerManager.EventType;
import org.dynmap.markers.MarkerAPI;
import org.getspout.spoutapi.plugin.SpoutPlugin;
import org.dynmap.utils.MapChunkCache;
public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
private DynmapCore core;
@@ -108,6 +110,11 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
* Server access abstraction class
*/
public class BukkitServer implements DynmapServerInterface {
/* Chunk load handling */
private Object loadlock = new Object();
private int chunks_in_cur_tick = 0;
private long cur_tick;
@Override
public void scheduleServerTask(Runnable run, long delay) {
getServer().getScheduler().scheduleSyncDelayedTask(DynmapPlugin.this, run, delay);
@@ -169,7 +176,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
break;
case WORLD_SPAWN_CHANGE:
pm.registerEvents(new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onSpawnChange(SpawnChangeEvent evt) {
DynmapWorld w = new BukkitWorld(evt.getWorld());
@@ -183,7 +189,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
break;
case PLAYER_BED_LEAVE:
pm.registerEvents(new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onPlayerBedLeave(PlayerBedLeaveEvent evt) {
DynmapPlayer p = new BukkitPlayer(evt.getPlayer());
@@ -193,7 +198,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
break;
case PLAYER_CHAT:
pm.registerEvents(new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onPlayerChat(PlayerChatEvent evt) {
if(evt.isCancelled()) return;
@@ -206,10 +210,11 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
break;
case BLOCK_BREAK:
pm.registerEvents(new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockBreak(BlockBreakEvent evt) {
if(evt.isCancelled()) return;
Block b = evt.getBlock();
if(b == null) return; /* Work around for stupid mods.... */
Location l = b.getLocation();
core.listenerManager.processBlockEvent(EventType.BLOCK_BREAK, b.getType().getId(),
BukkitWorld.normalizeWorldName(l.getWorld().getName()), l.getBlockX(), l.getBlockY(), l.getBlockZ());
@@ -218,9 +223,9 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
break;
case SIGN_CHANGE:
pm.registerEvents(new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onSignChange(SignChangeEvent evt) {
if(evt.isCancelled()) return;
Block b = evt.getBlock();
Location l = b.getLocation();
String[] lines = evt.getLines(); /* Note: changes to this change event - intentional */
@@ -302,6 +307,77 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
return false;
return permissions.hasOfflinePermission(player, perm);
}
/**
* Render processor helper - used by code running on render threads to request chunk snapshot cache from server/sync thread
*/
@Override
public MapChunkCache createMapChunkCache(DynmapWorld w, List<DynmapChunk> chunks,
boolean blockdata, boolean highesty, boolean biome, boolean rawbiome) {
MapChunkCache c = w.getChunkCache(chunks);
if(w.visibility_limits != null) {
for(MapChunkCache.VisibilityLimit limit: w.visibility_limits) {
c.setVisibleRange(limit);
}
c.setHiddenFillStyle(w.hiddenchunkstyle);
c.setAutoGenerateVisbileRanges(w.do_autogenerate);
}
if(w.hidden_limits != null) {
for(MapChunkCache.VisibilityLimit limit: w.hidden_limits) {
c.setHiddenRange(limit);
}
c.setHiddenFillStyle(w.hiddenchunkstyle);
}
if(c.setChunkDataTypes(blockdata, biome, highesty, rawbiome) == false) {
Log.severe("CraftBukkit build does not support biome APIs");
}
if(chunks.size() == 0) { /* No chunks to get? */
c.loadChunks(0);
return c;
}
final MapChunkCache cc = c;
while(!cc.isDoneLoading()) {
synchronized(loadlock) {
long now = System.currentTimeMillis();
if(cur_tick != (now/50)) { /* New tick? */
chunks_in_cur_tick = mapManager.getMaxChunkLoadsPerTick();
cur_tick = now/50;
}
}
Future<Boolean> f = core.getServer().callSyncMethod(new Callable<Boolean>() {
public Boolean call() throws Exception {
boolean exhausted;
synchronized(loadlock) {
if(chunks_in_cur_tick > 0)
chunks_in_cur_tick -= cc.loadChunks(chunks_in_cur_tick);
exhausted = (chunks_in_cur_tick == 0);
}
return exhausted;
}
});
Boolean delay;
try {
delay = f.get();
} catch (Exception ix) {
Log.severe(ix);
return null;
}
if((delay != null) && delay.booleanValue()) {
try { Thread.sleep(25); } catch (InterruptedException ix) {}
}
}
return c;
}
@Override
public int getMaxPlayers() {
return getServer().getMaxPlayers();
}
@Override
public int getCurrentPlayers() {
return getServer().getOnlinePlayers().length;
}
}
/**
* Player access abstraction class
@@ -343,7 +419,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(player == null) {
return null;
}
Location loc = player.getLocation();
Location loc = player.getEyeLocation(); // Use eye location, since we show head
return toLoc(loc);
}
@Override
@@ -657,13 +733,11 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
private void registerPlayerLoginListener() {
Listener pl = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent evt) {
DynmapPlayer dp = new BukkitPlayer(evt.getPlayer());
core.listenerManager.processPlayerEvent(EventType.PLAYER_JOIN, dp);
}
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent evt) {
DynmapPlayer dp = new BukkitPlayer(evt.getPlayer());
@@ -732,6 +806,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
private boolean onexplosion;
private boolean onstructuregrow;
private boolean onblockgrow;
private boolean onblockredstone;
private void registerEvents() {
@@ -747,10 +822,10 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
onblockphysics = core.isTrigger("blockphysics");
onpiston = core.isTrigger("pistonmoved");
onblockfade = core.isTrigger("blockfaded");
onblockredstone = core.isTrigger("blockredstone");
if(onplace) {
Listener placelistener = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockPlace(BlockPlaceEvent event) {
if(event.isCancelled())
@@ -766,12 +841,13 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(onbreak) {
Listener breaklistener = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockBreak(BlockBreakEvent event) {
if(event.isCancelled())
return;
Location loc = event.getBlock().getLocation();
Block b = event.getBlock();
if(b == null) return; /* Stupid mod workaround */
Location loc = b.getLocation();
String wn = BukkitWorld.normalizeWorldName(loc.getWorld().getName());
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockbreak");
@@ -782,7 +858,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(onleaves) {
Listener leaveslistener = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onLeavesDecay(LeavesDecayEvent event) {
if(event.isCancelled())
@@ -800,7 +875,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(onburn) {
Listener burnlistener = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockBurn(BlockBurnEvent event) {
if(event.isCancelled())
@@ -818,13 +892,13 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(onblockphysics) {
Listener physlistener = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockPhysics(BlockPhysicsEvent event) {
if(event.isCancelled())
return;
Block b = event.getBlock();
Material m = b.getType();
if(m == null) return;
switch(m) {
case STATIONARY_WATER:
case WATER:
@@ -832,7 +906,9 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
case LAVA:
case GRAVEL:
case SAND:
checkBlock(event.getBlock(), "blockphysics");
checkBlock(b, "blockphysics");
break;
default:
break;
}
}
@@ -842,17 +918,18 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(onblockfromto) {
Listener fromtolistener = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockFromTo(BlockFromToEvent event) {
if(event.isCancelled())
return;
Material m = event.getBlock().getType();
if((m != Material.WOOD_PLATE) && (m != Material.STONE_PLATE))
checkBlock(event.getBlock(), "blockfromto");
m = event.getToBlock().getType();
if((m != Material.WOOD_PLATE) && (m != Material.STONE_PLATE))
checkBlock(event.getToBlock(), "blockfromto");
Block b = event.getBlock();
Material m = b.getType();
if((m != Material.WOOD_PLATE) && (m != Material.STONE_PLATE) && (m != null))
checkBlock(b, "blockfromto");
b = event.getToBlock();
m = b.getType();
if((m != Material.WOOD_PLATE) && (m != Material.STONE_PLATE) && (m != null))
checkBlock(b, "blockfromto");
}
};
pm.registerEvents(fromtolistener, this);
@@ -860,7 +937,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(onpiston) {
Listener pistonlistener = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
if(event.isCancelled())
@@ -887,7 +963,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
}
}
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
if(event.isCancelled())
@@ -919,7 +994,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(onblockspread) {
Listener spreadlistener = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockSpread(BlockSpreadEvent event) {
if(event.isCancelled())
@@ -935,7 +1009,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(onblockform) {
Listener formlistener = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockForm(BlockFormEvent event) {
if(event.isCancelled())
@@ -951,7 +1024,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(onblockfade) {
Listener fadelistener = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockFade(BlockFadeEvent event) {
if(event.isCancelled())
@@ -971,7 +1043,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
try {
Class.forName("org.bukkit.event.block.BlockGrowEvent");
Listener growTrigger = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockGrow(BlockGrowEvent event) {
if(event.isCancelled())
@@ -988,9 +1059,21 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
}
}
if(onblockredstone) {
Listener redstoneTrigger = new Listener() {
@EventHandler(priority=EventPriority.MONITOR)
public void onBlockRedstone(BlockRedstoneEvent event) {
Location loc = event.getBlock().getLocation();
String wn = BukkitWorld.normalizeWorldName(loc.getWorld().getName());
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockredstone");
}
};
pm.registerEvents(redstoneTrigger, this);
}
/* Register player event trigger handlers */
Listener playerTrigger = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event) {
if(onplayerjoin) {
@@ -1006,7 +1089,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(onplayermove) {
Listener playermove = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onPlayerMove(PlayerMoveEvent event) {
Location loc = event.getPlayer().getLocation();
@@ -1018,7 +1100,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
}
/* Register entity event triggers */
Listener entityTrigger = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onEntityExplode(EntityExplodeEvent event) {
Location loc = event.getLocation();
@@ -1052,7 +1133,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
/* Register world event triggers */
Listener worldTrigger = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onWorldLoad(WorldLoadEvent event) {
core.updateConfigHashcode();
@@ -1060,7 +1140,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(core.processWorldLoad(w)) /* Have core process load first - fire event listeners if good load after */
core.listenerManager.processWorldEvent(EventType.WORLD_LOAD, w);
}
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onWorldUnload(WorldUnloadEvent event) {
core.updateConfigHashcode();
@@ -1068,7 +1147,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(w != null)
core.listenerManager.processWorldEvent(EventType.WORLD_UNLOAD, w);
}
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onStructureGrow(StructureGrowEvent event) {
Location loc = event.getLocation();
@@ -1103,7 +1181,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
ongeneratechunk = core.isTrigger("chunkgenerated");
if(ongeneratechunk) {
Listener chunkTrigger = new Listener() {
@SuppressWarnings("unused")
@EventHandler(priority=EventPriority.MONITOR)
public void onChunkPopulate(ChunkPopulateEvent event) {
Chunk c = event.getChunk();
@@ -1156,5 +1233,12 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
public boolean setDisableChatToWebProcessing(boolean disable) {
return core.setDisableChatToWebProcessing(disable);
}
@Override
public boolean testIfPlayerVisibleToPlayer(String player, String player_to_see) {
return core.testIfPlayerVisibleToPlayer(player, player_to_see);
}
@Override
public boolean testIfPlayerInfoProtected() {
return core.testIfPlayerInfoProtected();
}
}
@@ -69,6 +69,7 @@ public class NewMapChunkCache implements MapChunkCache {
* Iterator for traversing map chunk cache (base is for non-snapshot)
*/
public class OurMapIterator implements MapIterator {
@SuppressWarnings("unused")
private int x, y, z, chunkindex, bx, bz, off;
private ChunkSnapshot snap;
private BlockStep laststep;
@@ -101,16 +102,21 @@ public class NewMapChunkCache implements MapChunkCache {
exceptions++;
}
laststep = BlockStep.Y_MINUS;
typeid = blkdata = -1;
if((y >= 0) && (y < worldheight))
typeid = blkdata = -1;
else
typeid = blkdata = 0;
}
public final int getBlockTypeID() {
if(typeid < 0)
if(typeid < 0) {
typeid = snap.getBlockTypeId(bx, y, bz);
}
return typeid;
}
public final int getBlockData() {
if(blkdata < 0)
if(blkdata < 0) {
blkdata = snap.getBlockData(bx, y, bz);
}
return blkdata;
}
public int getBlockSkyLight() {
@@ -353,6 +359,8 @@ public class NewMapChunkCache implements MapChunkCache {
* Step current position in given direction
*/
public final void stepPosition(BlockStep step) {
typeid = -1;
blkdata = -1;
switch(step.ordinal()) {
case 0:
x++;
@@ -372,6 +380,9 @@ public class NewMapChunkCache implements MapChunkCache {
break;
case 1:
y++;
if(y >= worldheight) {
typeid = blkdata = 0;
}
break;
case 2:
z++;
@@ -407,6 +418,9 @@ public class NewMapChunkCache implements MapChunkCache {
break;
case 4:
y--;
if(y < 0) {
typeid = blkdata = 0;
}
break;
case 5:
z--;
@@ -426,8 +440,6 @@ public class NewMapChunkCache implements MapChunkCache {
break;
}
laststep = step;
typeid = -1;
blkdata = -1;
}
/**
* Unstep current position to previous position
@@ -449,8 +461,12 @@ public class NewMapChunkCache implements MapChunkCache {
else
laststep = BlockStep.Y_MINUS;
this.y = y;
typeid = -1;
blkdata = -1;
if((y < 0) || (y >= worldheight)) {
typeid = blkdata = 0;
}
else {
typeid = blkdata = -1;
}
}
public final int getX() {
return x;
@@ -493,9 +509,12 @@ public class NewMapChunkCache implements MapChunkCache {
}
@Override
public final boolean isEmptySection() {
if(isSectionNotEmpty[chunkindex] == null)
try {
return !isSectionNotEmpty[chunkindex][y >> 4];
} catch (Exception x) {
initSectionData(chunkindex);
return !isSectionNotEmpty[chunkindex][y >> 4];
return !isSectionNotEmpty[chunkindex][y >> 4];
}
}
}
@@ -583,9 +602,6 @@ public class NewMapChunkCache implements MapChunkCache {
public boolean isSectionEmpty(int sy) {
return (sy < 4);
}
public int getTopNonEmptySection() {
return 3;
}
}
private static class SpoutChunkSnapshot implements ChunkSnapshot {
@@ -778,7 +794,15 @@ public class NewMapChunkCache implements MapChunkCache {
}
chunks_attempted++;
boolean wasLoaded = w.isChunkLoaded(chunk.x, chunk.z);
boolean didload = w.loadChunk(chunk.x, chunk.z, false);
boolean didload = false;
try {
didload = w.loadChunk(chunk.x, chunk.z, false);
} catch (Throwable t) { /* Catch chunk error from Bukkit */
Log.warning("Bukkit error loading chunk " + chunk.x + "," + chunk.z + " on " + w.getName());
if(!wasLoaded) { /* If wasn't loaded, we loaded it if it now is */
didload = w.isChunkLoaded(chunk.x, chunk.z);
}
}
boolean didgenerate = false;
/* If we didn't load, and we're supposed to generate, do it */
if((!didload) && do_generate && vis)
@@ -934,7 +958,6 @@ public class NewMapChunkCache implements MapChunkCache {
}
private void initSectionData(int idx) {
isSectionNotEmpty[idx] = new boolean[nsect + 1];
int maxy = 0;
if(snaparray[idx] != EMPTY) {
if(!use_sections) {
Arrays.fill(isSectionNotEmpty[idx], true);
@@ -1060,6 +1083,9 @@ public class NewMapChunkCache implements MapChunkCache {
Biome[] b = Biome.values();
BiomeMap[] bm = BiomeMap.values();
biome_to_bmap = new BiomeMap[b.length];
for(int i = 0; i < b.length; i++) {
biome_to_bmap[i] = BiomeMap.NULL;
}
for(int i = 0; i < b.length; i++) {
String bs = b[i].toString();
for(int j = 0; j < bm.length; j++) {
@@ -9,7 +9,6 @@ import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import javax.imageio.ImageIO;
@@ -25,6 +25,9 @@ public class NijikokunPermissions implements PermissionProvider {
return null;
server.getPluginManager().enablePlugin(permissionsPlugin);
if(permissionsPlugin.isEnabled() == false)
return null;
Log.info("Using Permissions " + permissionsPlugin.getDescription().getVersion() + " for access control");
return new NijikokunPermissions(permissionsPlugin, name);
}
@@ -22,6 +22,8 @@ public class PEXPermissions implements PermissionProvider {
if (permissionsPlugin == null)
return null;
server.getPluginManager().enablePlugin(permissionsPlugin);
if(permissionsPlugin.isEnabled() == false)
return null;
if(PermissionsEx.isAvailable() == false)
return null;
Log.info("Using PermissionsEx " + permissionsPlugin.getDescription().getVersion() + " for access control");
@@ -1,23 +1,13 @@
package org.dynmap.bukkit.permissions;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.dynmap.Log;
import com.nijiko.permissions.PermissionHandler;
import com.platymuus.bukkit.permissions.PermissionInfo;
import com.platymuus.bukkit.permissions.PermissionsPlugin;
import de.bananaco.bpermissions.api.ApiLayer;
import de.bananaco.bpermissions.api.util.CalculableType;
import de.bananaco.bpermissions.api.util.Permission;
public class PermBukkitPermissions extends BukkitPermissions {
PermissionsPlugin plugin;
Map<String, Boolean> pd;
@@ -28,6 +18,9 @@ public class PermBukkitPermissions extends BukkitPermissions {
return null;
server.getPluginManager().enablePlugin(permissionsPlugin);
if(permissionsPlugin.isEnabled() == false)
return null;
Log.info("Using PermissionsBukkit " + permissionsPlugin.getDescription().getVersion() + " for access control");
Log.info("Web interface permissions only available for online users");
return new PermBukkitPermissions(permissionsPlugin, name, pd);
@@ -4,21 +4,12 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.Plugin;
import org.dynmap.Log;
import ru.tehkode.permissions.bukkit.PermissionsEx;
import de.bananaco.bpermissions.api.ApiLayer;
import de.bananaco.bpermissions.api.User;
import de.bananaco.bpermissions.api.WorldManager;
import de.bananaco.bpermissions.api.util.CalculableType;
import de.bananaco.bpermissions.api.util.Permission;
public class bPermPermissions extends BukkitPermissions {
WorldManager wm;
@@ -28,6 +19,9 @@ public class bPermPermissions extends BukkitPermissions {
if (permissionsPlugin == null)
return null;
server.getPluginManager().enablePlugin(permissionsPlugin);
if(permissionsPlugin.isEnabled() == false)
return null;
Log.info("Using bPermissions " + permissionsPlugin.getDescription().getVersion() + " for access control");
return new bPermPermissions(name, pd);
}
+47 -13
View File
@@ -32,12 +32,16 @@ components:
webchat-requires-login: false
# If set to true, users must have dynmap.webchat permission in order to chat
webchat-permissions: false
# Limit length of single chat messages
chatlengthlimit: 256
# # Optional - make players hidden when they are inside/underground/in shadows (#=light level: 0=full shadow,15=sky)
# hideifshadow: 4
# # Optional - make player hidden when they are under cover (#=sky light level,0=underground,15=open to sky)
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
# hideifsneaking: false
hideifsneaking: false
# If true, player positions/status is protected (login with ID with dynmap.playermarkers.seeall permission required for info other than self)
protected-player-info: false
#- class: org.dynmap.JsonFileClientUpdateComponent
# writeinterval: 1
# sendhealth: true
@@ -56,6 +60,8 @@ components:
# webchat-requires-login: false
# # If set to true, users must have dynmap.webchat permission in order to chat
# webchat-permissions: false
# # Limit length of single chat messages
# chatlengthlimit: 256
- class: org.dynmap.SimpleWebChatComponent
allowchat: true
@@ -133,11 +139,14 @@ components:
hidey: false
show-mcr: false
# Note: more than one logo component can be defined
#- class: org.dynmap.ClientComponent
# type: logo
# text: "Dynmap"
# #logourl: "images/block_surface.png"
# linkurl: "http://forums.bukkit.org/threads/dynmap.489/"
# # Valid positions: top-left, top-right, bottom-left, bottom-right
# position: bottom-right
#- class: org.dynmap.ClientComponent
# type: inactive
@@ -201,34 +210,44 @@ correct-water-lighting: true
# Control updating of player faces, once loaded (if faces are being managed by other apps or manually)
#refreshskins: false
# Customize URL used for fetching player skins (%player% is macro for name)
skin-url: "http://s3.amazonaws.com/MinecraftSkins/%player%.png"
# Control behavior for new (1.0+) compass orientation (sunrise moved 90 degrees: east is now what used to be south)
# default is 'newrose' (preserve pre-1.0 maps, rotate rose)
# 'newnorth' is used to rotate maps and rose (requires fullrender of any HDMap map - same as 'newrose' for FlatMap or KzedMap)
compass-mode: newnorth
# Enable Industrial Craft 2 block rendering support (core, Advanced Machines, Charging Bench, Power Converters)
### Mod block support ###
# Enable Industrial Craft 2 block rendering support (core, Advanced Machines, Charging Bench, Power Converters, Compact Solars, Nuclear Control)
#ic2-support: true
#ic2-advancesmachines-support: true
#ic2-chargingbench-support: true
#ic2-powerconverters-support: true
#ic2-compactsolars-support: true
#ic2-nuclearcontrol-support: true
# Enable BuildCraft block rendering support
#buildcraft-support: true
# Enable RedPower2 block rendering support
#redpower2-support: true
# Enable NetherOres block rendering support
#netherores-support: true
# Enable RailCraft block rendering support
#railcraft-support: true
# Enable Kaevator's Superslopes block rendering support
#superslopes-support: true
# Enabled ComputerCraft block rendering support
#computercraft-support: true
# Enabled LC Trees++ block rendering support
#lctrees-support: true
# Enable Forestry block rending support
#forestry-support: true
# Enable IronCheck block rendering support
#ironchest-support: true
# Enable TubeCraft block rendering support
#tubecraft-support: true
# Enable Ender Storage block rendering support
#enderstorage-support: true
render-triggers:
#- playermove
@@ -243,10 +262,11 @@ render-triggers:
- blockspread
- pistonmoved
- explosion
- blockfromto
- blockphysics
#- blockfromto
#- blockphysics
- structuregrow
- blockgrow
#- blockredstone
# Title for the web page - if not specified, defaults to the server's name (unless it is the default of 'Unknown Server')
#webpage-title: "My Awesome Server Map"
@@ -330,9 +350,6 @@ defaultmap: flat
#followzoom: 3
#followmap: surface
# Option to enable workaround for incorrectly encoded unicode in Cyrillic MC/Bukkit (not good for other code pages)
cyrillic-support: false
# If true, make persistent record of IP addresses used by player logins, to support web IP to player matching
persist-ids-by-ip: true
@@ -343,6 +360,23 @@ msg:
chatrequireslogin: "Chat Requires Login"
chatnotallowed: "You are not permitted to send chat messages"
# URL for client configuration (only need to be tailored for proxies or other non-standard configurations)
url:
# configuration URL
#configuration: "up/configuration"
# update URL
#update: "up/world/{world}/{timestamp}"
# sendmessage URL
#sendmessage: "up/sendmessage"
# login URL
#login: "up/login"
# register URL
#register: "up/register"
# tiles base URL
#tiles: "tiles/"
# markers base URL
#markers: "tiles/"
# Set to true to enable verbose startup messages - can help with debugging map configuration problems
# Set to false for a much quieter startup log
verbose: false
+4
View File
@@ -155,6 +155,7 @@ permissions:
dynmap.dmap.perspectivelist: true
dynmap.dmap.shaderlist: true
dynmap.dmap.lightinglist: true
dynmap.playermarkers.seeall: true
dynmap.render:
description: Allows /dynmap render command
default: true
@@ -320,3 +321,6 @@ permissions:
dynmap.webchat:
description: Allows web chat (if login required for webchat)
default: true
dynmap.playermarkers.seeall:
description: Allow all players to be seen by user on web UI
default: op