Merge from upstream

Dieser Commit ist enthalten in:
Jesse Boyd 2019-06-29 16:01:32 +10:00
Commit 6a7935829b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
589 geänderte Dateien mit 7156 neuen und 15969 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,39 @@
---
name: Bug / Issue report for FastAsyncWorldEdit 1.13.2
about: Bug / Issue report about this plugin
title: ''
labels: Requires Testing
assignees: ''
---
# Bug report for FastAsyncWorldEdit 1.13.2
<!--- If you are using 1.13 or 1.13.1 consider updating to 1.13.2 before raising an issue -->
<!--- In order to create a valid issue report you have to follow this template. -->
<!--- Remove this template if making a suggestion or asking a question. -->
<!--- Incomplete reports might be marked as invalid. -->
**[REQUIRED] FastAsyncWorldEdit Version Number:**
<!--- Enter /fawe version in game or in your console and copy the full output here -->
**[REQUIRED] Spigot/Paper Version Number:**
<!--- Enter /version ingame or in your console and paste the full output here -->
**Links to config.yml and config-legacy.yml file:**
<!--- Copy and paste the information to the service of your choosing (pastebin, hasteb.in e.g) and provide the link here. -->
**[REQUIRED] Description of the problem:**
<!--- Check your console for errors while testing -->
<!--- Include relevant information like errors or a picture of the problem -->
**Plugins being used on the server:**
<!--- Optional but recommended to look further into an issue --->
**How to replicate**:
<!--- If you can reproduce the issue please tell us as detailed as possible step by step how to do that -->
**Checklist**:
<!--- Make sure you've completed the following steps (put an "X" between of brackets): -->
- [] I included all information required in the sections above
- [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/issues?utf8=%E2%9C%93&q=is%3Aissue)
- [] I made sure I am using an up-to-date version of [FastAsyncWorldEdit for 1.13.2](https://ci.athion.net/job/FastAsyncWorldEdit-Breaking/)
- [] I made sure the bug/error is not caused by any other plugin

20
.github/ISSUE_TEMPLATE/feature_request.md vendored Normale Datei
Datei anzeigen

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: "[+] Enhancement"
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

1
.gitignore vendored
Datei anzeigen

@ -23,3 +23,4 @@ lib/
worldedit-bukkit/src/main/java/ignore/*
todo.txt
mvn/*
docs/

Datei anzeigen

@ -1,19 +0,0 @@
# Bug report for FastAsyncWorldEdit 1.13.x
<!--- Follow this template if reporting an issue. -->
<!--- Remove this template if making a suggestion or asking a question. -->
<!--- Please comment or react to an existing ticket if it exists -->
**Debug paste link**:
<!--- Enter /fawe debugpaste in game or in your console and copy the output here -->
**Description of the problem:**
<!--- Include relevant info like errors or a picture of the problem -->
**How to replicate**:
<!--- If you can reproduce the issue please tell us as detailed as possible step by step how to do that -->
**Checklist**:
<!--- Make sure you've completed the following steps (put an "X" between of brackets): -->
- [] I included a `/fawe debugpaste` link
- [] I made sure there aren't duplicates of this report [(Use Search)](https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/issues?utf8=%E2%9C%93&q=is%3Aissue)
- [] I made sure I am using an up-to-date version of [FAWE for 1.13.x](https://ci.athion.net/job/FastAsyncWorldEdit-1.13/)
- [] I made sure the bug/error is not caused by any other plugin

Datei anzeigen

@ -11,17 +11,19 @@ FAWE is a fork of WorldEdit that has huge speed and memory improvements and cons
* [Spigot Page](https://www.spigotmc.org/threads/fast-async-worldedit.100104/)
* [Discord](https://discord.gg/ngZCzbU)
* [Wiki](https://github.com/boy0001/FastAsyncWorldedit/wiki)
* [Report Issue](https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/issues/new)
* [Report Issue](https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/issues)
## Downloads
### 1.13+
* [Download](https://incendo.org/download/)
* [Jenkins](https://ci.athion.net/job/FastAsyncWorldEdit-1.13/)
* [Download](https://empcraft.com/fawe/download/)
* [Jenkins](https://ci.athion.net/job/FastAsyncWorldEdit-Breaking/)
* [JavaDoc](https://ci.athion.net/job/FastAsyncWorldEdit-1.13/javadoc/)
### < 1.12.2
* [Download](https://incendo.org/download/)
* [Download](https://empcraft.com/fawe/download/?bukkit)
* [Jenkins](https://ci.athion.net/job/FastAsyncWorldEdit/)
* [Repository](https://github.com/boy0001/FastAsyncWorldedit)
* [JavaDoc](https://ci.athion.net/job/FastAsyncWorldEdit/javadoc/)
## Building

Datei anzeigen

@ -2,7 +2,6 @@ import org.ajoberstar.grgit.Grgit
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
@ -10,8 +9,6 @@ buildscript {
configurations.all {
resolutionStrategy {
force 'com.google.guava:guava:21.0'
force 'org.ow2.asm:asm:6.0_BETA'
force 'commons-io:commons-io:2.4'
}
}
@ -27,14 +24,19 @@ plugins {
id "org.ajoberstar.grgit" version "3.1.1"
}
apply plugin: 'java'
clean { delete "target" }
println """
*******************************************
You are building WorldEdit!
If you encounter trouble:
1) Read COMPILING.md if you haven't yet
2) Try running 'build' in a separate Gradle run
3) Use gradlew and not gradle
4) If you still need help, ask on Discord! https://discord.gg/ngZCzbU
def splashFile = new File('splash.txt')
if (splashFile.exists()) {
print splashFile.text
}
Output files will be in /target
*******************************************
"""
group = 'com.boydti.fawe'
@ -58,42 +60,54 @@ ext {
}
}
if ( project.hasProperty("lzNoVersion") ) { // gradle build -PlzNoVersion
version = "unknown"
} else {
version = String.format("%s.%s", rootVersion, buildNumber)
}
version = String.format("%s.%s", rootVersion, buildNumber)
description = rootProject.name
subprojects {
repositories {
mavenCentral()
maven { url "http://maven.sk89q.com/repo/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "http://repo.maven.apache.org/maven2" }
// Fawe
maven { url "https://mvnrepository.com/artifact/" }
maven { url "http://repo.dmulloy2.net/content/groups/public/" }
maven { url "https://repo.destroystokyo.com/repository/maven-public//" }
maven { url "http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/" }
maven { url "https://libraries.minecraft.net" }
mavenLocal()
maven { url "http://empcraft.com/maven2" }
maven { url "https://hub.spigotmc.org/nexus/content/groups/public/" }
maven { url "http://ci.frostcast.net/plugin/repository/everything" }
maven { url "http://maven.sk89q.com/artifactory/repo" }
maven { url "http://repo.spongepowered.org/maven" }
maven { url "http://dl.bintray.com/tastybento/maven-repo" }
maven { url "http://ci.emc.gs/nexus/content/groups/aikar/" }
}
configurations.all {
resolutionStrategy {
cacheChangingModulesFor 5, 'minutes'
}
}
}
configure(['worldedit-core', 'worldedit-bukkit', 'favs'].collect { project("$it") }) {
apply plugin: 'java'
apply plugin: 'maven'
// apply plugin: 'checkstyle'
apply plugin: 'com.github.johnrengelman.shadow'
// Enable this requires putting license header files in many, many FAWE files
//apply plugin: 'net.minecrell.licenser'
// Enable this requires putting license header files in many, many FAWE files
// apply plugin: 'net.minecrell.licenser'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
compileJava { options.compilerArgs += ["-parameters"] }
// checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml")
// checkstyle.toolVersion = '7.6.1'
repositories {
mavenCentral()
maven { url "http://maven.sk89q.com/repo/" }
maven { url "http://repo.maven.apache.org/maven2" }
// Fawe
maven {url "https://mvnrepository.com/artifact/"}
maven {url "http://repo.dmulloy2.net/content/groups/public/"}
maven {url "https://repo.destroystokyo.com/repository/maven-public//"}
maven {url "http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/"}
mavenLocal()
maven {url "http://empcraft.com/maven2"}
maven {url "https://hub.spigotmc.org/nexus/content/groups/public/"}
maven {url "http://ci.frostcast.net/plugin/repository/everything"}
maven {url "http://maven.sk89q.com/artifactory/repo"}
maven {url "http://repo.spongepowered.org/maven"}
maven {url "http://dl.bintray.com/tastybento/maven-repo"}
maven {url "http://ci.emc.gs/nexus/content/groups/aikar/" }
clean.doFirst {
delete "../target"
}
if (JavaVersion.current().isJava8Compatible()) {
@ -103,16 +117,6 @@ subprojects {
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives jar
archives javadocJar
}
if (!(name.equals('worldedit-forge') || name.equals('worldedit-sponge'))) {
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
@ -125,23 +129,52 @@ subprojects {
build.dependsOn(sourcesJar)
}
shadowJar {
classifier 'dist'
dependencies {
include(dependency('com.sk89q:jchronic:0.2.4a'))
include(dependency('com.thoughtworks.paranamer:paranamer:2.6'))
include(dependency('com.sk89q.lib:jlibnoise:1.0.0'))
include(dependency('com.github.luben:zstd-jni:1.1.1'))
include(dependency('co.aikar:fastutil-lite:1.0'))
}
exclude 'GradleStart**'
exclude '.cache'
exclude 'LICENSE*'
// build.dependsOn(checkstyleMain)
// build.dependsOn(checkstyleTest)
dependencies {
compileOnly 'org.jetbrains:annotations:17.0.0'
}
// Enable this requires putting license header files in many, many FAWE files
//license {
// header = rootProject.file("HEADER.txt")
// include '**/*.java'
//}
configure(['bukkit'].collect { project(":worldedit-$it") }) {
shadowJar {
classifier 'dist'
dependencies {
include(project(":worldedit-libs:core"))
include(project(":worldedit-libs:${project.name.replace("worldedit-", "")}"))
include(project(":worldedit-core"))
include(dependency('com.github.luben:zstd-jni:1.1.1'))
include(dependency('co.aikar:fastutil-lite:1.0'))
}
exclude 'GradleStart**'
exclude '.cache'
exclude 'LICENSE*'
}
// Enable this requires putting license header files in many, many FAWE files
//license {
// header = rootProject.file("HEADER.txt")
// include '**/*.java'
//}
}
task aggregatedJavadocs(type: Javadoc, description: 'Generate javadocs from all child projects as if it was a single project', group: 'Documentation') {
destinationDir = file("./docs/javadoc")
title = "$project.name $version API"
options.author true
options.links 'http://docs.spring.io/spring/docs/4.3.x/javadoc-api/', 'http://docs.oracle.com/javase/8/docs/api/', 'http://docs.spring.io/spring-ws/docs/2.3.0.RELEASE/api/', 'http://docs.spring.io/spring-security/site/docs/4.0.4.RELEASE/apidocs/'
options.addStringOption('Xdoclint:none', '-quiet')
delete "./docs"
subprojects.each { proj ->
proj.tasks.withType(Javadoc).each { javadocTask ->
source += javadocTask.source
classpath += javadocTask.classpath
excludes += javadocTask.excludes
includes += javadocTask.includes
}
}
}
}

Datei anzeigen

@ -53,5 +53,19 @@
<!-- <module name="PackageName"/> Unlikely that we would miss this in a PR -->
<module name="ParameterName"/>
<!-- <module name="TypeName"/> Unlikely that we would miss this in a PR -->
<!-- Validate assignment operators -->
<module name="WhitespaceAround">
<property name="tokens" value="ASSIGN"/>
</module>
<!-- Validate String.to(Lower|Upper)Case() calls include Locale argument -->
<module name="Regexp">
<property name="message" value="Case-conversion calls must include an explicit Locale"/>
<property name="format" value="(?!Character)\.to(Lower|Upper)Case\(\)"/>
<property name="illegalPattern" value="true"/>
</module>
</module>
<!-- Validate that command annotations are formatted correctly -->
<module name="RegexpMultiline">
<property name="format" value="^( +)@(Arg|Switch|Command)\(.*?\n\1 {5,}"/>
</module>
</module>

Datei anzeigen

@ -16,6 +16,7 @@
<allow pkg="net.royawesome.jlibnoise"/>
<allow pkg="org.json.simple" />
<allow pkg="org.slf4j"/>
<allow pkg="org.enginehub"/>
<subpackage name="util.yaml">
<allow pkg="org.yaml.snakeyaml"/>
@ -38,11 +39,12 @@
<subpackage name="worldedit">
<allow pkg="org.mozilla.javascript"/>
<allow pkg="de.schlichtherle"/>
<allow pkg="com.google.auto"/>
<subpackage name="bukkit">
<allow pkg="org.bukkit"/>
<allow pkg="org.bstats.bukkit"/>
<allow pkg="net.minecraft.server"/>
<allow pkg="io.papermc.lib"/>
</subpackage>
<subpackage name="forge">
@ -55,6 +57,7 @@
<allow pkg="io.netty.buffer"/>
<allow pkg="org.spongepowered.api" />
<allow pkg="com.mojang.brigadier" />
<allow pkg="com.mojang.datafixers" />
</subpackage>
<subpackage name="sponge">

Datei anzeigen

@ -1,6 +1,5 @@
package com.boydti.fawe.bukkit.favs;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FawePlayer;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
@ -23,7 +22,7 @@ public class PatternUtil {
snipeData.sendMessage(ChatColor.GOLD + "Voxel: " + ChatColor.RED + arg);
return pattern;
} catch (InputParseException e) {
fp.sendMessage(BBC.getPrefix() + e.getMessage());
fp.sendMessage(e.getMessage());
return null;
}
}

Datei anzeigen

