Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
1,260 additions
and
771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...nt/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/Library/Compatibility/OfflineBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package net.ME1312.SubServers.Client.Bukkit.Library.Compatibility; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.Location; | ||
import org.bukkit.World; | ||
|
||
import java.util.Objects; | ||
import java.util.Optional; | ||
import java.util.UUID; | ||
|
||
/** | ||
* Offline Block Location Class | ||
*/ | ||
public class OfflineBlock { | ||
public final UUID world; | ||
public final int x, y, z; | ||
|
||
/** | ||
* Convert an existing location object | ||
* | ||
* @param location Location | ||
*/ | ||
public OfflineBlock(Location location) { | ||
this(location.getWorld().getUID(), location.getBlockX(), location.getBlockY(), location.getBlockZ()); | ||
} | ||
|
||
/** | ||
* Store location data | ||
* | ||
* @param world World ID | ||
* @param x X position | ||
* @param y Y position | ||
* @param z Z position | ||
*/ | ||
public OfflineBlock(UUID world, int x, int y, int z) { | ||
this.world = world; | ||
this.x = x; | ||
this.y = y; | ||
this.z = z; | ||
} | ||
|
||
/** | ||
* Find the World if loaded | ||
* | ||
* @return World (or null if unavailable) | ||
*/ | ||
public World world() { | ||
return Bukkit.getWorld(this.world); | ||
} | ||
|
||
/** | ||
* Find the Location if loaded | ||
* | ||
* @return Location (or null if unavailable) | ||
*/ | ||
public Location load() { | ||
World world = Bukkit.getWorld(this.world); | ||
return (world == null)? null : new Location(world, x, y, z); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
OfflineBlock that = (OfflineBlock) o; | ||
return x == that.x && y == that.y && z == that.z && Objects.equals(world, that.world); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(world, x, y, z); | ||
} | ||
} |
Oops, something went wrong.