-
Notifications
You must be signed in to change notification settings - Fork 1
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
BuildTools
committed
Nov 13, 2021
1 parent
e9ba3e6
commit 1f3787b
Showing
7 changed files
with
81 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package be4rjp.parallel.chunk; | ||
|
||
import be4rjp.parallel.nms.NMSUtil; | ||
import org.bukkit.Chunk; | ||
|
||
import java.util.Map; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
public class AsyncChunkCash { | ||
|
||
private static final Map<String, AsyncChunkCash> worldChunkCashMap = new ConcurrentHashMap<>(); | ||
|
||
public static AsyncChunkCash computeIfAbsentWorldAsyncChunkCash(String worldName){ | ||
return worldChunkCashMap.computeIfAbsent(worldName, k -> new AsyncChunkCash()); | ||
} | ||
|
||
public static AsyncChunkCash getWorldAsyncChunkCash(String worldName){ | ||
return worldChunkCashMap.get(worldName); | ||
} | ||
|
||
private final Map<Long, Object> chunkCashMap = new ConcurrentHashMap<>(); | ||
|
||
public void addLoadedChunk(Chunk chunk){ | ||
try { | ||
Object nmsChunk = NMSUtil.getNMSChunk(chunk); | ||
long coordinate = ((long)chunk.getX() << 32) | (chunk.getZ() & 0xFFFFFFFFL); | ||
chunkCashMap.put(coordinate, nmsChunk); | ||
} catch (Exception e) {e.printStackTrace();} | ||
} | ||
|
||
public Object getCashedChunk(int chunkX, int chunkZ){ | ||
return chunkCashMap.get(((long)chunkX << 32) | (chunkZ & 0xFFFFFFFFL)); | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
|
||
# 動作モードの設定 | ||
# NORMAL or ONLY_ONE | ||
# ONLY_ONEに設定した場合は全てのプレイヤーに対して同じParallelWorldが使われるようになります | ||
work-type: NORMAL | ||
|
||
|
||
# パフォーマンスモードを使用するかどうかの設定 | ||
# このプラグイン以外でブロックの設置が行われる可能性のある場合は false 推奨 | ||
performance-mode: false | ||
|
||
|
||
## ライトパケットへの介入を行うかどうかの設定 | ||
rewrite-light-packet: true | ||
rewrite-light-packet: true | ||
|
||
# 読み込まれていないチャンクのパケットを送信しようとしたときに警告を表示するかどうかの設定 | ||
show-chunk-packet-warning: true |