mirror of
https://github.com/Brettflan/WorldBorder.git
synced 2024-11-23 02:25:30 +01:00
added a bit to the "safe and open" and "painful" block-type lists for the function which teleports escapees back inside the border; removed code which force-loaded GroupManager if it was present since it could cause problems
This commit is contained in:
parent
302bc28d93
commit
40468fab36
@ -10,7 +10,7 @@ import org.bukkit.World;
|
||||
|
||||
public class BorderCheckTask implements Runnable
|
||||
{
|
||||
Server server = null;
|
||||
private transient Server server = null;
|
||||
|
||||
public BorderCheckTask(Server theServer)
|
||||
{
|
||||
@ -57,7 +57,7 @@ public class BorderCheckTask implements Runnable
|
||||
ride.teleport(newLoc);
|
||||
}
|
||||
else
|
||||
{ // when riding a pig, player.getVehicle() returns null; so, we unfortunately need to eject player in this rare case
|
||||
{ // when riding a pig, player.getVehicle() returns null on older Bukkit releases; in that case an eject is required
|
||||
players[i].leaveVehicle();
|
||||
players[i].teleport(newLoc);
|
||||
}
|
||||
|
@ -178,23 +178,23 @@ public class BorderData
|
||||
}
|
||||
|
||||
//these material IDs are acceptable for places to teleport player; breathable blocks and water
|
||||
private static LinkedHashSet<Integer> acceptableBlocks = new LinkedHashSet<Integer>(Arrays.asList(
|
||||
new Integer[] {0, 6, 8, 9, 37, 38, 39, 40, 50, 55, 59, 63, 64, 65, 66, 68, 69, 70, 71, 72, 75, 76, 77, 78, 83, 93, 94}
|
||||
private static LinkedHashSet<Integer> safeOpenBlocks = new LinkedHashSet<Integer>(Arrays.asList(
|
||||
new Integer[] {0, 6, 8, 9, 27, 28, 31, 32, 37, 38, 39, 40, 50, 55, 59, 63, 64, 65, 66, 68, 69, 70, 71, 72, 75, 76, 77, 78, 83, 90, 93, 94}
|
||||
));
|
||||
|
||||
//these material IDs are ones we don't want to drop the player onto, like cactus or lava
|
||||
//these material IDs are ones we don't want to drop the player onto, like cactus or lava or fire
|
||||
private static LinkedHashSet<Integer> painfulBlocks = new LinkedHashSet<Integer>(Arrays.asList(
|
||||
new Integer[] {10, 11, 81}
|
||||
new Integer[] {10, 11, 51, 81}
|
||||
));
|
||||
|
||||
// check if a particular spot consists of 2 breathable blocks over something relatively solid
|
||||
private boolean isSafeSpot(World world, int X, int Y, int Z)
|
||||
{
|
||||
Integer below = (Integer)world.getBlockTypeIdAt(X, Y - 1, Z);
|
||||
return (acceptableBlocks.contains((Integer)world.getBlockTypeIdAt(X, Y, Z)) // target block breathable, or is water
|
||||
&& acceptableBlocks.contains((Integer)world.getBlockTypeIdAt(X, Y + 1, Z)) // above target block breathable, or is water
|
||||
&& (!acceptableBlocks.contains(below) || below == 8 || below == 9) // below target block not breathable (probably solid), or is water
|
||||
&& !painfulBlocks.contains(below) // below target block not something painful
|
||||
return (safeOpenBlocks.contains((Integer)world.getBlockTypeIdAt(X, Y, Z)) // target block open and safe
|
||||
&& safeOpenBlocks.contains((Integer)world.getBlockTypeIdAt(X, Y + 1, Z)) // above target block open and safe
|
||||
&& (!safeOpenBlocks.contains(below) || below == 8 || below == 9) // below target block not open and safe (probably solid), or is water
|
||||
&& !painfulBlocks.contains(below) // below target block not painful
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -201,9 +201,6 @@ public class Config
|
||||
|
||||
if (test != null)
|
||||
{
|
||||
if (!test.isEnabled()) {
|
||||
plugin.getServer().getPluginManager().enablePlugin(test);
|
||||
}
|
||||
GroupPlugin = (GroupManager) test;
|
||||
LogConfig("Will use plugin for permissions: "+((GroupManager)test).getDescription().getFullName());
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user