Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.

Commit fcf862d

Browse files
committed
Awe API: Added Direct Chunk operations to API
1 parent d662387 commit fcf862d

5 files changed

Lines changed: 293 additions & 0 deletions

File tree

src/org/primesoft/asyncworldedit/api/IAsyncWorldEdit.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,11 @@ public interface IAsyncWorldEdit {
158158
* @return
159159
*/
160160
IWorld getWorld(String worldName);
161+
162+
163+
/**
164+
* Get the AsyncWorldEdit operations
165+
* @return
166+
*/
167+
IAweOperations getOperations();
161168
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* AsyncWorldEdit API
3+
* Copyright (c) 2016, SBPrime <https://github.com/SBPrime/>
4+
* Copyright (c) AsyncWorldEdit API contributors
5+
*
6+
* All rights reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted free of charge provided that the following
10+
* conditions are met:
11+
*
12+
* 1. Redistributions of source code must retain the above copyright notice, this
13+
* list of conditions and the following disclaimer.
14+
* 2. Redistributions in binary form must reproduce the above copyright notice,
15+
* this list of conditions and the following disclaimer in the documentation
16+
* and/or other materials provided with the distribution,
17+
* 3. Redistributions of source code, with or without modification, in any form
18+
* other then free of charge is not allowed,
19+
* 4. Redistributions in binary form in any form other then free of charge is
20+
* not allowed.
21+
* 5. Any derived work based on or containing parts of this software must reproduce
22+
* the above copyright notice, this list of conditions and the following
23+
* disclaimer in the documentation and/or other materials provided with the
24+
* derived work.
25+
* 6. The original author of the software is allowed to change the license
26+
* terms or the entire license of the software as he sees fit.
27+
* 7. The original author of the software is allowed to sublicense the software
28+
* or its parts using any license terms he sees fit.
29+
*
30+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
31+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
34+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40+
*/
41+
package org.primesoft.asyncworldedit.api;
42+
43+
import org.primesoft.asyncworldedit.api.directChunk.IDirectChunkCommands;
44+
45+
/**
46+
*
47+
* @author SBPrime
48+
*/
49+
public interface IAweOperations {
50+
/**
51+
* Get the direct chunk API operations
52+
* @return
53+
*/
54+
IDirectChunkCommands getChunkOperations();
55+
}

src/org/primesoft/asyncworldedit/api/blockPlacer/IBlockPlacer.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import com.sk89q.worldedit.MaxChangedBlocksException;
4444
import org.primesoft.asyncworldedit.api.blockPlacer.entries.IJobEntry;
4545
import org.primesoft.asyncworldedit.api.playerManager.IPlayerEntry;
46+
import org.primesoft.asyncworldedit.api.utils.IAsyncCommand;
4647
import org.primesoft.asyncworldedit.api.utils.IFuncParamEx;
4748
import org.primesoft.asyncworldedit.api.worldedit.ICancelabeEditSession;
4849
import org.primesoft.asyncworldedit.api.worldedit.IThreadSafeEditSession;
@@ -135,6 +136,15 @@ public interface IBlockPlacer {
135136
*/
136137
void performAsAsyncJob(final IThreadSafeEditSession editSession, final IPlayerEntry player, final String jobName,
137138
final IFuncParamEx<Integer, ICancelabeEditSession, MaxChangedBlocksException> action);
139+
140+
/**
141+
* Perform an async command asynchronicly
142+
*
143+
* @param editSession
144+
* @param asyncCommand
145+
*/
146+
void performAsAsyncJob(final IThreadSafeEditSession editSession, final IAsyncCommand asyncCommand);
147+
138148

139149
/**
140150
* Remove all entries for player
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
/*
2+
* AsyncWorldEdit API
3+
* Copyright (c) 2016, SBPrime <https://github.com/SBPrime/>
4+
* Copyright (c) AsyncWorldEdit API contributors
5+
*
6+
* All rights reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted free of charge provided that the following
10+
* conditions are met:
11+
*
12+
* 1. Redistributions of source code must retain the above copyright notice, this
13+
* list of conditions and the following disclaimer.
14+
* 2. Redistributions in binary form must reproduce the above copyright notice,
15+
* this list of conditions and the following disclaimer in the documentation
16+
* and/or other materials provided with the distribution,
17+
* 3. Redistributions of source code, with or without modification, in any form
18+
* other then free of charge is not allowed,
19+
* 4. Redistributions in binary form in any form other then free of charge is
20+
* not allowed.
21+
* 5. Any derived work based on or containing parts of this software must reproduce
22+
* the above copyright notice, this list of conditions and the following
23+
* disclaimer in the documentation and/or other materials provided with the
24+
* derived work.
25+
* 6. The original author of the software is allowed to change the license
26+
* terms or the entire license of the software as he sees fit.
27+
* 7. The original author of the software is allowed to sublicense the software
28+
* or its parts using any license terms he sees fit.
29+
*
30+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
31+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
34+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40+
*/
41+
package org.primesoft.asyncworldedit.api.directChunk;
42+
43+
import com.sk89q.worldedit.extent.clipboard.Clipboard;
44+
import com.sk89q.worldedit.function.mask.Mask;
45+
import com.sk89q.worldedit.function.pattern.Pattern;
46+
import com.sk89q.worldedit.regions.Region;
47+
import com.sk89q.worldedit.session.ClipboardHolder;
48+
import com.sk89q.worldedit.util.Location;
49+
import com.sk89q.worldedit.world.World;
50+
import org.primesoft.asyncworldedit.api.playerManager.IPlayerEntry;
51+
import org.primesoft.asyncworldedit.api.utils.IAsyncCommand;
52+
53+
/**
54+
*
55+
* @author SBPrime
56+
*/
57+
public interface IDirectChunkCommands {
58+
/**
59+
* Create the clear chunk command
60+
* @param playerEntry The player entry
61+
* @param region Region to clear
62+
* @param mask Mask
63+
* @return
64+
*/
65+
IAsyncCommand createClearChunk(IPlayerEntry playerEntry, Region region, Mask mask);
66+
67+
/**
68+
* Create the relight chunk command
69+
* @param playerEntry The player entry
70+
* @param region Region to clear
71+
* @return
72+
*/
73+
IAsyncCommand createRelight(IPlayerEntry playerEntry, Region region);
74+
75+
/**
76+
* Create the copy to clipboard command
77+
* @param playerEntry
78+
* @param region
79+
* @param mask
80+
* @param clipboard
81+
* @return
82+
*/
83+
IAsyncCommand createCopy(IPlayerEntry playerEntry, Region region, Mask mask, Clipboard clipboard);
84+
85+
/**
86+
* Create the clipboard paste command
87+
* @param playerEntry
88+
* @param position
89+
* @param world
90+
* @param mask
91+
* @param clipboard
92+
* @param ignoreAirBlocks
93+
* @param relight
94+
* @return
95+
*/
96+
IAsyncCommand createPaste(IPlayerEntry playerEntry, Location position, World world, Mask mask, ClipboardHolder clipboard,
97+
boolean ignoreAirBlocks, boolean relight);
98+
99+
/**
100+
* Create clone chunk command
101+
* @param playerEntry
102+
* @param region Source region
103+
* @param position Target position
104+
* @param world
105+
* @param mask
106+
* @return
107+
*/
108+
IAsyncCommand createClone(IPlayerEntry playerEntry, Region region, Location position, World world, Mask mask);
109+
110+
111+
/**
112+
* Create fill chunk command
113+
* @param playerEntry
114+
* @param position Source position
115+
* @param world Source world
116+
* @param region Target region (region to fill)
117+
* @param mask
118+
* @return
119+
*/
120+
IAsyncCommand createFill(IPlayerEntry playerEntry, Location position, World world, Region region, Mask mask);
121+
122+
/**
123+
* Create set chunk command
124+
* @param playerEntry
125+
* @param region
126+
* @param pattern
127+
* @param mask
128+
* @param fullChunk
129+
* @return
130+
*/
131+
IAsyncCommand createSet(IPlayerEntry playerEntry, Region region, Pattern pattern, Mask mask, boolean fullChunk);
132+
133+
/**
134+
* Create replace chunk command
135+
* @param playerEntry
136+
* @param region
137+
* @param from
138+
* @param to
139+
* @param mask
140+
* @param wholeWorld perform the replace over the whole world
141+
* @return
142+
*/
143+
IAsyncCommand createReplace(IPlayerEntry playerEntry, Region region, Mask from, Pattern to, Mask mask, boolean wholeWorld);
144+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* AsyncWorldEdit API
3+
* Copyright (c) 2016, SBPrime <https://github.com/SBPrime/>
4+
* Copyright (c) AsyncWorldEdit API contributors
5+
*
6+
* All rights reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted free of charge provided that the following
10+
* conditions are met:
11+
*
12+
* 1. Redistributions of source code must retain the above copyright notice, this
13+
* list of conditions and the following disclaimer.
14+
* 2. Redistributions in binary form must reproduce the above copyright notice,
15+
* this list of conditions and the following disclaimer in the documentation
16+
* and/or other materials provided with the distribution,
17+
* 3. Redistributions of source code, with or without modification, in any form
18+
* other then free of charge is not allowed,
19+
* 4. Redistributions in binary form in any form other then free of charge is
20+
* not allowed.
21+
* 5. Any derived work based on or containing parts of this software must reproduce
22+
* the above copyright notice, this list of conditions and the following
23+
* disclaimer in the documentation and/or other materials provided with the
24+
* derived work.
25+
* 6. The original author of the software is allowed to change the license
26+
* terms or the entire license of the software as he sees fit.
27+
* 7. The original author of the software is allowed to sublicense the software
28+
* or its parts using any license terms he sees fit.
29+
*
30+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
31+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
34+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40+
*/
41+
package org.primesoft.asyncworldedit.api.utils;
42+
43+
import com.sk89q.worldedit.MaxChangedBlocksException;
44+
import com.sk89q.worldedit.WorldEditException;
45+
import org.primesoft.asyncworldedit.api.playerManager.IPlayerEntry;
46+
import org.primesoft.asyncworldedit.api.worldedit.IAweEditSession;
47+
import org.primesoft.asyncworldedit.api.worldedit.ICancelabeEditSession;
48+
49+
/**
50+
*
51+
* @author SBPrime
52+
*/
53+
public interface IAsyncCommand extends IFuncParamEx<Integer, ICancelabeEditSession, MaxChangedBlocksException> {
54+
55+
/**
56+
* Get the command name
57+
*
58+
* @return
59+
*/
60+
String getName();
61+
62+
/**
63+
* The player entry
64+
*
65+
* @return
66+
*/
67+
IPlayerEntry getPlayer();
68+
69+
/**
70+
* The task
71+
*
72+
* @param editSesstion
73+
* @return
74+
* @throws MaxChangedBlocksException
75+
*/
76+
Integer task(IAweEditSession editSesstion) throws WorldEditException;
77+
}

0 commit comments

Comments
 (0)