Permalink
Browse files

Update to the new Vector system

  • Loading branch information...
me4502 committed Nov 4, 2018
1 parent 0dc5781 commit 91696533cf4aa4ec8f3af0e536f883106a492484
Showing with 394 additions and 403 deletions.
  1. +6 −6 worldguard-core/src/main/java/com/sk89q/worldguard/blacklist/event/AbstractBlacklistEvent.java
  2. +3 −3 worldguard-core/src/main/java/com/sk89q/worldguard/blacklist/event/BlacklistEvent.java
  3. +3 −3 worldguard-core/src/main/java/com/sk89q/worldguard/blacklist/event/BlockBlacklistEvent.java
  4. +2 −2 worldguard-core/src/main/java/com/sk89q/worldguard/blacklist/event/BlockBreakBlacklistEvent.java
  5. +2 −2 worldguard-core/src/main/java/com/sk89q/worldguard/blacklist/event/BlockDispenseBlacklistEvent.java
  6. +2 −2 worldguard-core/src/main/java/com/sk89q/worldguard/blacklist/event/BlockInteractBlacklistEvent.java
  7. +2 −2 worldguard-core/src/main/java/com/sk89q/worldguard/blacklist/event/BlockPlaceBlacklistEvent.java
  8. +2 −2 worldguard-core/src/main/java/com/sk89q/worldguard/blacklist/event/ItemAcquireBlacklistEvent.java
  9. +4 −4 worldguard-core/src/main/java/com/sk89q/worldguard/blacklist/event/ItemBlacklistEvent.java
  10. +3 −3 ...dguard-core/src/main/java/com/sk89q/worldguard/blacklist/event/ItemDestroyWithBlacklistEvent.java
  11. +2 −2 worldguard-core/src/main/java/com/sk89q/worldguard/blacklist/event/ItemDropBlacklistEvent.java
  12. +2 −2 worldguard-core/src/main/java/com/sk89q/worldguard/blacklist/event/ItemUseBlacklistEvent.java
  13. +4 −3 worldguard-core/src/main/java/com/sk89q/worldguard/blacklist/logger/DatabaseHandler.java
  14. +4 −4 worldguard-core/src/main/java/com/sk89q/worldguard/blacklist/logger/FileHandler.java
  15. +2 −2 worldguard-core/src/main/java/com/sk89q/worldguard/chest/SignChestProtection.java
  16. +1 −1 worldguard-core/src/main/java/com/sk89q/worldguard/protection/RegionResultSet.java
  17. +5 −5 worldguard-core/src/main/java/com/sk89q/worldguard/protection/flags/LazyLocation.java
  18. +5 −5 worldguard-core/src/main/java/com/sk89q/worldguard/protection/flags/LocationFlag.java
  19. +7 −7 worldguard-core/src/main/java/com/sk89q/worldguard/protection/flags/VectorFlag.java
  20. +8 −8 worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/RegionManager.java
  21. +33 −32 worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/index/ChunkHashTable.java
  22. +20 −24 worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/index/HashMapIndex.java
  23. +14 −17 worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/index/PriorityRTreeIndex.java
  24. +10 −9 worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/index/RegionIndex.java
  25. +4 −4 worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/migration/UUIDMigration.java
  26. +20 −14 ...uard-core/src/main/java/com/sk89q/worldguard/protection/managers/storage/file/YamlRegionFile.java
  27. +14 −15 worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/DataLoader.java
  28. +5 −5 ...guard-core/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionInserter.java
  29. +3 −3 ...dguard-core/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionRemover.java
  30. +7 −7 ...dguard-core/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/RegionUpdater.java
  31. +3 −3 worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/storage/sql/TableCache.java
  32. +8 −9 worldguard-core/src/main/java/com/sk89q/worldguard/protection/regions/GlobalProtectedRegion.java
  33. +19 −20 worldguard-core/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedCuboidRegion.java
  34. +17 −17 worldguard-core/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedPolygonalRegion.java
  35. +29 −30 worldguard-core/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegion.java
  36. +1 −1 worldguard-core/src/main/java/com/sk89q/worldguard/protection/regions/QueryCache.java
  37. +2 −2 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/BukkitOfflinePlayer.java
  38. +5 −5 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/BukkitRegionContainer.java
  39. +6 −7 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionCommandsBase.java
  40. +3 −3 ...guard-legacy/src/main/java/com/sk89q/worldguard/bukkit/commands/region/RegionPrintoutBuilder.java
  41. +13 −13 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/BlacklistListener.java
  42. +10 −10 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/SpongeUtil.java
  43. +2 −2 worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java
  44. +2 −2 worldguard-legacy/src/test/java/com/sk89q/worldguard/TestPlayer.java
  45. +5 −5 worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/MockApplicableRegionSet.java
  46. +8 −10 worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/RegionEntryExitTest.java
  47. +16 −18 worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/RegionOverlapTest.java
  48. +14 −16 worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/RegionPriorityTest.java
  49. +32 −32 worldguard-legacy/src/test/java/com/sk89q/worldguard/protection/regions/RegionIntersectTest.java
