This commit is contained in:
2024-07-13 12:58:16 -07:00
parent afc7fbf33b
commit 5ca18ad261
3 changed files with 79 additions and 2 deletions

View File

@@ -107,7 +107,7 @@
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.4</version>
<version>7.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@@ -1,6 +1,10 @@
package io.github.lncvrt.lncvrtbox;
import com.earth2me.essentials.Essentials;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.function.pattern.RandomPattern;
import com.sk89q.worldedit.world.block.BlockState;
import io.github.lncvrt.lncvrtbox.events.*;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
@@ -22,6 +26,12 @@ import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.bukkit.inventory.ItemStack;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.bukkit.Bukkit;
@@ -322,6 +332,69 @@ public final class LncvrtBox extends JavaPlugin implements Listener, TabExecutor
sender.sendMessage("You do not have permission to use this command.");
}
return true;
} else if (label.equalsIgnoreCase("fix")) {
//TODO: make selectionwall4 (front wall)
com.sk89q.worldedit.world.World world = BukkitAdapter.adapt(Bukkit.getWorld("world"));
CuboidRegion selectionground1 = new CuboidRegion(world, BlockVector3.at(131, 100, 105), BlockVector3.at(-67, 100, -123));
CuboidRegion selectionwall1 = new CuboidRegion(world, BlockVector3.at(-66, 139, 105), BlockVector3.at(130, 101, 105));
CuboidRegion selectionwall2 = new CuboidRegion(world, BlockVector3.at(-67, 139, 104), BlockVector3.at(-67, 101, -122));
CuboidRegion selectionwall3 = new CuboidRegion(world, BlockVector3.at(-67, 139, -123), BlockVector3.at(130, 101, -123));
try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1)) {
RandomPattern pat = new RandomPattern();
BlockState deepslate_tiles = BukkitAdapter.adapt(Material.DEEPSLATE_TILES.createBlockData());
BlockState deepslate_bricks = BukkitAdapter.adapt(Material.DEEPSLATE_BRICKS.createBlockData());
pat.add(deepslate_tiles, 0.5);
pat.add(deepslate_bricks, 0.5);
editSession.setBlocks(selectionground1, pat);
} catch (MaxChangedBlocksException ex) {
ex.printStackTrace();
}
try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1)) {
RandomPattern pat = new RandomPattern();
BlockState gold_block = BukkitAdapter.adapt(Material.GOLD_BLOCK.createBlockData());
BlockState raw_gold_block = BukkitAdapter.adapt(Material.RAW_GOLD_BLOCK.createBlockData());
BlockState yellow_concrete = BukkitAdapter.adapt(Material.YELLOW_CONCRETE.createBlockData());
pat.add(gold_block, 0.33333333333);
pat.add(raw_gold_block, 0.33333333333);
pat.add(yellow_concrete, 0.33333333333);
editSession.setBlocks(selectionwall1, pat);
} catch (MaxChangedBlocksException ex) {
ex.printStackTrace();
}
try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1)) {
RandomPattern pat = new RandomPattern();
BlockState lapis_block = BukkitAdapter.adapt(Material.LAPIS_BLOCK.createBlockData());
BlockState blue_concrete_powder = BukkitAdapter.adapt(Material.BLUE_CONCRETE_POWDER.createBlockData());
BlockState blue_concrete = BukkitAdapter.adapt(Material.BLUE_CONCRETE.createBlockData());
pat.add(lapis_block, 0.33333333333);
pat.add(blue_concrete_powder, 0.33333333333);
pat.add(blue_concrete, 0.33333333333);
editSession.setBlocks(selectionwall2, pat);
} catch (MaxChangedBlocksException ex) {
ex.printStackTrace();
}
try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1)) {
RandomPattern pat = new RandomPattern();
BlockState lime_concrete = BukkitAdapter.adapt(Material.LIME_CONCRETE.createBlockData());
BlockState melon = BukkitAdapter.adapt(Material.MELON.createBlockData());
BlockState green_glazed_terracotta = BukkitAdapter.adapt(Material.GREEN_GLAZED_TERRACOTTA.createBlockData());
pat.add(lime_concrete, 0.33333333333);
pat.add(melon, 0.33333333333);
pat.add(green_glazed_terracotta, 0.33333333333);
editSession.setBlocks(selectionwall3, pat);
} catch (MaxChangedBlocksException ex) {
ex.printStackTrace();
}
sender.sendMessage("fixed!");
return true;
}
return false;
}

View File

@@ -34,3 +34,7 @@ commands:
lockchat:
description: Lockchat
usage: /lockchat
fix:
description: fix
permission: lncvrtbox.admin
usage: /fix