-
Notifications
You must be signed in to change notification settings - Fork 0
システム完成 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
建築範囲は全員同じなので一か所にRangeを保存しておくほうがいいと思います |
指摘ありがとうございます。申し訳ないです、建築範囲の自分の中での解釈が違いました。修正しておきます。 |
|
|
||
| public void setup() { | ||
| File file = new File(plugin.getDataFolder() + "/PlayerData/", ""); | ||
| File file = new File(plugin.getDataFolder().toURI()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File file = plugin.getDataFolder();でいけますよ
| setMaxLoc(locMaxClone); | ||
| } | ||
|
|
||
| public boolean isPlayerWithinBound(Location loc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
確認するのがplayerに限らないのでisInBoundとかのほうがわかりやすいと思います
| } | ||
|
|
||
| if (strings[0].equals("info")) { | ||
| p.sendMessage(infoLoc()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
範囲が未登録の場合エラーが出ました
| } | ||
|
|
||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
こんな感じでブロックの破戒の対応とディスペンサーとピストンと溶岩と水による精製もキャンセルしてほしいです!
@EventHandler
public void onBlockEvent(BlockPlaceEvent e) {
blockEvent(e, e.getPlayer());
}
@EventHandler
public void onBlockEvent(BlockBreakEvent e) {
blockEvent(e, e.getPlayer());
}
private void blockEvent(@NotNull BlockEvent blockEvent, @Nullable Player player) {
final var block = blockEvent.getBlock();
if (!(blockEvent instanceof Cancellable cancellable)) return;
if (!block.getWorld().getName().equals(HakoniwaCore.getWorldName())) return;
if (player != null && player.getGameMode().equals(GameMode.CREATIVE)) return;
Location blockLocation = block.getLocation();
if (!HakoniwaCore.getRange().getBound().isPlayerWithinBound(blockLocation)) {
cancellable.setCancelled(true);
if (player != null) player.sendMessage(Utils.message("§cここにブロックを置くことは出来ません"));
}
}
システムが完成しました。
デバッグを行っていないため、バグは不明