@@ -19,19 +19,19 @@
package com.sk89q.worldguard.blacklist.event;
import com.sk89q.worldedit.Vector;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.target.Target;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
abstract class AbstractBlacklistEvent implements BlacklistEvent {
@Nullable
private final LocalPlayer player;
private final Vector position;
private final BlockVector3 position;
private final Target target;
/**
@@ -41,7 +41,7 @@
* @param position The position the event occurred at
* @param target The target of the event
*/
AbstractBlacklistEvent(@Nullable LocalPlayer player, Vector position, Target target) {
AbstractBlacklistEvent(@Nullable LocalPlayer player, BlockVector3 position, Target target) {
checkNotNull(position);
checkNotNull(target);
this.player = player;
@@ -61,7 +61,7 @@ public String getCauseName() {
}
@Override
public Vector getPosition() {
public BlockVector3 getPosition() {
return position;
}
@@ -19,7 +19,7 @@
package com.sk89q.worldguard.blacklist.event;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.target.Target;
@@ -47,14 +47,14 @@
*
* @return The position of this event
*/
Vector getPosition();
BlockVector3 getPosition();
/**
* Get the position that should be logged.
*
* @return The position that be logged.
*/
Vector getLoggedPosition();
BlockVector3 getLoggedPosition();
/**
* Get the item type.
@@ -19,7 +19,7 @@
package com.sk89q.worldguard.blacklist.event;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.target.Target;
@@ -34,7 +34,7 @@
* @param position The position the event occurred at
* @param target The target of the event
*/
BlockBlacklistEvent(@Nullable LocalPlayer player, Vector position, Target target) {
BlockBlacklistEvent(@Nullable LocalPlayer player, BlockVector3 position, Target target) {
super(player, position, target);
}
@@ -44,7 +44,7 @@ public String getLoggerMessage() {
}
@Override
public Vector getLoggedPosition() {
public BlockVector3 getLoggedPosition() {
return getPosition();
}
@@ -19,7 +19,7 @@
package com.sk89q.worldguard.blacklist.event;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.target.Target;
@@ -34,7 +34,7 @@
* @param position The position the event occurred at
* @param target The target of the event
*/
public BlockBreakBlacklistEvent(@Nullable LocalPlayer player, Vector position, Target target) {
public BlockBreakBlacklistEvent(@Nullable LocalPlayer player, BlockVector3 position, Target target) {
super(player, position, target);
}
@@ -19,7 +19,7 @@
package com.sk89q.worldguard.blacklist.event;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.target.Target;
@@ -34,7 +34,7 @@
* @param position The position the event occurred at
* @param target The target of the event
*/
public BlockDispenseBlacklistEvent(@Nullable LocalPlayer player, Vector position, Target target) {
public BlockDispenseBlacklistEvent(@Nullable LocalPlayer player, BlockVector3 position, Target target) {
super(player, position, target);
}
@@ -19,7 +19,7 @@
package com.sk89q.worldguard.blacklist.event;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.target.Target;
@@ -34,7 +34,7 @@
* @param position The position the event occurred at
* @param target The target of the event
*/
public BlockInteractBlacklistEvent(@Nullable LocalPlayer player, Vector position, Target target) {
public BlockInteractBlacklistEvent(@Nullable LocalPlayer player, BlockVector3 position, Target target) {
super(player, position, target);
}
@@ -19,7 +19,7 @@
package com.sk89q.worldguard.blacklist.event;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.target.Target;
@@ -34,7 +34,7 @@
* @param position The position the event occurred at
* @param target The target of the event
*/
public BlockPlaceBlacklistEvent(@Nullable LocalPlayer player, Vector position, Target target) {
public BlockPlaceBlacklistEvent(@Nullable LocalPlayer player, BlockVector3 position, Target target) {
super(player, position, target);
}
@@ -19,7 +19,7 @@
package com.sk89q.worldguard.blacklist.event;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.target.Target;
@@ -34,7 +34,7 @@
* @param position The position the event occurred at
* @param target The target of the event
*/
public ItemAcquireBlacklistEvent(@Nullable LocalPlayer player, Vector position, Target target) {
public ItemAcquireBlacklistEvent(@Nullable LocalPlayer player, BlockVector3 position, Target target) {
super(player, position, target);
}
@@ -19,7 +19,7 @@
package com.sk89q.worldguard.blacklist.event;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.target.Target;
@@ -34,7 +34,7 @@
* @param position The position the event occurred at
* @param target The target of the event
*/
ItemBlacklistEvent(@Nullable LocalPlayer player, Vector position, Target target) {
ItemBlacklistEvent(@Nullable LocalPlayer player, BlockVector3 position, Target target) {
super(player, position, target);
}
@@ -44,8 +44,8 @@ public String getLoggerMessage() {
}
@Override
public Vector getLoggedPosition() {
return getPlayer() != null ? getPlayer().getLocation().toVector() : getPosition();
public BlockVector3 getLoggedPosition() {
return getPlayer() != null ? getPlayer().getLocation().toVector().toBlockPoint() : getPosition();
}
}
@@ -19,7 +19,7 @@
package com.sk89q.worldguard.blacklist.event;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.target.Target;
@@ -34,7 +34,7 @@
* @param position The position the event occurred at
* @param target The target of the event
*/
public ItemDestroyWithBlacklistEvent(@Nullable LocalPlayer player, Vector position, Target target) {
public ItemDestroyWithBlacklistEvent(@Nullable LocalPlayer player, BlockVector3 position, Target target) {
super(player, position, target);
}
@@ -49,7 +49,7 @@ public EventType getEventType() {
}
@Override
public Vector getLoggedPosition() {
public BlockVector3 getLoggedPosition() {
// Use the block position instead
return getPosition();
}
@@ -19,7 +19,7 @@
package com.sk89q.worldguard.blacklist.event;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.target.Target;
@@ -34,7 +34,7 @@
* @param position The position the event occurred at
* @param target The target of the event
*/
public ItemDropBlacklistEvent(@Nullable LocalPlayer player, Vector position, Target target) {
public ItemDropBlacklistEvent(@Nullable LocalPlayer player, BlockVector3 position, Target target) {
super(player, position, target);
}
@@ -19,7 +19,7 @@
package com.sk89q.worldguard.blacklist.event;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.target.Target;
@@ -34,7 +34,7 @@
* @param position The position the event occurred at
* @param target The target of the event
*/
public ItemUseBlacklistEvent(@Nullable LocalPlayer player, Vector position, Target target) {
public ItemUseBlacklistEvent(@Nullable LocalPlayer player, BlockVector3 position, Target target) {
super(player, position, target);
}
@@ -19,19 +19,20 @@
package com.sk89q.worldguard.blacklist.logger;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.event.BlacklistEvent;
import com.sk89q.worldguard.blacklist.event.EventType;
import javax.annotation.Nullable;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
public class DatabaseHandler implements LoggerHandler {
private final String dsn;
@@ -84,7 +85,7 @@ private Connection getConnection() throws SQLException {
* @param item The item used
* @param comment The comment associated with the event
*/
private void logEvent(EventType eventType, @Nullable LocalPlayer player, Vector pos, String item, String comment) {
private void logEvent(EventType eventType, @Nullable LocalPlayer player, BlockVector3 pos, String item, String comment) {
try {
Connection conn = getConnection();
PreparedStatement stmt = conn.prepareStatement(
@@ -19,7 +19,7 @@
package com.sk89q.worldguard.blacklist.logger;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.event.BlacklistEvent;
import com.sk89q.worldguard.blacklist.target.Target;
@@ -48,7 +48,7 @@
private int cacheSize = 10;
private String pathPattern;
private String worldName;
private TreeMap<String,LogFileWriter> writers = new TreeMap<String,LogFileWriter>();
private TreeMap<String,LogFileWriter> writers = new TreeMap<>();
private final Logger logger;
@@ -217,11 +217,11 @@ private void log(LocalPlayer player, String message, String comment) {
* @param pos The position to get coordinates for
* @return The position's coordinates in human-readable form
*/
private String getCoordinates(Vector pos) {
private String getCoordinates(BlockVector3 pos) {
return "@" + pos.getBlockX() + "," + pos.getBlockY() + "," + pos.getBlockZ();
}
private void logEvent(BlacklistEvent event, String text, Target target, Vector pos, String comment) {
private void logEvent(BlacklistEvent event, String text, Target target, BlockVector3 pos, String comment) {
log(event.getPlayer(), "Tried to " + text + " " + target.getFriendlyName() + " " + getCoordinates(pos), comment);
}
@@ -33,7 +33,7 @@
public abstract Boolean isProtectedSign(Location block, LocalPlayer player);
public boolean isProtected(Location location, LocalPlayer player) {
com.sk89q.worldedit.world.block.BlockState blockState = location.getExtent().getBlock(location.toVector());
com.sk89q.worldedit.world.block.BlockState blockState = location.getExtent().getBlock(location.toVector().toBlockPoint());
if (isChest(blockState.getBlockType())) {
return isProtectedSignAround(location.setY(location.getY() - 1), player);
} else if (blockState.getBlockType() == BlockTypes.SIGN) {
@@ -77,7 +77,7 @@ private boolean isProtectedSignAround(Location searchBlock, LocalPlayer player)
}
private Boolean isProtectedSignAndChest(Location block, LocalPlayer player) {
if (!isChest(block.getExtent().getBlock(block.setY(block.getY() + 1).toVector()).getBlockType())) {
if (!isChest(block.getExtent().getBlock(block.setY(block.getY() + 1).toVector().toBlockPoint()).getBlockType())) {
return null;
}
return isProtectedSign(block, player);
@@ -144,7 +144,7 @@ public int size() {
if (regionSet != null) {
return regionSet;
}
regionSet = Collections.unmodifiableSet(new HashSet<ProtectedRegion>(applicable));
regionSet = Collections.unmodifiableSet(new HashSet<>(applicable));
return regionSet;
}
Oops, something went wrong.

0 comments on commit 9169653

Please sign in to comment.