Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6385374151 | ||
|
|
6865a71828 | ||
|
|
7415455019 |
No files matched your search
@@ -3,15 +3,13 @@
|
||||
[](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).
|
||||
It aims at a higher performance and lesser memory impact by having a quite simplistic approach to calculating vectors.
|
||||
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.
|
||||
|
||||
You can read up on everything else and see examples on the [**Spigot page**](https://www.spigotmc.org/resources/worldeditsui.60726/).
|
||||
|
||||
## 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 (everything below 1.8.4 still unsupported), see the `1.8-support` branch / the [**releases download page**](https://github.com/KennyTV/WorldEditSUI/releases).
|
||||
|
||||
The default master branch does not contain 1.8 support, since that version seems to be used by only a very small fraction of WESUI users and requires some extra encapsulation and small additions for every new Minecraft release.
|
||||
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`).
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<groupId>eu.kennytv.worldeditsui</groupId>
|
||||
<artifactId>worldedit-sui-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.6</version>
|
||||
<version>1.7</version>
|
||||
|
||||
<modules>
|
||||
<module>worldedit-sui</module>
|
||||
@@ -23,20 +23,26 @@
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>enginehub-repo</id>
|
||||
<url>https://maven.sk89q.com/artifactory/repo/</url>
|
||||
<id>papermc</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigotmc-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
<id>enginehub-repo</id>
|
||||
<url>https://maven.sk89q.com/artifactory/repo/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.14.4-R0.1-SNAPSHOT</version>
|
||||
<groupId>com.destroystokyo.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>19.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -47,7 +53,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<version>3.2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.worldeditsui</groupId>
|
||||
<artifactId>worldedit-sui-parent</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.7</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.7</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>we-compat-common</artifactId>
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018-2020 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.compat;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public interface ProtectedRegionHelper {
|
||||
|
||||
@Nullable
|
||||
ProtectedRegionWrapper getRegion(World world, String regionName);
|
||||
|
||||
Set<String> getRegionNames(World world);
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018-2020 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.compat;
|
||||
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
public final class ProtectedRegionWrapper {
|
||||
|
||||
private final Region region;
|
||||
private final SelectionType selectionType;
|
||||
|
||||
public ProtectedRegionWrapper(final Region region, final SelectionType selectionType) {
|
||||
this.region = region;
|
||||
this.selectionType = selectionType;
|
||||
}
|
||||
|
||||
public Region getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public SelectionType getSelectionType() {
|
||||
return selectionType;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
@@ -27,7 +27,7 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public interface IRegionHelper {
|
||||
public interface RegionHelper {
|
||||
|
||||
SimpleVector getRadius(EllipsoidRegion region);
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package eu.kennytv.worldeditsui.util;
|
||||
package eu.kennytv.worldeditsui.compat;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.worldeditsui</groupId>
|
||||
<artifactId>we-compat</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.7</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>we6-compat</artifactId>
|
||||
@@ -24,5 +24,11 @@
|
||||
<version>6.1.4-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>worldguard</artifactId>
|
||||
<version>6.1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018-2020 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.compat.we6;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Polygonal2DRegion;
|
||||
import com.sk89q.worldguard.bukkit.RegionContainer;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import com.sk89q.worldguard.protection.regions.RegionType;
|
||||
import eu.kennytv.worldeditsui.compat.ProtectedRegionHelper;
|
||||
import eu.kennytv.worldeditsui.compat.ProtectedRegionWrapper;
|
||||
import eu.kennytv.worldeditsui.compat.SelectionType;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
public final class ProtectedRegionHelper6 implements ProtectedRegionHelper {
|
||||
|
||||
private final RegionContainer regionContainer = WorldGuardPlugin.inst().getRegionContainer();
|
||||
|
||||
@Override
|
||||
public ProtectedRegionWrapper getRegion(final World world, final String regionName) {
|
||||
final RegionManager regionManager = regionContainer.get(world);
|
||||
if (regionManager == null) return null;
|
||||
|
||||
final ProtectedRegion region = regionManager.getRegion(regionName);
|
||||
final RegionType type = region.getType();
|
||||
final com.sk89q.worldedit.world.World worldWrapper = new BukkitWorld(world);
|
||||
switch (type) {
|
||||
case CUBOID:
|
||||
return new ProtectedRegionWrapper(new CuboidRegion(worldWrapper, region.getMinimumPoint(), region.getMaximumPoint()), SelectionType.CUBOID);
|
||||
case POLYGON:
|
||||
return new ProtectedRegionWrapper(new Polygonal2DRegion(worldWrapper, region.getPoints(),
|
||||
(int) region.getMinimumPoint().getY(), (int) region.getMaximumPoint().getY()), SelectionType.POLYGON);
|
||||
case GLOBAL:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getRegionNames(final World world) {
|
||||
final RegionManager regionManager = regionContainer.get(world);
|
||||
if (regionManager == null) return Collections.emptySet();
|
||||
|
||||
return regionManager.getRegions().keySet();
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
@@ -26,7 +26,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.regions.*;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import eu.kennytv.worldeditsui.compat.IRegionHelper;
|
||||
import eu.kennytv.worldeditsui.compat.RegionHelper;
|
||||
import eu.kennytv.worldeditsui.compat.Simple2DVector;
|
||||
import eu.kennytv.worldeditsui.compat.SimpleVector;
|
||||
import org.bukkit.Material;
|
||||
@@ -34,7 +34,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class RegionHelper implements IRegionHelper {
|
||||
public final class RegionHelper6 implements RegionHelper {
|
||||
|
||||
@Override
|
||||
public SimpleVector getRadius(final EllipsoidRegion region) {
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.worldeditsui</groupId>
|
||||
<artifactId>we-compat</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.7</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>we7-compat</artifactId>
|
||||
@@ -21,7 +21,13 @@
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldedit</groupId>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
<version>7.0.1-SNAPSHOT</version>
|
||||
<version>7.1.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.0.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018-2020 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.compat.we7;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Polygonal2DRegion;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||
import com.sk89q.worldguard.protection.regions.RegionType;
|
||||
import eu.kennytv.worldeditsui.compat.ProtectedRegionHelper;
|
||||
import eu.kennytv.worldeditsui.compat.ProtectedRegionWrapper;
|
||||
import eu.kennytv.worldeditsui.compat.SelectionType;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
public final class ProtectedRegionHelper7 implements ProtectedRegionHelper {
|
||||
|
||||
private final RegionContainer regionContainer = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
|
||||
@Override
|
||||
public ProtectedRegionWrapper getRegion(final World world, final String regionName) {
|
||||
final BukkitWorld worldWrapper = new BukkitWorld(world);
|
||||
final RegionManager regionManager = regionContainer.get(worldWrapper);
|
||||
if (regionManager == null) return null;
|
||||
|
||||
final ProtectedRegion region = regionManager.getRegion(regionName);
|
||||
final RegionType type = region.getType();
|
||||
switch (type) {
|
||||
case CUBOID:
|
||||
return new ProtectedRegionWrapper(new CuboidRegion(worldWrapper, region.getMinimumPoint(), region.getMaximumPoint()), SelectionType.CUBOID);
|
||||
case POLYGON:
|
||||
return new ProtectedRegionWrapper(new Polygonal2DRegion(worldWrapper, region.getPoints(),
|
||||
region.getMinimumPoint().getY(), region.getMaximumPoint().getY()), SelectionType.POLYGON);
|
||||
case GLOBAL:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getRegionNames(final World world) {
|
||||
final RegionManager regionManager = regionContainer.get(new BukkitWorld(world));
|
||||
if (regionManager == null) return Collections.emptySet();
|
||||
|
||||
return regionManager.getRegions().keySet();
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
@@ -27,14 +27,14 @@ import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.regions.*;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import eu.kennytv.worldeditsui.compat.IRegionHelper;
|
||||
import eu.kennytv.worldeditsui.compat.RegionHelper;
|
||||
import eu.kennytv.worldeditsui.compat.Simple2DVector;
|
||||
import eu.kennytv.worldeditsui.compat.SimpleVector;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class RegionHelper implements IRegionHelper {
|
||||
public final class RegionHelper7 implements RegionHelper {
|
||||
|
||||
@Override
|
||||
public SimpleVector getRadius(final EllipsoidRegion region) {
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.kennytv.worldeditsui</groupId>
|
||||
<artifactId>worldedit-sui-parent</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.7</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>worldedit-sui</artifactId>
|
||||
@@ -34,7 +34,7 @@
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldedit</groupId>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
<version>7.0.1-SNAPSHOT</version>
|
||||
<version>7.1.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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,12 +18,21 @@
|
||||
|
||||
package eu.kennytv.worldeditsui;
|
||||
|
||||
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
|
||||
import eu.kennytv.worldeditsui.util.ParticleData;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
|
||||
@@ -37,27 +46,29 @@ 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 int maxPing;
|
||||
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 ParticleData wgRegionParticle;
|
||||
private GridSettings advancedGrid;
|
||||
private GridSettings advancedClipboardGrid;
|
||||
private GridSettings advancedWGRegionGrid;
|
||||
|
||||
Settings(final WorldEditSUIPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
@@ -73,6 +84,17 @@ public final class Settings {
|
||||
|
||||
particle = loadParticle(config, "particle", Particle.FLAME);
|
||||
clipboardParticle = loadParticle(config, "clipboard-particle", Particle.VILLAGER_HAPPY);
|
||||
wgRegionParticle = loadParticle(config, "wg-region-particle", Particle.VILLAGER_HAPPY);
|
||||
|
||||
try {
|
||||
maxPing = Math.max(config.getInt("max-ping"), 0);
|
||||
Player.Spigot.class.getDeclaredMethod("getPing");
|
||||
} catch (final NoSuchMethodException ignored) {
|
||||
if (maxPing != 0) {
|
||||
plugin.getLogger().warning("The max-ping option only works on servers running Paper!");
|
||||
maxPing = 0;
|
||||
}
|
||||
}
|
||||
|
||||
final ConfigurationSection sendToAllSection = config.getConfigurationSection("send-particles-to-all");
|
||||
sendParticlesToAll = sendToAllSection.getBoolean("enabled");
|
||||
@@ -80,7 +102,7 @@ public final class Settings {
|
||||
if (otherParticlesPermission.isEmpty() || otherParticlesPermission.equalsIgnoreCase("none")) {
|
||||
otherParticlesPermission = null;
|
||||
}
|
||||
plugin.getParticleHelper().setPermission(otherParticlesPermission);
|
||||
|
||||
othersParticle = loadParticle(sendToAllSection, "others-particle", Particle.FLAME);
|
||||
othersClipboardParticle = loadParticle(sendToAllSection, "others-clipboard-particle", Particle.VILLAGER_HAPPY);
|
||||
|
||||
@@ -94,18 +116,16 @@ 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;
|
||||
|
||||
final ConfigurationSection wgRegionGridSection = config.getConfigurationSection("advanced-wg-region-grid");
|
||||
advancedWGRegionGrid = wgRegionGridSection != null && wgRegionGridSection.getBoolean("enabled", false) ?
|
||||
new GridSettings(plugin, wgRegionGridSection) : null;
|
||||
|
||||
particleSendInterval = config.getInt("particle-send-interval", 12);
|
||||
if (particleSendInterval < 5 || particleSendInterval > 200) {
|
||||
@@ -180,7 +200,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 +208,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() {
|
||||
@@ -220,8 +244,10 @@ public final class Settings {
|
||||
plugin.getLogger().warning("The language file is missing the following string: " + path);
|
||||
return "empty";
|
||||
}
|
||||
if (s.contains("%prefix%"))
|
||||
|
||||
if (s.contains("%prefix%")) {
|
||||
s = s.replace("%prefix%", language.getString("prefix", ""));
|
||||
}
|
||||
return ChatColor.translateAlternateColorCodes('&', s);
|
||||
}
|
||||
|
||||
@@ -233,22 +259,46 @@ public final class Settings {
|
||||
return otherParticlesPermission;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public GridSettings getGridSettings(final DrawedType drawedType) {
|
||||
switch (drawedType) {
|
||||
case SELECTED:
|
||||
return advancedGrid;
|
||||
case CLIPBOARD:
|
||||
return advancedClipboardGrid;
|
||||
case WG_REGION:
|
||||
return advancedWGRegionGrid;
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasAdvancedGrid(final DrawedType drawedType) {
|
||||
return getGridSettings(drawedType) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #hasAdvancedGrid(DrawedType)
|
||||
*/
|
||||
public double getParticleGridSpace(final DrawedType drawedType) {
|
||||
return getGridSettings(drawedType).getParticleGridSpace();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #hasAdvancedGrid(DrawedType)
|
||||
*/
|
||||
public int getParticlesPerGridBlock(final DrawedType drawedType) {
|
||||
return getGridSettings(drawedType).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;
|
||||
}
|
||||
@@ -261,6 +311,10 @@ public final class Settings {
|
||||
return expiresAfterMillis;
|
||||
}
|
||||
|
||||
public int getMaxPing() {
|
||||
return maxPing;
|
||||
}
|
||||
|
||||
public boolean isExpiryEnabled() {
|
||||
return expiryEnabled;
|
||||
}
|
||||
@@ -269,16 +323,12 @@ public final class Settings {
|
||||
return expireMessage;
|
||||
}
|
||||
|
||||
public boolean hasAdvancedGrid() {
|
||||
return advancedGrid;
|
||||
}
|
||||
|
||||
public boolean hasUpdateChecks() {
|
||||
return updateChecks;
|
||||
}
|
||||
|
||||
public boolean sendParticlesToAll() {
|
||||
return sendParticlesToAll;
|
||||
public boolean sendParticlesToAll(final DrawedType drawedType) {
|
||||
return sendParticlesToAll && (drawedType == DrawedType.SELECTED || drawedType == DrawedType.CLIPBOARD);
|
||||
}
|
||||
|
||||
public boolean hasPersistentToggles() {
|
||||
@@ -297,20 +347,27 @@ public final class Settings {
|
||||
return cacheLocations;
|
||||
}
|
||||
|
||||
public Particle getParticle() {
|
||||
return particle;
|
||||
public ParticleData getParticle(final DrawedType drawedType) {
|
||||
switch (drawedType) {
|
||||
default:
|
||||
case SELECTED:
|
||||
return particle;
|
||||
case CLIPBOARD:
|
||||
return clipboardParticle;
|
||||
case WG_REGION:
|
||||
return wgRegionParticle;
|
||||
}
|
||||
}
|
||||
|
||||
public Particle getClipboardParticle() {
|
||||
return clipboardParticle;
|
||||
}
|
||||
|
||||
public Particle getOthersParticle() {
|
||||
return othersParticle;
|
||||
}
|
||||
|
||||
public Particle getOthersClipboardParticle() {
|
||||
return othersClipboardParticle;
|
||||
public ParticleData getOthersParticle(final DrawedType drawedType) {
|
||||
switch (drawedType) {
|
||||
case SELECTED:
|
||||
return othersParticle;
|
||||
case CLIPBOARD:
|
||||
return othersClipboardParticle;
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
public String getWandItem() {
|
||||
@@ -320,4 +377,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
@@ -29,10 +29,17 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import eu.kennytv.worldeditsui.command.WESUICommand;
|
||||
import eu.kennytv.worldeditsui.compat.IRegionHelper;
|
||||
import eu.kennytv.worldeditsui.compat.ProtectedRegionHelper;
|
||||
import eu.kennytv.worldeditsui.compat.ProtectedRegionWrapper;
|
||||
import eu.kennytv.worldeditsui.compat.RegionHelper;
|
||||
import eu.kennytv.worldeditsui.compat.SelectionType;
|
||||
import eu.kennytv.worldeditsui.compat.SimpleVector;
|
||||
import eu.kennytv.worldeditsui.compat.we6.RegionHelper;
|
||||
import eu.kennytv.worldeditsui.compat.we6.ProtectedRegionHelper6;
|
||||
import eu.kennytv.worldeditsui.compat.we6.RegionHelper6;
|
||||
import eu.kennytv.worldeditsui.compat.we7.ProtectedRegionHelper7;
|
||||
import eu.kennytv.worldeditsui.compat.we7.RegionHelper7;
|
||||
import eu.kennytv.worldeditsui.drawer.DrawManager;
|
||||
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
|
||||
import eu.kennytv.worldeditsui.listener.PlayerJoinListener;
|
||||
import eu.kennytv.worldeditsui.listener.PlayerQuitListener;
|
||||
import eu.kennytv.worldeditsui.listener.WESelectionListener;
|
||||
@@ -41,12 +48,13 @@ import eu.kennytv.worldeditsui.user.SelectionCache;
|
||||
import eu.kennytv.worldeditsui.user.User;
|
||||
import eu.kennytv.worldeditsui.user.UserManager;
|
||||
import eu.kennytv.worldeditsui.util.ParticleHelper;
|
||||
import eu.kennytv.worldeditsui.util.SelectionType;
|
||||
import eu.kennytv.worldeditsui.util.Version;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -59,7 +67,8 @@ import java.net.URL;
|
||||
public final class WorldEditSUIPlugin extends JavaPlugin {
|
||||
|
||||
private static final String PREFIX = "§8[§eWorldEditSUI§8] ";
|
||||
private IRegionHelper regionHelper;
|
||||
private RegionHelper regionHelper;
|
||||
private ProtectedRegionHelper protectedRegionHelper;
|
||||
private ParticleHelper particleHelper;
|
||||
private UserManager userManager;
|
||||
private Settings settings;
|
||||
@@ -69,28 +78,30 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
|
||||
private Version newestVersion;
|
||||
private int expiryTask = -1;
|
||||
private int persistentTogglesTask = -1;
|
||||
private boolean worldGuardEnabled;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
version = new Version(getDescription().getVersion());
|
||||
printEnableMessage();
|
||||
|
||||
try {
|
||||
Class.forName("com.sk89q.worldedit.math.Vector2");
|
||||
regionHelper = new eu.kennytv.worldeditsui.compat.we7.RegionHelper();
|
||||
} catch (final ClassNotFoundException e) {
|
||||
regionHelper = new RegionHelper();
|
||||
}
|
||||
try {
|
||||
Class.forName("org.bukkit.Particle");
|
||||
} catch (final ClassNotFoundException e) {
|
||||
// See the master branch for 1.8 support
|
||||
getLogger().severe("Sorry - this plugin only supports Minecraft versions from 1.9 upwards.");
|
||||
getLogger().severe("This plugin only supports Minecraft versions from 1.9 upwards.");
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
particleHelper = new ParticleHelper();
|
||||
boolean isWorldEdit7 = true;
|
||||
try {
|
||||
Class.forName("com.sk89q.worldedit.math.Vector2");
|
||||
} catch (final ClassNotFoundException e) {
|
||||
isWorldEdit7 = false;
|
||||
}
|
||||
|
||||
regionHelper = isWorldEdit7 ? new RegionHelper7() : new RegionHelper6();
|
||||
particleHelper = new ParticleHelper(settings);
|
||||
|
||||
settings = new Settings(this);
|
||||
userManager = new UserManager(settings);
|
||||
@@ -98,6 +109,10 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
|
||||
|
||||
final PluginManager pm = getServer().getPluginManager();
|
||||
worldEditPlugin = ((WorldEditPlugin) pm.getPlugin("WorldEdit"));
|
||||
worldGuardEnabled = pm.isPluginEnabled("WorldGuard");
|
||||
if (worldGuardEnabled) {
|
||||
protectedRegionHelper = isWorldEdit7 ? new ProtectedRegionHelper7() : new ProtectedRegionHelper6();
|
||||
}
|
||||
|
||||
// Imagine someone using the server reload command 👀
|
||||
getServer().getOnlinePlayers().forEach(p -> userManager.createUser(p));
|
||||
@@ -105,7 +120,10 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
|
||||
pm.registerEvents(new PlayerJoinListener(this), this);
|
||||
pm.registerEvents(new PlayerQuitListener(userManager), this);
|
||||
pm.registerEvents(new WESelectionListener(this), this);
|
||||
getCommand("worldeditsui").setExecutor(new WESUICommand(this));
|
||||
|
||||
final PluginCommand command = getCommand("worldeditsui");
|
||||
command.setExecutor(new WESUICommand(this));
|
||||
command.setPermissionMessage(settings.getMessage("noPermission"));
|
||||
|
||||
// Start tasks
|
||||
getServer().getScheduler().runTaskTimerAsynchronously(this, this::updateSelections, settings.getParticleSendInterval(), settings.getParticleSendInterval());
|
||||
@@ -116,6 +134,8 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (settings == null) return; // if instantly disabled
|
||||
|
||||
settings.saveData();
|
||||
getServer().getOnlinePlayers().forEach(player -> userManager.deleteUser(player));
|
||||
}
|
||||
@@ -155,15 +175,20 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
|
||||
// Start tasks if not already running, or cancel them if one is running but now disabled in the config
|
||||
if (expiryTask == -1 && settings.isExpiryEnabled()) {
|
||||
expiryTask = getServer().getScheduler().runTaskTimer(this, () -> {
|
||||
userManager.getExpireTimestamps().entrySet().removeIf(entry -> {
|
||||
final boolean remove = entry.getValue() < System.currentTimeMillis();
|
||||
if (remove && settings.hasExpireMessage()) {
|
||||
getServer().getPlayer(entry.getKey()).sendMessage(settings.getMessage("idled"));
|
||||
for (final User user : userManager.getUsers().values()) {
|
||||
if (user.getExpireTimestamp() == 0) continue;
|
||||
if (user.getExpireTimestamp() > System.currentTimeMillis()) continue;
|
||||
|
||||
user.setExpireTimestamp(0);
|
||||
if (settings.hasExpireMessage()) {
|
||||
getServer().getPlayer(user.getUuid()).sendMessage(settings.getMessage("idled"));
|
||||
}
|
||||
return remove;
|
||||
});
|
||||
}
|
||||
}, 20, 20).getTaskId();
|
||||
} else if (expiryTask != -1 && !settings.isExpiryEnabled()) {
|
||||
for (final User user : userManager.getUsers().values()) {
|
||||
user.setExpireTimestamp(-1);
|
||||
}
|
||||
getServer().getScheduler().cancelTask(expiryTask);
|
||||
expiryTask = -1;
|
||||
}
|
||||
@@ -183,14 +208,22 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
|
||||
|
||||
final User user = userManager.getUser(player);
|
||||
if (user == null) continue;
|
||||
// Check for sending restrictions
|
||||
if (!user.isSelectionShown() && !user.isClipboardShown()) continue;
|
||||
if (settings.isExpiryEnabled() && !userManager.getExpireTimestamps().containsKey(player.getUniqueId()))
|
||||
if (settings.isExpiryEnabled() && user.getExpireTimestamp() == 0)
|
||||
continue;
|
||||
if (settings.getPermission() != null && !player.hasPermission(settings.getPermission())) continue;
|
||||
if (settings.getMaxPing() != 0 && player.spigot().getPing() > settings.getMaxPing()) continue;
|
||||
|
||||
final LocalSession session = worldEditPlugin.getSession(player);
|
||||
final RegionSelector selector = session.getRegionSelector(new BukkitWorld(player.getWorld()));
|
||||
|
||||
// Selected WorldGuard region
|
||||
final ProtectedRegionWrapper selectedWGRegion = user.getSelectedWGRegion();
|
||||
if (selectedWGRegion != null) {
|
||||
drawSelection(player, user, selectedWGRegion.getRegion(), selectedWGRegion.getSelectionType(), DrawedType.WG_REGION);
|
||||
}
|
||||
|
||||
// Clipboard
|
||||
if (user.isClipboardShown()) {
|
||||
try {
|
||||
@@ -206,7 +239,7 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
|
||||
// Shift the transformed region relative to the player
|
||||
final Region shiftedRegion = regionHelper.shift(region,
|
||||
location.getBlockX() - origin.getX(), location.getBlockY() - origin.getY(), location.getBlockZ() - origin.getZ());
|
||||
drawManager.getDrawer(SelectionType.CUBOID).draw(player, shiftedRegion, true);
|
||||
drawManager.getDrawer(SelectionType.CUBOID).draw(player, shiftedRegion, DrawedType.CLIPBOARD);
|
||||
} catch (final EmptyClipboardException ignored) {
|
||||
// Ignore if there's no clipboard
|
||||
}
|
||||
@@ -220,27 +253,24 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
|
||||
} catch (final IncompleteRegionException ignored) {
|
||||
// Clear cache if present
|
||||
if (settings.cacheLocations()) {
|
||||
final SelectionCache cache = user.getSelectionCache();
|
||||
if (cache != null) {
|
||||
cache.getVectors().clear();
|
||||
user.setSelectionCache(null);
|
||||
}
|
||||
user.clearCache(DrawedType.SELECTED);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
final SelectionType selectionType = SelectionType.fromKey(selector.getTypeName());
|
||||
if (selectionType != null)
|
||||
drawSelection(player, user, region, selectionType);
|
||||
if (selectionType != null) {
|
||||
drawSelection(player, user, region, selectionType, DrawedType.SELECTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawSelection(final Player player, final User user, final Region region, final SelectionType selectionType) {
|
||||
private void drawSelection(final Player player, final User user, final Region region, final SelectionType selectionType, final DrawedType drawedType) {
|
||||
if (settings.cacheLocations()) {
|
||||
final SimpleVector minimumPoint = regionHelper.getMinimumPoint(region);
|
||||
final SimpleVector maximumPoint = regionHelper.getMaximumPoint(region);
|
||||
SelectionCache cache = user.getSelectionCache();
|
||||
SelectionCache cache = user.getSelectionCache(drawedType);
|
||||
if (cache != null) {
|
||||
if (selectionType == cache.getSelectionType()
|
||||
&& cache.getMinimum().equals(minimumPoint) && cache.getMaximum().equals(maximumPoint)) {
|
||||
@@ -249,17 +279,18 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
|
||||
location.setX(vector.getX());
|
||||
location.setY(vector.getY());
|
||||
location.setZ(vector.getZ());
|
||||
if (settings.sendParticlesToAll()) {
|
||||
particleHelper.playEffectToAll(settings.getParticle(), settings.getOthersParticle(), location, 0, 1, settings.getParticleViewDistance(), player);
|
||||
if (settings.sendParticlesToAll(drawedType)) {
|
||||
particleHelper.playEffectToAll(settings.getParticle(drawedType), settings.getOthersParticle(drawedType),
|
||||
location, settings.getParticleViewDistance(), player);
|
||||
} else {
|
||||
particleHelper.playEffect(settings.getParticle(), location, 0, 1, settings.getParticleViewDistance(), player);
|
||||
particleHelper.playEffect(settings.getParticle(drawedType), location, settings.getParticleViewDistance(), player);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
cache = new SelectionCache();
|
||||
user.setSelectionCache(cache);
|
||||
user.setSelectionCache(drawedType, cache);
|
||||
}
|
||||
|
||||
// If there's a new region, reset the cache and recalculate vectors
|
||||
@@ -269,13 +300,18 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
|
||||
cache.getVectors().clear();
|
||||
}
|
||||
|
||||
drawManager.getDrawer(selectionType).draw(player, region);
|
||||
// Current selection
|
||||
drawManager.getDrawer(selectionType).draw(player, region, drawedType);
|
||||
}
|
||||
|
||||
public WorldEditPlugin getWorldEditPlugin() {
|
||||
return worldEditPlugin;
|
||||
}
|
||||
|
||||
public DrawManager getDrawManager() {
|
||||
return drawManager;
|
||||
}
|
||||
|
||||
public UserManager getUserManager() {
|
||||
return userManager;
|
||||
}
|
||||
@@ -296,11 +332,20 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
|
||||
return newestVersion;
|
||||
}
|
||||
|
||||
public IRegionHelper getRegionHelper() {
|
||||
public RegionHelper getRegionHelper() {
|
||||
return regionHelper;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ProtectedRegionHelper getProtectedRegionHelper() {
|
||||
return protectedRegionHelper;
|
||||
}
|
||||
|
||||
public ParticleHelper getParticleHelper() {
|
||||
return particleHelper;
|
||||
}
|
||||
|
||||
public boolean isWorldGuardEnabled() {
|
||||
return worldGuardEnabled;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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,17 +20,21 @@ package eu.kennytv.worldeditsui.command;
|
||||
|
||||
import eu.kennytv.worldeditsui.Settings;
|
||||
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
|
||||
import eu.kennytv.worldeditsui.user.SelectionCache;
|
||||
import eu.kennytv.worldeditsui.compat.ProtectedRegionWrapper;
|
||||
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
|
||||
import eu.kennytv.worldeditsui.user.User;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public final class WESUICommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
@@ -43,55 +47,95 @@ public final class WESUICommand implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command cmd, final String s, final String[] args) {
|
||||
if (checkPermission(sender, "command")) return true;
|
||||
public boolean onCommand(@NotNull final CommandSender sender, @NotNull final Command cmd, @NotNull final String s, @NotNull final String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("toggle")) {
|
||||
if (!(sender instanceof Player)) return true;
|
||||
if (checkPermission(sender, "command.toggle")) return true;
|
||||
final String arg = args[0].toLowerCase();
|
||||
switch (arg) {
|
||||
case "toggle": {
|
||||
if (!(sender instanceof Player)) return true;
|
||||
if (checkPermission(sender, "command.toggle")) return true;
|
||||
|
||||
final Player player = (Player) sender;
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
if (user.isSelectionShown()) {
|
||||
player.sendMessage(getMessage("particlesHidden"));
|
||||
user.setSelectionShown(false);
|
||||
|
||||
final SelectionCache cache = user.getSelectionCache();
|
||||
if (cache != null) {
|
||||
cache.getVectors().clear();
|
||||
user.setSelectionCache(null);
|
||||
final Player player = (Player) sender;
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
if (user.isSelectionShown()) {
|
||||
player.sendMessage(getMessage("particlesHidden"));
|
||||
user.setSelectionShown(false);
|
||||
user.clearCaches();
|
||||
} else {
|
||||
player.sendMessage(getMessage("particlesShown"));
|
||||
user.setSelectionShown(true);
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(getMessage("particlesShown"));
|
||||
user.setSelectionShown(true);
|
||||
}
|
||||
|
||||
if (settings.hasPersistentToggles()) {
|
||||
settings.setUserData("selection." + player.getUniqueId(), user.isSelectionShown());
|
||||
if (settings.hasPersistentToggles()) {
|
||||
settings.setUserData("selection." + player.getUniqueId(), user.isSelectionShown());
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("toggleclipboard")) {
|
||||
if (!(sender instanceof Player)) return true;
|
||||
if (checkPermission(sender, "command.toggleclipboard")) return true;
|
||||
case "toggleclipboard": {
|
||||
if (!(sender instanceof Player)) return true;
|
||||
if (checkPermission(sender, "command.toggleclipboard")) return true;
|
||||
|
||||
final Player player = (Player) sender;
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
player.sendMessage(user.isClipboardShown() ? getMessage("clipboardHidden") : getMessage("clipboardShown"));
|
||||
user.setClipboardShown(!user.isClipboardShown());
|
||||
if (settings.hasPersistentToggles()) {
|
||||
settings.setUserData("clipboard." + player.getUniqueId(), user.isClipboardShown());
|
||||
final Player player = (Player) sender;
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
player.sendMessage(user.isClipboardShown() ? getMessage("clipboardHidden") : getMessage("clipboardShown"));
|
||||
user.setClipboardShown(!user.isClipboardShown());
|
||||
if (settings.hasPersistentToggles()) {
|
||||
settings.setUserData("clipboard." + player.getUniqueId(), user.isClipboardShown());
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("reload")) {
|
||||
if (checkPermission(sender, "command.reload")) return true;
|
||||
case "reload":
|
||||
if (checkPermission(sender, "command.reload")) return true;
|
||||
|
||||
final boolean cache = settings.cacheLocations();
|
||||
settings.loadSettings();
|
||||
settings.loadLanguageFile();
|
||||
// Empty cache to recalculate positions
|
||||
plugin.getUserManager().getUsers().values().forEach(user -> user.setSelectionCache(null));
|
||||
plugin.checkTasks();
|
||||
sender.sendMessage(getMessage("reload"));
|
||||
} else
|
||||
sendHelp(sender);
|
||||
settings.loadSettings();
|
||||
settings.loadLanguageFile();
|
||||
// Empty cache to recalculate positions
|
||||
plugin.getUserManager().getUsers().values().forEach(User::clearCaches);
|
||||
plugin.checkTasks();
|
||||
sender.sendMessage(getMessage("reload"));
|
||||
// Reset Bukkit's no perm message for the command
|
||||
plugin.getCommand("worldeditsui").setPermissionMessage(settings.getMessage("noPermission"));
|
||||
break;
|
||||
case "showregion": {
|
||||
if (!(sender instanceof Player)) return true;
|
||||
if (checkPermission(sender, "command.showregion")) return true;
|
||||
|
||||
final Player player = (Player) sender;
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
if (user.getSelectedWGRegion() == null) {
|
||||
sendHelp(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
user.setSelectedWGRegion(null);
|
||||
user.clearCache(DrawedType.WG_REGION);
|
||||
user.setExpireTimestamp(System.currentTimeMillis() + plugin.getSettings().getExpiresAfterMillis());
|
||||
sender.sendMessage(getMessage("regionCleared"));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sendHelp(sender);
|
||||
break;
|
||||
}
|
||||
} else if (args.length == 2 && args[0].equalsIgnoreCase("showregion")) {
|
||||
if (!(sender instanceof Player)) return true;
|
||||
if (checkPermission(sender, "command.showregion")) return true;
|
||||
if (!plugin.isWorldGuardEnabled()) {
|
||||
sender.sendMessage(getMessage("WGNotEnabled"));
|
||||
return true;
|
||||
}
|
||||
|
||||
final Player player = (Player) sender;
|
||||
final ProtectedRegionWrapper region = plugin.getProtectedRegionHelper().getRegion(player.getWorld(), args[1]);
|
||||
if (region == null) {
|
||||
sender.sendMessage(getMessage("regionNotFound"));
|
||||
return true;
|
||||
}
|
||||
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
user.clearCache(DrawedType.WG_REGION);
|
||||
user.setSelectedWGRegion(region);
|
||||
player.sendMessage(getMessage("regionDisplayed"));
|
||||
} else
|
||||
sendHelp(sender);
|
||||
return true;
|
||||
@@ -106,6 +150,8 @@ public final class WESUICommand implements CommandExecutor, TabCompleter {
|
||||
sender.sendMessage(getMessage("helpToggle"));
|
||||
if (sender.hasPermission("wesui.command.toggleclipboard"))
|
||||
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(getMessage("helpHeader"));
|
||||
sender.sendMessage("");
|
||||
@@ -120,21 +166,33 @@ public final class WESUICommand implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(final CommandSender sender, final Command cmd, final String s, final String[] args) {
|
||||
if (args.length != 1 || !sender.hasPermission("wesui.command")) return Collections.emptyList();
|
||||
|
||||
final String arg = args[0].toLowerCase();
|
||||
final List<String> list = new ArrayList<>();
|
||||
checkString(sender, arg, "reload", list);
|
||||
checkString(sender, arg, "toggle", list);
|
||||
checkString(sender, arg, "toggleclipboard", list);
|
||||
return list;
|
||||
public List<String> onTabComplete(@NotNull final CommandSender sender, @NotNull final Command cmd, @NotNull final String s, @NotNull final String[] args) {
|
||||
if (!sender.hasPermission("wesui.command")) return Collections.emptyList();
|
||||
if (args.length == 1) {
|
||||
final String arg = args[0].toLowerCase();
|
||||
final List<String> list = new ArrayList<>();
|
||||
checkString(sender, arg, "reload", list);
|
||||
checkString(sender, arg, "toggle", list);
|
||||
checkString(sender, arg, "toggleclipboard", list);
|
||||
if (plugin.isWorldGuardEnabled()) {
|
||||
checkString(sender, arg, "showregion", list);
|
||||
}
|
||||
return list;
|
||||
} else if (args.length == 2) {
|
||||
if (sender instanceof Player && plugin.isWorldGuardEnabled()
|
||||
&& args[0].equalsIgnoreCase("showregion") && sender.hasPermission("wesui.showregion")) {
|
||||
final Set<String> regionNames = plugin.getProtectedRegionHelper().getRegionNames(((Player) sender).getWorld());
|
||||
return StringUtil.copyPartialMatches(args[1], regionNames, new ArrayList<>());
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private void checkString(final CommandSender sender, final String s, final String command, final List<String> list) {
|
||||
if (!s.isEmpty() && !command.startsWith(s)) return;
|
||||
if (sender.hasPermission("wesui.command." + command))
|
||||
if (sender.hasPermission("wesui.command." + command)) {
|
||||
list.add(command);
|
||||
}
|
||||
}
|
||||
|
||||
private String getMessage(final String path) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
@@ -21,6 +21,7 @@ package eu.kennytv.worldeditsui.drawer;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
|
||||
import eu.kennytv.worldeditsui.compat.SimpleVector;
|
||||
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
|
||||
import eu.kennytv.worldeditsui.drawer.base.DrawerBase;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -33,12 +34,7 @@ public final class CuboidDrawer extends DrawerBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(final Player player, final Region region) {
|
||||
this.draw(player, region, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(final Player player, final Region region, final boolean copySelection) {
|
||||
public void draw(final Player player, final Region region, final DrawedType drawedType) {
|
||||
final double width = region.getWidth();
|
||||
final double length = region.getLength();
|
||||
final double height = region.getHeight();
|
||||
@@ -53,56 +49,50 @@ public final class CuboidDrawer extends DrawerBase {
|
||||
int gridSpaceX = 0;
|
||||
int gridSpaceZ = 0;
|
||||
int topGridSpace = 0;
|
||||
if (settings.hasAdvancedGrid() && !copySelection) {
|
||||
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);
|
||||
maxGridTicks = height * settings.getParticlesPerGridBlock() - 1;
|
||||
maxTopGridTicksX = length * settings.getParticlesPerGridBlock() - 1;
|
||||
maxTopGridTicksZ = width * settings.getParticlesPerGridBlock() - 1;
|
||||
maxGridTicks = height * settings.getParticlesPerGridBlock(drawedType) - 1;
|
||||
maxTopGridTicksX = length * settings.getParticlesPerGridBlock(drawedType) - 1;
|
||||
maxTopGridTicksZ = width * settings.getParticlesPerGridBlock(drawedType) - 1;
|
||||
}
|
||||
|
||||
drawLines(player, minimumPoint.clone(), gridSpaceX, topGridSpace, maxTicksX, maxGridTicks, maxTopGridTicksX, height, true, copySelection);
|
||||
drawLines(player, minimumPoint.clone().add(0, 0, length), gridSpaceX, 0, maxTicksX, maxGridTicks, 0, height, true, copySelection);
|
||||
drawLines(player, minimumPoint.clone(), gridSpaceZ, topGridSpace, maxTicksZ, maxGridTicks, maxTopGridTicksZ, height, false, copySelection);
|
||||
drawLines(player, minimumPoint.clone().add(width, 0, 0), gridSpaceZ, 0, maxTicksZ, maxGridTicks, 0, height, false, copySelection);
|
||||
drawPillarsAndGrid(player, minimumPoint, gridSpaceX, gridSpaceZ, height, width, length, copySelection);
|
||||
drawLines(player, minimumPoint.clone(), gridSpaceX, topGridSpace, maxTicksX, maxGridTicks, maxTopGridTicksX, height, true, drawedType);
|
||||
drawLines(player, minimumPoint.clone().add(0, 0, length), gridSpaceX, 0, maxTicksX, maxGridTicks, 0, height, true, drawedType);
|
||||
drawLines(player, minimumPoint.clone(), gridSpaceZ, topGridSpace, maxTicksZ, maxGridTicks, maxTopGridTicksZ, height, false, drawedType);
|
||||
drawLines(player, minimumPoint.clone().add(width, 0, 0), gridSpaceZ, 0, maxTicksZ, maxGridTicks, 0, height, false, drawedType);
|
||||
drawPillarsAndGrid(player, minimumPoint, gridSpaceX, gridSpaceZ, height, width, length, drawedType);
|
||||
}
|
||||
|
||||
private void drawLines(final Player player, final Location location, final int gridSpace, final int topGridSpace,
|
||||
final double maxTicks, final double maxGridTicks, final double maxTopGridTicks,
|
||||
final double height, final boolean x, final boolean copySelection) {
|
||||
final double height, final boolean x, final DrawedType drawedType) {
|
||||
// Lower row (with vertical grid)
|
||||
final double oldX = location.getX();
|
||||
final double oldZ = location.getZ();
|
||||
int blocks = 0;
|
||||
for (int i = 0; i < maxTicks; i++) {
|
||||
if (settings.hasAdvancedGrid() && !copySelection) {
|
||||
if (settings.hasAdvancedGrid(drawedType)) {
|
||||
if (blocks % gridSpace == 0 && i != 0) {
|
||||
final Location clone = location.clone();
|
||||
for (double j = 0; j < maxGridTicks; j++) {
|
||||
clone.add(0, settings.getParticleGridSpace(), 0);
|
||||
playEffect(clone, player, copySelection);
|
||||
clone.add(0, settings.getParticleGridSpace(drawedType), 0);
|
||||
playEffect(clone, player, drawedType);
|
||||
}
|
||||
}
|
||||
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, drawedType);
|
||||
}
|
||||
blocks++;
|
||||
}
|
||||
|
||||
if (x)
|
||||
if (x) {
|
||||
location.add(settings.getParticleSpace(), 0, 0);
|
||||
else
|
||||
} else {
|
||||
location.add(0, 0, settings.getParticleSpace());
|
||||
playEffect(location, player, copySelection);
|
||||
}
|
||||
playEffect(location, player, drawedType);
|
||||
}
|
||||
|
||||
// Upper row
|
||||
@@ -111,64 +101,72 @@ 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(drawedType) && topGridSpace != 0 && blocks++ % topGridSpace == 0 && i != 0) {
|
||||
tickGrid(player, location, maxTopGridTicks, x, drawedType);
|
||||
}
|
||||
|
||||
if (x)
|
||||
if (x) {
|
||||
location.add(settings.getParticleSpace(), 0, 0);
|
||||
else
|
||||
} else {
|
||||
location.add(0, 0, settings.getParticleSpace());
|
||||
playEffect(location, player, copySelection);
|
||||
}
|
||||
playEffect(location, player, drawedType);
|
||||
}
|
||||
}
|
||||
|
||||
private void tickGrid(final Player player, final Location location, final double maxTopGridTicks, final boolean x, final DrawedType drawedType) {
|
||||
final Location clone = location.clone();
|
||||
for (double j = 0; j < maxTopGridTicks; j++) {
|
||||
if (x)
|
||||
clone.add(0, 0, settings.getParticleGridSpace(drawedType));
|
||||
else
|
||||
clone.add(settings.getParticleGridSpace(drawedType), 0, 0);
|
||||
playEffect(clone, player, drawedType);
|
||||
}
|
||||
}
|
||||
|
||||
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 double height, final double width, final double length, final DrawedType drawedType) {
|
||||
final boolean advancedGridEnabled = settings.hasAdvancedGrid(drawedType);
|
||||
|
||||
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(drawedType) : 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;
|
||||
setGrid(player, minimum, gridSpaceX, maxTicks, maxGridTicksX, gridSpace, 0, copySelection);
|
||||
final double maxGridTicksX = advancedGridEnabled ? width * settings.getParticlesPerGridBlock(drawedType) - 1 : 0;
|
||||
final double maxGridTicksZ = advancedGridEnabled ? length * settings.getParticlesPerGridBlock(drawedType) - 1 : 0;
|
||||
setGrid(player, minimum, gridSpaceX, maxTicks, maxGridTicksX, gridSpace, 0, drawedType);
|
||||
minimum.setX(x + width);
|
||||
minimum.setY(y);
|
||||
minimum.setZ(z + length);
|
||||
setGrid(player, minimum, gridSpaceX, maxTicks, maxGridTicksX, -gridSpace, 0, copySelection);
|
||||
setGrid(player, minimum, gridSpaceX, maxTicks, maxGridTicksX, -gridSpace, 0, drawedType);
|
||||
minimum.setX(x + width);
|
||||
minimum.setY(y);
|
||||
minimum.setZ(z);
|
||||
setGrid(player, minimum, gridSpaceZ, maxTicks, maxGridTicksZ, 0, gridSpace, copySelection);
|
||||
setGrid(player, minimum, gridSpaceZ, maxTicks, maxGridTicksZ, 0, gridSpace, drawedType);
|
||||
minimum.setX(x);
|
||||
minimum.setY(y);
|
||||
minimum.setZ(z + length);
|
||||
setGrid(player, minimum, gridSpaceZ, maxTicks, maxGridTicksZ, 0, -gridSpace, copySelection);
|
||||
setGrid(player, minimum, gridSpaceZ, maxTicks, maxGridTicksZ, 0, -gridSpace, drawedType);
|
||||
}
|
||||
|
||||
private void setGrid(final Player player, final Location location, final int gridSpace, final double maxTicks, final double maxGridTicks, final double xAddition, final double zAddition, final boolean copySelection) {
|
||||
private void setGrid(final Player player, final Location location, final int gridSpace, final double maxTicks, final double maxGridTicks,
|
||||
final double xAddition, final double zAddition, final DrawedType drawedType) {
|
||||
int blocks = 0;
|
||||
for (int i = 0; i < maxTicks; i++) {
|
||||
// Horizontal grid
|
||||
if (settings.hasAdvancedGrid() && !copySelection && blocks++ % gridSpace == 0 && i != 0) {
|
||||
if (settings.hasAdvancedGrid(drawedType) && 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, drawedType);
|
||||
}
|
||||
}
|
||||
|
||||
// Pillar
|
||||
location.add(0, settings.getParticleSpace(), 0);
|
||||
playEffect(location, player, copySelection);
|
||||
playEffect(location, player, drawedType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
@@ -23,6 +23,7 @@ import com.sk89q.worldedit.regions.FlatRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
|
||||
import eu.kennytv.worldeditsui.compat.SimpleVector;
|
||||
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
|
||||
import eu.kennytv.worldeditsui.drawer.base.DrawerBase;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -34,7 +35,7 @@ public final class CylinderDrawer extends DrawerBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(final Player player, final Region region) {
|
||||
public void draw(final Player player, final Region region, final DrawedType drawedType) {
|
||||
final SimpleVector radius = plugin.getRegionHelper().getRadius((CylinderRegion) region, 1.3, 1.3);
|
||||
final int width = (int) radius.getX();
|
||||
final int length = (int) radius.getZ();
|
||||
@@ -51,46 +52,68 @@ public final class CylinderDrawer extends DrawerBase {
|
||||
location.setY(top);
|
||||
drawCurves(player, width, length, 1, location, wideGrid, heightSpace == 0 ? 1 : heightSpace);
|
||||
|
||||
if (settings.hasAdvancedGrid()) {
|
||||
if (settings.hasAdvancedGrid(drawedType)) {
|
||||
location.setY(bottom);
|
||||
final double wideInterval = Math.PI / (settings.getParticlesPerGridBlock() * max / 10D);
|
||||
drawCurves(player, width, length, height * settings.getParticlesPerGridBlock(), location, wideInterval, settings.getParticleGridSpace());
|
||||
drawGrid(player, width, length, top, location, true);
|
||||
drawGrid(player, length, width, top, location, false);
|
||||
final double wideInterval = Math.PI / (settings.getParticlesPerGridBlock(drawedType) * max / 10D);
|
||||
drawCurves(player, width, length, height * settings.getParticlesPerGridBlock(drawedType), location, wideInterval, settings.getParticleGridSpace(drawedType));
|
||||
drawGrid(player, drawedType, width, length, top, location, true);
|
||||
drawGrid(player, drawedType, length, width, top, location, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawGrid(final Player player, final int width, final int length, final int top, final Location location, final boolean xAxis) {
|
||||
private void drawGrid(final Player player, final DrawedType drawedType, final int width, final int length, final int top, final Location location, final boolean xAxis) {
|
||||
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 ticks = 2 * (width - 1) / gap;
|
||||
if (xAxis) location.setX(location.getX() - width);
|
||||
else location.setZ(location.getZ() - width);
|
||||
if (xAxis) {
|
||||
location.setX(location.getX() - width);
|
||||
} else {
|
||||
location.setZ(location.getZ() - width);
|
||||
}
|
||||
|
||||
for (int i = 0; i < ticks; i++) {
|
||||
if (xAxis) location.setX(location.getX() + gap);
|
||||
else location.setZ(location.getZ() + gap);
|
||||
if (xAxis) {
|
||||
location.setX(location.getX() + gap);
|
||||
} else {
|
||||
location.setZ(location.getZ() + gap);
|
||||
}
|
||||
|
||||
final double delta = Math.abs(xAxis ? location.getX() - x : location.getZ() - z);
|
||||
// Thanks to a beautiful buddy of mine that took an our of his life to come up with this formula by himself, even though it's on Wikipedia 👀
|
||||
final double radius = ((double) length / width) * Math.sqrt((width * width) - (delta * delta));
|
||||
final int gridTicks = (int) (radius * settings.getParticlesPerGridBlock() * 2);
|
||||
if (xAxis) location.setZ(location.getZ() - radius);
|
||||
else location.setX(location.getX() - radius);
|
||||
final int gridTicks = (int) (radius * settings.getParticlesPerGridBlock(drawedType) * 2);
|
||||
if (xAxis) {
|
||||
location.setZ(location.getZ() - radius);
|
||||
} else {
|
||||
location.setX(location.getX() - radius);
|
||||
}
|
||||
|
||||
for (int j = 0; j < gridTicks; j++) {
|
||||
if (xAxis) location.setZ(location.getZ() + settings.getParticleGridSpace());
|
||||
else location.setX(location.getX() + settings.getParticleGridSpace());
|
||||
if (xAxis) {
|
||||
location.setZ(location.getZ() + settings.getParticleGridSpace(drawedType));
|
||||
} else {
|
||||
location.setX(location.getX() + settings.getParticleGridSpace(drawedType));
|
||||
}
|
||||
playEffect(location, player);
|
||||
location.setY(top);
|
||||
playEffect(location, player);
|
||||
location.setY(bottom);
|
||||
}
|
||||
if (xAxis) location.setZ(z);
|
||||
else location.setX(x);
|
||||
|
||||
if (xAxis) {
|
||||
location.setZ(z);
|
||||
} else {
|
||||
location.setX(x);
|
||||
}
|
||||
}
|
||||
|
||||
if (xAxis) {
|
||||
location.setX(x);
|
||||
} else {
|
||||
location.setZ(z);
|
||||
}
|
||||
if (xAxis) location.setX(x);
|
||||
else location.setZ(z);
|
||||
}
|
||||
|
||||
private void drawCurves(final Player player, final int width, final int length, final int ticks, final Location location, final double wideGrid, final double heightSpace) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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,7 +18,7 @@
|
||||
|
||||
package eu.kennytv.worldeditsui.drawer;
|
||||
|
||||
import eu.kennytv.worldeditsui.util.SelectionType;
|
||||
import eu.kennytv.worldeditsui.compat.SelectionType;
|
||||
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
|
||||
import eu.kennytv.worldeditsui.drawer.base.Drawer;
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public final class DrawManager {
|
||||
|
||||
private final Map<SelectionType, Drawer> drawers = new HashMap<>();
|
||||
|
||||
public DrawManager(final WorldEditSUIPlugin plugin) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
@@ -22,6 +22,7 @@ import com.sk89q.worldedit.regions.EllipsoidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
|
||||
import eu.kennytv.worldeditsui.compat.SimpleVector;
|
||||
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
|
||||
import eu.kennytv.worldeditsui.drawer.base.DrawerBase;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -33,7 +34,7 @@ public final class EllipsoidDrawer extends DrawerBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(final Player player, final Region region) {
|
||||
public void draw(final Player player, final Region region, final DrawedType drawedType) {
|
||||
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();
|
||||
@@ -46,9 +47,9 @@ public final class EllipsoidDrawer extends DrawerBase {
|
||||
final double wideInterval = Math.PI / (settings.getParticlesPerBlock() * max / 10D);
|
||||
showGrid(player, width, length, height, location, wideInterval, heightInterval);
|
||||
|
||||
if (settings.hasAdvancedGrid()) {
|
||||
final double heightGrid = Math.PI / (settings.getParticlesPerGridBlock() * height);
|
||||
final double wideGrid = Math.PI / (settings.getParticlesPerGridBlock() * max / 5D);
|
||||
if (settings.hasAdvancedGrid(drawedType)) {
|
||||
final double heightGrid = Math.PI / (settings.getParticlesPerGridBlock(drawedType) * height);
|
||||
final double wideGrid = Math.PI / (settings.getParticlesPerGridBlock(drawedType) * max / 5D);
|
||||
showGrid(player, width, length, height, location, heightGrid, wideGrid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
@@ -23,6 +23,7 @@ import com.sk89q.worldedit.regions.Polygonal2DRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
|
||||
import eu.kennytv.worldeditsui.compat.Simple2DVector;
|
||||
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
|
||||
import eu.kennytv.worldeditsui.drawer.base.DrawerBase;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -34,7 +35,7 @@ public final class PolygonalDrawer extends DrawerBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(final Player player, final Region region) {
|
||||
public void draw(final Player player, final Region region, final DrawedType drawedType) {
|
||||
final Polygonal2DRegion polyRegion = (Polygonal2DRegion) region;
|
||||
final Simple2DVector[] points = plugin.getRegionHelper().getPoints(polyRegion);
|
||||
Simple2DVector last = points[0];
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018-2020 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.drawer.base;
|
||||
|
||||
public enum DrawedType {
|
||||
|
||||
SELECTED,
|
||||
CLIPBOARD,
|
||||
WG_REGION
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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,11 +20,21 @@ package eu.kennytv.worldeditsui.drawer.base;
|
||||
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface Drawer {
|
||||
|
||||
/**
|
||||
* Recreates the given with particles.
|
||||
* If the given player object is null, the particles
|
||||
* will be sent to all players nearby.
|
||||
*
|
||||
* @param player player to send the particles to, may be null when sent to all players
|
||||
* @param region region to be displayed with particles
|
||||
* @param drawedType drawed type
|
||||
*/
|
||||
void draw(@Nullable Player player, Region region, DrawedType drawedType);
|
||||
|
||||
/**
|
||||
* Recreates the given with particles.
|
||||
* If the given player object is null, the particles
|
||||
@@ -33,21 +43,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
|
||||
*/
|
||||
void draw(@Nullable Player player, Region region);
|
||||
|
||||
/**
|
||||
* Recreates the given with particles.
|
||||
* If the given player object is null, the particles
|
||||
* will be sent to all players nearby.
|
||||
*
|
||||
* @param player player to send the particles to, may be null when sent to all players
|
||||
* @param region region to be displayed with particles
|
||||
* @param copySelection if the region is a copied region
|
||||
* @see #draw(Player, Region)
|
||||
* @deprecated only implemented by the CuboidDrawer
|
||||
*/
|
||||
@Deprecated
|
||||
default void draw(@Nullable final Player player, final Region region, final boolean copySelection) {
|
||||
this.draw(player, region);
|
||||
default void draw(@Nullable final Player player, final Region region) {
|
||||
draw(player, region, DrawedType.SELECTED);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
@@ -21,9 +21,10 @@ package eu.kennytv.worldeditsui.drawer.base;
|
||||
import eu.kennytv.worldeditsui.Settings;
|
||||
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
|
||||
import eu.kennytv.worldeditsui.compat.SimpleVector;
|
||||
import eu.kennytv.worldeditsui.user.SelectionCache;
|
||||
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 {
|
||||
@@ -38,22 +39,24 @@ public abstract class DrawerBase implements Drawer {
|
||||
}
|
||||
|
||||
protected void playEffect(final Location location, final Player player) {
|
||||
playEffect(location, player, false);
|
||||
playEffect(location, player, DrawedType.SELECTED);
|
||||
}
|
||||
|
||||
protected void playEffect(final Location location, final Player player, final boolean copySelection) {
|
||||
if (settings.cacheLocations() && !copySelection) {
|
||||
protected void playEffect(final Location location, final Player player, final DrawedType drawedType) {
|
||||
if (settings.cacheLocations() && drawedType != DrawedType.CLIPBOARD) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
if (user == null) return;
|
||||
user.getSelectionCache().getVectors().add(new SimpleVector(location.getX(), location.getY(), location.getZ()));
|
||||
|
||||
final SelectionCache cache = user.getSelectionCache(drawedType);
|
||||
cache.getVectors().add(new SimpleVector(location.getX(), location.getY(), location.getZ()));
|
||||
}
|
||||
|
||||
final Particle particle = copySelection ? settings.getClipboardParticle() : settings.getParticle();
|
||||
if (settings.sendParticlesToAll()) {
|
||||
final Particle othersParticle = copySelection ? settings.getOthersClipboardParticle() : settings.getOthersParticle();
|
||||
plugin.getParticleHelper().playEffectToAll(particle, othersParticle, location, 0, 1, settings.getParticleViewDistance(), player);
|
||||
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);
|
||||
} else {
|
||||
plugin.getParticleHelper().playEffect(particle, location, 0, 1, settings.getParticleViewDistance(), player);
|
||||
plugin.getParticleHelper().playEffect(particle, location, settings.getParticleViewDistance(), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
@@ -70,6 +70,5 @@ public final class PlayerJoinListener implements Listener {
|
||||
player.sendMessage(plugin.getPrefix() + "§cDownload it at: §6https://www.spigotmc.org/resources/worldeditsui.60726/");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
|
||||
+8
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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,6 +31,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class WESelectionListener implements Listener {
|
||||
|
||||
@@ -78,7 +79,8 @@ public final class WESelectionListener implements Listener {
|
||||
final String type = item.getType().name();
|
||||
if (!type.endsWith("_AXE") || !type.contains("WOOD")) return;
|
||||
}
|
||||
plugin.getUserManager().getExpireTimestamps().put(player.getUniqueId(), System.currentTimeMillis() + plugin.getSettings().getExpiresAfterMillis());
|
||||
|
||||
plugin.getUserManager().getUser(player).setExpireTimestamp(System.currentTimeMillis() + plugin.getSettings().getExpiresAfterMillis());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -89,10 +91,13 @@ public final class WESelectionListener implements Listener {
|
||||
while (!arguments.isEmpty() && arguments.charAt(0) == '/') {
|
||||
arguments = arguments.substring(1);
|
||||
}
|
||||
|
||||
if (arguments.isEmpty()) return;
|
||||
|
||||
final String command = arguments.split(" ", 2)[0].toLowerCase();
|
||||
if (weCommands.stream().noneMatch(command::equals)) return;
|
||||
plugin.getUserManager().getExpireTimestamps().put(event.getActor().getUniqueId(), System.currentTimeMillis() + plugin.getSettings().getExpiresAfterMillis());
|
||||
|
||||
final UUID uuid = event.getActor().getUniqueId();
|
||||
plugin.getUserManager().getUser(uuid).setExpireTimestamp(System.currentTimeMillis() + plugin.getSettings().getExpiresAfterMillis());
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import java.util.zip.GZIPOutputStream;
|
||||
public final class MetricsLite {
|
||||
|
||||
public static final int B_STATS_VERSION = 1;
|
||||
private static final int PLUGIN_ID = 5444;
|
||||
private static final String URL = "https://bStats.org/submitData/bukkit";
|
||||
private final boolean enabled;
|
||||
private static boolean logFailedRequests;
|
||||
@@ -113,6 +114,7 @@ public final class MetricsLite {
|
||||
final String pluginVersion = plugin.getDescription().getVersion();
|
||||
|
||||
data.addProperty("pluginName", pluginName);
|
||||
data.addProperty("id", PLUGIN_ID);
|
||||
data.addProperty("pluginVersion", pluginVersion);
|
||||
data.add("customCharts", new JsonArray());
|
||||
|
||||
@@ -221,21 +223,18 @@ public final class MetricsLite {
|
||||
connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION);
|
||||
|
||||
connection.setDoOutput(true);
|
||||
final DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());
|
||||
outputStream.write(compressedData);
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
try (final DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
|
||||
outputStream.write(compressedData);
|
||||
}
|
||||
|
||||
if (logResponseStatusText) {
|
||||
final InputStream inputStream = connection.getInputStream();
|
||||
final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
String line;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
builder.append(line);
|
||||
try (final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
||||
String line;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
builder.append(line);
|
||||
}
|
||||
}
|
||||
bufferedReader.close();
|
||||
plugin.getLogger().info("Sent data to bStats and received response: " + builder);
|
||||
} else {
|
||||
connection.getInputStream().close();
|
||||
@@ -247,9 +246,9 @@ public final class MetricsLite {
|
||||
return null;
|
||||
}
|
||||
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
final GZIPOutputStream gzip = new GZIPOutputStream(outputStream);
|
||||
gzip.write(str.getBytes(StandardCharsets.UTF_8));
|
||||
gzip.close();
|
||||
try (final GZIPOutputStream gzip = new GZIPOutputStream(outputStream)) {
|
||||
gzip.write(str.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
return outputStream.toByteArray();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
@@ -19,7 +19,7 @@
|
||||
package eu.kennytv.worldeditsui.user;
|
||||
|
||||
import eu.kennytv.worldeditsui.compat.SimpleVector;
|
||||
import eu.kennytv.worldeditsui.util.SelectionType;
|
||||
import eu.kennytv.worldeditsui.compat.SelectionType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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,17 +18,32 @@
|
||||
|
||||
package eu.kennytv.worldeditsui.user;
|
||||
|
||||
import eu.kennytv.worldeditsui.compat.ProtectedRegionWrapper;
|
||||
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public final class User {
|
||||
|
||||
private final UUID uuid;
|
||||
private SelectionCache selectionCache;
|
||||
private SelectionCache selectedWGRegionCache;
|
||||
private ProtectedRegionWrapper selectedWGRegion;
|
||||
private boolean selectionShown;
|
||||
private boolean clipboardShown;
|
||||
private long expireTimestamp = -1;
|
||||
|
||||
User(final boolean selectionShown, final boolean clipboardShown) {
|
||||
User(final UUID uuid, final boolean selectionShown, final boolean clipboardShown) {
|
||||
this.uuid = uuid;
|
||||
this.selectionShown = selectionShown;
|
||||
this.clipboardShown = clipboardShown;
|
||||
}
|
||||
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public boolean isSelectionShown() {
|
||||
return selectionShown;
|
||||
}
|
||||
@@ -45,11 +60,72 @@ public final class User {
|
||||
this.clipboardShown = clipboardShown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return time at which the selection will expire, 0 if no longer shown, -1 if disabled
|
||||
*/
|
||||
public long getExpireTimestamp() {
|
||||
return expireTimestamp;
|
||||
}
|
||||
|
||||
public void setExpireTimestamp(final long expireTimestamp) {
|
||||
this.expireTimestamp = expireTimestamp;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public SelectionCache getSelectionCache() {
|
||||
return selectionCache;
|
||||
}
|
||||
|
||||
public void setSelectionCache(final SelectionCache selectionCache) {
|
||||
this.selectionCache = selectionCache;
|
||||
@Nullable
|
||||
public SelectionCache getSelectionCache(final DrawedType drawedType) {
|
||||
switch (drawedType) {
|
||||
case SELECTED:
|
||||
return selectionCache;
|
||||
case WG_REGION:
|
||||
return selectedWGRegionCache;
|
||||
default:
|
||||
throw new IllegalArgumentException("Only allowed types are SELECTED and WG_REGION");
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelectionCache(final DrawedType drawedType, @Nullable final SelectionCache selectionCache) {
|
||||
switch (drawedType) {
|
||||
case SELECTED:
|
||||
this.selectionCache = selectionCache;
|
||||
break;
|
||||
case WG_REGION:
|
||||
this.selectedWGRegionCache = selectionCache;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Only allowed types are SELECTED and WG_REGION");
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ProtectedRegionWrapper getSelectedWGRegion() {
|
||||
return selectedWGRegion;
|
||||
}
|
||||
|
||||
public void setSelectedWGRegion(@Nullable final ProtectedRegionWrapper selectedWGRegion) {
|
||||
this.selectedWGRegion = selectedWGRegion;
|
||||
}
|
||||
|
||||
public void clearCaches() {
|
||||
if (selectionCache != null) {
|
||||
selectionCache.getVectors().clear();
|
||||
selectionCache = null;
|
||||
}
|
||||
if (selectedWGRegionCache != null) {
|
||||
selectedWGRegionCache.getVectors().clear();
|
||||
selectedWGRegionCache = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void clearCache(final DrawedType drawedType) {
|
||||
final SelectionCache oldCache = getSelectionCache(drawedType);
|
||||
if (oldCache != null) {
|
||||
oldCache.getVectors().clear();
|
||||
setSelectionCache(drawedType, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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
|
||||
@@ -28,13 +28,16 @@ import java.util.UUID;
|
||||
public final class UserManager {
|
||||
|
||||
private final Map<UUID, User> users = new HashMap<>();
|
||||
private final Map<UUID, Long> expireTimestamps = new HashMap<>();
|
||||
private final Settings settings;
|
||||
|
||||
public UserManager(final Settings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
public User getUser(final UUID uuid) {
|
||||
return users.get(uuid);
|
||||
}
|
||||
|
||||
public User getUser(final Player player) {
|
||||
return users.get(player.getUniqueId());
|
||||
}
|
||||
@@ -50,22 +53,15 @@ public final class UserManager {
|
||||
selection = settings.showByDefault();
|
||||
clipboard = settings.showClipboardByDefault();
|
||||
}
|
||||
users.put(player.getUniqueId(), new User(selection, clipboard));
|
||||
users.put(player.getUniqueId(), new User(player.getUniqueId(), selection, clipboard));
|
||||
}
|
||||
|
||||
public void deleteUser(final Player player) {
|
||||
expireTimestamps.remove(player.getUniqueId());
|
||||
final User remove = users.remove(player.getUniqueId());
|
||||
final SelectionCache cache = remove.getSelectionCache();
|
||||
if (cache != null)
|
||||
cache.getVectors().clear();
|
||||
final User removedUser = users.remove(player.getUniqueId());
|
||||
removedUser.clearCaches();
|
||||
}
|
||||
|
||||
public Map<UUID, User> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public Map<UUID, Long> getExpireTimestamps() {
|
||||
return expireTimestamps;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018-2020 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;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class ParticleData {
|
||||
|
||||
private final Particle particle;
|
||||
private final Object data;
|
||||
|
||||
public ParticleData(final Particle particle, @Nullable final Object data) {
|
||||
this.particle = particle;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Particle getParticle() {
|
||||
return particle;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
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!");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditCUI - https://git.io/wecui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018-2020 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,36 +18,37 @@
|
||||
|
||||
package eu.kennytv.worldeditsui.util;
|
||||
|
||||
import eu.kennytv.worldeditsui.Settings;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public final class ParticleHelper {
|
||||
|
||||
/**
|
||||
* Only players with this permission can see another player's particles.
|
||||
*/
|
||||
private String permission;
|
||||
private final Settings settings;
|
||||
|
||||
public void playEffect(final Particle 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 ParticleHelper(final Settings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
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 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) {
|
||||
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, 1, offX, offY, offZ, 0, 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) {
|
||||
playEffectToAll(particle, othersParticle, location, 0, 0, 0, speed, amount, radius, origin);
|
||||
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 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 int radius, final Player origin) {
|
||||
final int radiusSquared = radius * radius;
|
||||
for (final Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!location.getWorld().equals(player.getWorld())
|
||||
@@ -56,15 +57,12 @@ 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, 1, offX, offY, offZ, 0, toSend.getData());
|
||||
}
|
||||
}
|
||||
|
||||
public void setPermission(final String permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
private boolean canSeeOtherParticles(final Player player) {
|
||||
return permission == null || player.hasPermission(permission);
|
||||
return settings.getOtherParticlesPermission() == null || player.hasPermission(settings.getOtherParticlesPermission());
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WorldEditSUI - https://git.io/wesui
|
||||
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
|
||||
* Copyright (C) 2018-2020 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,8 @@
|
||||
|
||||
package eu.kennytv.worldeditsui.util;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class Version implements Comparable<Version> {
|
||||
|
||||
private final int[] parts;
|
||||
@@ -53,7 +55,7 @@ public final class Version implements Comparable<Version> {
|
||||
* @return 0 if they are the same, 1 if this instance is newer, -1 if older
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(final Version version) {
|
||||
public int compareTo(@NotNull final Version version) {
|
||||
if (version == null || version.toString() == null) return 0;
|
||||
final int max = Math.max(this.parts.length, version.parts.length);
|
||||
for (int i = 0; i < max; i++) {
|
||||
|
||||
@@ -9,10 +9,15 @@ 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.
|
||||
clipboard-particle: VILLAGER_HAPPY
|
||||
# Shown for the WG region view (when using '/wesui showregion <region>').
|
||||
wg-region-particle: VILLAGER_HAPPY
|
||||
|
||||
# How many particles should be displayed for every block of length.
|
||||
# The recommended amount is between 2 and 4. Can be set from 1 to 5.
|
||||
@@ -23,6 +28,10 @@ particles-per-block: 3
|
||||
# For reference: 20 Minecraft ticks are equivalent to 1 second -> 10 ticks are 0.5 seconds -> 1 tick is 0.05 seconds.
|
||||
particle-send-interval: 12
|
||||
|
||||
# Max ping a player can have before particles are no longer sent - this option only works on Paper servers.
|
||||
# Set this to -1 to disable.
|
||||
max-ping: 150
|
||||
|
||||
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).
|
||||
@@ -32,6 +41,18 @@ 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
|
||||
|
||||
advanced-wg-region-grid:
|
||||
# You can also enable the grid for the WG region view by using the '/wesui showregion <region>' command.
|
||||
# Same as advanced-grid settings, but for the WorldGuard regions.
|
||||
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 +64,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'.
|
||||
|
||||
@@ -7,8 +7,13 @@ clipboardShown: "%prefix% &aParticles of your clipboard are now shown!"
|
||||
clipboardHidden: "%prefix% &cParticles of your clipboard are now hidden!"
|
||||
reload: "%prefix% &aReloaded config and language file!"
|
||||
idled: "%prefix% &7The selection particles are no longer displayed. Update your selection to display them again."
|
||||
WGNotEnabled: "%prefix% &cThis command requires WorldGuard to be present."
|
||||
regionNotFound: "%prefix% &cThere is no region with that name!"
|
||||
regionDisplayed: "%prefix% &aThe selected region will now be displayed. Use &e/wesui showregion &ato turn it off again."
|
||||
regionCleared: "%prefix% &7The WG region is no longer displayed."
|
||||
|
||||
helpHeader: "&8===========[ &eWorldEditSUI &8]==========="
|
||||
helpReload: "&6/wesui reload &7(Reloads the config file)"
|
||||
helpToggle: "&6/wesui toggle &7(Toggles the visibility of your selection-particles)"
|
||||
helpToggleClipboard: "&6/wesui toggleclipboard &7(Toggles the visibility of your clipboard-particles)"
|
||||
helpShowRegion: "&6/wesui showgregion <WG region> §7(Outlines the given WorldGuard region)"
|
||||
@@ -3,10 +3,12 @@ version: ${project.version}
|
||||
main: eu.kennytv.worldeditsui.WorldEditSUIPlugin
|
||||
authors: [KennyTV]
|
||||
depend: [WorldEdit]
|
||||
softdepend: [WorldGuard]
|
||||
website: https://www.spigotmc.org/resources/worldeditsui.60726/
|
||||
api-version: 1.13
|
||||
|
||||
commands:
|
||||
worldeditsui:
|
||||
description: WorldEditSUI main command.
|
||||
aliases: [wesui, wecui] # keep wecui alias for legacy reasons
|
||||
aliases: [wesui]
|
||||
permission: wesui.command
|
||||
Reference in new issue
Block a user