Restore blobinator colors
This commit is contained in:
parent
68dbd1884d
commit
545790a598
16
pom.xml
16
pom.xml
|
@ -5,8 +5,8 @@
|
|||
<version>master</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.6</maven.compiler.source>
|
||||
<maven.compiler.target>1.6</maven.compiler.target>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -36,6 +36,18 @@
|
|||
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||
<enableRulesSummary>false</enableRulesSummary>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>checkstyle</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<failOnViolation>false</failOnViolation>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package pw.kaboom.weapons;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
|
@ -16,7 +13,6 @@ import org.bukkit.World;
|
|||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
@ -39,8 +35,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import org.bukkit.material.Wool;
|
||||
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
|
@ -151,8 +145,8 @@ class Events implements Listener {
|
|||
final Player player = event.getPlayer();
|
||||
final Location eyeLocation = player.getEyeLocation();
|
||||
|
||||
final double x = (i * Math.cos(Math.toRadians(eyeLocation.getYaw())));
|
||||
final double z = (i * Math.sin(Math.toRadians(eyeLocation.getYaw())));
|
||||
final double x = i * Math.cos(Math.toRadians(eyeLocation.getYaw()));
|
||||
final double z = i * Math.sin(Math.toRadians(eyeLocation.getYaw()));
|
||||
|
||||
final Vector velocity = eyeLocation.getDirection().multiply(12);
|
||||
|
||||
|
@ -466,19 +460,8 @@ class Events implements Listener {
|
|||
"weaponsBlobinatorBall".equals(projectile.getCustomName())) {
|
||||
final int radius = 4;
|
||||
final World world = projectile.getWorld();
|
||||
|
||||
final DyeColor[] colors = DyeColor.values();
|
||||
final Random random = new Random();
|
||||
final DyeColor color = colors[random.nextInt(colors.length)];
|
||||
|
||||
final HashSet<BlockFace> faces = new HashSet<BlockFace>(Arrays.asList(new BlockFace[] {
|
||||
BlockFace.NORTH,
|
||||
BlockFace.SOUTH,
|
||||
BlockFace.WEST,
|
||||
BlockFace.EAST,
|
||||
BlockFace.UP,
|
||||
BlockFace.DOWN,
|
||||
}));
|
||||
final Material color = main.colors.get(random.nextInt(main.colors.size()));
|
||||
|
||||
for (int x = -radius; x < radius; x++) {
|
||||
for (int y = -radius; y < radius; y++) {
|
||||
|
@ -488,16 +471,12 @@ class Events implements Listener {
|
|||
if (blockLocation.distance(hitBlock.getLocation()) <= radius) {
|
||||
final Block block = world.getBlockAt(blockLocation);
|
||||
|
||||
if (block.getType() != Material.AIR) {
|
||||
for (BlockFace face : faces) {
|
||||
if (block.getRelative(face).getType() == Material.AIR) {
|
||||
block.setType(Material.LEGACY_WOOL);
|
||||
|
||||
final BlockState state = block.getState();
|
||||
final Wool wool = (Wool) state.getData();
|
||||
wool.setColor(color);
|
||||
state.setData(wool);
|
||||
state.update();
|
||||
if (block.getType() != Material.AIR &&
|
||||
block.getType() != Material.CAVE_AIR) {
|
||||
for (BlockFace face : main.faces) {
|
||||
if (block.getRelative(face).getType() == Material.AIR ||
|
||||
block.getRelative(face).getType() == Material.CAVE_AIR) {
|
||||
block.setType(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,51 @@
|
|||
package pw.kaboom.weapons;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
HashSet<UUID> machineGunActive = new HashSet<UUID>();
|
||||
HashSet<BlockFace> faces = new HashSet<>();
|
||||
HashSet<UUID> machineGunActive = new HashSet<>();
|
||||
|
||||
List<Material> colors = Arrays.asList(
|
||||
Material.BLACK_WOOL,
|
||||
Material.BLUE_WOOL,
|
||||
Material.BROWN_WOOL,
|
||||
Material.CYAN_WOOL,
|
||||
Material.GRAY_WOOL,
|
||||
Material.GREEN_WOOL,
|
||||
Material.LIGHT_BLUE_WOOL,
|
||||
Material.LIGHT_GRAY_WOOL,
|
||||
Material.LIME_WOOL,
|
||||
Material.MAGENTA_WOOL,
|
||||
Material.ORANGE_WOOL,
|
||||
Material.PINK_WOOL,
|
||||
Material.PURPLE_WOOL,
|
||||
Material.RED_WOOL,
|
||||
Material.WHITE_WOOL,
|
||||
Material.YELLOW_WOOL
|
||||
);
|
||||
|
||||
public void onEnable() {
|
||||
Collections.addAll(
|
||||
faces,
|
||||
BlockFace.NORTH,
|
||||
BlockFace.SOUTH,
|
||||
BlockFace.WEST,
|
||||
BlockFace.EAST,
|
||||
BlockFace.UP,
|
||||
BlockFace.DOWN
|
||||
);
|
||||
|
||||
this.getCommand("weapons").setExecutor(new CommandWeapons());
|
||||
this.getServer().getPluginManager().registerEvents(new Events(this), this);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue