6 Commits
Author SHA1 Message Date
Nassim Jahnke 24b97184cc 1.7.2 Release 2021-11-06 21:57:51 +01:00
Nassim Jahnke 8e10485e89 Add ability to set per-particle radius, speed, and offset 2021-11-06 21:53:12 +01:00
Nassim Jahnke 95a766d250 Update copyright header and name 2021-11-06 21:33:16 +01:00
KennyTV 75db35d027 Add sanity check when uncaching players 2020-04-23 18:38:05 +02:00
KennyTV b698132801 Replace domain redirection with proper discord link 2020-04-13 23:48:39 +02:00
KennyTV a7085b1bc0 1.7.1 Release
* Add max selection size option
* Limit the maximum advanced grid size to make them more beautiful
* Fix send to all particles not working (Fixes #7)
2020-04-12 13:59:25 +02:00
40 changed files with 244 additions and 143 deletions

No files matched your search

+2 -2
View File
@@ -1,6 +1,6 @@
# WorldEditSUI
[![Discord](https://img.shields.io/discord/489135856284729384.svg?label=Discord&logo=discord&logoColor=fff)](https://discord.gg/vGCUzHq)
[![Twitter](https://img.shields.io/twitter/follow/KennyTVN.svg?label=Twitter)](https://twitter.com/KennyTVN)
[![Twitter](https://img.shields.io/twitter/follow/KennyTVN.svg?label=Twitter)](https://twitter.com/kennytvn)
Sassy Minecraft plugin to show your current WorldEdit selection by displaying particles (which can be greatly customized in the plugin's config).
Compared to other server plugins with similar functionality, it aims at a higher performance and lesser memory impact by having a quite simplistic approach to calculating vectors.
@@ -9,7 +9,7 @@ You can read up on everything else and see examples on the [**Spigot page**](htt
## Legacy support
This branch supports Minecraft versions from 1.9 upwards.
If you want a jar that supports 1.8.4-1.8.9 as well, see the `1.8-support` branch / the [**last release to contain a 1.8 build**](https://github.com/KennyTV/WorldEditSUI/releases/tag/1.6.1).
If you want a jar that supports 1.8.4-1.8.9 as well, see the `1.8-support` branch / the [**last release to contain a 1.8 build**](https://github.com/kennytv/WorldEditSUI/releases/tag/1.6.1).
## Compiling
Use Maven to compile the project (`mvn clean package`).
+4 -4
View File
@@ -7,7 +7,7 @@
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>worldedit-sui-parent</artifactId>
<packaging>pom</packaging>
<version>1.7</version>
<version>1.7.2</version>
<modules>
<module>worldedit-sui</module>
@@ -36,13 +36,13 @@
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>19.0.0</version>
<version>22.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -53,7 +53,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>worldedit-sui-parent</artifactId>
<version>1.7</version>
<version>1.7.2</version>
</parent>
<packaging>pom</packaging>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>we-compat</artifactId>
<version>1.7</version>
<version>1.7.2</version>
</parent>
<artifactId>we-compat-common</artifactId>
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>we-compat</artifactId>
<version>1.7</version>
<version>1.7.2</version>
</parent>
<artifactId>we6-compat</artifactId>
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,7 +24,12 @@ import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.regions.*;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.CylinderRegion;
import com.sk89q.worldedit.regions.EllipsoidRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.session.ClipboardHolder;
import eu.kennytv.worldeditsui.compat.RegionHelper;
import eu.kennytv.worldeditsui.compat.Simple2DVector;
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>we-compat</artifactId>
<version>1.7</version>
<version>1.7.2</version>
</parent>
<artifactId>we7-compat</artifactId>
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,7 +25,12 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector2;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.regions.*;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.CylinderRegion;
import com.sk89q.worldedit.regions.EllipsoidRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.session.ClipboardHolder;
import eu.kennytv.worldeditsui.compat.RegionHelper;
import eu.kennytv.worldeditsui.compat.Simple2DVector;
+9 -1
View File
@@ -6,11 +6,19 @@
<parent>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>worldedit-sui-parent</artifactId>
<version>1.7</version>
<version>1.7.2</version>
</parent>
<artifactId>worldedit-sui</artifactId>
<name>WorldEditSUI</name>
<url>https://github.com/kennytv/WorldEditSUI</url>
<developers>
<developer>
<id>kennytv</id>
<url>https://github.com/kennytv/</url>
</developer>
</developers>
<dependencies>
<dependency>
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -52,7 +52,9 @@ public final class Settings {
private int particleSendInterval;
private int particleViewDistance;
private long expiresAfterMillis;
private long maxSelectionSizeToDisplay;
private int maxPing;
private boolean useMaxSelectionSizeBypassPerm;
private boolean cacheLocations;
private boolean expiryEnabled;
private boolean expireMessage;
@@ -82,12 +84,25 @@ public final class Settings {
final YamlConfiguration config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "config.yml"));
wandItem = config.getString("wand", "").toUpperCase().replace("MINECRAFT:", "");
particleViewDistance = config.getInt("particle-viewdistance", 99);
if (particleViewDistance < 1 || particleViewDistance > 500) {
plugin.getLogger().warning("To punish you for your deeds of setting the particle viewdistance to an astonishing "
+ particleViewDistance + ", it has been set to 2 blocks.");
plugin.getLogger().warning("Also, this puppy just died.\n"
+ " __\n" +
" (___()'`;\n" +
" /, /`\n" +
" \\\\\"--\\\\");
plugin.getLogger().warning("Is this what you wanted?");
particleViewDistance = 2;
}
particle = loadParticle(config, "particle", Particle.FLAME);
clipboardParticle = loadParticle(config, "clipboard-particle", Particle.VILLAGER_HAPPY);
wgRegionParticle = loadParticle(config, "wg-region-particle", Particle.VILLAGER_HAPPY);
maxPing = Math.max(config.getInt("max-ping"), 0);
try {
maxPing = Math.max(config.getInt("max-ping"), 0);
Player.Spigot.class.getDeclaredMethod("getPing");
} catch (final NoSuchMethodException ignored) {
if (maxPing != 0) {
@@ -145,19 +160,6 @@ public final class Settings {
showByDefault = config.getBoolean("show-selection-by-default", true);
showClipboardByDefault = config.getBoolean("show-clipboard-by-default");
particleViewDistance = config.getInt("particle-viewdistance", 99);
if (particleViewDistance < 1 || particleViewDistance > 500) {
plugin.getLogger().warning("To punish you for your deeds of setting the particle viewdistance to an astonishing "
+ particleViewDistance + ", it has been set to 2 blocks.");
plugin.getLogger().warning("Also, this puppy just died.\n"
+ " __\n" +
" (___()'`;\n" +
" /, /`\n" +
" \\\\\"--\\\\");
plugin.getLogger().warning("Is this what you wanted?");
particleViewDistance = 2;
}
expiryEnabled = config.getBoolean("particle-expiry.enabled", false);
if (expiryEnabled) {
expireMessage = config.getBoolean("particle-expiry.expire-message", true);
@@ -171,6 +173,9 @@ public final class Settings {
}
}
maxSelectionSizeToDisplay = Math.max(config.getLong("max-selection-size-to-display"), 0);
useMaxSelectionSizeBypassPerm = config.getBoolean("enable-max-selection-bypass-perm", true);
if (persistentToggles) {
final File file = new File(plugin.getDataFolder(), "userdata.yml");
if (!file.exists()) {
@@ -208,17 +213,29 @@ public final class Settings {
} catch (final Exception e) {
plugin.getLogger().warning("Unknown particle for " + s + ": " + particleName.toUpperCase());
plugin.getLogger().warning("Switched to default particle: " + defaultParticle);
return new ParticleData(defaultParticle, null);
return new ParticleData(defaultParticle, particleViewDistance);
}
double speed = 0;
double offX = 0;
double offY = 0;
double offZ = 0;
int radius = particleViewDistance;
final ConfigurationSection particleSection = section.getConfigurationSection(s + "-data");
if (particleSection != null) {
speed = Math.max(0, particleSection.getDouble("speed"));
offX = particleSection.getDouble("offX");
offY = particleSection.getDouble("offY");
offZ = particleSection.getDouble("offZ");
radius = Math.min(500, Math.max(1, particleSection.getInt("radius", radius))); // TODO warn if radius is too high
}
try {
final Object data = ParticleData.getExtraData(particle, section.getConfigurationSection(s + "-data"));
return new ParticleData(particle, data);
return new ParticleData(particle, radius, speed, offX, offY, offZ, ParticleData.getExtraData(particle, particleSection));
} catch (final Exception e) {
plugin.getLogger().warning("Error loading particle data of " + particleName + " - Missing data? You may read up on how to correctly set its data at the bottom of the plugin's Spigot page.");
plugin.getLogger().warning("Falling back to default particle: " + defaultParticle);
e.printStackTrace();
return new ParticleData(particle, null);
return new ParticleData(particle, particleViewDistance);
}
}
@@ -315,6 +332,14 @@ public final class Settings {
return maxPing;
}
public long getMaxSelectionSizeToDisplay() {
return maxSelectionSizeToDisplay;
}
public boolean useMaxSelectionSizeBypassPerm() {
return useMaxSelectionSizeBypassPerm;
}
public boolean isExpiryEnabled() {
return expiryEnabled;
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -61,9 +61,6 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* @author KennyTV
*/
public final class WorldEditSUIPlugin extends JavaPlugin {
private static final String PREFIX = "§8[§eWorldEditSUI§8] ";
@@ -101,9 +98,10 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
}
regionHelper = isWorldEdit7 ? new RegionHelper7() : new RegionHelper6();
particleHelper = new ParticleHelper(settings);
settings = new Settings(this);
particleHelper = new ParticleHelper(settings);
userManager = new UserManager(settings);
drawManager = new DrawManager(this);
@@ -141,7 +139,7 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
}
private void printEnableMessage() {
getLogger().info("Plugin by KennyTV");
getLogger().info("Plugin by kennytv");
getServer().getScheduler().runTaskAsynchronously(this, () -> {
updateAvailable();
final int compare = version.compareTo(newestVersion);
@@ -149,7 +147,7 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
getLogger().info("§cNewest version available: §aVersion " + newestVersion + "§c, you're on §a" + version);
} else if (compare == 1) {
if (version.getTag().equalsIgnoreCase("snapshot")) {
getLogger().info("§cYou're running a development version, please report bugs on the Discord server (https://kennytv.eu/discord).");
getLogger().info("§cYou're running a development version, please report bugs on the Discord server (https://discord.gg/vGCUzHq).");
} else {
getLogger().info("§cYou're running a version, that doesn't exist! §cN§ai§dc§ee§5!");
}
@@ -280,10 +278,9 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
location.setY(vector.getY());
location.setZ(vector.getZ());
if (settings.sendParticlesToAll(drawedType)) {
particleHelper.playEffectToAll(settings.getParticle(drawedType), settings.getOthersParticle(drawedType),
location, settings.getParticleViewDistance(), player);
particleHelper.playEffectToAll(settings.getParticle(drawedType), settings.getOthersParticle(drawedType), location, player);
} else {
particleHelper.playEffect(settings.getParticle(drawedType), location, settings.getParticleViewDistance(), player);
particleHelper.playEffect(settings.getParticle(drawedType), location, player);
}
}
return;
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -152,7 +152,7 @@ public final class WESUICommand implements CommandExecutor, TabCompleter {
sender.sendMessage(getMessage("helpToggleClipboard"));
if (plugin.isWorldGuardEnabled() && sender.hasPermission("wesui.command.showregion"))
sender.sendMessage(getMessage("helpShowRegion"));
sender.sendMessage("§8× §eVersion " + plugin.getVersion() + " §7by §bKennyTV");
sender.sendMessage("§8× §eVersion " + plugin.getVersion() + " §7by §bkennytv");
sender.sendMessage(getMessage("helpHeader"));
sender.sendMessage("");
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,6 +35,8 @@ public final class CuboidDrawer extends DrawerBase {
@Override
public void draw(final Player player, final Region region, final DrawedType drawedType) {
if (!hasValidSize(player, region)) return;
final double width = region.getWidth();
final double length = region.getLength();
final double height = region.getHeight();
@@ -50,9 +52,9 @@ public final class CuboidDrawer extends DrawerBase {
int gridSpaceZ = 0;
int topGridSpace = 0;
if (settings.hasAdvancedGrid(drawedType)) {
gridSpaceX = settings.getParticlesPerBlock() * ((int) ((width * height) / AREA_FACTOR) + 1);
gridSpaceZ = settings.getParticlesPerBlock() * ((int) ((length * height) / AREA_FACTOR) + 1);
topGridSpace = settings.getParticlesPerBlock() * ((int) ((width * length) / AREA_FACTOR) + 1);
gridSpaceX = settings.getParticlesPerBlock() * checkSpace(((int) ((width * height) / AREA_FACTOR) + 1));
gridSpaceZ = settings.getParticlesPerBlock() * checkSpace(((int) ((length * height) / AREA_FACTOR) + 1));
topGridSpace = settings.getParticlesPerBlock() * checkSpace(((int) ((width * length) / AREA_FACTOR) + 1));
maxGridTicks = height * settings.getParticlesPerGridBlock(drawedType) - 1;
maxTopGridTicksX = length * settings.getParticlesPerGridBlock(drawedType) - 1;
maxTopGridTicksZ = width * settings.getParticlesPerGridBlock(drawedType) - 1;
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,6 +36,8 @@ public final class CylinderDrawer extends DrawerBase {
@Override
public void draw(final Player player, final Region region, final DrawedType drawedType) {
if (!hasValidSize(player, region)) return;
final SimpleVector radius = plugin.getRegionHelper().getRadius((CylinderRegion) region, 1.3, 1.3);
final int width = (int) radius.getX();
final int length = (int) radius.getZ();
@@ -65,7 +67,7 @@ public final class CylinderDrawer extends DrawerBase {
final double x = location.getX();
final double z = location.getZ();
final double bottom = location.getY();
final int gap = settings.getParticlesPerBlock() * (((width * length) / AREA_FACTOR) + 1);
final int gap = checkSpace(settings.getParticlesPerBlock() * (((width * length) / AREA_FACTOR) + 1));
final int ticks = 2 * (width - 1) / gap;
if (xAxis) {
location.setX(location.getX() - width);
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,8 +18,8 @@
package eu.kennytv.worldeditsui.drawer;
import eu.kennytv.worldeditsui.compat.SelectionType;
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
import eu.kennytv.worldeditsui.compat.SelectionType;
import eu.kennytv.worldeditsui.drawer.base.Drawer;
import java.util.HashMap;
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,6 +35,8 @@ public final class EllipsoidDrawer extends DrawerBase {
@Override
public void draw(final Player player, final Region region, final DrawedType drawedType) {
if (!hasValidSize(player, region)) return;
final SimpleVector radius = plugin.getRegionHelper().getRadius((EllipsoidRegion) region, 1.5, 1.4, 1.5);
final int width = (int) radius.getX();
final int length = (int) radius.getZ();
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,6 +36,8 @@ public final class PolygonalDrawer extends DrawerBase {
@Override
public void draw(final Player player, final Region region, final DrawedType drawedType) {
if (!hasValidSize(player, region)) return;
final Polygonal2DRegion polyRegion = (Polygonal2DRegion) region;
final Simple2DVector[] points = plugin.getRegionHelper().getPoints(polyRegion);
Simple2DVector last = points[0];
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,7 +20,6 @@ package eu.kennytv.worldeditsui.drawer.base;
import com.sk89q.worldedit.regions.Region;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
public interface Drawer {
@@ -33,7 +32,7 @@ public interface Drawer {
* @param region region to be displayed with particles
* @param drawedType drawed type
*/
void draw(@Nullable Player player, Region region, DrawedType drawedType);
void draw(Player player, Region region, DrawedType drawedType);
/**
* Recreates the given with particles.
@@ -43,7 +42,7 @@ public interface Drawer {
* @param player player to send the particles to, may be null when sent to all players
* @param region region to be displayed with particles
*/
default void draw(@Nullable final Player player, final Region region) {
default void draw(final Player player, final Region region) {
draw(player, region, DrawedType.SELECTED);
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@
package eu.kennytv.worldeditsui.drawer.base;
import com.sk89q.worldedit.regions.Region;
import eu.kennytv.worldeditsui.Settings;
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
import eu.kennytv.worldeditsui.compat.SimpleVector;
@@ -29,6 +30,7 @@ import org.bukkit.entity.Player;
public abstract class DrawerBase implements Drawer {
protected static final int MAX_GAP = 30;
protected static final int AREA_FACTOR = 256;
protected final WorldEditSUIPlugin plugin;
protected final Settings settings;
@@ -38,6 +40,12 @@ public abstract class DrawerBase implements Drawer {
this.settings = plugin.getSettings();
}
protected boolean hasValidSize(final Player player, final Region region) {
if (settings.getMaxSelectionSizeToDisplay() == 0) return true;
return region.getArea() <= settings.getMaxSelectionSizeToDisplay()
|| (settings.useMaxSelectionSizeBypassPerm() && player.hasPermission("wesui.maxselectionsize.bypass"));
}
protected void playEffect(final Location location, final Player player) {
playEffect(location, player, DrawedType.SELECTED);
}
@@ -54,9 +62,13 @@ public abstract class DrawerBase implements Drawer {
final ParticleData particle = settings.getParticle(drawedType);
if (settings.sendParticlesToAll(drawedType)) {
final ParticleData othersParticle = settings.getOthersParticle(drawedType);
plugin.getParticleHelper().playEffectToAll(particle, othersParticle, location, settings.getParticleViewDistance(), player);
plugin.getParticleHelper().playEffectToAll(particle, othersParticle, location, player);
} else {
plugin.getParticleHelper().playEffect(particle, location, settings.getParticleViewDistance(), player);
plugin.getParticleHelper().playEffect(particle, location, player);
}
}
protected int checkSpace(final int gap) {
return Math.min(gap, MAX_GAP);
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -10,7 +10,12 @@ import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.ServicePriority;
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,8 +18,8 @@
package eu.kennytv.worldeditsui.user;
import eu.kennytv.worldeditsui.compat.SimpleVector;
import eu.kennytv.worldeditsui.compat.SelectionType;
import eu.kennytv.worldeditsui.compat.SimpleVector;
import java.util.ArrayList;
import java.util.List;
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -58,7 +58,9 @@ public final class UserManager {
public void deleteUser(final Player player) {
final User removedUser = users.remove(player.getUniqueId());
removedUser.clearCaches();
if (removedUser != null) {
removedUser.clearCaches();
}
}
public Map<UUID, User> getUsers() {
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,24 +30,30 @@ import org.jetbrains.annotations.Nullable;
public final class ParticleData {
private final Particle particle;
private final int radiusSquared;
private final double speed;
private final double offX;
private final double offY;
private final double offZ;
private final Object data;
public ParticleData(final Particle particle, @Nullable final Object data) {
public ParticleData(final Particle particle, final int radius) {
this(particle, radius, 0, 0, 0, 0, null);
}
public ParticleData(final Particle particle, final int radius, final double speed,
final double offX, final double offY, final double offZ, @Nullable final Object data) {
this.particle = particle;
this.radiusSquared = radius * radius;
this.data = data;
}
public Particle getParticle() {
return particle;
}
@Nullable
public Object getData() {
return data;
this.speed = speed;
this.offX = offX;
this.offY = offY;
this.offZ = offZ;
}
//TODO proper error handling/warnings
public static Object getExtraData(final Particle particle, final ConfigurationSection section) throws Exception {
public static Object getExtraData(final Particle particle, final ConfigurationSection section) {
final Class<?> dataType = particle.getDataType();
if (dataType == null || dataType == Void.class) return null;
@@ -76,4 +82,33 @@ public final class ParticleData {
throw new IllegalArgumentException("The datatype " + name + " is not yet supported by the plugin - please report this error!");
}
public Particle getParticle() {
return particle;
}
public int radiusSquared() {
return radiusSquared;
}
public double speed() {
return speed;
}
public double offX() {
return offX;
}
public double offY() {
return offY;
}
public double offZ() {
return offZ;
}
@Nullable
public Object getData() {
return data;
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,34 +31,26 @@ public final class ParticleHelper {
this.settings = settings;
}
public void playEffect(final ParticleData particle, final Location location, final int radius, final Player player) {
playEffect(particle, location, 0, 0, 0, radius, player);
}
public void playEffect(final ParticleData particle, final Location location, final float offX, final float offY, final float offZ, final int radius, final Player player) {
public void playEffect(final ParticleData particle, final Location location, final Player player) {
if (!location.getWorld().equals(player.getWorld())) return;
final int radiusSquared = radius * radius;
if (player.getLocation().distanceSquared(location) > radiusSquared) return;
if (player.getLocation().distanceSquared(location) > particle.radiusSquared()) return;
player.spawnParticle(particle.getParticle(), location, 1, offX, offY, offZ, 0, particle.getData());
player.spawnParticle(particle.getParticle(), location, 1,
particle.offX(), particle.offY(), particle.offZ(), particle.speed(), particle.getData());
}
public void playEffectToAll(final ParticleData particle, final ParticleData othersParticle, final Location location, final int radius, final Player origin) {
playEffectToAll(particle, othersParticle, location, 0, 0, 0, radius, origin);
}
public void playEffectToAll(final ParticleData particle, final ParticleData othersParticle, final Location location, final float offX, final float offY, final float offZ, final int radius, final Player origin) {
final int radiusSquared = radius * radius;
public void playEffectToAll(final ParticleData particle, final ParticleData othersParticle, final Location location, final Player origin) {
for (final Player player : Bukkit.getOnlinePlayers()) {
if (!location.getWorld().equals(player.getWorld())
|| player.getLocation().distanceSquared(location) > radiusSquared) continue;
|| player.getLocation().distanceSquared(location) > particle.radiusSquared()) continue;
final boolean originalPlayer = player.getUniqueId().equals(origin.getUniqueId());
if (!originalPlayer && !canSeeOtherParticles(player)) continue;
final ParticleData toSend = originalPlayer ? particle : othersParticle;
player.spawnParticle(toSend.getParticle(), location, 1, offX, offY, offZ, 0, toSend.getData());
player.spawnParticle(toSend.getParticle(), location, 1,
particle.offX(), particle.offY(), particle.offZ(), particle.speed(), toSend.getData());
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2020 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+9 -1
View File
@@ -1,4 +1,4 @@
# WorldEditSUI Plugin by KennyTV
# WorldEditSUI Plugin by kennytv
# If enabled, the positions for particles will only be calculated once per selection and then cached.
# This essentially entirely removes the higher CPU usage of the calculations, but results in some caching if many/big selections are being made.
@@ -12,6 +12,7 @@ cache-calculated-positions: true
#
# If you want to use a particle that requires extra data (REDSTONE, FALLING_DUST, BLOCK_DUST, BLOCK_CRACK, ITEM_CRACK),
# you can read up on how to do that at the bottom of the plugin's Spigot page.
# The same applies to per-particle view-distance, speed, and offsets.
particle: FLAME
# Shown for the clipboard (after using WorldEdit's //copy command).
# Can be enabled with the '/wesui toggleclipboard' command.
@@ -32,6 +33,13 @@ particle-send-interval: 12
# Set this to -1 to disable.
max-ping: 150
# Selecting giant areas may result in a high cpu usage or server lag.
# This limits the maximum number of blocks that can be displayed (default is 10 million, ~250*150*250 blocks).
# You could still go even higher if they can only be used by trusted people.
max-selection-size-to-display: 10_000_000
# If set to true, players with the 'wesui.maxselectionsize.bypass' permission ignore the limit from above.
enable-max-selection-bypass-perm: true
advanced-grid:
# If enabled, the selection will not only be displayed by the outline,
# but also with a grid between the outlines (the bigger the selection, the bigger the grid).
+1 -1
View File
@@ -1,7 +1,7 @@
name: ${project.name}
version: ${project.version}
main: eu.kennytv.worldeditsui.WorldEditSUIPlugin
authors: [KennyTV]
authors: [kennytv]
depend: [WorldEdit]
softdepend: [WorldGuard]
website: https://www.spigotmc.org/resources/worldeditsui.60726/