9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-28 19:49:06 +00:00

Totally stable optimizations that wont cause any problems at all.

This commit is contained in:
Daniel Mills
2021-07-14 16:40:20 -04:00
parent 886553a923
commit 7d423fa49d
260 changed files with 2329 additions and 3058 deletions

View File

@@ -46,46 +46,44 @@ public class ConversionManager {
converters = new KList<>();
J.s(() ->
{
J.attemptAsync(() ->
{
if (Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {
converters.add(new Converter() {
@Override
public String getOutExtension() {
return "iob";
}
J.attemptAsync(() ->
{
if (Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {
converters.add(new Converter() {
@Override
public String getOutExtension() {
return "iob";
}
@Override
public String getInExtension() {
return "schem";
}
@Override
public String getInExtension() {
return "schem";
}
@Override
public void convert(File in, File out) {
SKConversion.convertSchematic(in, out);
}
});
@Override
public void convert(File in, File out) {
SKConversion.convertSchematic(in, out);
}
});
converters.add(new Converter() {
@Override
public String getOutExtension() {
return "iob";
}
converters.add(new Converter() {
@Override
public String getOutExtension() {
return "iob";
}
@Override
public String getInExtension() {
return "schematic";
}
@Override
public String getInExtension() {
return "schematic";
}
@Override
public void convert(File in, File out) {
SKConversion.convertSchematic(in, out);
}
});
}
});
}, 5);
@Override
public void convert(File in, File out) {
SKConversion.convertSchematic(in, out);
}
});
}
}), 5);
}
private String toPoolName(String poolReference) {
@@ -136,22 +134,22 @@ public class ConversionManager {
if (compound.containsKey("blocks") && compound.containsKey("palette") && compound.containsKey("size")) {
String id = in.toURI().relativize(folder.toURI()).getPath() + file.getName().split("\\Q.\\E")[0];
ListTag<IntTag> size = (ListTag<IntTag>) compound.getListTag("size");
@SuppressWarnings("unchecked") ListTag<IntTag> size = (ListTag<IntTag>) compound.getListTag("size");
int w = size.get(0).asInt();
int h = size.get(1).asInt();
int d = size.get(2).asInt();
KList<BlockData> palette = new KList<>();
ListTag<CompoundTag> paletteList = (ListTag<CompoundTag>) compound.getListTag("palette");
@SuppressWarnings("unchecked") ListTag<CompoundTag> paletteList = (ListTag<CompoundTag>) compound.getListTag("palette");
for (int i = 0; i < paletteList.size(); i++) {
CompoundTag cp = paletteList.get(i);
palette.add(DirectWorldWriter.getBlockData(cp));
}
IrisJigsawPiece piece = new IrisJigsawPiece();
IrisObject object = new IrisObject(w, h, d);
ListTag<CompoundTag> blockList = (ListTag<CompoundTag>) compound.getListTag("blocks");
@SuppressWarnings("unchecked") ListTag<CompoundTag> blockList = (ListTag<CompoundTag>) compound.getListTag("blocks");
for (int i = 0; i < blockList.size(); i++) {
CompoundTag cp = blockList.get(i);
ListTag<IntTag> pos = (ListTag<IntTag>) cp.getListTag("pos");
@SuppressWarnings("unchecked") ListTag<IntTag> pos = (ListTag<IntTag>) cp.getListTag("pos");
int x = pos.get(0).asInt();
int y = pos.get(1).asInt();
int z = pos.get(2).asInt();

View File

@@ -35,8 +35,8 @@ public class IrisBoardManager implements BoardProvider, Listener {
private final BoardManager manager;
private String mem = "...";
public RollingSequence hits = new RollingSequence(20);
public RollingSequence tp = new RollingSequence(100);
public final RollingSequence hits = new RollingSequence(20);
public final RollingSequence tp = new RollingSequence(100);
private final ChronoLatch cl = new ChronoLatch(1000);
@@ -105,9 +105,9 @@ public class IrisBoardManager implements BoardProvider, Listener {
parallaxRegions += g.getCompound().getEngine(i).getParallax().getRegionCount();
parallaxChunks += g.getCompound().getEngine(i).getParallax().getChunkCount();
loadedObjects += g.getCompound().getData().getObjectLoader().getSize();
memoryGuess += g.getCompound().getData().getObjectLoader().getTotalStorage() * 225;
memoryGuess += parallaxChunks * 3500;
memoryGuess += parallaxRegions * 1700000;
memoryGuess += g.getCompound().getData().getObjectLoader().getTotalStorage() * 225L;
memoryGuess += parallaxChunks * 3500L;
memoryGuess += parallaxRegions * 1700000L;
}
tp.put(0); // TODO: CHUNK SPEED

View File

@@ -41,6 +41,7 @@ import java.io.IOException;
import java.util.Objects;
import java.util.UUID;
@SuppressWarnings("ALL")
@Data
public class IrisProject {
private File path;
@@ -122,21 +123,18 @@ public class IrisProject {
}
private KList<Report> scanForErrors(IrisBiome biome, IrisObjectPlacement i) {
KList<Report> reports = new KList<>();
return reports;
return new KList<>();
}
private KList<Report> scanForErrors(IrisBiome biome, IrisBiomePaletteLayer i) {
KList<Report> reports = new KList<>();
return reports;
return new KList<>();
}
private KList<Report> scanForErrorsSeaLayers(IrisBiome biome, IrisBiomePaletteLayer i) {
KList<Report> reports = new KList<>();
return reports;
return new KList<>();
}
public boolean isOpen() {

View File

@@ -30,7 +30,6 @@ import org.zeroturnaround.zip.ZipUtil;
import org.zeroturnaround.zip.commons.FileUtils;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.UUID;
@@ -53,7 +52,7 @@ public class ProjectManager {
if (m != null) {
try {
IO.copyFile(m, ignore);
} catch (IOException e) {
} catch (IOException ignored) {
}
}
@@ -63,7 +62,8 @@ public class ProjectManager {
}
public static int countUniqueDimensions() {
int vv = counter.aquire(() -> {
return counter.aquire(() -> {
int v = 0;
try {
@@ -82,8 +82,6 @@ public class ProjectManager {
return v;
});
return vv;
}
public IrisDimension installIntoWorld(MortarSender sender, String type, File folder) {
@@ -106,7 +104,7 @@ public class ProjectManager {
try {
FileUtils.copyDirectory(f, irispack);
} catch (IOException e) {
} catch (IOException ignored) {
}
}
@@ -192,12 +190,13 @@ public class ProjectManager {
} catch (Throwable e) {
e.printStackTrace();
sender.sendMessage(
"Issue when unpacking. Please check/do the following:" +
"\n1. Do you have a functioning internet connection?" +
"\n2. Did the download corrupt?" +
"\n3. Try deleting the */plugins/iris/packs folder and re-download." +
"\n4. Download the pack from the GitHub repo: https://github.com/IrisDimensions/overworld" +
"\n5. Contact support (if all other options do not help)"
"""
Issue when unpacking. Please check/do the following:
1. Do you have a functioning internet connection?
2. Did the download corrupt?
3. Try deleting the */plugins/iris/packs folder and re-download.
4. Download the pack from the GitHub repo: https://github.com/IrisDimensions/overworld
5. Contact support (if all other options do not help)"""
);
}
File dir = null;
@@ -352,12 +351,7 @@ public class ProjectManager {
}
try {
FileUtils.copyDirectory(importPack, newPack, new FileFilter() {
@Override
public boolean accept(File pathname) {
return !pathname.getAbsolutePath().contains(".git");
}
}, false);
FileUtils.copyDirectory(importPack, newPack, pathname -> !pathname.getAbsolutePath().contains(".git"), false);
} catch (IOException e) {
e.printStackTrace();
}

File diff suppressed because it is too large Load Diff

View File

@@ -127,7 +127,7 @@ public class WandManager implements Listener {
}
Location lv = new Location(d[0].getWorld(), j, k, l).clone().add(0.5, 0.5, 0.5).clone().add(push);
Color color = Color.getHSBColor((float) (0.5f + (Math.sin((j + k + l + (p.getTicksLived() / 2)) / 20f) / 2)), 1, 1);
Color color = Color.getHSBColor((float) (0.5f + (Math.sin((j + k + l + (p.getTicksLived() / 2f)) / 20f) / 2)), 1, 1);
int r = color.getRed();
int g = color.getGreen();
int b = color.getBlue();

View File

@@ -47,6 +47,7 @@ public class CommandIrisDownload extends MortarCommand {
for (String i : args) {
if (i.equals("-t") || i.equals("--trim")) {
trim = true;
break;
}
}

View File

@@ -59,7 +59,7 @@ public class CommandIrisObjectContract extends MortarCommand {
return true;
}
int amt = args.length == 1 ? Integer.valueOf(args[0]) : 1;
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
Location a1 = b[0].clone();
Location a2 = b[1].clone();

View File

@@ -59,7 +59,7 @@ public class CommandIrisObjectExpand extends MortarCommand {
return true;
}
int amt = args.length == 1 ? Integer.valueOf(args[0]) : 1;
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
Location a1 = b[0].clone();
Location a2 = b[1].clone();

View File

@@ -79,6 +79,7 @@ public class CommandIrisObjectPaste extends MortarCommand {
for (String i : args) {
if (i.equalsIgnoreCase("-edit")) {
intoWand = true;
break;
}
}

View File

@@ -69,6 +69,7 @@ public class CommandIrisObjectSave extends MortarCommand {
for (String i : args) {
if (i.equals("-o")) {
overwrite = true;
break;
}
}

View File

@@ -59,7 +59,7 @@ public class CommandIrisObjectShift extends MortarCommand {
return true;
}
int amt = args.length == 1 ? Integer.valueOf(args[0]) : 1;
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
Location a1 = b[0].clone();
Location a2 = b[1].clone();

View File

@@ -90,7 +90,7 @@ public class CommandIrisStudioLoot extends MortarCommand {
boolean fast = ffast;
boolean add = fadd;
O<Integer> ta = new O<Integer>();
O<Integer> ta = new O<>();
ta.set(-1);
ta.set(Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, () ->

View File

@@ -58,6 +58,7 @@ public class CommandIrisStudioPackage extends MortarCommand {
for (String i : args) {
if (i.equalsIgnoreCase("-o")) {
o = true;
break;
}
}

View File

@@ -113,12 +113,7 @@ public class CommandIrisStudioProfile extends MortarCommand {
in.setFunction(i);
in.setHorizontalScale(8);
NoiseProvider np = new NoiseProvider() {
@Override
public double noise(double x, double z) {
return Math.random();
}
};
NoiseProvider np = (x, z) -> Math.random();
for (int j = 0; j < 3000; j++) {
in.interpolate(j, -j, np);

View File

@@ -63,7 +63,7 @@ public class CommandIrisWhatBiome extends MortarCommand {
if (p.getLocation().getBlock().getBiome().equals(Biome.CUSTOM)) {
try {
sender.sendMessage("Data Pack Biome: " + INMS.get().getTrueBiomeBaseKey(p.getLocation()) + " (ID: " + INMS.get().getTrueBiomeBaseId(INMS.get().getTrueBiomeBase(p.getLocation())) + ")");
} catch (Throwable ex) {
} catch (Throwable ignored) {
}
}

View File

@@ -54,6 +54,7 @@ public class CommandIrisWhatObjects extends MortarCommand {
}
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
@Override
public boolean handle(MortarSender sender, String[] args) {
if (sender.isPlayer()) {
@@ -78,7 +79,7 @@ public class CommandIrisWhatObjects extends MortarCommand {
int cz = l.getChunk().getZ();
new Spiraler(3, 3, (x, z) -> chunks.addIfMissing(world.getChunkAt(x + cx, z + cz))).drain();
}
} catch (Throwable e) {
} catch (Throwable ignored) {
}
@@ -218,6 +219,7 @@ public class CommandIrisWhatObjects extends MortarCommand {
objects.compute(n1, (k1, v1) ->
{
//noinspection ReplaceNullCheck
if (v1 == null) {
return new KMap<>();
}

View File

@@ -60,24 +60,28 @@ public class CommandIrisCreate extends MortarCommand {
String pre = split[0].toLowerCase();
if (pre.equals("type")) {
for (String s : Iris.proj.getListing(true).keySet()) {
list.add("type=" + s);
switch (pre) {
case "type" -> {
for (String s : Iris.proj.getListing(true).keySet()) {
list.add("type=" + s);
}
if (!list.contains("type=overworld")) {
list.contains("type=overworld");
}
}
if (!list.contains("type=overworld")) {
list.contains("type=overworld");
case "seed" -> {
list.add("seed=1337");
list.add("seed=" + new Random().nextInt());
list.add("seed=random");
}
case "pregen" -> {
list.add("500");
list.add("1000");
list.add("2000");
list.add("5k");
list.add("10k");
list.add("25k");
}
} else if (pre.equals("seed")) {
list.add("seed=1337");
list.add("seed=" + new Random().nextInt());
list.add("seed=random");
} else if (pre.equals("pregen")) {
list.add("500");
list.add("1000");
list.add("2000");
list.add("5k");
list.add("10k");
list.add("25k");
}
}
@@ -129,13 +133,13 @@ public class CommandIrisCreate extends MortarCommand {
sender.sendMessage("You must remember to either have multiverse installed or use the Bukkit method, otherwise the world will go corrupt!");
sender.sendMessage("Wiki: https://volmitsoftware.gitbook.io/iris/getting-started");
O<Boolean> b = new O<Boolean>();
O<Boolean> b = new O<>();
b.set(true);
if (sender.isPlayer()) {
try {
sender.player().teleport(world.get().getSpawnLocation());
} catch (Throwable e) {
} catch (Throwable ignored) {
}
}
@@ -148,9 +152,7 @@ public class CommandIrisCreate extends MortarCommand {
sender.sendMessage("Expect server lag during this time. Use '/iris pregen stop' to cancel");
new Pregenerator(world.get(), size, () ->
{
b.set(true);
});
b.set(true));
}
World ww = world.get();

View File

@@ -47,7 +47,7 @@ public class CommandIrisFix extends MortarCommand {
return true;
}
int viewDistance = args.length > 0 ? Integer.valueOf(args[0]) : -1;
int viewDistance = args.length > 0 ? Integer.parseInt(args[0]) : -1;
if (viewDistance <= 1) {
J.a(() -> {
int fixed = a.getCompound().getDefaultEngine().getFramework().getEngineParallax().repairChunk(sender.player().getLocation().getChunk());

View File

@@ -33,10 +33,11 @@ public class CommandIrisPregen extends MortarCommand {
public CommandIrisPregen() {
super("pregen", "preg", "p");
setDescription(
"Pregen this world with optional parameters: " +
"\n'1k' = 1000 by 1000 blocks, '1c' = 1 by 1 chunks, and '1r' = 32 by 32 chunks." +
"\nIf you are using the console or want to pregen a world you're not in:" +
"\nalso specify the name of the world. E.g. /ir pregen 5k world"
"""
Pregen this world with optional parameters:\s
'1k' = 1000 by 1000 blocks, '1c' = 1 by 1 chunks, and '1r' = 32 by 32 chunks.
If you are using the console or want to pregen a world you're not in:
also specify the name of the world. E.g. /ir pregen 5k world"""
);
requiresPermission(Iris.perm.studio);
setCategory("Pregen");

View File

@@ -48,6 +48,7 @@ public class CommandIrisUpdateWorld extends MortarCommand {
for (String i : args) {
if (i.equalsIgnoreCase("--fresh-download")) {
fresh = true;
break;
}
}

View File

@@ -31,7 +31,7 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import java.util.Arrays;
public class CommandLocate extends MortarCommand implements Listener {
CommandLocate instance;
final CommandLocate instance;
@EventHandler
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) {

View File

@@ -28,6 +28,7 @@ import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@SuppressWarnings("InstantiationOfUtilityClass")
public class BlockSignal {
public static void of(Block block, int ticks) {
new BlockSignal(block, ticks);

View File

@@ -23,6 +23,7 @@ import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
@SuppressWarnings("ClassCanBeRecord")
public class BukkitBlockEditor implements BlockEditor {
private final World world;

View File

@@ -26,6 +26,7 @@ import lombok.Data;
import org.bukkit.World;
import org.bukkit.block.Block;
@SuppressWarnings("ALL")
@Data
public class DustRevealer {
private final ParallaxAccess parallax;

View File

@@ -62,7 +62,6 @@ public class WEBlockEditor implements BlockEditor {
@Override
public void close() {
es.close();
return;
}
@Override

View File

@@ -24,6 +24,7 @@ import org.bukkit.Material;
import java.awt.image.BufferedImage;
@SuppressWarnings("ClassCanBeRecord")
public class IrisRenderer {
private final Renderer renderer;

View File

@@ -32,12 +32,10 @@ import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
public class IrisVision extends JPanel implements MouseWheelListener {
private static final long serialVersionUID = 2094606939770332040L;
@@ -63,38 +61,32 @@ public class IrisVision extends JPanel implements MouseWheelListener {
private final KMap<BlockPosition, BufferedImage> fastpositions = new KMap<>();
private final KSet<BlockPosition> working = new KSet<>();
private final KSet<BlockPosition> workingfast = new KSet<>();
private final ExecutorService e = Executors.newFixedThreadPool(8, new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
tid++;
Thread t = new Thread(r);
t.setName("Iris HD Renderer " + tid);
t.setPriority(Thread.MIN_PRIORITY);
t.setUncaughtExceptionHandler((et, e) ->
{
Iris.info("Exception encountered in " + et.getName());
e.printStackTrace();
});
private final ExecutorService e = Executors.newFixedThreadPool(8, r -> {
tid++;
Thread t = new Thread(r);
t.setName("Iris HD Renderer " + tid);
t.setPriority(Thread.MIN_PRIORITY);
t.setUncaughtExceptionHandler((et, e) ->
{
Iris.info("Exception encountered in " + et.getName());
e.printStackTrace();
});
return t;
}
return t;
});
private final ExecutorService eh = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
tid++;
Thread t = new Thread(r);
t.setName("Iris Renderer " + tid);
t.setPriority(Thread.NORM_PRIORITY);
t.setUncaughtExceptionHandler((et, e) ->
{
Iris.info("Exception encountered in " + et.getName());
e.printStackTrace();
});
private final ExecutorService eh = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), r -> {
tid++;
Thread t = new Thread(r);
t.setName("Iris Renderer " + tid);
t.setPriority(Thread.NORM_PRIORITY);
t.setUncaughtExceptionHandler((et, e) ->
{
Iris.info("Exception encountered in " + et.getName());
e.printStackTrace();
});
return t;
}
return t;
});
public IrisVision() {
@@ -241,12 +233,7 @@ public class IrisVision extends JPanel implements MouseWheelListener {
BufferedImage t = getTile(gg, iscale, Math.floorDiv((posX / iscale) + i, iscale) * iscale, Math.floorDiv((posZ / iscale) + j, iscale) * iscale, m);
if (t != null) {
g.drawImage(t, i - ((posX / iscale) % (iscale)), j - ((posZ / iscale) % (iscale)), iscale, iscale, new ImageObserver() {
@Override
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
return true;
}
});
g.drawImage(t, i - ((posX / iscale) % (iscale)), j - ((posZ / iscale) % (iscale)), iscale, iscale, (img, infoflags, x, y, width, height) -> true);
}
}
}
@@ -298,7 +285,7 @@ public class IrisVision extends JPanel implements MouseWheelListener {
if (file != null) {
try {
frame.setIconImage(ImageIO.read(file));
} catch (IOException e) {
} catch (IOException ignored) {
}
}
@@ -306,9 +293,7 @@ public class IrisVision extends JPanel implements MouseWheelListener {
public static void launch(IrisAccess g, int i) {
J.a(() ->
{
createAndShowGUI((x, z) -> g.getEngineAccess(i).draw(x, z), i, g.getCompound().getWorld());
});
createAndShowGUI((x, z) -> g.getEngineAccess(i).draw(x, z), i, g.getCompound().getWorld()));
}
public void mouseWheelMoved(MouseWheelEvent e) {
@@ -321,6 +306,6 @@ public class IrisVision extends JPanel implements MouseWheelListener {
positions.clear();
fastpositions.clear();
mscale = mscale + ((0.044 * mscale) * notches);
mscale = mscale < 0.00001 ? 0.00001 : mscale;
mscale = Math.max(mscale, 0.00001);
}
}

View File

@@ -37,12 +37,16 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener {
private static final long serialVersionUID = 2094606939770332040L;
static JComboBox<String> combo;
@SuppressWarnings("CanBeFinal")
RollingSequence r = new RollingSequence(90);
@SuppressWarnings("CanBeFinal")
boolean colorMode = true;
double scale = 1;
@SuppressWarnings("CanBeFinal")
static boolean hd = false;
static double ascale = 10;
CNG cng = NoiseStyle.STATIC.create(new RNG(RNG.r.nextLong()));
@SuppressWarnings("CanBeFinal")
GroupedExecutor gx = new GroupedExecutor(Runtime.getRuntime().availableProcessors(), Thread.MAX_PRIORITY, "Iris Renderer");
ReentrantLock l = new ReentrantLock();
int[][] co;
@@ -57,6 +61,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener {
double mz = 0;
static double mxx = 0;
static double mzz = 0;
@SuppressWarnings("CanBeFinal")
static boolean down = false;
double lx = Double.MAX_VALUE; //MouseX
double lz = Double.MAX_VALUE; //MouseY
@@ -154,8 +159,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener {
accuracy = down ? accuracy * 4 : accuracy;
int v = 1000;
if (g instanceof Graphics2D) {
Graphics2D gg = (Graphics2D) g;
if (g instanceof Graphics2D gg) {
if (getParent().getWidth() != w || getParent().getHeight() != h) {
w = getParent().getWidth();
@@ -250,8 +254,8 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener {
JFrame frame = new JFrame("Noise Explorer");
NoiseExplorer nv = new NoiseExplorer();
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
KList<String> li = new KList<NoiseStyle>(NoiseStyle.values()).toStringList();
combo = new JComboBox<String>(li.toArray(new String[li.size()]));
KList<String> li = new KList<>(NoiseStyle.values()).toStringList();
combo = new JComboBox<>(li.toArray(new String[0]));
combo.setSelectedItem("STATIC");
combo.setFocusable(false);
combo.addActionListener(e -> {
@@ -284,7 +288,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener {
}
public static void launch() {
EventQueue.invokeLater(() -> createAndShowGUI());
EventQueue.invokeLater(NoiseExplorer::createAndShowGUI);
}
static class HandScrollListener extends MouseAdapter {

View File

@@ -40,8 +40,7 @@ public class BKLink {
}
public Plugin getBK() {
Plugin p = Bukkit.getPluginManager().getPlugin("BKCommonLib");
return p;
return Bukkit.getPluginManager().getPlugin("BKCommonLib");
}
}

View File

@@ -30,21 +30,8 @@ public class CitizensLink {
return getCitizens() != null;
}
// public Entity spawn(EntityType type, String npcType, Location a)
// {
// if(!supported())
// {
// return null;
// }
//
// NPC npc = CitizensAPI.getNPCRegistry().createNPC(type, "");
// npc.spawn(a);
// return npc.getEntity();
// }
public Plugin getCitizens() {
Plugin p = Bukkit.getPluginManager().getPlugin("Citizens");
return p;
return Bukkit.getPluginManager().getPlugin("Citizens");
}
}

View File

@@ -118,9 +118,8 @@ public class MultiverseCoreLink {
}
public Plugin getMultiverse() {
Plugin p = Bukkit.getPluginManager().getPlugin("Multiverse-Core");
return p;
return Bukkit.getPluginManager().getPlugin("Multiverse-Core");
}
public String envName(World.Environment environment) {
@@ -128,15 +127,12 @@ public class MultiverseCoreLink {
return "normal";
}
switch (environment) {
case NORMAL:
return "normal";
case NETHER:
return "nether";
case THE_END:
return "end";
}
return switch (environment) {
case NORMAL -> "normal";
case NETHER -> "nether";
case THE_END -> "end";
default -> environment.toString().toLowerCase();
};
return environment.toString().toLowerCase();
}
}

View File

@@ -55,12 +55,11 @@ public class MythicMobsLink {
}
}
return v.toArray(new String[v.size()]);
return v.toArray(new String[0]);
}
public Plugin getMythicMobs() {
Plugin p = Bukkit.getPluginManager().getPlugin("MythicMobs");
return p;
return Bukkit.getPluginManager().getPlugin("MythicMobs");
}
}