@ -3,9 +3,6 @@ package com.thevoxelbox.voxelsniper;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.bukkit.ChatColor;
/**
*
*/
public class Message {
private static final int BRUSH_SIZE_WARNING_THRESHOLD = 20;
private final SnipeData snipeData;

Datei anzeigen

@ -23,9 +23,9 @@ public final class PaintingWrapper {
/**
* The paint method used to scroll or set a painting to a specific type.
*
* @param p The player executing the method
* @param auto Scroll automatically? If false will use 'choice' to try and set the painting
* @param back Scroll in reverse?
* @param p The player executing the method
* @param auto Scroll automatically? If false will use 'choice' to try and set the painting
* @param back Scroll in reverse?
* @param choice Chosen index to set the painting to
*/
@SuppressWarnings("deprecation")

Datei anzeigen

@ -1,4 +1,4 @@
/**
/*
This file is part of VoxelSniper, licensed under the MIT License (MIT).
Copyright (c) The VoxelBox <http://thevoxelbox.com>
@ -281,8 +281,8 @@ public class RangeBlockHelper {
this.range = range;
this.step = step;
this.length = 0.0D;
this.rotX = (double)((this.playerLoc.getYaw() + 90.0F) % 360.0F);
this.rotY = (double)(this.playerLoc.getPitch() * -1.0F);
this.rotX = (this.playerLoc.getYaw() + 90.0F) % 360.0F;
this.rotY = this.playerLoc.getPitch() * -1.0F;
this.rotYCos = Math.cos(Math.toRadians(this.rotY));
this.rotYSin = Math.sin(Math.toRadians(this.rotY));
this.rotXCos = Math.cos(Math.toRadians(this.rotX));

Datei anzeigen

@ -1,8 +1,5 @@
package com.thevoxelbox.voxelsniper;
/**
*
*/
public enum SnipeAction {
ARROW, GUNPOWDER
}

Datei anzeigen

@ -1,4 +1,4 @@
/**
/*
This file is part of VoxelSniper, licensed under the MIT License (MIT).
Copyright (c) The VoxelBox <http://thevoxelbox.com>
@ -33,9 +33,6 @@ import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.entity.Player;
/**
* @author Piotr
*/
public class SnipeData {
public static final int DEFAULT_REPLACE_DATA_VALUE = 0;
@ -87,9 +84,6 @@ public class SnipeData {
private Pattern pattern;
private String patternInfo;
/**
* @param vs
*/
public SnipeData(final Sniper vs) {
this.owner = vs;
}
@ -219,9 +213,6 @@ public class SnipeData {
this.voxelList = new VoxelList();
}
/**
* @param message
*/
public final void sendMessage(final String message) {
this.owner.getPlayer().sendMessage(message);
}

Datei anzeigen

@ -1,4 +1,4 @@
/**
/*
This file is part of VoxelSniper, licensed under the MIT License (MIT).
Copyright (c) The VoxelBox <http://thevoxelbox.com>
@ -71,7 +71,6 @@ import java.util.Map;
import java.util.UUID;
public class Sniper {
private VoxelSniper plugin;
private final UUID player;
private boolean enabled = true;
// private LinkedList<FaweChangeSet> undoList = new LinkedList<>();
@ -80,7 +79,6 @@ public class Sniper {
public Sniper(VoxelSniper plugin, Player player) {
Preconditions.checkNotNull(plugin);
Preconditions.checkNotNull(player);
this.plugin = plugin;
this.player = player.getUniqueId();
SniperTool sniperTool = new SniperTool(this);
sniperTool.assignAction(SnipeAction.ARROW, Material.ARROW);
@ -89,7 +87,7 @@ public class Sniper {
}
public String getCurrentToolId() {
return getToolId((getPlayer().getInventory().getItemInMainHand() != null) ? getPlayer().getInventory().getItemInMainHand().getType() : null);
return getToolId(getPlayer().getInventory().getItemInMainHand().getType());
}
public String getToolId(Material itemInHand) {
@ -130,10 +128,10 @@ public class Sniper {
/**
* Sniper execution call.
*
* @param action Action player performed
* @param itemInHand Item in hand of player
* @param action Action player performed
* @param itemInHand Item in hand of player
* @param clickedBlock Block that the player targeted/interacted with
* @param clickedFace Face of that targeted Block
* @param clickedFace Face of that targeted Block
* @return true if command visibly processed, false otherwise.
*/
public boolean snipe(final Action action, final Material itemInHand, final Block clickedBlock, final BlockFace clickedFace) {
@ -397,14 +395,12 @@ public class Sniper {
} else {
changeQueue.flush();
}
if (changeSet != null) {
if (Settings.IMP.HISTORY.COMBINE_STAGES) {
changeSet.closeAsync();
} else {
changeSet.close();
}
session.remember(changeSet.toEditSession(fp));
if (Settings.IMP.HISTORY.COMBINE_STAGES) {
changeSet.closeAsync();
} else {
changeSet.close();
}
session.remember(changeSet.toEditSession(fp));
return true;
}
return false;
@ -511,7 +507,7 @@ public class Sniper {
count++;
}
if (count > 0) {
BBC.COMMAND_UNDO_SUCCESS.send(fp);
BBC.COMMAND_UNDO_SUCCESS.send(fp, count == 1 ? "" : " x" + count);
} else {
BBC.COMMAND_UNDO_ERROR.send(fp);
}

Datei anzeigen

@ -6,9 +6,6 @@ import org.bukkit.entity.Player;
import java.util.Map;
import java.util.UUID;
/**
*
*/
public class SniperManager {
private Map<UUID, Sniper> sniperInstances = Maps.newHashMap();
private VoxelSniper plugin;

Datei anzeigen

@ -1,4 +1,4 @@
/**
/*
This file is part of VoxelSniper, licensed under the MIT License (MIT).
Copyright (c) The VoxelBox <http://thevoxelbox.com>

Datei anzeigen

@ -1,5 +1,6 @@
package com.thevoxelbox.voxelsniper;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.bukkit.BukkitCommand;
import com.boydti.fawe.object.FaweCommand;
import com.boydti.fawe.object.FawePlayer;
@ -8,7 +9,16 @@ import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Bukkit extension point.
@ -54,16 +64,46 @@ public class VoxelSniper extends JavaPlugin {
return sniperManager;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
private static Map<String, Plugin> lookupNames;
static {
{ // Disable BetterBrushes - FAVS includes the features and BetterBrushes is outdated
PluginManager manager = Bukkit.getPluginManager();
try {
Field pluginsField = manager.getClass().getDeclaredField("plugins");
Field lookupNamesField = manager.getClass().getDeclaredField("lookupNames");
pluginsField.setAccessible(true);
lookupNamesField.setAccessible(true);
List<Plugin> plugins = (List<Plugin>) pluginsField.get(manager);
lookupNames = (Map<String, Plugin>) lookupNamesField.get(manager);
pluginsField.set(manager, new ArrayList<Plugin>(plugins) {
@Override
public boolean add(Plugin plugin) {
if (plugin.getName().startsWith("BetterBrushes")) {
Fawe.debug("Disabling `" + plugin.getName() + "`. FastAsyncVoxelSniper includes all the features.");
} else {
return super.add(plugin);
}
return false;
}
});
lookupNamesField.set(manager, lookupNames = new ConcurrentHashMap<String, Plugin>(lookupNames) {
@Override
public Plugin put(@NotNull String key, @NotNull Plugin plugin) {
if (plugin.getName().startsWith("BetterBrushes")) {
return null;
}
return super.put(key, plugin);
}
});
} catch (Throwable ignore) {}
}
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, String commandLabel, @NotNull String[] args) {
if (sender instanceof Player) {
String[] arguments = args;
if (arguments == null) {
arguments = new String[0];
}
return voxelSniperListener.onCommand((Player) sender, arguments, command.getName());
return voxelSniperListener.onCommand((Player) sender, args, command.getName());
}
getLogger().info("Only players can execute VoxelSniper commands.");
@ -90,7 +130,7 @@ public class VoxelSniper extends JavaPlugin {
Player player = (Player) fp.parent;
return onCommand(player, new Command("p") {
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
public boolean execute(@NotNull CommandSender sender, String commandLabel, @NotNull String[] args) {
return false;
}
}, null, args);
@ -103,7 +143,7 @@ public class VoxelSniper extends JavaPlugin {
Player player = (Player) fp.parent;
return onCommand(player, new Command("d") {
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
public boolean execute(@NotNull CommandSender sender, String commandLabel, @NotNull String[] args) {
return false;
}
}, null, args);

Datei anzeigen

@ -1,20 +1,14 @@
package com.thevoxelbox.voxelsniper;
import com.google.common.base.Preconditions;
import org.bukkit.configuration.file.FileConfiguration;
import java.util.List;
/**
* Configuration storage defining global configurations for VoxelSniper.
*/
public class VoxelSniperConfiguration {
public static final String CONFIG_IDENTIFIER_LITESNIPER_MAX_BRUSH_SIZE = "litesniper-max-brush-size";
public static final String CONFIG_IDENTIFIER_UNDO_CACHE_SIZE = "undo-cache-size";
public static final String CONFIG_IDENTIFIER_LITESNIPER_RESTRICTED_ITEMS = "litesniper-restricted-items";
public static final String CONFIG_IDENTIFIER_MESSAGE_ON_LOGIN_ENABLED = "message-on-login-enabled";
public static final int DEFAULT_LITESNIPER_MAX_BRUSH_SIZE = 5;
public static final int DEFAULT_UNDO_CACHE_SIZE = 20;
public static final int DEFAULT_LITESNIPER_MAX_BRUSH_SIZE = 30;
public static final boolean DEFAULT_MESSAGE_ON_LOGIN_ENABLED = true;
private FileConfiguration configuration;
@ -25,24 +19,6 @@ public class VoxelSniperConfiguration {
this.configuration = configuration;
}
/**
* Returns the maximum amount of snipes stored in the undo cache of snipers.
*
* @return the maximum amount of snipes stored in the undo cache of snipers
*/
public int getUndoCacheSize() {
return configuration.getInt(CONFIG_IDENTIFIER_UNDO_CACHE_SIZE, DEFAULT_UNDO_CACHE_SIZE);
}
/**
* Set the maximum amount of snipes stored in the undo cache of snipers.
*
* @param size size of undo cache
*/
public void setUndoCacheSize(int size) {
configuration.set(CONFIG_IDENTIFIER_UNDO_CACHE_SIZE, size);
}
/**
* Returns maximum size of brushes that LiteSnipers can use.
*
@ -52,34 +28,6 @@ public class VoxelSniperConfiguration {
return configuration.getInt(CONFIG_IDENTIFIER_LITESNIPER_MAX_BRUSH_SIZE, DEFAULT_LITESNIPER_MAX_BRUSH_SIZE);
}
/**
* Set maximum size of brushes that LiteSnipers can use.
*
* @param size maximum size
*/
public void setLiteSniperMaxBrushSize(int size) {
configuration.set(CONFIG_IDENTIFIER_LITESNIPER_MAX_BRUSH_SIZE, size);
}
/**
* Returns List of restricted Litesniper Items.
*
* @return List of restricted Litesniper Items
*/
public List<Integer> getLiteSniperRestrictedItems() {
return configuration.getIntegerList(CONFIG_IDENTIFIER_LITESNIPER_RESTRICTED_ITEMS);
}
/**
* Set new list of restricted Litesniper Items.
*
* @param restrictedItems List of restricted Litesniper Items
*/
public void setLitesniperRestrictedItems(List<Integer> restrictedItems) {
Preconditions.checkNotNull(restrictedItems, "Restricted items must be a list.");
configuration.set(CONFIG_IDENTIFIER_LITESNIPER_RESTRICTED_ITEMS, restrictedItems);
}
/**
* Returns if the login message is enabled.
*
@ -88,13 +36,4 @@ public class VoxelSniperConfiguration {
public boolean isMessageOnLoginEnabled() {
return configuration.getBoolean(CONFIG_IDENTIFIER_MESSAGE_ON_LOGIN_ENABLED, DEFAULT_MESSAGE_ON_LOGIN_ENABLED);
}
/**
* Set the message on login to be enabled or disabled.
*
* @param enabled Message on Login enabled
*/
public void setMessageOnLoginEnabled(boolean enabled) {
configuration.set(CONFIG_IDENTIFIER_MESSAGE_ON_LOGIN_ENABLED, enabled);
}
}

Datei anzeigen

@ -17,9 +17,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
import java.util.HashMap;
import java.util.Map;
/**
* @author Voxel
*/
public class VoxelSniperListener implements Listener {
private static final String SNIPER_PERMISSION = "voxelsniper.sniper";
@ -117,9 +115,6 @@ public class VoxelSniperListener implements Listener {
}
}
/**
* @param event
*/
@EventHandler(ignoreCancelled = false)
public final void onPlayerInteract(final PlayerInteractEvent event) {
Player player = event.getPlayer();
@ -133,14 +128,11 @@ public class VoxelSniperListener implements Listener {
if (sniper.isEnabled() && sniper.snipe(event.getAction(), event.getMaterial(), event.getClickedBlock(), event.getBlockFace())) {
event.setCancelled(true);
}
} catch (final Throwable ignored) {
ignored.printStackTrace();
} catch (final Throwable throwable) {
throwable.printStackTrace();
}
}
/**
* @param event
*/
@EventHandler
public final void onPlayerJoin(final PlayerJoinEvent event) {
Player player = event.getPlayer();

Datei anzeigen

@ -8,7 +8,6 @@ import org.bukkit.ChatColor;
/**
* A brush that creates a solid ball.
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Ball_Brush
*
* @author Piotr
*/
@ -17,10 +16,7 @@ public class BallBrush extends PerformBrush {
public static final int TRUE_CIRCLE_OFF_VALUE = 0;
private double trueCircle = 0;
/**
*
*/
public BallBrush() {
public BallBrush() {
this.setName("Ball");
}
@ -111,7 +107,7 @@ public class BallBrush extends PerformBrush {
this.trueCircle = TRUE_CIRCLE_OFF_VALUE;
v.sendMessage(ChatColor.AQUA + "True circle mode OFF.");
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -6,15 +6,10 @@ import org.bukkit.ChatColor;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
/**
*
*/
public class BiomeBrush extends Brush {
private Biome selectedBiome = Biome.PLAINS;
/**
*
*/
public BiomeBrush() {
this.setName("Biome (/b biome [Biome Name])");
}
@ -78,7 +73,7 @@ public class BiomeBrush extends Brush {
}
availableBiomes.append(ChatColor.RED + ", " + ChatColor.DARK_GREEN)
.append(biome.name());
.append(biome.name());
}
v.sendMessage(ChatColor.DARK_BLUE + "Available biomes: " + availableBiomes);

Datei anzeigen

@ -6,13 +6,8 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
import org.bukkit.ChatColor;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Blend_Brushes
*/
public class BlendBallBrush extends BlendBrushBase {
/**
*
*/
public BlendBallBrush() {
this.setName("Blend Ball");
}
@ -40,7 +35,7 @@ public class BlendBallBrush extends BlendBrushBase {
for (int x = 0; x <= brushSizeDoubled; x++) {
for (int y = 0; y <= brushSizeDoubled; y++) {
System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
brushSizeDoubled + 1);
brushSizeDoubled + 1);
}
}

Datei anzeigen

@ -4,17 +4,10 @@ import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData;
import org.bukkit.ChatColor;
/**
* @author Monofraps
*/
@SuppressWarnings("deprecation")
public abstract class BlendBrushBase extends Brush {
protected boolean excludeAir = true;
protected boolean excludeWater = true;
/**
* @param v
*/
protected abstract void blend(final SnipeData v);
@Override
@ -47,30 +40,18 @@ public abstract class BlendBrushBase extends Brush {
}
}
/**
* @return
*/
protected final boolean isExcludeAir() {
return excludeAir;
}
/**
* @param excludeAir
*/
protected final void setExcludeAir(boolean excludeAir) {
this.excludeAir = excludeAir;
}
/**
* @return
*/
protected final boolean isExcludeWater() {
return excludeWater;
}
/**
* @param excludeWater
*/
protected final void setExcludeWater(boolean excludeWater) {
this.excludeWater = excludeWater;
}

Datei anzeigen

@ -6,13 +6,8 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
import org.bukkit.ChatColor;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Blend_Brushes
*/
public class BlendDiscBrush extends BlendBrushBase {
/**
*
*/
public BlendDiscBrush() {
this.setName("Blend Disc");
}

Datei anzeigen

@ -6,13 +6,8 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
import org.bukkit.ChatColor;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Blend_Brushes
*/
public class BlendVoxelBrush extends BlendBrushBase {
/**
*
*/
public BlendVoxelBrush() {
this.setName("Blend Voxel");
}
@ -40,7 +35,7 @@ public class BlendVoxelBrush extends BlendBrushBase {
for (int x = 0; x <= brushSizeDoubled; x++) {
for (int y = 0; y <= brushSizeDoubled; y++) {
System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
brushSizeDoubled + 1);
brushSizeDoubled + 1);
}
}

Datei anzeigen

@ -6,13 +6,8 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
import org.bukkit.ChatColor;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Blend_Brushes
*/
public class BlendVoxelDiscBrush extends BlendBrushBase {
/**
*
*/
public BlendVoxelDiscBrush() {
this.setName("Blend Voxel Disc");
}

Datei anzeigen

@ -7,11 +7,6 @@ import org.bukkit.ChatColor;
import java.util.Random;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Blob_Brush
*
* @author Giltwist
*/
public class BlobBrush extends PerformBrush {
private static final int GROW_PERCENT_DEFAULT = 1000;
private static final int GROW_PERCENT_MIN = 1;
@ -20,9 +15,6 @@ public class BlobBrush extends PerformBrush {
private Random randomGenerator = new Random();
private int growPercent = GROW_PERCENT_DEFAULT; // chance block on recursion pass is made active
/**
*
*/
public BlobBrush() {
this.setName("Blob");
}
@ -233,7 +225,7 @@ public class BlobBrush extends PerformBrush {
v.sendMessage(ChatColor.RED + "Growth percent must be an integer " + GROW_PERCENT_MIN + "-" + GROW_PERCENT_MAX + "!");
}
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -7,39 +7,36 @@ import org.bukkit.block.Block;
import java.util.ArrayList;
/**
* @author MikeMatrix
*/
public class BlockResetBrush extends Brush {
private static final ArrayList<Material> DENIED_UPDATES = new ArrayList<>();
static {
BlockResetBrush.DENIED_UPDATES.add(Material.SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_SIGN_POST);
BlockResetBrush.DENIED_UPDATES.add(Material.WALL_SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.CHEST);
BlockResetBrush.DENIED_UPDATES.add(Material.FURNACE);
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_BURNING_FURNACE);
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_REDSTONE_TORCH_OFF);
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_REDSTONE_TORCH_ON);
BlockResetBrush.DENIED_UPDATES.add(Material.REDSTONE_TORCH);
BlockResetBrush.DENIED_UPDATES.add(Material.REDSTONE_WALL_TORCH);
BlockResetBrush.DENIED_UPDATES.add(Material.REDSTONE_WIRE);
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_DIODE_BLOCK_OFF);
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_DIODE_BLOCK_ON);
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_WOODEN_DOOR);
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_WOOD_DOOR);
BlockResetBrush.DENIED_UPDATES.add(Material.OAK_DOOR);
BlockResetBrush.DENIED_UPDATES.add(Material.DARK_OAK_DOOR);
BlockResetBrush.DENIED_UPDATES.add(Material.BIRCH_DOOR);
BlockResetBrush.DENIED_UPDATES.add(Material.ACACIA_DOOR);
BlockResetBrush.DENIED_UPDATES.add(Material.SPRUCE_DOOR);
BlockResetBrush.DENIED_UPDATES.add(Material.JUNGLE_DOOR);
BlockResetBrush.DENIED_UPDATES.add(Material.IRON_DOOR);
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_IRON_DOOR_BLOCK);
BlockResetBrush.DENIED_UPDATES.add(Material.LEGACY_FENCE_GATE);
BlockResetBrush.DENIED_UPDATES.add(Material.DARK_OAK_FENCE_GATE);
BlockResetBrush.DENIED_UPDATES.add(Material.ACACIA_FENCE_GATE);
BlockResetBrush.DENIED_UPDATES.add(Material.BIRCH_FENCE_GATE);
BlockResetBrush.DENIED_UPDATES.add(Material.SPRUCE_FENCE_GATE);
BlockResetBrush.DENIED_UPDATES.add(Material.JUNGLE_FENCE_GATE);
BlockResetBrush.DENIED_UPDATES.add(Material.OAK_FENCE_GATE);
}
/**
*
*/
public BlockResetBrush() {
this.setName("Block Reset Brush");
}
@SuppressWarnings("deprecation")
private void applyBrush(final SnipeData v) {
for (int z = -v.getBrushSize(); z <= v.getBrushSize(); z++) {
for (int x = -v.getBrushSize(); x <= v.getBrushSize(); x++) {

Datei anzeigen

@ -24,14 +24,11 @@ import org.bukkit.Material;
* @author GavJenks
*/
public class BlockResetSurfaceBrush extends Brush {
/**
*
*/
public BlockResetSurfaceBrush() {
this.setName("Block Reset Brush Surface Only");
}
@SuppressWarnings("deprecation")
private void applyBrush(final SnipeData v) {
final AsyncWorld world = this.getWorld();

Datei anzeigen

@ -33,9 +33,9 @@ public abstract class Brush implements IBrush {
private String name = "Undefined";
/**
* @param x
* @param y
* @param z
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
* @return {@link Block}
*/
public final AsyncBlock clampY(final int x, final int y, final int z) {
@ -103,9 +103,9 @@ public abstract class Brush implements IBrush {
/**
* Overridable getTarget method.
*
* @param v
* @param clickedBlock
* @param clickedFace
* @param v Sniper caller
* @param clickedBlock Block that the player targeted/interacted with
* @param clickedFace Face of that targeted Block
* @return boolean
*/
protected final boolean getTarget(final SnipeData v, final AsyncBlock clickedBlock, final BlockFace clickedFace) {
@ -123,7 +123,7 @@ public abstract class Brush implements IBrush {
} else {
RangeBlockHelper rangeBlockHelper;
if (v.owner().getSnipeData(v.owner().getCurrentToolId()).isRanged()) {
rangeBlockHelper = new RangeBlockHelper(v.owner().getPlayer(), v.owner().getWorld(), (double) v.owner().getSnipeData(v.owner().getCurrentToolId()).getRange());
rangeBlockHelper = new RangeBlockHelper(v.owner().getPlayer(), v.owner().getWorld(), v.owner().getSnipeData(v.owner().getCurrentToolId()).getRange());
this.setTargetBlock(rangeBlockHelper.getRangeBlock());
} else {
rangeBlockHelper = new RangeBlockHelper(v.owner().getPlayer(), v.owner().getWorld());
@ -190,7 +190,6 @@ public abstract class Brush implements IBrush {
* @param z Z coordinate
* @return Type ID of Block at given coordinates in the world of the targeted Block.
*/
@SuppressWarnings("deprecation")
protected int getBlockIdAt(int x, int y, int z) {
return getWorld().getBlockAt(x, y, z).getTypeId();
}
@ -243,9 +242,9 @@ public abstract class Brush implements IBrush {
/**
* Sets the Id of the block at the passed coordinate.
*
* @param z Z coordinate
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
* @param x X coordinate
* @param y Y coordinate
* @param id The id the block will be set to
*/
@SuppressWarnings("deprecation")
@ -256,10 +255,10 @@ public abstract class Brush implements IBrush {
/**
* Sets the id and data value of the block at the passed coordinate.
*
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
* @param id The id the block will be set to
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
* @param id The id the block will be set to
* @param data The data value the block will be set to
*/
@SuppressWarnings("deprecation")
@ -270,10 +269,10 @@ public abstract class Brush implements IBrush {
/**
* Sets the id and data value of the block at the passed coordinate.
*
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
* @param id The id the block will be set to
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
* @param id The id the block will be set to
* @param data The data value the block will be set to
*/
@SuppressWarnings("deprecation")

Datei anzeigen

@ -11,27 +11,16 @@ import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.block.Block;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_CANYONATOR
*
* @author Voxel
*/
public class CanyonBrush extends Brush {
private static final int SHIFT_LEVEL_MIN = 10;
private static final int SHIFT_LEVEL_MAX = 60;
private int yLevel = 10;
/**
*
*/
public CanyonBrush() {
this.setName("Canyon");
}
/**
* @param chunk
* @param undo
*/
@SuppressWarnings("deprecation")
protected final void canyon(final AsyncChunk chunk, final Undo undo) {
for (int x = 0; x < CHUNK_SIZE; x++) {

Datei anzeigen

@ -6,19 +6,12 @@ import com.thevoxelbox.voxelsniper.Undo;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Canyon_Selection_Brush
*
* @author Voxel
*/
public class CanyonSelectionBrush extends CanyonBrush {
private boolean first = true;
private int fx;
private int fz;
/**
*
*/
public CanyonSelectionBrush() {
this.setName("Canyon Selection");
}

Datei anzeigen

@ -6,9 +6,6 @@ import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
import org.bukkit.ChatColor;
import org.bukkit.block.Block;
/**
* @author MikeMatrix
*/
public class CheckerVoxelDiscBrush extends PerformBrush {
private boolean useWorldCoordinates = true;
@ -19,10 +16,6 @@ public class CheckerVoxelDiscBrush extends PerformBrush {
this.setName("Checker Voxel Disc");
}
/**
* @param v
* @param target
*/
private void applyBrush(final SnipeData v, final Block target) {
for (int x = v.getBrushSize(); x >= -v.getBrushSize(); x--) {
for (int y = v.getBrushSize(); y >= -v.getBrushSize(); y--) {
@ -69,7 +62,7 @@ public class CheckerVoxelDiscBrush extends PerformBrush {
this.useWorldCoordinates = false;
v.sendMessage(ChatColor.AQUA + "Disabled using World Coordinates.");
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
break;
}
}

Datei anzeigen

@ -7,17 +7,9 @@ import com.thevoxelbox.voxelsniper.Undo;
import org.bukkit.ChatColor;
import org.bukkit.Material;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Clean_Snow_Brush
*
* @author psanker
*/
public class CleanSnowBrush extends Brush {
private double trueCircle = 0;
/**
*
*/
public CleanSnowBrush() {
this.setName("Clean Snow");
}
@ -80,7 +72,7 @@ public class CleanSnowBrush extends Brush {
this.trueCircle = 0;
v.sendMessage(ChatColor.AQUA + "True circle mode OFF.");
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -6,15 +6,11 @@ import org.bukkit.ChatColor;
/**
* The CloneStamp class is used to create a collection of blocks in a cylinder shape according to the selection the player has set.
* http://www.voxelwiki.com/minecraft/Voxelsniper#Clone_and_CopyPasta_Brushes
*
* @author Voxel
*/
public class CloneStampBrush extends StampBrush {
/**
*
*/
public CloneStampBrush() {
public CloneStampBrush() {
this.setName("Clone");
}
@ -24,7 +20,7 @@ public class CloneStampBrush extends StampBrush {
* x y z -- initial center of the selection v.brushSize -- the radius of the cylinder v.voxelHeight -- the heigth of the cylinder c.cCen -- the offset on
* the Y axis of the selection ( bottom of the cylinder ) as blockPositionY: Bottom_Y = targetBlock.y + v.cCen;
*
* @param v the caller
* @param v Sniper Caller
*/
private void clone(final SnipeData v) {
final int brushSize = v.getBrushSize();
@ -109,7 +105,7 @@ public class CloneStampBrush extends StampBrush {
}
@Override
public final void parameters(final String[] par, final com.thevoxelbox.voxelsniper.SnipeData v) {
public final void parameters(final String[] par, final SnipeData v) {
final String parameter = par[1];
if (parameter.equalsIgnoreCase("info")) {

Datei anzeigen

@ -8,17 +8,9 @@ import org.bukkit.entity.LargeFireball;
import org.bukkit.entity.SmallFireball;
import org.bukkit.util.Vector;
/**
* @author Gavjenks Heavily revamped from ruler brush blockPositionY
* @author Giltwist
* @author Monofraps (Merged Meteor brush)
*/
public class CometBrush extends Brush {
private boolean useBigBalls = false;
/**
*
*/
public CometBrush() {
this.setName("Comet");
}

Datei anzeigen

@ -7,11 +7,6 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
import org.bukkit.ChatColor;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#CopyPasta_Brush
*
* @author giltwist
*/
public class CopyPastaBrush extends Brush {
private static final int BLOCK_LIMIT = 10000;
@ -27,14 +22,10 @@ public class CopyPastaBrush extends Brush {
private int[] arraySize = new int[3];
private int pivot = 0; // ccw degrees
/**
*
*/
public CopyPastaBrush() {
this.setName("CopyPasta");
}
@SuppressWarnings("deprecation")
private void doCopy(final SnipeData v) {
for (int i = 0; i < 3; i++) {
this.arraySize[i] = Math.abs(this.firstPoint[i] - this.secondPoint[i]) + 1;
@ -103,7 +94,7 @@ public class CopyPastaBrush extends Brush {
}
@Override
protected final void arrow(final com.thevoxelbox.voxelsniper.SnipeData v) {
protected final void arrow(final SnipeData v) {
switch (this.points) {
case 0:
this.firstPoint[0] = this.getTargetBlock().getX();
@ -131,7 +122,7 @@ public class CopyPastaBrush extends Brush {
}
@Override
protected final void powder(final com.thevoxelbox.voxelsniper.SnipeData v) {
protected final void powder(final SnipeData v) {
if (this.points == 2) {
if (this.numBlocks == 0) {
this.doCopy(v);
@ -156,7 +147,7 @@ public class CopyPastaBrush extends Brush {
}
@Override
public final void parameters(final String[] par, final com.thevoxelbox.voxelsniper.SnipeData v) {
public final void parameters(final String[] par, final SnipeData v) {
final String parameter = par[1];
if (parameter.equalsIgnoreCase("info")) {

Datei anzeigen

@ -6,15 +6,9 @@ import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
import org.bukkit.ChatColor;
import org.bukkit.block.Block;
/**
* @author Kavutop
*/
public class CylinderBrush extends PerformBrush {
private double trueCircle = 0;
/**
*
*/
public CylinderBrush() {
this.setName("Cylinder");
}
@ -104,7 +98,7 @@ public class CylinderBrush extends PerformBrush {
v.setcCen((int) Double.parseDouble(parameter.replace("c", "")));
v.sendMessage(ChatColor.AQUA + "Cylinder origin set to: " + v.getcCen());
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -7,11 +7,6 @@ import org.bukkit.ChatColor;
import org.bukkit.block.Block;
import org.bukkit.util.Vector;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Disc_Brush
*
* @author Voxel
*/
public class DiscBrush extends PerformBrush {
private double trueCircle = 0;
@ -25,7 +20,7 @@ public class DiscBrush extends PerformBrush {
/**
* Disc executor.
*
* @param v
* @param v Snipe Data
*/
private void disc(final SnipeData v, final Block targetBlock) {
final double radiusSquared = (v.getBrushSize() + this.trueCircle) * (v.getBrushSize() + this.trueCircle);
@ -76,7 +71,7 @@ public class DiscBrush extends PerformBrush {
this.trueCircle = 0;
v.sendMessage(ChatColor.AQUA + "True circle mode OFF.");
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -7,17 +7,9 @@ import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
import org.bukkit.ChatColor;
import org.bukkit.block.BlockFace;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Disc_Face_Brush
*
* @author Voxel
*/
public class DiscFaceBrush extends PerformBrush {
private double trueCircle = 0;
/**
*
*/
public DiscFaceBrush() {
this.setName("Disc Face");
}
@ -139,7 +131,7 @@ public class DiscFaceBrush extends PerformBrush {
this.trueCircle = 0;
v.sendMessage(ChatColor.AQUA + "True circle mode OFF.");
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -11,16 +11,8 @@ import org.bukkit.util.Vector;
import java.util.HashSet;
import java.util.Set;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Dome_Brush
*
* @author Gavjenks
* @author MikeMatrix
*/
public class DomeBrush extends Brush {
/**
*
*/
public DomeBrush() {
this.setName("Dome");
}
@ -34,8 +26,8 @@ public class DomeBrush extends Brush {
}
/**
* @param v
* @param targetBlock
* @param v Snipe Data
* @param targetBlock the targetBlock to set
*/
@SuppressWarnings("deprecation")
private void generateDome(final SnipeData v, final Block targetBlock) {

Datei anzeigen

@ -6,24 +6,14 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Undo;
import org.bukkit.ChatColor;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Drain_Brush
*
* @author Gavjenks
* @author psanker
*/
public class DrainBrush extends Brush {
private double trueCircle = 0;
private boolean disc = false;
/**
*
*/
public DrainBrush() {
this.setName("Drain");
}
@SuppressWarnings("deprecation")
private void drain(final SnipeData v) {
final int brushSize = v.getBrushSize();
final double brushSizeSquared = Math.pow(brushSize + this.trueCircle, 2);
@ -123,7 +113,7 @@ public class DrainBrush extends Brush {
v.sendMessage(ChatColor.AQUA + "Disc drain mode ON");
}
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -6,11 +6,6 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
import org.bukkit.ChatColor;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Ellipse_Brush
*
* @author psanker
*/
public class EllipseBrush extends PerformBrush {
private static final double TWO_PI = (2 * Math.PI);
private static final int SCL_MIN = 1;
@ -25,9 +20,6 @@ public class EllipseBrush extends PerformBrush {
private double stepSize;
private boolean fill;
/**
*
*/
public EllipseBrush() {
this.setName("Ellipse");
}
@ -182,7 +174,7 @@ public class EllipseBrush extends PerformBrush {
}
@Override
public final void parameters(final String[] par, final com.thevoxelbox.voxelsniper.SnipeData v) {
public final void parameters(final String[] par, final SnipeData v) {
for (int i = 1; i < par.length; i++) {
final String parameter = par[i];

Datei anzeigen

@ -6,18 +6,12 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
import org.bukkit.ChatColor;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Ellipsoid_Brush
*/
public class EllipsoidBrush extends PerformBrush {
private double xRad;
private double yRad;
private double zRad;
private boolean istrue;
/**
*
*/
public EllipsoidBrush() {
this.setName("Ellipsoid");
}
@ -78,7 +72,7 @@ public class EllipsoidBrush extends PerformBrush {
}
@Override
public final void parameters(final String[] par, final com.thevoxelbox.voxelsniper.SnipeData v) {
public final void parameters(final String[] par, final SnipeData v) {
this.istrue = false;
for (int i = 1; i < par.length; i++) {
final String parameter = par[i];

Datei anzeigen

@ -5,17 +5,10 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import org.bukkit.ChatColor;
import org.bukkit.entity.EntityType;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Entity_Brush
*
* @author Piotr
*/
public class EntityBrush extends Brush {
private EntityType entityType = EntityType.ZOMBIE;
/**
*
*/
public EntityBrush() {
this.setName("Entity");
}

Datei anzeigen

@ -11,15 +11,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.regex.PatternSyntaxException;
/**
*
*/
public class EntityRemovalBrush extends Brush {
private final List<String> exemptions = new ArrayList<>(3);
/**
*
*/
public EntityRemovalBrush() {
this.setName("Entity Removal");
@ -129,8 +123,8 @@ public class EntityRemovalBrush extends Brush {
// +#/-# will suppress auto-prefixing
final String exemptionPattern = currentParam.startsWith("+#") || currentParam.startsWith("-#") ?
currentParam.substring(2) :
(currentParam.contains(".") ? currentParam.substring(1) : ".*." + currentParam.substring(1));
currentParam.substring(2) :
(currentParam.contains(".") ? currentParam.substring(1) : ".*." + currentParam.substring(1));
if (isAddOperation) {
exemptions.add(exemptionPattern);

Datei anzeigen

@ -10,11 +10,7 @@ import org.bukkit.block.Block;
import java.util.EnumSet;
import java.util.Set;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Eraser_Brush
*
* @author Voxel
*/
public class EraserBrush extends Brush {
private static final Set<Material> EXCLUSIVE_MATERIALS = EnumSet.of(
@ -22,9 +18,6 @@ public class EraserBrush extends Brush {
private static final Set<Material> EXCLUSIVE_LIQUIDS = EnumSet.of(
Material.WATER, Material.WATER, Material.LAVA, Material.LAVA);
/**
*
*/
public EraserBrush() {
this.setName("Eraser");
}

Datei anzeigen

@ -3,50 +3,50 @@ package com.thevoxelbox.voxelsniper.brush;
import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData;
public class ErodeBlendBrush extends Brush{
public class ErodeBlendBrush extends Brush {
private BlendBallBrush blendBall;
private ErodeBrush erode;
private BlendBallBrush blendBall;
private ErodeBrush erode;
public ErodeBlendBrush() {
this.blendBall = new BlendBallBrush();
this.erode = new ErodeBrush();
this.setName("Erode BlendBall");
}
public ErodeBlendBrush() {
this.blendBall = new BlendBallBrush();
this.erode = new ErodeBrush();
this.setName("Erode BlendBall");
}
@Override
protected final void arrow(final SnipeData v) {
this.blendBall.excludeAir = false;
this.blendBall.setTargetBlock(this.getTargetBlock());
this.blendBall.arrow(v);
this.erode.setTargetBlock(this.getTargetBlock());
this.erode.arrow(v);
}
@Override
protected final void arrow(final SnipeData v) {
this.blendBall.excludeAir = false;
this.blendBall.setTargetBlock(this.getTargetBlock());
this.blendBall.arrow(v);
this.erode.setTargetBlock(this.getTargetBlock());
this.erode.arrow(v);
}
@Override
protected final void powder(final SnipeData v) {
this.blendBall.excludeAir = false;
this.blendBall.setTargetBlock(this.getTargetBlock());
this.blendBall.arrow(v);
this.erode.setTargetBlock(this.getTargetBlock());
this.erode.powder(v);
}
@Override
protected final void powder(final SnipeData v) {
this.blendBall.excludeAir = false;
this.blendBall.setTargetBlock(this.getTargetBlock());
this.blendBall.arrow(v);
this.erode.setTargetBlock(this.getTargetBlock());
this.erode.powder(v);
}
@Override
public final void parameters(final String[] par, final SnipeData v) {
this.blendBall.parameters(par, v);
this.erode.parameters(par, v);
}
@Override
public final void parameters(final String[] par, final SnipeData v) {
this.blendBall.parameters(par, v);
this.erode.parameters(par, v);
}
@Override
public String getPermissionNode() {
return "voxelsniper.brush.erodeblend";
}
@Override
public String getPermissionNode() {
return "voxelsniper.brush.erodeblend";
}
@Override
public void info(Message vm) {
this.erode.info(vm);
this.blendBall.info(vm);
}
@Override
public void info(Message vm) {
this.erode.info(vm);
this.blendBall.info(vm);
}
}

Datei anzeigen

@ -22,20 +22,11 @@ import org.bukkit.util.Vector;
import java.util.*;
/**
* http://www.voxelwiki.com/minecraft/VoxelSniper#The_Erosion_Brush
*
* @author Piotr
* @author MikeMatrix
*/
public class ErodeBrush extends Brush {
private static final Vector[] FACES_TO_CHECK = {new Vector(0, 0, 1), new Vector(0, 0, -1), new Vector(0, 1, 0), new Vector(0, -1, 0), new Vector(1, 0, 0), new Vector(-1, 0, 0)};
private final HelpJSAP parser = new HelpJSAP("/b e", "Brush for eroding landscape.", ChatPaginator.GUARANTEED_NO_WRAP_CHAT_PAGE_WIDTH);
private ErosionPreset currentPreset = new ErosionPreset(0, 1, 0, 1);
/**
*
*/
public ErodeBrush() {
this.setName("Erode");
@ -49,12 +40,6 @@ public class ErodeBrush extends Brush {
}
}
/**
* @param result
* @param player
* @param helpJSAP
* @return if a message was sent.
*/
public static boolean sendHelpOrErrorMessageToPlayer(final JSAPResult result, final Player player, final HelpJSAP helpJSAP) {
final List<String> output = helpJSAP.writeHelpOrErrorMessageIfRequired(result);
if (!output.isEmpty()) {
@ -252,11 +237,12 @@ public class ErodeBrush extends Brush {
return "voxelsniper.brush.erode";
}
/**
* @author MikeMatrix
*/
private enum Preset {
MELT(new ErosionPreset(2, 1, 5, 1)), FILL(new ErosionPreset(5, 1, 2, 1)), SMOOTH(new ErosionPreset(3, 1, 3, 1)), LIFT(new ErosionPreset(6, 0, 1, 1)), FLOATCLEAN(new ErosionPreset(6, 1, 6, 1));
MELT(new ErosionPreset(2, 1, 5, 1)),
FILL(new ErosionPreset(5, 1, 2, 1)),
SMOOTH(new ErosionPreset(3, 1, 3, 1)),
LIFT(new ErosionPreset(6, 0, 1, 1)),
FLOATCLEAN(new ErosionPreset(6, 1, 6, 1));
private ErosionPreset preset;
Preset(final ErosionPreset preset) {
@ -267,21 +253,20 @@ public class ErodeBrush extends Brush {
* Generates a concat string of all options.
*
* @param seperator Seperator for delimiting entries.
* @return
*/
public static String getValuesString(String seperator) {
String valuesString = "";
StringBuilder valuesString = new StringBuilder();
boolean delimiterHelper = true;
for (final Preset preset : Preset.values()) {
if (delimiterHelper) {
delimiterHelper = false;
} else {
valuesString += seperator;
valuesString.append(seperator);
}
valuesString += preset.name();
valuesString.append(preset.name());
}
return valuesString;
return valuesString.toString();
}
public ErosionPreset getPreset() {
@ -291,9 +276,6 @@ public class ErodeBrush extends Brush {
}
/**
* @author MikeMatrix
*/
private static final class BlockChangeTracker {
private final Map<Integer, Map<Vector, BlockWrapper>> blockChanges;
private final Map<Vector, BlockWrapper> flatChanges;
@ -307,7 +289,7 @@ public class ErodeBrush extends Brush {
}
public BlockWrapper get(final Vector position, final int iteration) {
BlockWrapper changedBlock = null;
BlockWrapper changedBlock;
for (int i = iteration - 1; i >= 0; --i) {
if (this.blockChanges.containsKey(i) && this.blockChanges.get(i).containsKey(position)) {
@ -339,16 +321,12 @@ public class ErodeBrush extends Brush {
}
}
/**
* @author MikeMatrix
*/
private static final class BlockWrapper {
private final AsyncBlock block;
private final Material material;
private final int data;
@SuppressWarnings("deprecation")
public BlockWrapper(final AsyncBlock block) {
this.block = block;
this.data = block.getPropertyId();
@ -411,9 +389,6 @@ public class ErodeBrush extends Brush {
}
/**
* @author MikeMatrix
*/
private static final class ErosionPreset {
private final int erosionFaces;
private final int erosionRecursion;

Datei anzeigen

@ -7,17 +7,9 @@ import org.bukkit.ChatColor;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Extrude_Brush
*
* @author psanker
*/
public class ExtrudeBrush extends Brush {
private double trueCircle;
/**
*
*/
public ExtrudeBrush() {
this.setName("Extrude");
}
@ -153,7 +145,7 @@ public class ExtrudeBrush extends Brush {
}
@Override
public final void parameters(final String[] par, final com.thevoxelbox.voxelsniper.SnipeData v) {
public final void parameters(final String[] par, final SnipeData v) {
for (int i = 1; i < par.length; i++) {
final String parameter = par[i];

Datei anzeigen

@ -8,17 +8,12 @@ import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
import org.bukkit.ChatColor;
import org.bukkit.block.Block;
/**
* @author Voxel
*/
public class FillDownBrush extends PerformBrush {
private double trueCircle = 0;
private boolean fillLiquid = true;
private boolean fromExisting = false;
/**
*
*/
public FillDownBrush() {
this.setName("Fill Down");
}
@ -45,7 +40,9 @@ public class FillDownBrush extends PerformBrush {
break;
}
}
if (!found) continue;
if (!found) {
continue;
}
y--;
}
for (; y >= -targetBlock.getY(); --y) {
@ -110,7 +107,7 @@ public class FillDownBrush extends PerformBrush {
this.fromExisting = !this.fromExisting;
v.sendMessage(ChatColor.AQUA + "Now filling down from " + ((this.fromExisting) ? "existing" : "all") + " blocks.");
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -6,23 +6,16 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import org.bukkit.ChatColor;
import org.bukkit.Material;
/**
* @author GavJenks
*/
public class FlatOceanBrush extends Brush {
private static final int DEFAULT_WATER_LEVEL = 29;
private static final int DEFAULT_FLOOR_LEVEL = 8;
private int waterLevel = DEFAULT_WATER_LEVEL;
private int floorLevel = DEFAULT_FLOOR_LEVEL;
/**
*
*/
public FlatOceanBrush() {
this.setName("FlatOcean");
}
@SuppressWarnings("deprecation")
private void flatOcean(final AsyncChunk chunk) {
for (int x = 0; x < CHUNK_SIZE; x++) {
for (int z = 0; z < CHUNK_SIZE; z++) {

Datei anzeigen

@ -14,11 +14,6 @@ import java.util.Random;
// Proposal: Use /v and /vr for leave and wood material // or two more parameters -- Monofraps
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#VoxelTrees_Brush
*
* @author Ghost8700 @ Voxel
*/
public class GenerateTreeBrush extends Brush {
// Tree Variables.
private Random randGenerator = new Random();
@ -35,7 +30,7 @@ public class GenerateTreeBrush extends Brush {
private int thickness = 1;
private int slopeChance = 40;
private int twistChance = 5; // This is a hidden value not available through Parameters. Otherwise messy.
private int heightMininmum = 14;
private int heightMinimum = 14;
private int heightMaximum = 18;
private int branchLength = 8;
private int nodeMax = 4;
@ -45,10 +40,7 @@ public class GenerateTreeBrush extends Brush {
private int blockPositionY;
private int blockPositionZ;
/**
*
*/
public GenerateTreeBrush() {
public GenerateTreeBrush() {
this.setName("Generate Tree");
}
@ -81,7 +73,6 @@ public class GenerateTreeBrush extends Brush {
}
// Branch Creation based on direction chosen from the parameters passed.
@SuppressWarnings("deprecation")
private void branchCreate(final int xDirection, final int zDirection) {
// Sets branch origin.
@ -125,7 +116,6 @@ public class GenerateTreeBrush extends Brush {
blockPositionZ = originZ;
}
@SuppressWarnings("deprecation")
private void leafNodeCreate() {
// Generates the node size.
final int nodeRadius = this.randGenerator.nextInt(this.nodeMax - this.nodeMin + 1) + this.nodeMin;
@ -223,7 +213,6 @@ public class GenerateTreeBrush extends Brush {
* @param xDirection
* @param zDirection
*/
@SuppressWarnings("deprecation")
private void rootCreate(final int xDirection, final int zDirection) {
// Sets Origin.
final int originX = blockPositionX;
@ -313,7 +302,6 @@ public class GenerateTreeBrush extends Brush {
this.rootCreate(-1, -1);
}
@SuppressWarnings("deprecation")
private void trunkCreate() {
// Creates true circle discs of the set size using the wood type selected.
final double bSquared = Math.pow(this.thickness + 0.5, 2);
@ -368,7 +356,7 @@ public class GenerateTreeBrush extends Brush {
// ----------
// Main Trunk
// ----------
// Sets diretional preferences.
// Sets directional preferences.
int xPreference = this.randGenerator.nextInt(this.slopeChance);
int zPreference = this.randGenerator.nextInt(this.slopeChance);
@ -384,7 +372,7 @@ public class GenerateTreeBrush extends Brush {
}
// Generates a height for trunk.
int height = this.randGenerator.nextInt(this.heightMaximum - this.heightMininmum + 1) + this.heightMininmum;
int height = this.randGenerator.nextInt(this.heightMaximum - this.heightMinimum + 1) + this.heightMinimum;
for (int p = 0; p < height; p++) {
if (p > 3) {
@ -409,7 +397,7 @@ public class GenerateTreeBrush extends Brush {
blockPositionY = blockPositionY + 1;
}
// Generates branchs at top of trunk for each quadrant.
// Generates branches at top of trunk for each quadrant.
this.branchCreate(1, 1);
this.branchCreate(-1, 1);
this.branchCreate(1, -1);
@ -423,7 +411,7 @@ public class GenerateTreeBrush extends Brush {
// ---------------
// Secondary Trunk
// ---------------
// Sets diretional preferences.
// Sets directional preferences.
xPreference = this.randGenerator.nextInt(this.slopeChance);
zPreference = this.randGenerator.nextInt(this.slopeChance);
@ -439,7 +427,7 @@ public class GenerateTreeBrush extends Brush {
}
// Generates a height for trunk.
height = this.randGenerator.nextInt(this.heightMaximum - this.heightMininmum + 1) + this.heightMininmum;
height = this.randGenerator.nextInt(this.heightMaximum - this.heightMinimum + 1) + this.heightMinimum;
if (height > 4) {
for (int p = 0; p < height; p++) {
@ -463,7 +451,7 @@ public class GenerateTreeBrush extends Brush {
blockPositionY = blockPositionY + 1;
}
// Generates branchs at top of trunk for each quadrant.
// Generates branches at top of trunk for each quadrant.
this.branchCreate(1, 1);
this.branchCreate(-1, 1);
this.branchCreate(1, -1);
@ -581,17 +569,17 @@ public class GenerateTreeBrush extends Brush {
this.slopeChance = Integer.parseInt(parameter.replace("ts", ""));
v.sendMessage(ChatColor.BLUE + "Trunk Slope set to " + this.slopeChance);
} else if (parameter.startsWith("minh")) { // Height Minimum
this.heightMininmum = Integer.parseInt(parameter.replace("minh", ""));
if (this.heightMininmum > this.heightMaximum) {
this.heightMininmum = this.heightMaximum;
v.sendMessage(ChatColor.RED + "Minimum Height exceed than Maximum Height, has been set to " + this.heightMininmum + " Instead!");
this.heightMinimum = Integer.parseInt(parameter.replace("minh", ""));
if (this.heightMinimum > this.heightMaximum) {
this.heightMinimum = this.heightMaximum;
v.sendMessage(ChatColor.RED + "Minimum Height exceed than Maximum Height, has been set to " + this.heightMinimum + " Instead!");
} else {
v.sendMessage(ChatColor.BLUE + "Minimum Height set to " + this.heightMininmum);
v.sendMessage(ChatColor.BLUE + "Minimum Height set to " + this.heightMinimum);
}
} else if (parameter.startsWith("maxh")) { // Height Maximum
this.heightMaximum = Integer.parseInt(parameter.replace("maxh", ""));
if (this.heightMininmum > this.heightMaximum) {
this.heightMaximum = this.heightMininmum;
if (this.heightMinimum > this.heightMaximum) {
this.heightMaximum = this.heightMinimum;
v.sendMessage(ChatColor.RED + "Maximum Height can't be lower than Minimum Height, has been set to " + this.heightMaximum + " Instead!");
} else {
v.sendMessage(ChatColor.BLUE + "Maximum Roots set to " + this.heightMaximum);
@ -619,14 +607,14 @@ public class GenerateTreeBrush extends Brush {
this.minRoots = 1;
this.thickness = 1;
this.slopeChance = 40;
this.heightMininmum = 14;
this.heightMinimum = 14;
this.heightMaximum = 18;
this.branchLength = 8;
this.nodeMax = 4;
this.nodeMin = 3;
v.sendMessage(ChatColor.GOLD + "Brush reset to default parameters.");
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
} catch (final Exception exception) {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! \"" + par[i] + "\" is not a valid statement. Please use the 'info' parameter to display parameter info.");

Datei anzeigen

@ -13,27 +13,19 @@ import org.bukkit.util.noise.PerlinNoiseGenerator;
import java.util.ArrayList;
import java.util.Random;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Heat_Ray
*
* @author Gavjenks
*/
public class HeatRayBrush extends Brush {
/**
* @author MikeMatrix
*/
// private enum FlameableBlock
// {
// WOOD(Material.WOOD), SAPLING(Material.SAPLING), LOG(Material.LOG), LEAVES(Material.LEAVES), SPONGE(Material.SPONGE), WEB(Material.WEB), LONG_GRASS(Material.LONG_GRASS), DEAD_BUSH(Material.DEAD_BUSH), WOOL(Material.WOOL), YELLOW_FLOWER(Material.YELLOW_FLOWER), RED_ROSE(Material.RED_ROSE), TORCH(Material.TORCH), FIRE(Material.FIRE), WOOD_STAIRS(Material.WOOD_STAIRS), CROPS(Material.CROPS), SIGN_POST(Material.SIGN_POST), WOODEN_DOOR(Material.WOODEN_DOOR), LADDER(Material.LADDER), WALL_SIGN(Material.WALL_SIGN), WOOD_PLATE(Material.WOOD_PLATE), SNOW(Material.SNOW), ICE(Material.ICE), SUGAR_CANE_BLOCK(Material.SUGAR_CANE_BLOCK), FENCE(Material.FENCE), TRAP_DOOR(Material.TRAP_DOOR), VINE(Material.VINE), FENCE_GATE(Material.FENCE_GATE), WATER_LILLY(Material.WATER_LILY);
//
// private Material material;
//
// FlameableBlock(final Material material)
// {
// this.material = material;
// }
// }
/* private enum FlameableBlock
{
WOOD(Material.WOOD), SAPLING(Material.SAPLING), LOG(Material.LOG), LEAVES(Material.LEAVES), SPONGE(Material.SPONGE), WEB(Material.WEB), LONG_GRASS(Material.LONG_GRASS), DEAD_BUSH(Material.DEAD_BUSH), WOOL(Material.WOOL), YELLOW_FLOWER(Material.YELLOW_FLOWER), RED_ROSE(Material.RED_ROSE), TORCH(Material.TORCH), FIRE(Material.FIRE), WOOD_STAIRS(Material.WOOD_STAIRS), CROPS(Material.CROPS), SIGN_POST(Material.SIGN_POST), WOODEN_DOOR(Material.WOODEN_DOOR), LADDER(Material.LADDER), WALL_SIGN(Material.WALL_SIGN), WOOD_PLATE(Material.WOOD_PLATE), SNOW(Material.SNOW), ICE(Material.ICE), SUGAR_CANE_BLOCK(Material.SUGAR_CANE_BLOCK), FENCE(Material.FENCE), TRAP_DOOR(Material.TRAP_DOOR), VINE(Material.VINE), FENCE_GATE(Material.FENCE_GATE), WATER_LILLY(Material.WATER_LILY);
private Material material;
FlameableBlock(final Material material)
{
this.material = material;
}
}*/
private static final double REQUIRED_OBSIDIAN_DENSITY = 0.6;
private static final double REQUIRED_COBBLE_DENSITY = 0.5;
@ -84,7 +76,7 @@ public class HeatRayBrush extends Brush {
if (currentLocation.toVector().isInSphere(targetLocation, v.getBrushSize())) {
currentBlock = currentLocation.getBlock();
if (currentBlock == null || currentBlock.getType() == Material.CHEST) {
if (currentBlock.getType() == Material.CHEST) {
continue;
}
@ -168,13 +160,13 @@ public class HeatRayBrush extends Brush {
v.sendMessage(ChatColor.AQUA + "/b hr freq[float] -- Frequency parameter for the noise generator.");
}
if (parameter.startsWith("oct")) {
this.octaves = Integer.valueOf(parameter.replace("oct", ""));
this.octaves = Integer.parseInt(parameter.replace("oct", ""));
v.getVoxelMessage().custom(ChatColor.GREEN + "Octaves: " + this.octaves);
} else if (parameter.startsWith("amp")) {
this.amplitude = Double.valueOf(parameter.replace("amp", ""));
this.amplitude = Double.parseDouble(parameter.replace("amp", ""));
v.getVoxelMessage().custom(ChatColor.GREEN + "Amplitude: " + this.amplitude);
} else if (parameter.startsWith("freq")) {
this.frequency = Double.valueOf(parameter.replace("freq", ""));
this.frequency = Double.parseDouble(parameter.replace("freq", ""));
v.getVoxelMessage().custom(ChatColor.GREEN + "Frequency: " + this.frequency);
}
}

Datei anzeigen

@ -19,7 +19,7 @@ public interface IBrush {
* Handles parameters passed to brushes.
*
* @param par Array of string containing parameters
* @param v Snipe Data
* @param v Snipe Data
*/
void parameters(String[] par, SnipeData v);

Datei anzeigen

@ -12,12 +12,6 @@ import org.bukkit.util.Vector;
import java.util.Random;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Jagged_Line_Brush
*
* @author Giltwist
* @author Monofraps
*/
public class JaggedLineBrush extends PerformBrush {
private static final Vector HALF_BLOCK_OFFSET = new Vector(0.5, 0.5, 0.5);
private static final int RECURSION_MIN = 1;
@ -31,9 +25,6 @@ public class JaggedLineBrush extends PerformBrush {
private int recursion = RECURSION_DEFAULT;
private int spread = SPREAD_DEFAULT;
/**
*
*/
public JaggedLineBrush() {
this.setName("Jagged Line");
}

Datei anzeigen

@ -12,20 +12,11 @@ import org.bukkit.event.player.PlayerTeleportEvent;
import java.util.List;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Jockey_Brush
*
* @author Voxel
* @author Monofraps
*/
public class JockeyBrush extends Brush {
private static final int ENTITY_STACK_LIMIT = 50;
private JockeyType jockeyType = JockeyType.NORMAL_ALL_ENTITIES;
private Entity jockeyedEntity = null;
/**
*
*/
public JockeyBrush() {
this.setName("Jockey");
}
@ -139,16 +130,15 @@ public class JockeyBrush extends Brush {
public final void info(final Message vm) {
vm.brushName(this.getName());
vm.custom("Current jockey mode: " + ChatColor.GREEN + jockeyType.toString());
vm.custom(ChatColor.GREEN + "Help: " + ChatColor.AQUA + "http://www.voxelwiki.com/minecraft/Voxelsniper#The_Jockey_Brush");
}
@Override
public final void parameters(final String[] par, final SnipeData v) {
boolean inverse = false;
boolean playerOnly = false;
boolean stack = false;
try {
boolean inverse = false;
boolean playerOnly = false;
boolean stack = false;
for (String parameter : par) {
if (parameter.startsWith("-i:")) {
inverse = parameter.endsWith("y");

Datei anzeigen

@ -3,13 +3,8 @@ package com.thevoxelbox.voxelsniper.brush;
import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData;
/**
* @author Gavjenks
*/
public class LightningBrush extends Brush {
/**
*
*/
public LightningBrush() {
this.setName("Lightning");
}

Datei anzeigen

@ -10,22 +10,12 @@ import org.bukkit.util.BlockIterator;
import org.bukkit.util.NumberConversions;
import org.bukkit.util.Vector;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Line_Brush
*
* @author Gavjenks
* @author giltwist
* @author MikeMatrix
*/
public class LineBrush extends PerformBrush {
private static final Vector HALF_BLOCK_OFFSET = new Vector(0.5, 0.5, 0.5);
private Vector originCoords = null;
private Vector targetCoords = new Vector();
private AsyncWorld targetWorld;
/**
*
*/
public LineBrush() {
this.setName("Line");
}

Datei anzeigen

@ -17,7 +17,6 @@ import java.util.HashSet;
/**
* Moves a selection blockPositionY a certain amount.
* http://www.voxelwiki.com/minecraft/Voxelsniper#Move_Brush
*
* @author MikeMatrix
*/
@ -31,9 +30,6 @@ public class MoveBrush extends Brush {
*/
private Selection selection = null;
/**
*
*/
public MoveBrush() {
this.setName("Move");
}
@ -151,13 +147,13 @@ public class MoveBrush extends Brush {
v.getVoxelMessage().custom(ChatColor.AQUA + "Z direction set to: " + this.moveDirections[2]);
}
if (par[i].toLowerCase().startsWith("x")) {
this.moveDirections[0] = Integer.valueOf(par[i].substring(1));
this.moveDirections[0] = Integer.parseInt(par[i].substring(1));
v.getVoxelMessage().custom(ChatColor.AQUA + "X direction set to: " + this.moveDirections[0]);
} else if (par[i].toLowerCase().startsWith("y")) {
this.moveDirections[1] = Integer.valueOf(par[i].substring(1));
this.moveDirections[1] = Integer.parseInt(par[i].substring(1));
v.getVoxelMessage().custom(ChatColor.AQUA + "Y direction set to: " + this.moveDirections[1]);
} else if (par[i].toLowerCase().startsWith("z")) {
this.moveDirections[2] = Integer.valueOf(par[i].substring(1));
this.moveDirections[2] = Integer.parseInt(par[i].substring(1));
v.getVoxelMessage().custom(ChatColor.AQUA + "Z direction set to: " + this.moveDirections[2]);
}
}
@ -182,13 +178,7 @@ public class MoveBrush extends Brush {
* Calculated BlockStates of the selection.
*/
private final ArrayList<AsyncBlockState> blockStates = new ArrayList<>();
/**
*
*/
private Location location1 = null;
/**
*
*/
private Location location2 = null;
/**
@ -200,14 +190,14 @@ public class MoveBrush extends Brush {
public boolean calculateRegion() throws Exception {
if (this.location1 != null && this.location2 != null) {
if (this.location1.getWorld().equals(this.location2.getWorld())) {
final int lowX = ((this.location1.getBlockX() <= this.location2.getBlockX()) ? this.location1.getBlockX() : this.location2.getBlockX());
final int lowY = (this.location1.getBlockY() <= this.location2.getBlockY()) ? this.location1.getBlockY() : this.location2.getBlockY();
final int lowZ = (this.location1.getBlockZ() <= this.location2.getBlockZ()) ? this.location1.getBlockZ() : this.location2.getBlockZ();
final int highX = (this.location1.getBlockX() >= this.location2.getBlockX()) ? this.location1.getBlockX() : this.location2.getBlockX();
final int highY = (this.location1.getBlockY() >= this.location2.getBlockY()) ? this.location1.getBlockY() : this.location2.getBlockY();
final int highZ = (this.location1.getBlockZ() >= this.location2.getBlockZ()) ? this.location1.getBlockZ() : this.location2.getBlockZ();
final int lowX = Math.min(this.location1.getBlockX(), this.location2.getBlockX());
final int lowY = Math.min(this.location1.getBlockY(), this.location2.getBlockY());
final int lowZ = Math.min(this.location1.getBlockZ(), this.location2.getBlockZ());
final int highX = Math.max(this.location1.getBlockX(), this.location2.getBlockX());
final int highY = Math.max(this.location1.getBlockY(), this.location2.getBlockY());
final int highZ = Math.max(this.location1.getBlockZ(), this.location2.getBlockZ());
if (Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY) > Selection.MAX_BLOCK_COUNT) {
throw new Exception(ChatColor.RED + "Selection size above hardcoded limit, please use a smaller selection.");
throw new Exception(ChatColor.RED + "Selection size above hardcoded limit of 5000000, please use a smaller selection.");
}
final AsyncWorld world = (AsyncWorld) this.location1.getWorld();
for (int y = lowY; y <= highY; y++) {

Datei anzeigen

@ -9,11 +9,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_OCEANATOR_5000
*
* @author Voxel
*/
public class OceanBrush extends Brush {
private static final int WATER_LEVEL_DEFAULT = 62; // y=63 -- we are using array indices here
private static final int WATER_LEVEL_MIN = 12;
@ -22,9 +18,6 @@ public class OceanBrush extends Brush {
private int waterLevel = WATER_LEVEL_DEFAULT;
private boolean coverFloor = false;
/**
*
*/
public OceanBrush() {
this.setName("OCEANATOR 5000(tm)");
}
@ -39,10 +32,6 @@ public class OceanBrush extends Brush {
return 0;
}
/**
* @param v
* @param undo
*/
protected final void oceanator(final SnipeData v, final Undo undo) {
final AsyncWorld world = this.getWorld();
@ -55,7 +44,7 @@ public class OceanBrush extends Brush {
for (int z = minZ; z <= maxZ; z++) {
final int currentHeight = getHeight(x, z);
final int wLevelDiff = currentHeight - (this.waterLevel - 1);
final int newSeaFloorLevel = ((this.waterLevel - wLevelDiff) >= LOW_CUT_LEVEL) ? this.waterLevel - wLevelDiff : LOW_CUT_LEVEL;
final int newSeaFloorLevel = Math.max((this.waterLevel - wLevelDiff), LOW_CUT_LEVEL);
final int highestY = this.getWorld().getHighestBlockYAt(x, z);

Datei anzeigen

@ -10,19 +10,11 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
import org.bukkit.ChatColor;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Overlay_.2F_Topsoil_Brush
*
* @author Gavjenks
*/
public class OverlayBrush extends PerformBrush {
private static final int DEFAULT_DEPTH = 3;
private int depth = DEFAULT_DEPTH;
private boolean allBlocks = false;
/**
*
*/
public OverlayBrush() {
this.setName("Overlay (Topsoil Filling)");
}
@ -37,24 +29,24 @@ public class OverlayBrush extends PerformBrush {
// check if column is valid
// column is valid if it has no solid block right above the clicked layer
final int materialId = this.getBlockIdAt(this.getTargetBlock().getX() + x,
this.getTargetBlock().getY() + 1, this.getTargetBlock().getZ() + z);
this.getTargetBlock().getY() + 1, this.getTargetBlock().getZ() + z);
if (isIgnoredBlock(materialId)) {
if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared) {
for (int y = this.getTargetBlock().getY(); y > 0; y--) {
// check for surface
final int layerBlockId =
this.getBlockIdAt(this.getTargetBlock().getX() + x, y,
this.getTargetBlock().getZ() + z);
this.getTargetBlock().getZ() + z);
if (!isIgnoredBlock(layerBlockId)) {
for (int currentDepth = y;
y - currentDepth < depth; currentDepth--) {
final int currentBlockId =
this.getBlockIdAt(this.getTargetBlock().getX() + x,
currentDepth, this.getTargetBlock().getZ() + z);
currentDepth, this.getTargetBlock().getZ() + z);
if (isOverrideableMaterial(currentBlockId)) {
this.current.perform(
this.clampY(this.getTargetBlock().getX() + x,
currentDepth, this.getTargetBlock().getZ() + z));
currentDepth, this.getTargetBlock().getZ() + z));
}
}
break;
@ -107,25 +99,25 @@ public class OverlayBrush extends PerformBrush {
if ((Math.pow(x, 2) + Math.pow(z, 2))
<= brushSizeSquared) { // if inside of the column...
if (!this.getBlockAt(this.getTargetBlock().getX() + x, y - 1,
this.getTargetBlock().getZ() + z)
.isEmpty()) { // if not a floating block (like one of Notch'world pools)
this.getTargetBlock().getZ() + z)
.isEmpty()) { // if not a floating block (like one of Notch'world pools)
if (this.getBlockAt(this.getTargetBlock().getX() + x, y + 1,
this.getTargetBlock().getZ() + z)
this.getTargetBlock().getZ() + z)
.isEmpty()) { // must start at surface... this prevents it filling stuff in if
// you click in a wall and it starts out below surface.
if (!this.allBlocks) { // if the override parameter has not been activated, go to the switch that filters out manmade stuff.
BlockType type = BukkitAdapter.asBlockType((this
.getBlockType(this.getTargetBlock().getX() + x, y,
this.getTargetBlock().getZ() + z)));
this.getTargetBlock().getZ() + z)));
BlockMaterial mat = type.getMaterial();
if (mat.isSolid() && mat.isFullCube() && !mat
.hasContainer()) {
for (int d = 1; (d < this.depth + 1); d++) {
this.current.perform(
this.clampY(this.getTargetBlock().getX() + x,
y + d, this.getTargetBlock().getZ()
+ z)); // fills down as many layers as you specify
y + d, this.getTargetBlock().getZ()
+ z)); // fills down as many layers as you specify
// in parameters
memory[x + brushSize][z + brushSize] =
1; // stop it from checking any other blocks in this vertical 1x1 column.
@ -137,8 +129,8 @@ public class OverlayBrush extends PerformBrush {
for (int d = 1; (d < this.depth + 1); d++) {
this.current.perform(
this.clampY(this.getTargetBlock().getX() + x, y + d,
this.getTargetBlock().getZ()
+ z)); // fills down as many layers as you specify in
this.getTargetBlock().getZ()
+ z)); // fills down as many layers as you specify in
// parameters
memory[x + brushSize][z + brushSize] =
1; // stop it from checking any other blocks in this vertical 1x1 column.
@ -181,9 +173,9 @@ public class OverlayBrush extends PerformBrush {
if (parameter.equalsIgnoreCase("info")) {
v.sendMessage(ChatColor.GOLD + "Overlay brush parameters:");
v.sendMessage(ChatColor.AQUA
+ "d[number] (ex: d3) How many blocks deep you want to replace from the surface.");
+ "d[number] (ex: d3) How many blocks deep you want to replace from the surface.");
v.sendMessage(ChatColor.BLUE
+ "all (ex: /b over all) Sets the brush to overlay over ALL materials, not just natural surface ones (will no longer ignore trees and buildings). The parameter /some will set it back to default.");
+ "all (ex: /b over all) Sets the brush to overlay over ALL materials, not just natural surface ones (will no longer ignore trees and buildings). The parameter /some will set it back to default.");
return;
}
if (parameter.startsWith("d")) {
@ -207,7 +199,7 @@ public class OverlayBrush extends PerformBrush {
ChatColor.BLUE + "Will overlay only natural block types." + this.depth);
} else {
v.sendMessage(ChatColor.RED
+ "Invalid brush parameters! use the info parameter to display parameter info.");
+ "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -6,14 +6,11 @@ import com.thevoxelbox.voxelsniper.SnipeData;
/**
* Painting scrolling Brush.
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Painting_Picker_Brush
*
* @author Voxel
*/
public class PaintingBrush extends Brush {
/**
*
*/
public PaintingBrush() {
this.setName("Painting");
}

Datei anzeigen

@ -8,9 +8,7 @@ import org.bukkit.ChatColor;
import java.util.HashSet;
/**
* @author Piotr
*/
public class PullBrush extends Brush {
private final HashSet<BlockWrapper> surface = new HashSet<>();
private int vh;
@ -244,9 +242,7 @@ public class PullBrush extends Brush {
return "voxelsniper.brush.pull";
}
/**
* @author Piotr
*/
private final class BlockWrapper {
private final int id;

Datei anzeigen

@ -19,13 +19,6 @@ import org.bukkit.util.Vector;
import java.util.List;
import java.util.Random;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Punish_Brush
*
* @author Monofraps
* @author Deamon
* @author MikeMatrix
*/
public class PunishBrush extends PerformBrush {
private static final int MAXIMAL_RANDOM_TELEPORTATION_RANGE = 400;
private static final int TICKS_PER_SECOND = 20;
@ -213,7 +206,7 @@ public class PunishBrush extends PerformBrush {
}
} catch (final Exception exception) {
exception.printStackTrace();
v.sendMessage("An error occured.");
v.sendMessage("An error occurred.");
return;
}
} else if (v.getBrushSize() == PunishBrush.INFINIPUNISH_SIZE) {
@ -315,9 +308,6 @@ public class PunishBrush extends PerformBrush {
return "voxelsniper.brush.punish";
}
/**
* @author Monofraps
*/
private enum Punishment {
// Monofraps
FIRE, LIGHTNING, BLINDNESS, DRUNK, KILL, RANDOMTP, ALL_POTION,

Datei anzeigen

@ -8,12 +8,6 @@ import com.thevoxelbox.voxelsniper.Undo;
import java.util.Random;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Random-Erode_Brush
*
* @author Piotr
* @author Giltwist (Randomized blockPositionY)
*/
public class RandomErodeBrush extends Brush {
private final double trueCircle = 0.5;
private BlockWrapper[][][] snap;
@ -21,14 +15,10 @@ public class RandomErodeBrush extends Brush {
private int bsize;
private int erodeFace;
private int fillFace;
private int brushSize;
private int erodeRecursion = 1;
private int fillRecursion = 1;
private Random generator = new Random();
/**
*
*/
public RandomErodeBrush() {
this.setName("RandomErode");
}
@ -60,7 +50,6 @@ public class RandomErodeBrush extends Brush {
}
}
@SuppressWarnings("deprecation")
private boolean fill(final int x, final int y, final int z) {
if (this.snap[x][y][z].isSolid()) {
return false;
@ -95,19 +84,17 @@ public class RandomErodeBrush extends Brush {
}
private void getMatrix() {
this.brushSize = ((this.bsize + 1) * 2) + 1;
int brushSize = ((this.bsize + 1) * 2) + 1;
if (this.snap.length == 0) {
this.snap = new BlockWrapper[this.brushSize][this.brushSize][this.brushSize];
this.snap = new BlockWrapper[brushSize][brushSize][brushSize];
int sx = this.getTargetBlock().getX() - (this.bsize + 1);
int sy = this.getTargetBlock().getY() - (this.bsize + 1);
int sz = this.getTargetBlock().getZ() - (this.bsize + 1);
for (int x = 0; x < this.snap.length; x++) {
sz = this.getTargetBlock().getZ() - (this.bsize + 1);
int sz = this.getTargetBlock().getZ() - (this.bsize + 1);
for (int z = 0; z < this.snap.length; z++) {
sy = this.getTargetBlock().getY() - (this.bsize + 1);
int sy = this.getTargetBlock().getY() - (this.bsize + 1);
for (int y = 0; y < this.snap.length; y++) {
this.snap[x][y][z] = new BlockWrapper(this.clampY(sx, sy, sz));
sy++;
@ -118,16 +105,14 @@ public class RandomErodeBrush extends Brush {
}
this.firstSnap = this.snap.clone();
} else {
this.snap = new BlockWrapper[this.brushSize][this.brushSize][this.brushSize];
this.snap = new BlockWrapper[brushSize][brushSize][brushSize];
int sx = this.getTargetBlock().getX() - (this.bsize + 1);
int sy = this.getTargetBlock().getY() - (this.bsize + 1);
int sz = this.getTargetBlock().getZ() - (this.bsize + 1);
for (int x = 0; x < this.snap.length; x++) {
sz = this.getTargetBlock().getZ() - (this.bsize + 1);
int sz = this.getTargetBlock().getZ() - (this.bsize + 1);
for (int z = 0; z < this.snap.length; z++) {
sy = this.getTargetBlock().getY() - (this.bsize + 1);
int sy = this.getTargetBlock().getY() - (this.bsize + 1);
for (int y = 0; y < this.snap.length; y++) {
this.snap[x][y][z] = new BlockWrapper(this.clampY(sx, sy, sz));
sy++;
@ -317,29 +302,18 @@ public class RandomErodeBrush extends Brush {
return "voxelsniper.brush.randomerode";
}
/**
* @author unknown
*/
private class BlockWrapper {
private boolean solid;
private AsyncBlock nativeBlock;
private int id;
private int i;
/**
* @param bl
*/
@SuppressWarnings("deprecation")
public BlockWrapper(final AsyncBlock bl) {
this.setNativeBlock(bl);
this.setI(bl.getTypeId());
switch (bl.getType()) {
case AIR:
this.setSolid(false);
break;
case WATER:
this.setSolid(false);
break;
case LAVA:
this.setSolid(false);
break;

Datei anzeigen

@ -11,9 +11,7 @@ import org.bukkit.Chunk;
* @author Mick
*/
public class RegenerateChunkBrush extends Brush {
/**
*
*/
public RegenerateChunkBrush() {
this.setName("Chunk Generator 40k");
}

Datei anzeigen

@ -6,18 +6,11 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
import org.bukkit.ChatColor;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Ring_Brush
*
* @author Voxel
*/
public class RingBrush extends PerformBrush {
private double trueCircle = 0;
private double innerSize = 0;
/**
*
*/
public RingBrush() {
this.setName("Ring");
}
@ -83,7 +76,7 @@ public class RingBrush extends PerformBrush {
v.sendMessage(ChatColor.RED + "The parameters included are invalid.");
}
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -7,9 +7,7 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.util.BlockWrapper;
import org.bukkit.ChatColor;
/**
* @author Piotr
*/
public class Rot2DBrush extends Brush {
private int mode = 0;
private int bSize;
@ -17,9 +15,6 @@ public class Rot2DBrush extends Brush {
private BlockWrapper[][][] snap;
private double se;
/**
*
*/
public Rot2DBrush() {
this.setName("2D Rotation");
}

Datei anzeigen

@ -8,40 +8,31 @@ import com.thevoxelbox.voxelsniper.util.BlockWrapper;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
/**
* @author Gavjenks, hack job from the other 2d rotation brush blockPositionY piotr
*/
// The X Y and Z variable names in this file do NOT MAKE ANY SENSE. Do not attempt to actually figure out what on earth is going on here. Just go to the
// original 2d horizontal brush if you wish to make anything similar to this, and start there. I didn't bother renaming everything.
public class Rot2DvertBrush extends Brush {
private int mode = 0;
private int bSize;
private int brushSize;
private BlockWrapper[][][] snap;
private double se;
/**
*
*/
public Rot2DvertBrush() {
this.setName("2D Rotation");
}
@SuppressWarnings("deprecation")
private void getMatrix() {
this.brushSize = (this.bSize * 2) + 1;
int brushSize = (this.bSize * 2) + 1;
this.snap = new BlockWrapper[this.brushSize][this.brushSize][this.brushSize];
this.snap = new BlockWrapper[brushSize][brushSize][brushSize];
int sx = this.getTargetBlock().getX() - this.bSize;
int sy = this.getTargetBlock().getY() - this.bSize;
int sz = this.getTargetBlock().getZ() - this.bSize;
for (int x = 0; x < this.snap.length; x++) {
sz = this.getTargetBlock().getZ() - this.bSize;
int sz = this.getTargetBlock().getZ() - this.bSize;
for (int z = 0; z < this.snap.length; z++) {
sy = this.getTargetBlock().getY() - this.bSize;
int sy = this.getTargetBlock().getY() - this.bSize;
for (int y = 0; y < this.snap.length; y++) {
final AsyncBlock block = this.clampY(sx, sy, sz); // why is this not sx + x, sy + y sz + z?
@ -56,7 +47,7 @@ public class Rot2DvertBrush extends Brush {
}
}
private void rotate(final SnipeData v) {
private void rotate() {
final double brushSizeSquared = Math.pow(this.bSize + 0.5, 2);
final double cos = Math.cos(this.se);
final double sin = Math.sin(this.se);
@ -142,7 +133,7 @@ public class Rot2DvertBrush extends Brush {
if (this.mode == 0) {
this.getMatrix();
this.rotate(v);
this.rotate();
} else {
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
}
@ -154,7 +145,7 @@ public class Rot2DvertBrush extends Brush {
if (this.mode == 0) {
this.getMatrix();
this.rotate(v);
this.rotate();
} else {
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
}

Datei anzeigen

@ -8,9 +8,6 @@ import com.thevoxelbox.voxelsniper.Undo;
import com.thevoxelbox.voxelsniper.util.BlockWrapper;
import org.bukkit.ChatColor;
/**
*
*/
public class Rot3DBrush extends Brush {
private final int mode = 0;
private int bSize;
@ -20,9 +17,6 @@ public class Rot3DBrush extends Brush {
private double sePitch;
private double seRoll;
/**
*
*/
public Rot3DBrush() {
this.setName("3D Rotation");
}

Datei anzeigen

@ -6,11 +6,6 @@ import com.thevoxelbox.voxelsniper.Undo;
import org.bukkit.ChatColor;
import org.bukkit.util.Vector;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Ruler_Brush
*
* @author Gavjenks
*/
public class RulerBrush extends Brush {
private boolean first = true;
private Vector coords = new Vector(0, 0, 0);
@ -19,9 +14,6 @@ public class RulerBrush extends Brush {
private int yOff = 0;
private int zOff = 0;
/**
*
*/
public RulerBrush() {
this.setName("Ruler");
}
@ -93,7 +85,7 @@ public class RulerBrush extends Brush {
this.xOff = 0;
v.sendMessage(ChatColor.BLUE + "Ruler mode.");
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -8,9 +8,6 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
/**
* @author DivineRage
*/
public class ScannerBrush extends Brush {
private static final int DEPTH_MIN = 1;
private static final int DEPTH_DEFAULT = 24;
@ -19,9 +16,6 @@ public class ScannerBrush extends Brush {
private int depth = DEPTH_DEFAULT;
private Material checkFor = Material.AIR;
/**
*
*/
public ScannerBrush() {
this.setName("Scanner");
}
@ -29,10 +23,8 @@ public class ScannerBrush extends Brush {
private int clamp(final int value, final int min, final int max) {
if (value < min) {
return min;
} else if (value > max) {
return max;
} else {
return value;
return Math.min(value, max);
}
}
@ -152,7 +144,7 @@ public class ScannerBrush extends Brush {
this.depth = this.clamp(Integer.parseInt(par[i].substring(1)), DEPTH_MIN, DEPTH_MAX);
v.sendMessage(ChatColor.AQUA + "Scanner depth set to " + this.depth);
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -6,18 +6,11 @@ import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
import org.bukkit.ChatColor;
import org.bukkit.block.Block;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Set_Brush
*
* @author Voxel
*/
public class SetBrush extends PerformBrush {
private static final int SELECTION_SIZE_MAX = 5000000;
private Block block = null;
/**
*
*/
public SetBrush() {
this.setName("Set");
}
@ -32,15 +25,15 @@ public class SetBrush extends PerformBrush {
this.block = null;
return true;
}
final int lowX = (this.block.getX() <= bl.getX()) ? this.block.getX() : bl.getX();
final int lowY = (this.block.getY() <= bl.getY()) ? this.block.getY() : bl.getY();
final int lowZ = (this.block.getZ() <= bl.getZ()) ? this.block.getZ() : bl.getZ();
final int highX = (this.block.getX() >= bl.getX()) ? this.block.getX() : bl.getX();
final int highY = (this.block.getY() >= bl.getY()) ? this.block.getY() : bl.getY();
final int highZ = (this.block.getZ() >= bl.getZ()) ? this.block.getZ() : bl.getZ();
final int lowX = Math.min(this.block.getX(), bl.getX());
final int lowY = Math.min(this.block.getY(), bl.getY());
final int lowZ = Math.min(this.block.getZ(), bl.getZ());
final int highX = Math.max(this.block.getX(), bl.getX());
final int highY = Math.max(this.block.getY(), bl.getY());
final int highZ = Math.max(this.block.getZ(), bl.getZ());
if (Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY) > SELECTION_SIZE_MAX) {
v.sendMessage(ChatColor.RED + "Selection size above hardcoded limit, please use a smaller selection.");
v.sendMessage(ChatColor.RED + "Selection size above hardcoded limit of 5000000, please use a smaller selection.");
} else {
for (int y = lowY; y <= highY; y++) {
for (int x = lowX; x <= highX; x++) {

Datei anzeigen

@ -8,17 +8,12 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
/**
* @author Voxel
*/
public class SetRedstoneFlipBrush extends Brush {
private Block block = null;
private Undo undo;
private boolean northSouth = true;
/**
*
*/
public SetRedstoneFlipBrush() {
this.setName("Set Redstone Flip");
}
@ -29,12 +24,12 @@ public class SetRedstoneFlipBrush extends Brush {
return true;
} else {
this.undo = new Undo();
final int lowX = (this.block.getX() <= bl.getX()) ? this.block.getX() : bl.getX();
final int lowY = (this.block.getY() <= bl.getY()) ? this.block.getY() : bl.getY();
final int lowZ = (this.block.getZ() <= bl.getZ()) ? this.block.getZ() : bl.getZ();
final int highX = (this.block.getX() >= bl.getX()) ? this.block.getX() : bl.getX();
final int highY = (this.block.getY() >= bl.getY()) ? this.block.getY() : bl.getY();
final int highZ = (this.block.getZ() >= bl.getZ()) ? this.block.getZ() : bl.getZ();
final int lowX = Math.min(this.block.getX(), bl.getX());
final int lowY = Math.min(this.block.getY(), bl.getY());
final int lowZ = Math.min(this.block.getZ(), bl.getZ());
final int highX = Math.max(this.block.getX(), bl.getX());
final int highY = Math.max(this.block.getY(), bl.getY());
final int highZ = Math.max(this.block.getZ(), bl.getZ());
for (int y = lowY; y <= highY; y++) {
for (int x = lowX; x <= highX; x++) {
@ -110,7 +105,7 @@ public class SetRedstoneFlipBrush extends Brush {
this.northSouth = false;
v.sendMessage(ChatColor.AQUA + "Flip direction set to east/west.");
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -8,16 +8,11 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
/**
* @author Voxel
*/
public class SetRedstoneRotateBrush extends Brush {
private Block block = null;
private Undo undo;
/**
*
*/
public SetRedstoneRotateBrush() {
this.setName("Set Redstone Rotate");
}
@ -28,12 +23,12 @@ public class SetRedstoneRotateBrush extends Brush {
return true;
} else {
this.undo = new Undo();
final int lowX = (this.block.getX() <= bl.getX()) ? this.block.getX() : bl.getX();
final int lowY = (this.block.getY() <= bl.getY()) ? this.block.getY() : bl.getY();
final int lowZ = (this.block.getZ() <= bl.getZ()) ? this.block.getZ() : bl.getZ();
final int highX = (this.block.getX() >= bl.getX()) ? this.block.getX() : bl.getX();
final int highY = (this.block.getY() >= bl.getY()) ? this.block.getY() : bl.getY();
final int highZ = (this.block.getZ() >= bl.getZ()) ? this.block.getZ() : bl.getZ();
final int lowX = Math.min(this.block.getX(), bl.getX());
final int lowY = Math.min(this.block.getY(), bl.getY());
final int lowZ = Math.min(this.block.getZ(), bl.getZ());
final int highX = Math.max(this.block.getX(), bl.getX());
final int highY = Math.max(this.block.getY(), bl.getY());
final int highZ = Math.max(this.block.getZ(), bl.getZ());
for (int y = lowY; y <= highY; y++) {
for (int x = lowX; x <= highX; x++) {

Datei anzeigen

@ -8,14 +8,11 @@ import org.bukkit.block.Block;
/**
* THIS BRUSH SHOULD NOT USE PERFORMERS.
* http://www.voxelwiki.com/minecraft/Voxelsniper#Shell_Brushes
*
* @author Voxel
*/
public class ShellBallBrush extends Brush {
/**
*
*/
public ShellBallBrush() {
this.setName("Shell Ball");
}
@ -43,7 +40,7 @@ public class ShellBallBrush extends Brush {
for (int x = 0; x <= brushSizeDoubled; x++) {
for (int y = 0; y <= brushSizeDoubled; y++) {
System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
brushSizeDoubled + 1);
brushSizeDoubled + 1);
}
}
@ -103,7 +100,7 @@ public class ShellBallBrush extends Brush {
}
v.owner().storeUndo(undo);
// This is needed because most uses of this brush will not be sible to the sniper.
// This is needed because most uses of this brush will not be sible to the sible sniper.
v.owner().getPlayer().sendMessage(ChatColor.AQUA + "Shell complete.");
}

Datei anzeigen

@ -9,18 +9,11 @@ import org.bukkit.block.Block;
import java.util.ArrayList;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Shell_Brushes
*
* @author Piotr
*/
public class ShellSetBrush extends Brush {
private static final int MAX_SIZE = 5000000;
private Block block = null;
/**
*
*/
public ShellSetBrush() {
this.setName("Shell Set");
}
@ -37,18 +30,18 @@ public class ShellSetBrush extends Brush {
return true;
}
final int lowX = (this.block.getX() <= bl.getX()) ? this.block.getX() : bl.getX();
final int lowY = (this.block.getY() <= bl.getY()) ? this.block.getY() : bl.getY();
final int lowZ = (this.block.getZ() <= bl.getZ()) ? this.block.getZ() : bl.getZ();
final int highX = (this.block.getX() >= bl.getX()) ? this.block.getX() : bl.getX();
final int highY = (this.block.getY() >= bl.getY()) ? this.block.getY() : bl.getY();
final int highZ = (this.block.getZ() >= bl.getZ()) ? this.block.getZ() : bl.getZ();
final int lowX = Math.min(this.block.getX(), bl.getX());
final int lowY = Math.min(this.block.getY(), bl.getY());
final int lowZ = Math.min(this.block.getZ(), bl.getZ());
final int highX = Math.max(this.block.getX(), bl.getX());
final int highY = Math.max(this.block.getY(), bl.getY());
final int highZ = Math.max(this.block.getZ(), bl.getZ());
if (Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY) > MAX_SIZE) {
v.sendMessage(ChatColor.RED + "Selection size above hardcoded limit, please use a smaller selection.");
int selectionSize = Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY);
if (selectionSize > MAX_SIZE) {
v.sendMessage(ChatColor.RED + "Selection size above hardcoded limit of 5000000, please use a smaller selection.");
} else {
final ArrayList<AsyncBlock> blocks = new ArrayList<>(
((Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY)) / 2));
final ArrayList<AsyncBlock> blocks = new ArrayList<>(selectionSize / 2);
for (int y = lowY; y <= highY; y++) {
for (int x = lowX; x <= highX; x++) {
for (int z = lowZ; z <= highZ; z++) {

Datei anzeigen

@ -8,14 +8,11 @@ import org.bukkit.block.Block;
/**
* THIS BRUSH SHOULD NOT USE PERFORMERS.
* http://www.voxelwiki.com/minecraft/Voxelsniper#Shell_Brushes
*
* @author Voxel
*/
public class ShellVoxelBrush extends Brush {
/**
*
*/
public ShellVoxelBrush() {
this.setName("Shell Voxel");
}
@ -42,7 +39,7 @@ public class ShellVoxelBrush extends Brush {
for (int x = 0; x <= brushSizeSquared; x++) {
for (int y = 0; y <= brushSizeSquared; y++) {
System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
brushSizeSquared + 1);
brushSizeSquared + 1);
}
}
int temp;

Datei anzeigen

@ -8,10 +8,10 @@ import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import java.io.*;
import java.util.Arrays;
/**
* Overwrites signs. (Wiki:
* http://www.voxelwiki.com/minecraft/VoxelSniper#Sign_Overwrite_Brush)
* Overwrites signs.
*
* @author Monofraps
*/
@ -27,9 +27,6 @@ public class SignOverwriteBrush extends Brush {
private boolean[] signLinesEnabled = new boolean[NUM_SIGN_LINES];
private boolean rangedMode = false;
/**
*
*/
public SignOverwriteBrush() {
this.setName("Sign Overwrite Brush");
@ -134,7 +131,7 @@ public class SignOverwriteBrush extends Brush {
try {
if (parameter.equalsIgnoreCase("info")) {
v.sendMessage(ChatColor.AQUA + "Sign Overwrite Brush Powder/Arrow:");
v.sendMessage(ChatColor.BLUE + "The arrow writes the internal line buffer to the tearget sign.");
v.sendMessage(ChatColor.BLUE + "The arrow writes the internal line buffer to the target sign.");
v.sendMessage(ChatColor.BLUE + "The powder reads the text of the target sign into the internal buffer.");
v.sendMessage(ChatColor.AQUA + "Sign Overwrite Brush Parameters:");
v.sendMessage(ChatColor.GREEN + "-1[:(enabled|disabled)] ... " + ChatColor.BLUE + "-- Sets the text of the first sign line. (e.g. -1 Blah Blah)");
@ -240,7 +237,7 @@ public class SignOverwriteBrush extends Brush {
return i;
}
String newText = "";
StringBuilder newText = new StringBuilder();
// go through the array until the next top level parameter is found
for (i++; i < params.length; i++) {
@ -250,16 +247,16 @@ public class SignOverwriteBrush extends Brush {
i--;
break;
} else {
newText += currentParameter + " ";
newText.append(currentParameter).append(" ");
}
}
newText = ChatColor.translateAlternateColorCodes('&', newText);
newText = new StringBuilder(ChatColor.translateAlternateColorCodes('&', newText.toString()));
// remove last space or return if the string is empty and the user just wanted to set the status
if (!newText.isEmpty() && newText.endsWith(" ")) {
newText = newText.substring(0, newText.length() - 1);
} else if (newText.isEmpty()) {
if ((newText.length() > 0) && newText.toString().endsWith(" ")) {
newText = new StringBuilder(newText.substring(0, newText.length() - 1));
} else if (newText.length() == 0) {
if (statusSet) {
return i;
}
@ -269,10 +266,10 @@ public class SignOverwriteBrush extends Brush {
// check the line length and cut the text if needed
if (newText.length() > MAX_SIGN_LINE_LENGTH) {
v.sendMessage(ChatColor.RED + "Warning: Text on line " + lineNumber + " exceeds the maximum line length of " + MAX_SIGN_LINE_LENGTH + " characters. Your text will be cut.");
newText = newText.substring(0, MAX_SIGN_LINE_LENGTH);
newText = new StringBuilder(newText.substring(0, MAX_SIGN_LINE_LENGTH));
}
this.signTextLines[lineIndex] = newText;
this.signTextLines[lineIndex] = newText.toString();
return i;
}
@ -298,17 +295,13 @@ public class SignOverwriteBrush extends Brush {
try {
store.createNewFile();
FileWriter outFile = new FileWriter(store);
BufferedWriter outStream = new BufferedWriter(outFile);
for (int i = 0; i < this.signTextLines.length; i++) {
outStream.write(this.signLinesEnabled[i] + "\n");
outStream.write(this.signTextLines[i] + "\n");
try (FileWriter outFile = new FileWriter(store); BufferedWriter outStream = new BufferedWriter(outFile)) {
for (int i = 0; i < this.signTextLines.length; i++) {
outStream.write(this.signLinesEnabled[i] + "\n");
outStream.write(this.signTextLines[i] + "\n");
}
}
outStream.close();
outFile.close();
v.sendMessage(ChatColor.BLUE + "File saved successfully.");
} catch (IOException exception) {
v.sendMessage(ChatColor.RED + "Failed to save file. " + exception.getMessage());
@ -330,18 +323,13 @@ public class SignOverwriteBrush extends Brush {
return;
}
try {
FileReader inFile = new FileReader(store);
BufferedReader inStream = new BufferedReader(inFile);
try (FileReader inFile = new FileReader(store); BufferedReader inStream = new BufferedReader(inFile)) {
for (int i = 0; i < this.signTextLines.length; i++) {
this.signLinesEnabled[i] = Boolean.valueOf(inStream.readLine());
this.signLinesEnabled[i] = Boolean.parseBoolean(inStream.readLine());
this.signTextLines[i] = inStream.readLine();
}
inStream.close();
inFile.close();
v.sendMessage(ChatColor.BLUE + "File loaded successfully.");
} catch (IOException exception) {
v.sendMessage(ChatColor.RED + "Failed to load file. " + exception.getMessage());
@ -353,18 +341,14 @@ public class SignOverwriteBrush extends Brush {
* Clears the internal text buffer. (Sets it to empty strings)
*/
private void clearBuffer() {
for (int i = 0; i < this.signTextLines.length; i++) {
this.signTextLines[i] = "";
}
Arrays.fill(this.signTextLines, "");
}
/**
* Resets line enabled states to enabled.
*/
private void resetStates() {
for (int i = 0; i < this.signLinesEnabled.length; i++) {
this.signLinesEnabled[i] = true;
}
Arrays.fill(this.signLinesEnabled, true);
}
@Override

Datei anzeigen

@ -4,15 +4,9 @@ import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Snipe_Brush
*
* @author Voxel
*/
public class SnipeBrush extends PerformBrush {
/**
*
*/
public SnipeBrush() {
this.setName("Snipe");
}

Datei anzeigen

@ -12,11 +12,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Snow_cone_brush
*
* @author Voxel
*/
public class SnowConeBrush extends Brush {
@SuppressWarnings("deprecation")
private void addSnow(final SnipeData v, Block targetBlock) {
@ -129,11 +125,11 @@ public class SnowConeBrush extends Brush {
} else {
Block blockAbove = getTargetBlock().getRelative(BlockFace.UP);
if (blockAbove != null && BukkitAdapter.adapt(blockAbove.getType()).getMaterial()
.isAir()) {
.isAir()) {
addSnow(v, blockAbove);
} else {
v.owner().getPlayer()
.sendMessage(ChatColor.RED + "Error: Center block neither snow nor air.");
.sendMessage(ChatColor.RED + "Error: Center block neither snow nor air.");
}
}
}

Datei anzeigen

@ -1,7 +1,6 @@
package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData;
@ -9,24 +8,15 @@ import com.thevoxelbox.voxelsniper.Undo;
import org.bukkit.ChatColor;
import org.bukkit.block.Block;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Spiral_Staircase_Brush
*
* @author giltwist
*/
public class SpiralStaircaseBrush extends Brush {
private String stairtype = "block"; // "block" 1x1 blocks (default), "step" alternating step double step, "stair" staircase with blocks on corners
private String sdirect = "c"; // "c" clockwise (default), "cc" counter-clockwise
private String sopen = "n"; // "n" north (default), "e" east, "world" south, "world" west
/**
*
*/
public SpiralStaircaseBrush() {
this.setName("Spiral Staircase");
}
@SuppressWarnings("deprecation")
private void buildStairWell(final SnipeData v, Block targetBlock) {
if (v.getVoxelHeight() < 1) {
v.setVoxelHeight(1);
@ -37,12 +27,9 @@ public class SpiralStaircaseBrush extends Brush {
// locate first block in staircase
// Note to self, fix these
int startX = 0;
int startZ = 0;
int startX;
int startZ;
int y = 0;
int xOffset = 0;
int zOffset = 0;
int toggle = 0;
if (this.sdirect.equalsIgnoreCase("cc")) {
if (this.sopen.equalsIgnoreCase("n")) {
@ -74,6 +61,9 @@ public class SpiralStaircaseBrush extends Brush {
}
}
int xOffset = 0;
int zOffset = 0;
int toggle = 0;
while (y < v.getVoxelHeight()) {
if (this.stairtype.equalsIgnoreCase("block")) {
// 1x1x1 voxel material steps
@ -223,9 +213,6 @@ public class SpiralStaircaseBrush extends Brush {
break;
case 1:
switch (stairtype) {
}
if (this.stairtype.equalsIgnoreCase("block")) {
this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, v.getVoxelId());
} else if (this.stairtype.equalsIgnoreCase("step")) {
@ -258,7 +245,6 @@ public class SpiralStaircaseBrush extends Brush {
v.owner().storeUndo(undo);
}
@SuppressWarnings("deprecation")
private void digStairWell(final SnipeData v, Block targetBlock) {
if (v.getVoxelHeight() < 1) {
v.setVoxelHeight(1);
@ -270,12 +256,8 @@ public class SpiralStaircaseBrush extends Brush {
// locate first block in staircase
// Note to self, fix these
int startX = 0;
int startZ = 0;
int y = 0;
int xOffset = 0;
int zOffset = 0;
int toggle = 0;
int startX;
int startZ;
if (this.sdirect.equalsIgnoreCase("cc")) {
if (this.sopen.equalsIgnoreCase("n")) {
@ -307,6 +289,10 @@ public class SpiralStaircaseBrush extends Brush {
}
}
int xOffset = 0;
int zOffset = 0;
int toggle = 0;
int y = 0;
while (y < v.getVoxelHeight()) {
if (this.stairtype.equalsIgnoreCase("block")) {
// 1x1x1 voxel material steps
@ -522,14 +508,11 @@ public class SpiralStaircaseBrush extends Brush {
// step/slab
try {
BlockType type = BlockTypes.parse(par[i]);
this.stairtype = par[i].toLowerCase().intern();
v.sendMessage(ChatColor.BLUE + "Staircase type: " + this.stairtype);
return;
} catch (InputParseException ignore) {
}
if ("block".equals(par[i].toLowerCase())) {
}
if (par[i].equalsIgnoreCase("block") || par[i].equalsIgnoreCase("step") || par[i].equalsIgnoreCase("woodstair") || par[i].equalsIgnoreCase("cobblestair")) {
this.stairtype = par[i].toLowerCase().intern();
v.sendMessage(ChatColor.BLUE + "Staircase type: " + this.stairtype);
@ -540,7 +523,7 @@ public class SpiralStaircaseBrush extends Brush {
this.sopen = par[i];
v.sendMessage(ChatColor.BLUE + "Staircase opens: " + this.sopen);
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -8,11 +8,7 @@ import org.bukkit.ChatColor;
import java.util.Random;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Splatter_Brushes
*
* @author Voxel
*/
public class SplatterBallBrush extends PerformBrush {
private static final int GROW_PERCENT_MIN = 1;
private static final int GROW_PERCENT_DEFAULT = 1000;
@ -28,9 +24,6 @@ public class SplatterBallBrush extends PerformBrush {
private int splatterRecursions; // How many times you grow the seeds
private Random generator = new Random();
/**
*
*/
public SplatterBallBrush() {
this.setName("Splatter Ball");
}
@ -105,9 +98,10 @@ public class SplatterBallBrush extends PerformBrush {
// integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--) {
for (int y = 2 * v.getBrushSize(); y >= 0; y--) {
if (2 * v.getBrushSize() + 1 >= 0)
if (2 * v.getBrushSize() + 1 >= 0) {
System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0,
2 * v.getBrushSize() + 1);
2 * v.getBrushSize() + 1);
}
}
}
}
@ -211,7 +205,7 @@ public class SplatterBallBrush extends PerformBrush {
v.sendMessage(ChatColor.RED + "Recursions must be an integer 1-10!");
}
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -8,11 +8,7 @@ import org.bukkit.ChatColor;
import java.util.Random;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Splatter_Brushes
*
* @author Voxel
*/
public class SplatterDiscBrush extends PerformBrush {
private static final int GROW_PERCENT_MIN = 1;
private static final int GROW_PERCENT_DEFAULT = 1000;
@ -28,9 +24,6 @@ public class SplatterDiscBrush extends PerformBrush {
private int splatterRecursions; // How many times you grow the seeds
private Random generator = new Random();
/**
*
*/
public SplatterDiscBrush() {
this.setName("Splatter Disc");
}
@ -95,8 +88,9 @@ public class SplatterDiscBrush extends PerformBrush {
// integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--) {
if (2 * v.getBrushSize() + 1 >= 0)
if (2 * v.getBrushSize() + 1 >= 0) {
System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
}
}
}
this.growPercent = gref;
@ -186,7 +180,7 @@ public class SplatterDiscBrush extends PerformBrush {
v.sendMessage(ChatColor.RED + "Recursions must be an integer 1-10!");
}
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -10,11 +10,6 @@ import org.bukkit.ChatColor;
import java.util.Random;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Splatter_Overlay_Brush
*
* @author Gavjenks Splatterized blockPositionY Giltwist
*/
public class SplatterOverlayBrush extends PerformBrush {
private static final int GROW_PERCENT_MIN = 1;
private static final int GROW_PERCENT_DEFAULT = 1000;
@ -34,9 +29,6 @@ public class SplatterOverlayBrush extends PerformBrush {
private int depth = 3;
private boolean allBlocks = false;
/**
*
*/
public SplatterOverlayBrush() {
this.setName("Splatter Overlay");
}
@ -88,8 +80,9 @@ public class SplatterOverlayBrush extends PerformBrush {
}
// integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--) {
if (2 * v.getBrushSize() + 1 >= 0)
if (2 * v.getBrushSize() + 1 >= 0) {
System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
}
}
}
this.growPercent = gref;
@ -124,9 +117,6 @@ public class SplatterOverlayBrush extends PerformBrush {
memory[x + v.getBrushSize()][z + v.getBrushSize()] = 1;
}
}
continue;
} else {
continue;
}
} else {
final int depth = randomizeHeight ? generator.nextInt(this.depth) : this.depth;
@ -197,8 +187,9 @@ public class SplatterOverlayBrush extends PerformBrush {
}
// integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--) {
if (2 * v.getBrushSize() + 1 >= 0)
if (2 * v.getBrushSize() + 1 >= 0) {
System.arraycopy(tempsplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
}
}
}
this.growPercent = gref;
@ -225,9 +216,6 @@ public class SplatterOverlayBrush extends PerformBrush {
// in parameters
memory[x + v.getBrushSize()][z + v.getBrushSize()] = 1; // stop it from checking any other blocks in this vertical 1x1 column.
}
continue;
} else {
continue;
}
} else {
final int depth = randomizeHeight ? generator.nextInt(this.depth) : this.depth;
@ -338,10 +326,10 @@ public class SplatterOverlayBrush extends PerformBrush {
v.sendMessage(ChatColor.RED + "Recursions must be an integer 1-10!");
}
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
} catch (Exception exception) {
v.sendMessage(String.format("An error occured while processing parameter %s.", parameter));
v.sendMessage(String.format("An error occurred while processing parameter %s.", parameter));
}
}
}

Datei anzeigen

@ -8,11 +8,7 @@ import org.bukkit.ChatColor;
import java.util.Random;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Splatter_Brushes
*
* @author Voxel
*/
public class SplatterVoxelBrush extends PerformBrush {
private static final int GROW_PERCENT_MIN = 1;
private static final int GROW_PERCENT_DEFAULT = 1000;
@ -28,9 +24,6 @@ public class SplatterVoxelBrush extends PerformBrush {
private int splatterRecursions; // How many times you grow the seeds
private Random generator = new Random();
/**
*
*/
public SplatterVoxelBrush() {
this.setName("Splatter Voxel");
}
@ -105,9 +98,10 @@ public class SplatterVoxelBrush extends PerformBrush {
// integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--) {
for (int y = 2 * v.getBrushSize(); y >= 0; y--) {
if (2 * v.getBrushSize() + 1 >= 0)
if (2 * v.getBrushSize() + 1 >= 0) {
System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0,
2 * v.getBrushSize() + 1);
2 * v.getBrushSize() + 1);
}
}
}
}
@ -201,7 +195,7 @@ public class SplatterVoxelBrush extends PerformBrush {
v.sendMessage(ChatColor.RED + "Recursions must be an integer 1-10!");
}
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -8,11 +8,7 @@ import org.bukkit.block.Block;
import java.util.Random;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Splatter_Brushes
*
* @author Voxel
*/
public class SplatterVoxelDiscBrush extends PerformBrush {
private static final int GROW_PERCENT_MIN = 1;
private static final int GROW_PERCENT_DEFAULT = 1000;
@ -28,9 +24,6 @@ public class SplatterVoxelDiscBrush extends PerformBrush {
private int splatterRecursions; // How many times you grow the seeds
private Random generator = new Random();
/**
*
*/
public SplatterVoxelDiscBrush() {
this.setName("Splatter Voxel Disc");
}
@ -92,8 +85,9 @@ public class SplatterVoxelDiscBrush extends PerformBrush {
}
// integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--) {
if (2 * v.getBrushSize() + 1 >= 0)
if (2 * v.getBrushSize() + 1 >= 0) {
System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
}
}
}
this.growPercent = gref;
@ -184,7 +178,7 @@ public class SplatterVoxelDiscBrush extends PerformBrush {
v.sendMessage(ChatColor.RED + "Recursions must be an integer 1-10!");
}
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -43,7 +43,7 @@ public class SplineBrush extends PerformBrush {
this.ctrlPts.add(targetBlock);
v.sendMessage(ChatColor.GRAY + "Added block " + ChatColor.RED + "(" + targetBlock.getX() + ", " + targetBlock.getY() + ", " + targetBlock.getZ() + ") " + ChatColor.GRAY
+ "to control point selection");
+ "to control point selection");
}
public final void removeFromSet(final SnipeData v, final boolean ep, Block targetBlock) {
@ -55,7 +55,7 @@ public class SplineBrush extends PerformBrush {
this.endPts.add(targetBlock);
v.sendMessage(ChatColor.GRAY + "Removed block " + ChatColor.RED + "(" + targetBlock.getX() + ", " + targetBlock.getY() + ", " + targetBlock.getZ() + ") " + ChatColor.GRAY
+ "from endpoint selection");
+ "from endpoint selection");
return;
}
@ -66,7 +66,7 @@ public class SplineBrush extends PerformBrush {
this.ctrlPts.remove(targetBlock);
v.sendMessage(ChatColor.GRAY + "Removed block " + ChatColor.RED + "(" + targetBlock.getX() + ", " + targetBlock.getY() + ", " + targetBlock.getZ() + ") " + ChatColor.GRAY
+ "from control point selection");
+ "from control point selection");
}
public final boolean spline(final Point start, final Point end, final Point c1, final Point c2, final SnipeData v) {
@ -146,7 +146,7 @@ public class SplineBrush extends PerformBrush {
}
@Override
public final void parameters(final String[] par, final com.thevoxelbox.voxelsniper.SnipeData v) {
public final void parameters(final String[] par, final SnipeData v) {
for (int i = 1; i < par.length; i++) {
if (par[i].equalsIgnoreCase("info")) {
v.sendMessage(ChatColor.GOLD + "Spline brush parameters");
@ -181,7 +181,7 @@ public class SplineBrush extends PerformBrush {
this.render(v);
}
} else {
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -9,9 +9,6 @@ import org.bukkit.ChatColor;
import java.util.HashSet;
/**
*
*/
public class StampBrush extends Brush {
protected HashSet<BlockWrapper> clone = new HashSet<>();
protected HashSet<BlockWrapper> fall = new HashSet<>();
@ -20,39 +17,24 @@ public class StampBrush extends Brush {
protected Undo undo;
protected boolean sorted = false;
protected StampType stamp = StampType.DEFAULT;
/**
*
*/
public StampBrush() {
this.setName("Stamp");
}
/**
*
*/
public final void reSort() {
this.sorted = false;
}
/**
* @param id
* @return
*/
protected final boolean falling(final int id) {
return (id > 7 && id < 14);
}
/**
* @param id
* @return
*/
protected final boolean fallsOff(final int id) {
return (BlockTypes.get(id).getMaterial().isFragileWhenPushed());
}
/**
* @param cb
*/
@SuppressWarnings("deprecation")
protected final void setBlock(final BlockWrapper cb) {
final AsyncBlock block = this.clampY(this.getTargetBlock().getX() + cb.x, this.getTargetBlock().getY() + cb.y, this.getTargetBlock().getZ() + cb.z);
@ -61,9 +43,6 @@ public class StampBrush extends Brush {
block.setPropertyId(cb.d);
}
/**
* @param cb
*/
@SuppressWarnings("deprecation")
protected final void setBlockFill(final BlockWrapper cb) {
final AsyncBlock block = this.clampY(this.getTargetBlock().getX() + cb.x, this.getTargetBlock().getY() + cb.y, this.getTargetBlock().getZ() + cb.z);
@ -74,16 +53,10 @@ public class StampBrush extends Brush {
}
}
/**
* @param type
*/
protected final void setStamp(final StampType type) {
this.stamp = type;
}
/**
* @param v
*/
protected final void stamp(final SnipeData v) {
this.undo = new Undo();
@ -123,9 +96,6 @@ public class StampBrush extends Brush {
v.owner().storeUndo(this.undo);
}
/**
* @param v
*/
protected final void stampFill(final SnipeData v) {
this.undo = new Undo();
@ -166,9 +136,6 @@ public class StampBrush extends Brush {
v.owner().storeUndo(this.undo);
}
/**
* @param v
*/
protected final void stampNoAir(final SnipeData v) {
this.undo = new Undo();
@ -245,16 +212,11 @@ public class StampBrush extends Brush {
return "voxelsniper.brush.stamp";
}
/**
* @author Monofraps
*/
protected enum StampType {
NO_AIR, FILL, DEFAULT
}
/**
* @author Voxel
*/
protected class BlockWrapper {
public int id;
public int x;
@ -262,13 +224,6 @@ public class StampBrush extends Brush {
public int z;
public int d;
/**
* @param b
* @param blx
* @param bly
* @param blz
*/
@SuppressWarnings("deprecation")
public BlockWrapper(final AsyncBlock b, final int blx, final int bly, final int blz) {
this.id = b.getTypeId();
this.d = b.getPropertyId();

Datei anzeigen

@ -42,10 +42,7 @@ public class StencilBrush extends Brush {
private int[] pastePoint = new int[3];
private byte point = 1;
/**
*
*/
public StencilBrush() {
public StencilBrush() {
this.setName("Stencil");
}
@ -60,8 +57,7 @@ public class StencilBrush extends Brush {
final File file = new File("plugins/VoxelSniper/stencils/" + this.filename + ".vstencil");
if (file.exists()) {
try {
final FaweInputStream in = new FaweInputStream(new DataInputStream(new GZIPInputStream(new BufferedInputStream(new FileInputStream(file)))));
try (final FaweInputStream in = new FaweInputStream(new DataInputStream(new GZIPInputStream(new BufferedInputStream(new FileInputStream(file)))))) {
this.x = in.readShort();
this.z = in.readShort();
@ -203,7 +199,7 @@ public class StencilBrush extends Brush {
}
}
@SuppressWarnings("deprecation")
@SuppressWarnings("UnstableApiUsage")
private void stencilSave(final SnipeData v) {
final File file = new File("plugins/VoxelSniper/stencils/" + this.filename + ".vstencil");
@ -222,62 +218,62 @@ public class StencilBrush extends Brush {
Files.createParentDirs(file);
file.createNewFile();
final FaweOutputStream out = new FaweOutputStream(new DataOutputStream(new PGZIPOutputStream(new BufferedOutputStream(new FileOutputStream(file)))));
int blockPositionX = (this.firstPoint[0] > this.secondPoint[0]) ? this.secondPoint[0] : this.firstPoint[0];
int blockPositionZ = (this.firstPoint[1] > this.secondPoint[1]) ? this.secondPoint[1] : this.firstPoint[1];
int blockPositionY = (this.firstPoint[2] > this.secondPoint[2]) ? this.secondPoint[2] : this.firstPoint[2];
out.writeShort(this.x);
out.writeShort(this.z);
out.writeShort(this.y);
out.writeShort(this.xRef);
out.writeShort(this.zRef);
out.writeShort(this.yRef);
try (FaweOutputStream out = new FaweOutputStream(new DataOutputStream(new PGZIPOutputStream(new BufferedOutputStream(new FileOutputStream(file)))))) {
int blockPositionX = Math.min(this.firstPoint[0], this.secondPoint[0]);
int blockPositionZ = Math.min(this.firstPoint[1], this.secondPoint[1]);
int blockPositionY = Math.min(this.firstPoint[2], this.secondPoint[2]);
out.writeShort(this.x);
out.writeShort(this.z);
out.writeShort(this.y);
out.writeShort(this.xRef);
out.writeShort(this.zRef);
out.writeShort(this.yRef);
v.sendMessage(ChatColor.AQUA + "Volume: " + this.x * this.z * this.y + " blockPositionX:" + blockPositionX + " blockPositionZ:" + blockPositionZ + " blockPositionY:" + blockPositionY);
v.sendMessage(ChatColor.AQUA + "Volume: " + this.x * this.z * this.y + " blockPositionX:" + blockPositionX + " blockPositionZ:" + blockPositionZ + " blockPositionY:" + blockPositionY);
int[] blockArray = new int[this.x * this.z * this.y];
byte[] runSizeArray = new byte[this.x * this.z * this.y];
int[] blockArray = new int[this.x * this.z * this.y];
byte[] runSizeArray = new byte[this.x * this.z * this.y];
int lastId = (this.getWorld().getBlockAt(blockPositionX, blockPositionY, blockPositionZ).getCombinedId());
int thisId;
int counter = 0;
int arrayIndex = 0;
for (int y = 0; y < this.y; y++) {
for (int z = 0; z < this.z; z++) {
for (int x = 0; x < this.x; x++) {
AsyncBlock currentBlock = getWorld().getBlockAt(blockPositionX + x, blockPositionY + y, blockPositionZ + z);
thisId = (currentBlock.getCombinedId());
if (thisId != lastId || counter == 255) {
blockArray[arrayIndex] = lastId;
runSizeArray[arrayIndex] = (byte) (counter - 128);
arrayIndex++;
counter = 1;
lastId = thisId;
} else {
counter++;
lastId = thisId;
int lastId = (this.getWorld().getBlockAt(blockPositionX, blockPositionY, blockPositionZ).getCombinedId());
int thisId;
int counter = 0;
int arrayIndex = 0;
for (int y = 0; y < this.y; y++) {
for (int z = 0; z < this.z; z++) {
for (int x = 0; x < this.x; x++) {
AsyncBlock currentBlock = getWorld().getBlockAt(blockPositionX + x, blockPositionY + y, blockPositionZ + z);
thisId = (currentBlock.getCombinedId());
if (thisId != lastId || counter == 255) {
blockArray[arrayIndex] = lastId;
runSizeArray[arrayIndex] = (byte) (counter - 128);
arrayIndex++;
counter = 1;
lastId = thisId;
} else {
counter++;
lastId = thisId;
}
}
}
}
}
blockArray[arrayIndex] = lastId; // saving last run, which will always be left over.
runSizeArray[arrayIndex] = (byte) (counter - 128);
blockArray[arrayIndex] = lastId; // saving last run, which will always be left over.
runSizeArray[arrayIndex] = (byte) (counter - 128);
out.writeInt(arrayIndex + 1);
// v.sendMessage("number of runs = " + arrayIndex);
for (int i = 0; i < arrayIndex + 1; i++) {
if (runSizeArray[i] > -127) {
out.writeBoolean(true);
out.writeByte(runSizeArray[i]);
out.writeVarInt(blockArray[i]);
} else {
out.writeBoolean(false);
out.writeVarInt(blockArray[i]);
out.writeInt(arrayIndex + 1);
// v.sendMessage("number of runs = " + arrayIndex);
for (int i = 0; i < arrayIndex + 1; i++) {
if (runSizeArray[i] > -127) {
out.writeBoolean(true);
out.writeByte(runSizeArray[i]);
out.writeVarInt(blockArray[i]);
} else {
out.writeBoolean(false);
out.writeVarInt(blockArray[i]);
}
}
}
v.sendMessage(ChatColor.BLUE + "Saved as '" + this.filename + "'.");
out.close();
v.sendMessage(ChatColor.BLUE + "Saved as '" + this.filename + "'.");
}
} catch (final Exception exception) {
v.sendMessage(ChatColor.RED + "Something went wrong.");

Datei anzeigen

@ -12,9 +12,6 @@ import java.io.FileInputStream;
import java.util.HashMap;
import java.util.Scanner;
/**
* @author Gavjenks
*/
public class StencilListBrush extends Brush {
private byte pasteOption = 1; // 0 = full, 1 = fill, 2 = replace
private String filename = "NoFileLoaded";
@ -27,20 +24,17 @@ public class StencilListBrush extends Brush {
private byte pasteParam = 0;
private HashMap<Integer, String> stencilList = new HashMap<>();
/**
*
*/
public StencilListBrush() {
this.setName("StencilList");
}
private String readRandomStencil(final SnipeData v) {
private String readRandomStencil() {
double rand = Math.random() * (this.stencilList.size());
final int choice = (int) rand;
return this.stencilList.get(choice);
}
private void readStencilList(final String listname, final SnipeData v) {
private void readStencilList() {
final File file = new File("plugins/VoxelSniper/stencilLists/" + this.filename + ".txt");
if (file.exists()) {
try {
@ -64,16 +58,14 @@ public class StencilListBrush extends Brush {
return;
}
final String stencilName = this.readRandomStencil(v);
final String stencilName = this.readRandomStencil();
v.sendMessage(stencilName);
final Undo undo = new Undo();
final File file = new File("plugins/VoxelSniper/stencils/" + stencilName + ".vstencil");
if (file.exists()) {
try {
final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
try (final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)))){
this.x = in.readShort();
this.z = in.readShort();
this.y = in.readShort();
@ -224,14 +216,13 @@ public class StencilListBrush extends Brush {
return;
}
final String stencilName = this.readRandomStencil(v);
final String stencilName = this.readRandomStencil();
final Undo undo = new Undo();
final File file = new File("plugins/VoxelSniper/stencils/" + stencilName + ".vstencil");
if (file.exists()) {
try {
final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
try (final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)))) {
this.x = in.readShort();
this.z = in.readShort();
@ -383,14 +374,13 @@ public class StencilListBrush extends Brush {
return;
}
final String stencilName = this.readRandomStencil(v);
final String stencilName = this.readRandomStencil();
final Undo undo = new Undo();
final File file = new File("plugins/VoxelSniper/stencils/" + stencilName + ".vstencil");
if (file.exists()) {
try {
final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
try (final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)))) {
this.x = in.readShort();
this.z = in.readShort();
@ -550,7 +540,7 @@ public class StencilListBrush extends Brush {
return;
}
final String stencilName = this.readRandomStencil(v);
final String stencilName = this.readRandomStencil();
final Undo undo = new Undo();
final File file = new File("plugins/VoxelSniper/stencils/" + stencilName + ".vstencil");
@ -704,7 +694,7 @@ public class StencilListBrush extends Brush {
private void stencilPasteRotation(final SnipeData v) {
// just randomly chooses a rotation and then calls stencilPaste.
this.readStencilList(this.filename, v);
this.readStencilList();
final double random = Math.random();
if (random < 0.26) {
this.stencilPaste(v);
@ -756,7 +746,7 @@ public class StencilListBrush extends Brush {
final File file = new File("plugins/VoxelSniper/stencilLists/" + this.filename + ".txt");
if (file.exists()) {
v.sendMessage(ChatColor.RED + "Stencil List '" + this.filename + "' exists and was loaded.");
this.readStencilList(this.filename, v);
this.readStencilList();
} else {
v.sendMessage(ChatColor.AQUA + "Stencil List '" + this.filename + "' does not exist. This brush will not function without a valid stencil list.");
this.filename = "NoFileLoaded";

Datei anzeigen

@ -7,11 +7,6 @@ import org.bukkit.ChatColor;
import org.bukkit.util.NumberConversions;
import org.bukkit.util.Vector;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Three-Point_Circle_Brush
*
* @author Giltwist
*/
public class ThreePointCircleBrush extends PerformBrush {
private Vector coordsOne;
private Vector coordsTwo;
@ -159,12 +154,12 @@ public class ThreePointCircleBrush extends PerformBrush {
public final void parameters(final String[] par, final SnipeData v) {
if (par[1].equalsIgnoreCase("info")) {
v.sendMessage(ChatColor.YELLOW + "3-Point Circle Brush instructions: Select three corners with the arrow brush, then generate the Circle with the powder brush.");
String toleranceOptions = "";
StringBuilder toleranceOptions = new StringBuilder();
for (final Tolerance tolerance : Tolerance.values()) {
if (!toleranceOptions.isEmpty()) {
toleranceOptions += "|";
if (toleranceOptions.length() > 0) {
toleranceOptions.append("|");
}
toleranceOptions += tolerance.name().toLowerCase();
toleranceOptions.append(tolerance.name().toLowerCase());
}
v.sendMessage(ChatColor.GOLD + "/b tpc " + toleranceOptions + " -- Toggle the calculations to emphasize accuracy or smoothness");
return;
@ -193,7 +188,9 @@ public class ThreePointCircleBrush extends PerformBrush {
* @author MikeMatrix
*/
private enum Tolerance {
DEFAULT(1000), ACCURATE(10), SMOOTH(2000);
DEFAULT(1000),
ACCURATE(10),
SMOOTH(2000);
private int value;
Tolerance(final int value) {

Datei anzeigen

@ -12,18 +12,9 @@ import org.bukkit.Material;
import org.bukkit.TreeType;
import org.bukkit.block.BlockFace;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Tree_Brush
*
* @author Mick
*/
public class TreeSnipeBrush extends Brush {
private TreeType treeType = TreeType.TREE;
/**
*
*/
public TreeSnipeBrush() {
this.setName("Tree Snipe");
}

Datei anzeigen

@ -5,11 +5,6 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
import org.bukkit.ChatColor;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Triangle_Brush
*
* @author Giltwist
*/
public class TriangleBrush extends PerformBrush {
private double[] coordsOne = new double[3]; // Three corners
private double[] coordsTwo = new double[3];
@ -21,9 +16,6 @@ public class TriangleBrush extends PerformBrush {
private double[] vectorThree = new double[3]; // Point 2 to 3, for area calculations
private double[] normalVector = new double[3];
/**
*
*/
public TriangleBrush() {
this.setName("Triangle");
}
@ -62,10 +54,10 @@ public class TriangleBrush extends PerformBrush {
}
private void triangleP(final SnipeData v) {
double lengthOne = 0;
double lengthTwo = 0;
double lengthThree = 0;
double heronBig = 0;
double lengthOne;
double lengthTwo;
double lengthThree;
double heronBig;
// Calculate slope vectors
for (int i = 0; i < 3; i++) {
@ -85,7 +77,7 @@ public class TriangleBrush extends PerformBrush {
lengthThree = Math.pow(Math.pow(this.vectorThree[0], 2) + Math.pow(this.vectorThree[1], 2) + Math.pow(this.vectorThree[2], 2), .5);
// Bigger vector determines brush size
final int brushSize = (int) Math.ceil((lengthOne > lengthTwo) ? lengthOne : lengthTwo);
final int brushSize = (int) Math.ceil(Math.max(lengthOne, lengthTwo));
// Calculate constant term
final double planeConstant = this.normalVector[0] * this.coordsOne[0] + this.normalVector[1] * this.coordsOne[1] + this.normalVector[2] * this.coordsOne[2];

Datei anzeigen

@ -7,20 +7,11 @@ import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
import org.bukkit.ChatColor;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#Underlay_Brush
*
* @author jmck95 Credit to GavJenks for framework and 95 of code. Big Thank you to GavJenks
*/
public class UnderlayBrush extends PerformBrush {
private static final int DEFAULT_DEPTH = 3;
private int depth = DEFAULT_DEPTH;
private boolean allBlocks = false;
/**
*
*/
public UnderlayBrush() {
this.setName("Underlay (Reverse Overlay)");
}
@ -48,8 +39,6 @@ public class UnderlayBrush extends PerformBrush {
}
break;
} else {
continue;
}
} else {
for (int d = 0; (d < this.depth); d++) {
@ -91,8 +80,6 @@ public class UnderlayBrush extends PerformBrush {
memory[x + v.getBrushSize()][z + v.getBrushSize()] = 1; // stop it from checking any other blocks in this vertical 1x1 column.
}
break;
} else {
continue;
}
} else {
for (int d = -1; (d < this.depth - 1); d++) {
@ -148,7 +135,7 @@ public class UnderlayBrush extends PerformBrush {
this.allBlocks = false;
v.owner().getPlayer().sendMessage(ChatColor.BLUE + "Will underlay only natural block types." + this.depth);
} else {
v.owner().getPlayer().sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
v.owner().getPlayer().sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
}
}
}

Datei anzeigen

@ -7,20 +7,12 @@ import org.bukkit.ChatColor;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Volt-Meter_Brush
*
* @author Gavjenks
*/
public class VoltMeterBrush extends Brush {
/**
*
*/
public VoltMeterBrush() {
this.setName("VoltMeter");
}
@SuppressWarnings("deprecation")
private void data(final SnipeData v) {
final AsyncBlock block = this.clampY(this.getTargetBlock().getX(), this.getTargetBlock().getY(), this.getTargetBlock().getZ());
final int data = block.getPropertyId();

Datei anzeigen

@ -4,15 +4,9 @@ import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Voxel_Brush
*
* @author Piotr
*/
public class VoxelBrush extends PerformBrush {
/**
*
*/
public VoxelBrush() {
this.setName("Voxel");
}

Datei anzeigen

@ -5,15 +5,9 @@ import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
/**
* http://www.voxelwiki.com/minecraft/Voxelsniper#The_Voxel_Disc_Brush
*
* @author Voxel
*/
public class VoxelDiscBrush extends PerformBrush {
/**
*
*/
public VoxelDiscBrush() {
this.setName("Voxel Disc");
}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen