-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #796 from VolmitSoftware/Development
**Changelog** - Fixed a Memory Leak (There might be more, keep reports coming) - Fixed Iris wand selections (WE) - Added Iris Wand Worldedit compatibility [Make selection using Worldedit, then /Iris object want worldedit (/ir o w we) to then set your selection to a new iris wand]
- Loading branch information
Showing
6 changed files
with
60 additions
and
26 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
32 changes: 32 additions & 0 deletions
32
src/main/java/com/volmit/iris/core/link/WorldEditLink.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,32 @@ | ||
package com.volmit.iris.core.link; | ||
|
||
import com.mojang.datafixers.util.Pair; | ||
import com.sk89q.worldedit.IncompleteRegionException; | ||
import com.sk89q.worldedit.LocalSession; | ||
import com.sk89q.worldedit.WorldEdit; | ||
import com.sk89q.worldedit.bukkit.BukkitAdapter; | ||
import com.sk89q.worldedit.math.BlockVector3; | ||
import com.sk89q.worldedit.regions.Region; | ||
import com.sk89q.worldedit.session.MissingSessionException; | ||
import org.bukkit.Location; | ||
import org.bukkit.entity.Player; | ||
|
||
public class WorldEditLink { | ||
|
||
public static Pair<Location, Location> getSelection(Player p) { | ||
LocalSession session = WorldEdit.getInstance().getSessionManager().getIfPresent(BukkitAdapter.adapt(p)); | ||
try { | ||
if(session == null) | ||
throw new MissingSessionException(); | ||
Region r = session.getSelection(BukkitAdapter.adapt(p.getWorld())); | ||
BlockVector3 p1 = r.getMinimumPoint(); | ||
BlockVector3 p2 = r.getMaximumPoint(); | ||
return new Pair<>(new Location(p.getWorld(), p1.getX(), p1.getY(), p1.getZ()), new Location(p.getWorld(), p2.getX(), p2.getY(), p2.getZ())); | ||
} catch(MissingSessionException e) { | ||
return new Pair<>(null, new Location(null, 0, 0, 0)); | ||
} catch(IncompleteRegionException e) { | ||
return new Pair<>(new Location(null, 0, 0, 0), null); | ||
} | ||
|
||
} | ||
} |
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