1.6.1 Release
* Add support for particles that need extra data * Add option to enable the advanced for the clipboard selection as well
Dieser Commit ist enthalten in:
Ursprung
7f63342c4c
Commit
7415455019
2
pom.xml
2
pom.xml
@ -7,7 +7,7 @@
|
||||
<groupId>eu.kennytv.worldeditsui</groupId>
|
||||
<artifactId>worldedit-sui-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.6</version>
|
||||
<version>1.6.1</version>
|
||||
|
||||
<modules>
|
||||
<module>worldedit-sui</module>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.worldeditsui</groupId>
|
||||
<artifactId>worldedit-sui-parent</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.6.1</version>
|
||||
</parent>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.worldeditsui</groupId>
|
||||
<artifactId>we-compat</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.6.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>we-compat-common</artifactId>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.worldeditsui</groupId>
|
||||
<artifactId>we-compat</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.6.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>we6-compat</artifactId>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.worldeditsui</groupId>
|
||||
<artifactId>we-compat</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.6.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>we7-compat</artifactId>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.worldeditsui</groupId>
|
||||
<artifactId>worldedit-sui-parent</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.6.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>worldedit-sui</artifactId>
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package eu.kennytv.worldeditsui;
|
||||
|
||||
import eu.kennytv.worldeditsui.util.ParticleData;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -37,27 +38,26 @@ public final class Settings {
|
||||
|
||||
private String permission;
|
||||
private String otherParticlesPermission;
|
||||
private String wandItem;
|
||||
private String wandItem; // optional value, exists for fallback/legacy reasons
|
||||
private double particleSpace;
|
||||
private double particleGridSpace;
|
||||
private int particlesPerBlock;
|
||||
private int particlesPerGridBlock;
|
||||
private int particleSendInterval;
|
||||
private int particleViewDistance;
|
||||
private long expiresAfterMillis;
|
||||
private boolean cacheLocations;
|
||||
private boolean expiryEnabled;
|
||||
private boolean expireMessage;
|
||||
private boolean advancedGrid;
|
||||
private boolean updateChecks;
|
||||
private boolean sendParticlesToAll;
|
||||
private boolean persistentToggles;
|
||||
private boolean showByDefault;
|
||||
private boolean showClipboardByDefault;
|
||||
private Particle particle;
|
||||
private Particle clipboardParticle;
|
||||
private Particle othersParticle;
|
||||
private Particle othersClipboardParticle;
|
||||
private ParticleData particle;
|
||||
private ParticleData clipboardParticle;
|
||||
private ParticleData othersParticle;
|
||||
private ParticleData othersClipboardParticle;
|
||||
private GridSettings advancedGrid;
|
||||
private GridSettings advancedClipboardGrid;
|
||||
|
||||
Settings(final WorldEditSUIPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
@ -94,18 +94,12 @@ public final class Settings {
|
||||
this.particleSpace = 1D / particlesPerBlock;
|
||||
}
|
||||
|
||||
advancedGrid = config.getBoolean("advanced-grid.enabled", false);
|
||||
if (advancedGrid) {
|
||||
particlesPerGridBlock = config.getInt("advanced-grid.particles-per-block", 2);
|
||||
if (particlesPerGridBlock < 1 || particlesPerGridBlock > 5) {
|
||||
plugin.getLogger().warning("The value advanced-grid.particles-per-block has to be set between 2 and 5!");
|
||||
plugin.getLogger().warning("Switched to default advanced-grid.particles-per-block: 2");
|
||||
particlesPerGridBlock = 2;
|
||||
particleGridSpace = 0.5;
|
||||
} else {
|
||||
particleGridSpace = 1D / particlesPerGridBlock;
|
||||
}
|
||||
}
|
||||
final ConfigurationSection gridSection = config.getConfigurationSection("advanced-grid");
|
||||
advancedGrid = gridSection.getBoolean("enabled", false) ? new GridSettings(plugin, gridSection) : null;
|
||||
|
||||
final ConfigurationSection clipboardGridSection = config.getConfigurationSection("advanced-clipboard-grid");
|
||||
advancedClipboardGrid = clipboardGridSection != null && clipboardGridSection.getBoolean("enabled", false) ?
|
||||
new GridSettings(plugin, clipboardGridSection) : null;
|
||||
|
||||
particleSendInterval = config.getInt("particle-send-interval", 12);
|
||||
if (particleSendInterval < 5 || particleSendInterval > 200) {
|
||||
@ -180,7 +174,7 @@ public final class Settings {
|
||||
}
|
||||
}
|
||||
|
||||
private Particle loadParticle(final ConfigurationSection section, final String s, final Particle defaultParticle) {
|
||||
private ParticleData loadParticle(final ConfigurationSection section, final String s, final Particle defaultParticle) {
|
||||
final String particleName = section.getString(s, defaultParticle.name()).toUpperCase().replace("MINECRAFT:", "");
|
||||
final Particle particle;
|
||||
try {
|
||||
@ -188,14 +182,18 @@ 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 defaultParticle;
|
||||
return new ParticleData(defaultParticle, null);
|
||||
}
|
||||
|
||||
if (particle == Particle.BLOCK_CRACK || particle == Particle.BLOCK_DUST || particle == Particle.ITEM_CRACK
|
||||
|| particle == Particle.REDSTONE || particle == Particle.FALLING_DUST) {
|
||||
plugin.getLogger().warning("This particle needs custom data, which isn't yet implemented in the plugin -> This particle might not work correctly!");
|
||||
try {
|
||||
final Object data = ParticleData.getExtraData(particle, section.getConfigurationSection(s + "-data"));
|
||||
return new ParticleData(particle, data);
|
||||
} 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 particle;
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
@ -229,26 +227,55 @@ public final class Settings {
|
||||
return permission;
|
||||
}
|
||||
|
||||
// getter is unused since the perm is directly given to the particle helper class
|
||||
public String getOtherParticlesPermission() {
|
||||
return otherParticlesPermission;
|
||||
}
|
||||
|
||||
public boolean hasAdvancedGrid() {
|
||||
return advancedGrid != null;
|
||||
}
|
||||
|
||||
public boolean hasAdvancedGrid(final boolean clipboardSelection) {
|
||||
return clipboardSelection ? advancedClipboardGrid != null : advancedGrid != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #hasAdvancedGrid()
|
||||
*/
|
||||
public double getParticleGridSpace() {
|
||||
return advancedGrid.getParticleGridSpace();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #hasAdvancedGrid(boolean)
|
||||
*/
|
||||
public double getParticleGridSpace(final boolean clipboardSelection) {
|
||||
return clipboardSelection ? advancedClipboardGrid.getParticleGridSpace() : advancedGrid.getParticleGridSpace();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #hasAdvancedGrid()
|
||||
*/
|
||||
public int getParticlesPerGridBlock() {
|
||||
return advancedGrid.getParticlesPerGridBlock();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #hasAdvancedGrid(boolean)
|
||||
*/
|
||||
public int getParticlesPerGridBlock(final boolean clipboardSelection) {
|
||||
return clipboardSelection ? advancedClipboardGrid.getParticlesPerGridBlock() : advancedGrid.getParticlesPerGridBlock();
|
||||
}
|
||||
|
||||
public double getParticleSpace() {
|
||||
return particleSpace;
|
||||
}
|
||||
|
||||
public double getParticleGridSpace() {
|
||||
return particleGridSpace;
|
||||
}
|
||||
|
||||
public int getParticlesPerBlock() {
|
||||
return particlesPerBlock;
|
||||
}
|
||||
|
||||
public int getParticlesPerGridBlock() {
|
||||
return particlesPerGridBlock;
|
||||
}
|
||||
|
||||
public int getParticleSendInterval() {
|
||||
return particleSendInterval;
|
||||
}
|
||||
@ -269,10 +296,6 @@ public final class Settings {
|
||||
return expireMessage;
|
||||
}
|
||||
|
||||
public boolean hasAdvancedGrid() {
|
||||
return advancedGrid;
|
||||
}
|
||||
|
||||
public boolean hasUpdateChecks() {
|
||||
return updateChecks;
|
||||
}
|
||||
@ -297,19 +320,19 @@ public final class Settings {
|
||||
return cacheLocations;
|
||||
}
|
||||
|
||||
public Particle getParticle() {
|
||||
public ParticleData getParticle() {
|
||||
return particle;
|
||||
}
|
||||
|
||||
public Particle getClipboardParticle() {
|
||||
public ParticleData getClipboardParticle() {
|
||||
return clipboardParticle;
|
||||
}
|
||||
|
||||
public Particle getOthersParticle() {
|
||||
public ParticleData getOthersParticle() {
|
||||
return othersParticle;
|
||||
}
|
||||
|
||||
public Particle getOthersClipboardParticle() {
|
||||
public ParticleData getOthersClipboardParticle() {
|
||||
return othersClipboardParticle;
|
||||
}
|
||||
|
||||
@ -320,4 +343,31 @@ public final class Settings {
|
||||
public YamlConfiguration getUserData() {
|
||||
return userData;
|
||||
}
|
||||
|
||||
public static final class GridSettings {
|
||||
|
||||
private final int particlesPerGridBlock;
|
||||
private final double particleGridSpace;
|
||||
|
||||
private GridSettings(final WorldEditSUIPlugin plugin, final ConfigurationSection section) {
|
||||
final int particlesPerGridBlock = section.getInt("particles-per-block", 2);
|
||||
if (particlesPerGridBlock < 1 || particlesPerGridBlock > 5) {
|
||||
plugin.getLogger().warning("The value particles-per-block in " + section.getCurrentPath() + " has to be set between 2 and 5!");
|
||||
plugin.getLogger().warning("Switched to default particles-per-block: 2");
|
||||
this.particlesPerGridBlock = 2;
|
||||
particleGridSpace = 0.5;
|
||||
} else {
|
||||
this.particlesPerGridBlock = particlesPerGridBlock;
|
||||
particleGridSpace = 1D / this.particlesPerGridBlock;
|
||||
}
|
||||
}
|
||||
|
||||
public int getParticlesPerGridBlock() {
|
||||
return particlesPerGridBlock;
|
||||
}
|
||||
|
||||
public double getParticleGridSpace() {
|
||||
return particleGridSpace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,13 +53,13 @@ public final class CuboidDrawer extends DrawerBase {
|
||||
int gridSpaceX = 0;
|
||||
int gridSpaceZ = 0;
|
||||
int topGridSpace = 0;
|
||||
if (settings.hasAdvancedGrid() && !copySelection) {
|
||||
if (settings.hasAdvancedGrid(copySelection)) {
|
||||
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);
|
||||
maxGridTicks = height * settings.getParticlesPerGridBlock() - 1;
|
||||
maxTopGridTicksX = length * settings.getParticlesPerGridBlock() - 1;
|
||||
maxTopGridTicksZ = width * settings.getParticlesPerGridBlock() - 1;
|
||||
maxGridTicks = height * settings.getParticlesPerGridBlock(copySelection) - 1;
|
||||
maxTopGridTicksX = length * settings.getParticlesPerGridBlock(copySelection) - 1;
|
||||
maxTopGridTicksZ = width * settings.getParticlesPerGridBlock(copySelection) - 1;
|
||||
}
|
||||
|
||||
drawLines(player, minimumPoint.clone(), gridSpaceX, topGridSpace, maxTicksX, maxGridTicks, maxTopGridTicksX, height, true, copySelection);
|
||||
@ -77,23 +77,16 @@ public final class CuboidDrawer extends DrawerBase {
|
||||
final double oldZ = location.getZ();
|
||||
int blocks = 0;
|
||||
for (int i = 0; i < maxTicks; i++) {
|
||||
if (settings.hasAdvancedGrid() && !copySelection) {
|
||||
if (settings.hasAdvancedGrid(copySelection)) {
|
||||
if (blocks % gridSpace == 0 && i != 0) {
|
||||
final Location clone = location.clone();
|
||||
for (double j = 0; j < maxGridTicks; j++) {
|
||||
clone.add(0, settings.getParticleGridSpace(), 0);
|
||||
clone.add(0, settings.getParticleGridSpace(copySelection), 0);
|
||||
playEffect(clone, player, copySelection);
|
||||
}
|
||||
}
|
||||
if (topGridSpace != 0 && blocks % topGridSpace == 0 && i != 0) {
|
||||
final Location clone = location.clone();
|
||||
for (double j = 0; j < maxTopGridTicks; j++) {
|
||||
if (x)
|
||||
clone.add(0, 0, settings.getParticleGridSpace());
|
||||
else
|
||||
clone.add(settings.getParticleGridSpace(), 0, 0);
|
||||
playEffect(clone, player, copySelection);
|
||||
}
|
||||
tickGrid(player, location, maxTopGridTicks, x, copySelection);
|
||||
}
|
||||
blocks++;
|
||||
}
|
||||
@ -111,15 +104,8 @@ public final class CuboidDrawer extends DrawerBase {
|
||||
location.setY(location.getY() + height);
|
||||
blocks = 0;
|
||||
for (double i = 0; i < maxTicks; i++) {
|
||||
if (settings.hasAdvancedGrid() && !copySelection && topGridSpace != 0 && blocks++ % topGridSpace == 0 && i != 0) {
|
||||
final Location clone = location.clone();
|
||||
for (double j = 0; j < maxTopGridTicks; j++) {
|
||||
if (x)
|
||||
clone.add(0, 0, settings.getParticleGridSpace());
|
||||
else
|
||||
clone.add(settings.getParticleGridSpace(), 0, 0);
|
||||
playEffect(clone, player);
|
||||
}
|
||||
if (settings.hasAdvancedGrid(copySelection) && topGridSpace != 0 && blocks++ % topGridSpace == 0 && i != 0) {
|
||||
tickGrid(player, location, maxTopGridTicks, x, copySelection);
|
||||
}
|
||||
|
||||
if (x)
|
||||
@ -130,15 +116,28 @@ public final class CuboidDrawer extends DrawerBase {
|
||||
}
|
||||
}
|
||||
|
||||
private void tickGrid(final Player player, final Location location, final double maxTopGridTicks, final boolean x, final boolean copySelection) {
|
||||
final Location clone = location.clone();
|
||||
for (double j = 0; j < maxTopGridTicks; j++) {
|
||||
if (x)
|
||||
clone.add(0, 0, settings.getParticleGridSpace(copySelection));
|
||||
else
|
||||
clone.add(settings.getParticleGridSpace(copySelection), 0, 0);
|
||||
playEffect(clone, player, copySelection);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawPillarsAndGrid(final Player player, final Location minimum, final int gridSpaceX, final int gridSpaceZ,
|
||||
final double height, final double width, final double length, final boolean copySelection) {
|
||||
final boolean advancedGridEnabled = settings.hasAdvancedGrid(copySelection);
|
||||
|
||||
final double x = minimum.getX();
|
||||
final double y = minimum.getY();
|
||||
final double z = minimum.getZ();
|
||||
final double gridSpace = settings.getParticleGridSpace();
|
||||
final double gridSpace = advancedGridEnabled ? settings.getParticleGridSpace(copySelection) : 0;
|
||||
final double maxTicks = height * settings.getParticlesPerBlock();
|
||||
final double maxGridTicksX = settings.hasAdvancedGrid() ? width * settings.getParticlesPerGridBlock() - 1 : 0;
|
||||
final double maxGridTicksZ = settings.hasAdvancedGrid() ? length * settings.getParticlesPerGridBlock() - 1 : 0;
|
||||
final double maxGridTicksX = advancedGridEnabled ? width * settings.getParticlesPerGridBlock(copySelection) - 1 : 0;
|
||||
final double maxGridTicksZ = advancedGridEnabled ? length * settings.getParticlesPerGridBlock(copySelection) - 1 : 0;
|
||||
setGrid(player, minimum, gridSpaceX, maxTicks, maxGridTicksX, gridSpace, 0, copySelection);
|
||||
minimum.setX(x + width);
|
||||
minimum.setY(y);
|
||||
@ -158,11 +157,11 @@ public final class CuboidDrawer extends DrawerBase {
|
||||
int blocks = 0;
|
||||
for (int i = 0; i < maxTicks; i++) {
|
||||
// Horizontal grid
|
||||
if (settings.hasAdvancedGrid() && !copySelection && blocks++ % gridSpace == 0 && i != 0) {
|
||||
if (settings.hasAdvancedGrid(copySelection) && blocks++ % gridSpace == 0 && i != 0) {
|
||||
final Location clone = location.clone();
|
||||
for (double j = 0; j < maxGridTicks; j++) {
|
||||
clone.add(xAddition, 0, zAddition);
|
||||
playEffect(clone, player);
|
||||
playEffect(clone, player, copySelection);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,8 @@ import eu.kennytv.worldeditsui.Settings;
|
||||
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
|
||||
import eu.kennytv.worldeditsui.compat.SimpleVector;
|
||||
import eu.kennytv.worldeditsui.user.User;
|
||||
import eu.kennytv.worldeditsui.util.ParticleData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class DrawerBase implements Drawer {
|
||||
@ -48,9 +48,9 @@ public abstract class DrawerBase implements Drawer {
|
||||
user.getSelectionCache().getVectors().add(new SimpleVector(location.getX(), location.getY(), location.getZ()));
|
||||
}
|
||||
|
||||
final Particle particle = copySelection ? settings.getClipboardParticle() : settings.getParticle();
|
||||
final ParticleData particle = copySelection ? settings.getClipboardParticle() : settings.getParticle();
|
||||
if (settings.sendParticlesToAll()) {
|
||||
final Particle othersParticle = copySelection ? settings.getOthersClipboardParticle() : settings.getOthersParticle();
|
||||
final ParticleData othersParticle = copySelection ? settings.getOthersClipboardParticle() : settings.getOthersParticle();
|
||||
plugin.getParticleHelper().playEffectToAll(particle, othersParticle, location, 0, 1, settings.getParticleViewDistance(), player);
|
||||
} else {
|
||||
plugin.getParticleHelper().playEffect(particle, location, 0, 1, settings.getParticleViewDistance(), player);
|
||||
|
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* WorldEditCUI - https://git.io/wecui
|
||||
* Copyright (C) 2018 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.kennytv.worldeditsui.util;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
public final class ParticleData {
|
||||
|
||||
private final Particle particle;
|
||||
private final Object data;
|
||||
|
||||
public ParticleData(final Particle particle, final Object data) {
|
||||
this.particle = particle;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Particle getParticle() {
|
||||
return particle;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
//TODO proper error handling/warnings
|
||||
public static Object getExtraData(final Particle particle, final ConfigurationSection section) throws Exception {
|
||||
final Class<?> dataType = particle.getDataType();
|
||||
if (dataType == null || dataType == Void.class) return null;
|
||||
|
||||
Preconditions.checkArgument(section != null, "The data section is missing!");
|
||||
|
||||
final String name = dataType.getSimpleName();
|
||||
// they might exist, they might not ¯\_(ツ)_/¯
|
||||
// also it's only executed when (re)loading the config, so I think I might just get away with this method (prolly not worth doing extra modules for this)
|
||||
if (name.equals("DustOptions")) {
|
||||
final float size = (float) section.getDouble("size");
|
||||
final Color color = section.contains("rgb") ? Color.fromRGB(section.getInt("rgb"))
|
||||
: Color.fromRGB(section.getInt("r"), section.getInt("g"), section.getInt("b"));
|
||||
return new Particle.DustOptions(color, size);
|
||||
} else if (name.equals("BlockData")) {
|
||||
final Material material = Material.getMaterial(section.getString("material"));
|
||||
Preconditions.checkArgument(material.isBlock(), "This particle requires a block material for its data.");
|
||||
return material.createBlockData();
|
||||
} else if (dataType == ItemStack.class) {
|
||||
return new ItemStack(Material.getMaterial(section.getString("material")));
|
||||
} else if (name.equals("MaterialData")) { // use the name in case of its removal
|
||||
return new MaterialData(Material.getMaterial(section.getString("material")), (byte) section.getInt("data"));
|
||||
} else if (dataType == Color.class) {
|
||||
return section.contains("rgb") ? Color.fromRGB(section.getInt("rgb"))
|
||||
: Color.fromRGB(section.getInt("r"), section.getInt("g"), section.getInt("b"));
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("The datatype " + name + " is not yet supported by the plugin - please report this error!");
|
||||
}
|
||||
}
|
@ -20,7 +20,6 @@ package eu.kennytv.worldeditsui.util;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public final class ParticleHelper {
|
||||
@ -30,24 +29,24 @@ public final class ParticleHelper {
|
||||
*/
|
||||
private String permission;
|
||||
|
||||
public void playEffect(final Particle particle, final Location location, final float speed, final int amount, final int radius, final Player player) {
|
||||
public void playEffect(final ParticleData particle, final Location location, final float speed, final int amount, final int radius, final Player player) {
|
||||
playEffect(particle, location, 0, 0, 0, speed, amount, radius, player);
|
||||
}
|
||||
|
||||
public void playEffect(final Particle particle, final Location location, final float offX, final float offY, final float offZ, final float speed, final int amount, final int radius, final Player player) {
|
||||
public void playEffect(final ParticleData particle, final Location location, final float offX, final float offY, final float offZ, final float speed, final int amount, final int radius, final Player player) {
|
||||
if (!location.getWorld().equals(player.getWorld())) return;
|
||||
|
||||
final int radiusSquared = radius * radius;
|
||||
if (player.getLocation().distanceSquared(location) > radiusSquared) return;
|
||||
|
||||
player.spawnParticle(particle, location, amount, offX, offY, offZ, speed);
|
||||
player.spawnParticle(particle.getParticle(), location, amount, offX, offY, offZ, speed, particle.getData());
|
||||
}
|
||||
|
||||
public void playEffectToAll(final Particle particle, final Particle othersParticle, final Location location, final float speed, final int amount, final int radius, final Player origin) {
|
||||
public void playEffectToAll(final ParticleData particle, final ParticleData othersParticle, final Location location, final float speed, final int amount, final int radius, final Player origin) {
|
||||
playEffectToAll(particle, othersParticle, location, 0, 0, 0, speed, amount, radius, origin);
|
||||
}
|
||||
|
||||
public void playEffectToAll(final Particle particle, final Particle othersParticle, final Location location, final float offX, final float offY, final float offZ, final float speed, final int amount, final int radius, final Player origin) {
|
||||
public void playEffectToAll(final ParticleData particle, final ParticleData othersParticle, final Location location, final float offX, final float offY, final float offZ, final float speed, final int amount, final int radius, final Player origin) {
|
||||
final int radiusSquared = radius * radius;
|
||||
for (final Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!location.getWorld().equals(player.getWorld())
|
||||
@ -56,7 +55,8 @@ public final class ParticleHelper {
|
||||
final boolean originalPlayer = player.getUniqueId().equals(origin.getUniqueId());
|
||||
if (!originalPlayer && !canSeeOtherParticles(player)) continue;
|
||||
|
||||
player.spawnParticle(originalPlayer ? particle : othersParticle, location, amount, offX, offY, offZ, speed);
|
||||
final ParticleData toSend = originalPlayer ? particle : othersParticle;
|
||||
player.spawnParticle(toSend.getParticle(), location, amount, offX, offY, offZ, speed, toSend.getData());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,9 @@ cache-calculated-positions: true
|
||||
# A list of all particles can be found here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Particle.html
|
||||
# Just note that newly introduced particles obviously won't work in older versions.
|
||||
# Shown for the selection you currently have.
|
||||
#
|
||||
# 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.
|
||||
particle: FLAME
|
||||
# Shown for the clipboard (after using WorldEdit's //copy command).
|
||||
# Can be enabled with the '/wesui toggleclipboard' command.
|
||||
@ -32,6 +35,12 @@ advanced-grid:
|
||||
# The recommended amount is between 2 and 3. Can be set from 2 to 5.
|
||||
particles-per-block: 2
|
||||
|
||||
advanced-clipboard-grid:
|
||||
# You can also enable the grid for the clipboard view.
|
||||
# Same as advanced-grid settings, but for the clipboard.
|
||||
enabled: false
|
||||
particles-per-block: 2
|
||||
|
||||
particle-expiry:
|
||||
# If enabled and a selection isn't changed for the given amount of seconds, particles will stop being sent for it
|
||||
enabled: false
|
||||
@ -43,9 +52,9 @@ particle-expiry:
|
||||
# Else, only players with the set permission will have particles for their selection.
|
||||
permission: "none"
|
||||
|
||||
# If enabled, the particles will be sent to all players, rather than just to the player having the WorldEdit selection.
|
||||
# Might be useful when building as a group.
|
||||
send-particles-to-all:
|
||||
# If enabled, the particles will be sent to all players, rather than just to the player having the WorldEdit selection.
|
||||
# Might be useful when building as a group.
|
||||
enabled: false
|
||||
# You can also limit those seeing the particles by a permission. Leave 'none' to let all players see them.
|
||||
# Warning: If you have a (bad) perm plugin that does not cache its checks / takes a while for permission checks, leave this at 'none'.
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren