mirror of
https://github.com/darksaid98/Builders-Utilities.git
synced 2026-12-01 14:38:46 +00:00
Do style from 8bd43aa1eb properly
This commit is contained in:
55 files changed
+1499
-188
No files matched your search
+1013
File diff suppressed because it is too large.
Load diff
@@ -4,7 +4,7 @@ on: ["pull_request", "push"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: "ubuntu-latest"
|
||||
runs-on: "ubuntu-20.04"
|
||||
steps:
|
||||
- name: "Checkout Repository"
|
||||
uses: "actions/[email protected]"
|
||||
|
||||
+6
-7
@@ -9,6 +9,9 @@ plugins {
|
||||
id("org.cadixdev.licenser") version "0.6.1"
|
||||
id("com.github.johnrengelman.shadow") version "7.0.0"
|
||||
id("org.ajoberstar.grgit") version "4.1.0"
|
||||
|
||||
idea
|
||||
eclipse
|
||||
}
|
||||
|
||||
the<JavaPluginExtension>().toolchain {
|
||||
@@ -33,10 +36,6 @@ repositories {
|
||||
name = "Mojang"
|
||||
url = uri("https://libraries.minecraft.net/")
|
||||
}
|
||||
maven {
|
||||
name = "IntellectualSites"
|
||||
url = uri("https://mvn.intellectualsites.com/content/groups/public/")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -45,7 +44,7 @@ dependencies {
|
||||
implementation("org.bstats:bstats-bukkit:2.2.1")
|
||||
implementation("org.bstats:bstats-base:2.2.1")
|
||||
implementation("com.github.cryptomorin:XSeries:8.4.0")
|
||||
implementation("org.incendo.serverlib:ServerLib:2.2.1")
|
||||
implementation("dev.notmyfault.serverlib:ServerLib:2.3.0")
|
||||
implementation("io.papermc:paperlib:1.0.6")
|
||||
compileOnlyApi("org.apache.logging.log4j:log4j-api:2.14.1")
|
||||
}
|
||||
@@ -68,7 +67,7 @@ version = String.format("%s-%s", rootProject.version, buildNumber)
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
archiveClassifier.set(null as String?)
|
||||
dependencies {
|
||||
relocate("com.cryptomorin.xseries", "net.arcaniax.utils") {
|
||||
relocate("com.cryptomorin.xseries", "net.arcaniax.buildersutilities.xseries") {
|
||||
include(dependency("com.github.cryptomorin:XSeries:8.4.0"))
|
||||
}
|
||||
relocate("org.bstats", "net.arcaniax.buildersutilities.metrics") {
|
||||
@@ -79,7 +78,7 @@ tasks.named<ShadowJar>("shadowJar") {
|
||||
include(dependency("io.papermc:paperlib:1.0.6"))
|
||||
}
|
||||
relocate("org.incendo.serverlib", "net.arcaniax.buildersutilities.serverlib") {
|
||||
include(dependency("org.incendo.serverlib:ServerLib:2.2.1"))
|
||||
include(dependency("dev.notmyfault.serverlib:ServerLib:2.3.0"))
|
||||
}
|
||||
}
|
||||
minimize()
|
||||
|
||||
@@ -106,8 +106,10 @@ public final class BuildersUtilities extends JavaPlugin {
|
||||
|
||||
CommandExecutor commandExecutor = new CommandExecutor() {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender commandSender, Command command, String s,
|
||||
String[] strings) {
|
||||
public boolean onCommand(
|
||||
CommandSender commandSender, Command command, String s,
|
||||
String[] strings
|
||||
) {
|
||||
String[] commandArgs = new String[strings.length + 1];
|
||||
commandArgs[0] = s;
|
||||
System.arraycopy(strings, 0, commandArgs, 1, strings.length);
|
||||
@@ -115,7 +117,7 @@ public final class BuildersUtilities extends JavaPlugin {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
getCommand("butil").setExecutor(commandExecutor);
|
||||
getCommand("banner").setExecutor(commandExecutor);
|
||||
getCommand("banner").setExecutor(commandExecutor);
|
||||
@@ -157,4 +159,5 @@ public final class BuildersUtilities extends JavaPlugin {
|
||||
public NmsManager getNmsManager() {
|
||||
return nmsManager;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -93,4 +93,5 @@ public class NoClipManager {
|
||||
|| player.getLocation().add(0, 1, -0.4).getBlock().getType().isSolid()
|
||||
|| player.getLocation().add(0, +1.9, 0).getBlock().getType().isSolid();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -60,4 +60,5 @@ public class Settings {
|
||||
sendErrorMessages = customConfig.get("send-error-messages", Boolean.class, true);
|
||||
sendDebugMessages = customConfig.get("send-debug-messages", Boolean.class, false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class AdvancedFlyCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.advancedfly")) {
|
||||
@@ -47,4 +48,5 @@ public class AdvancedFlyCommand implements ICommand {
|
||||
player.sendMessage(BuildersUtilities.MSG_PREFIX + "Advanced Fly " + ChatColor.RED + "disabled");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import net.arcaniax.buildersutilities.menus.Menus;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ColorCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.color")) {
|
||||
@@ -42,4 +43,5 @@ public class ColorCommand implements ICommand {
|
||||
|
||||
Menus.COLOR_MENU.open(player);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class NightVisionCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.nightvision")) {
|
||||
@@ -47,7 +48,8 @@ public class NightVisionCommand implements ICommand {
|
||||
player.sendMessage(BuildersUtilities.MSG_PREFIX + "Night Vision " + ChatColor.RED + "disabled");
|
||||
} else {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, true, false));
|
||||
player.sendMessage(BuildersUtilities.MSG_PREFIX + "Night Vision " + ChatColor.GREEN + "enabled");
|
||||
player.sendMessage(BuildersUtilities.MSG_PREFIX + "Night Vision " + ChatColor.GREEN + "enabled");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class NoClipCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.noclip")) {
|
||||
@@ -53,4 +54,5 @@ public class NoClipCommand implements ICommand {
|
||||
player.sendMessage(BuildersUtilities.MSG_PREFIX + "NoClip " + ChatColor.GREEN + "enabled");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import net.arcaniax.buildersutilities.menus.Menus;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SecretBlockCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.secretblocks")) {
|
||||
@@ -42,4 +43,5 @@ public class SecretBlockCommand implements ICommand {
|
||||
|
||||
Menus.SECRET_BLOCK_MENU.open(player);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import net.arcaniax.buildersutilities.menus.Menus;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class UtilsCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.gui")) {
|
||||
@@ -42,4 +43,5 @@ public class UtilsCommand implements ICommand {
|
||||
|
||||
Menus.TOGGLE_MENU.open(player);
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -30,6 +30,7 @@ import net.arcaniax.buildersutilities.commands.system.ICommand;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ConvexSelectionAliasCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.aliases")) {
|
||||
@@ -42,4 +43,5 @@ public class ConvexSelectionAliasCommand implements ICommand {
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/sel convex");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import net.arcaniax.buildersutilities.commands.system.ICommand;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CopyAliasCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.aliases")) {
|
||||
@@ -46,6 +47,7 @@ public class CopyAliasCommand implements ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/copy " + builder.toString());
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/copy " + builder);
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -30,6 +30,7 @@ import net.arcaniax.buildersutilities.commands.system.ICommand;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CuboidSelectionAliasCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.aliases")) {
|
||||
@@ -42,4 +43,5 @@ public class CuboidSelectionAliasCommand implements ICommand {
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/sel cuboid");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -70,4 +70,5 @@ public class DeformRotateAliasCommand implements ICommand {
|
||||
player.sendMessage(BuildersUtilities.MSG_PREFIX + ChatColor.RED + "//derot [axis] [degrees]");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import net.arcaniax.buildersutilities.commands.system.ICommand;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FlipAliasCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.aliases")) {
|
||||
@@ -46,6 +47,7 @@ public class FlipAliasCommand implements ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/flip " + builder.toString());
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/flip " + builder);
|
||||
}
|
||||
|
||||
}
|
||||
+3
-1
@@ -30,6 +30,7 @@ import net.arcaniax.buildersutilities.commands.system.ICommand;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FlySpeedAliasCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.aliases")) {
|
||||
@@ -46,6 +47,7 @@ public class FlySpeedAliasCommand implements ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "speed fly " + builder.toString());
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "speed fly " + builder);
|
||||
}
|
||||
|
||||
}
|
||||
+3
-1
@@ -30,6 +30,7 @@ import net.arcaniax.buildersutilities.commands.system.ICommand;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PasteAliasCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.aliases")) {
|
||||
@@ -46,6 +47,7 @@ public class PasteAliasCommand implements ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/paste " + builder.toString());
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/paste " + builder);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import net.arcaniax.buildersutilities.commands.system.ICommand;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PosOneAliasCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.aliases")) {
|
||||
@@ -42,4 +43,5 @@ public class PosOneAliasCommand implements ICommand {
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/pos1");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import net.arcaniax.buildersutilities.commands.system.ICommand;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PosTwoAliasCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.aliases")) {
|
||||
@@ -42,4 +43,5 @@ public class PosTwoAliasCommand implements ICommand {
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/pos2");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+3
-1
@@ -30,6 +30,7 @@ import net.arcaniax.buildersutilities.commands.system.ICommand;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ReplaceAliasCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.aliases")) {
|
||||
@@ -46,6 +47,7 @@ public class ReplaceAliasCommand implements ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/replace " + builder.toString());
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/replace " + builder);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ScaleAliasCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.aliases")) {
|
||||
@@ -55,4 +56,5 @@ public class ScaleAliasCommand implements ICommand {
|
||||
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/deform x/=" + size + ";y/=" + size + ";z/=" + size);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import net.arcaniax.buildersutilities.commands.system.ICommand;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SetAliasCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.aliases")) {
|
||||
@@ -46,6 +47,7 @@ public class SetAliasCommand implements ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/set " + builder.toString());
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "/set " + builder);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -67,4 +67,5 @@ public class TwistAliasCommand implements ICommand {
|
||||
player.sendMessage(BuildersUtilities.MSG_PREFIX + ChatColor.RED + "//twist [axis] [degrees]");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+3
-1
@@ -30,6 +30,7 @@ import net.arcaniax.buildersutilities.commands.system.ICommand;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class WalkSpeedAliasCommand implements ICommand {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, String[] args) {
|
||||
if (!player.hasPermission("builders.util.aliases")) {
|
||||
@@ -46,6 +47,7 @@ public class WalkSpeedAliasCommand implements ICommand {
|
||||
}
|
||||
}
|
||||
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "speed walk " + builder.toString());
|
||||
BuildersUtilities.getInstance().getServer().dispatchCommand(player, "speed walk " + builder);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,24 +28,24 @@ import net.arcaniax.buildersutilities.BuildersUtilities;
|
||||
import net.arcaniax.buildersutilities.commands.AdvancedFlyCommand;
|
||||
import net.arcaniax.buildersutilities.commands.BannerCommand;
|
||||
import net.arcaniax.buildersutilities.commands.ColorCommand;
|
||||
import net.arcaniax.buildersutilities.commands.SecretBlockCommand;
|
||||
import net.arcaniax.buildersutilities.commands.NoClipCommand;
|
||||
import net.arcaniax.buildersutilities.commands.NightVisionCommand;
|
||||
import net.arcaniax.buildersutilities.commands.NoClipCommand;
|
||||
import net.arcaniax.buildersutilities.commands.SecretBlockCommand;
|
||||
import net.arcaniax.buildersutilities.commands.UtilsCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.ConvexSelectionAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.CopyAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.CuboidSelectionAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.DeformRotateAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.FlipAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.FlySpeedAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.PasteAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.PosOneAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.PosTwoAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.SetAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.ReplaceAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.PasteAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.FlipAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.CopyAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.DeformRotateAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.TwistAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.ScaleAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.SetAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.TwistAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.WalkSpeedAliasCommand;
|
||||
import net.arcaniax.buildersutilities.commands.aliases.FlySpeedAliasCommand;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -56,6 +56,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CommandForwarder implements CommandExecutor {
|
||||
|
||||
private final Map<String, ICommand> commands;
|
||||
|
||||
public CommandForwarder() {
|
||||
@@ -104,4 +105,5 @@ public class CommandForwarder implements CommandExecutor {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,6 +40,7 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class BlockBreakListener implements Listener {
|
||||
|
||||
public static Set<UUID> slabIds;
|
||||
|
||||
public BlockBreakListener() {
|
||||
|
||||
@@ -38,18 +38,26 @@ public class BlockPhysicsListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPhysics(BlockPhysicsEvent e) {
|
||||
if (e.getSourceBlock().getType().equals(Material.AIR)){
|
||||
if (e.getChangedType().equals(Material.AIR)){
|
||||
if (e.getBlock().getLocation().getBlockY()>0){
|
||||
if (e.getBlock().getLocation().add(0, -1, 0).getBlock().getType().name().toLowerCase().contains("grass_block")){
|
||||
if (e.getSourceBlock().getType().equals(Material.AIR)) {
|
||||
if (e.getChangedType().equals(Material.AIR)) {
|
||||
if (e.getBlock().getLocation().getBlockY() > 0) {
|
||||
if (e
|
||||
.getBlock()
|
||||
.getLocation()
|
||||
.add(0, -1, 0)
|
||||
.getBlock()
|
||||
.getType()
|
||||
.name()
|
||||
.toLowerCase()
|
||||
.contains("grass_block")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (e.getSourceBlock().getType().name().toLowerCase().contains("snow")){
|
||||
if (e.getBlock().getLocation().getBlockY()>0){
|
||||
if (e.getBlock().getLocation().add(0, -1, 0).getBlock().getType().name().toLowerCase().contains("grass_block")){
|
||||
if (e.getSourceBlock().getType().name().toLowerCase().contains("snow")) {
|
||||
if (e.getBlock().getLocation().getBlockY() > 0) {
|
||||
if (e.getBlock().getLocation().add(0, -1, 0).getBlock().getType().name().toLowerCase().contains("grass_block")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -90,7 +98,7 @@ public class BlockPhysicsListener implements Listener {
|
||||
e.setCancelled(true);
|
||||
if (Settings.sendDebugMessages) {
|
||||
logger.info(
|
||||
"Gravity physics were cancelled because disable-gravity-physics: true");
|
||||
"Gravity physics were cancelled because disable-gravity-physics: true");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,10 +107,11 @@ public class BlockPhysicsListener implements Listener {
|
||||
e.setCancelled(true);
|
||||
if (Settings.sendDebugMessages) {
|
||||
logger.info(
|
||||
"Physics were cancelled because disable-physics: true");
|
||||
"Physics were cancelled because disable-physics: true");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class ExplosionListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
if (Settings.sendDebugMessages) {
|
||||
logger.info(
|
||||
"Explosion was cancelled because disable-explosions: true");
|
||||
"Explosion was cancelled because disable-explosions: true");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class IronTrapdoorListener implements Listener {
|
||||
|
||||
public static Set<UUID> ironTrapdoorIds;
|
||||
|
||||
public IronTrapdoorListener() {
|
||||
|
||||
@@ -41,7 +41,7 @@ public class LeafDecayListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
if (Settings.sendDebugMessages) {
|
||||
logger.info(
|
||||
"Leaf decay was cancelled because disable-leaves-decay: true");
|
||||
"Leaf decay was cancelled because disable-leaves-decay: true");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ public class PlayerInteractListener implements Listener {
|
||||
&& event.getClickedBlock().getType().equals(Material.DRAGON_EGG)
|
||||
&& Settings.preventDragonEggTeleport
|
||||
&& !(event.getPlayer().isSneaking()
|
||||
&& (!event.getPlayer().getInventory().getItemInOffHand().getType().isAir()
|
||||
|| !event.getPlayer().getInventory().getItemInMainHand().getType().isAir()))
|
||||
&& (!event.getPlayer().getInventory().getItemInOffHand().getType().isAir()
|
||||
|| !event.getPlayer().getInventory().getItemInMainHand().getType().isAir()))
|
||||
) {
|
||||
event.setCancelled(true);
|
||||
if (Settings.sendDebugMessages) {
|
||||
logger.info(
|
||||
"Dragon egg teleport was cancelled because prevent-dragon-egg-teleport: true");
|
||||
"Dragon egg teleport was cancelled because prevent-dragon-egg-teleport: true");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,11 +72,12 @@ public class PlayerInteractListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
if (Settings.sendDebugMessages) {
|
||||
logger.info(
|
||||
"Soil trampling was cancelled because disable-soil-trample: true");
|
||||
"Soil trampling was cancelled because disable-soil-trample: true");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,9 +31,15 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerMoveListener implements Listener {
|
||||
|
||||
private static final List<String> slower = new ArrayList<>();
|
||||
private static final List<String> slower2 = new ArrayList<>();
|
||||
public static Set<UUID> enabledPlayers = new HashSet<>();
|
||||
@@ -55,7 +61,10 @@ public class PlayerMoveListener implements Listener {
|
||||
if (!enabledPlayers.contains(e.getPlayer().getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
Double speed = e.getFrom().clone().add(0, -e.getFrom().getY(), 0).distance(e.getTo().clone().add(0, -e.getTo().getY(), 0));
|
||||
Double speed = e.getFrom().clone().add(0, -e.getFrom().getY(), 0).distance(e
|
||||
.getTo()
|
||||
.clone()
|
||||
.add(0, -e.getTo().getY(), 0));
|
||||
|
||||
if (Math.abs(e.getFrom().getYaw() - e.getTo().getYaw()) > 2.5) {
|
||||
return;
|
||||
@@ -93,4 +102,5 @@ public class PlayerMoveListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,6 +36,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class PlayerQuitAndJoinListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
@@ -45,7 +45,9 @@ public class TeleportListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
if (Settings.sendDebugMessages) {
|
||||
logger.info(
|
||||
"Spectate teleport was cancelled because {} lacks the permission builders.util.tpgm3", event.getPlayer());
|
||||
"Spectate teleport was cancelled because {} lacks the permission builders.util.tpgm3",
|
||||
event.getPlayer()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class TerracottaInteractListener implements Listener {
|
||||
|
||||
public static Set<UUID> terracottaIds;
|
||||
|
||||
public TerracottaInteractListener() {
|
||||
|
||||
@@ -41,8 +41,9 @@ public class WeatherChangeListener implements Listener {
|
||||
e.setCancelled(true);
|
||||
if (Settings.sendDebugMessages) {
|
||||
logger.info(
|
||||
"Weather changing was cancelled because disable-weather-changes: true");
|
||||
"Weather changing was cancelled because disable-weather-changes: true");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,6 +35,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class ColorMenuProvider implements InventoryProvider {
|
||||
|
||||
private static final float MULTIPLIER = 255f / 20f;
|
||||
private static final String LORE = "&7__&7Left click to increase__&7Right click to decrease__&7Shift click to change by 5";
|
||||
|
||||
@@ -72,35 +73,57 @@ public class ColorMenuProvider implements InventoryProvider {
|
||||
b = (int) (contents.get(3, 6).get().getItem().getAmount() * MULTIPLIER);
|
||||
}
|
||||
|
||||
contents.set(1, 1, ClickableItem.of(Items.color(new ItemStack(Material.LEATHER_HELMET), r, g, b),
|
||||
inventoryClickEvent -> player.getInventory().addItem(Items.color(new ItemStack(Material.LEATHER_HELMET), r, g, b))));
|
||||
contents.set(2, 1, ClickableItem.of(Items.color(new ItemStack(Material.LEATHER_CHESTPLATE), r, g, b),
|
||||
inventoryClickEvent -> player.getInventory().addItem(Items.color(new ItemStack(Material.LEATHER_CHESTPLATE), r, g, b))));
|
||||
contents.set(3, 1, ClickableItem.of(Items.color(new ItemStack(Material.LEATHER_LEGGINGS), r, g, b),
|
||||
inventoryClickEvent -> player.getInventory().addItem(Items.color(new ItemStack(Material.LEATHER_LEGGINGS), r, g, b))));
|
||||
contents.set(4, 1, ClickableItem.of(Items.color(new ItemStack(Material.LEATHER_BOOTS), r, g, b),
|
||||
inventoryClickEvent -> player.getInventory().addItem(Items.color(new ItemStack(Material.LEATHER_BOOTS), r, g, b))));
|
||||
contents.set(1, 1, ClickableItem.of(
|
||||
Items.color(new ItemStack(Material.LEATHER_HELMET), r, g, b),
|
||||
inventoryClickEvent -> player.getInventory().addItem(Items.color(new ItemStack(Material.LEATHER_HELMET), r, g, b))
|
||||
));
|
||||
contents.set(2, 1, ClickableItem.of(
|
||||
Items.color(new ItemStack(Material.LEATHER_CHESTPLATE), r, g, b),
|
||||
inventoryClickEvent -> player
|
||||
.getInventory()
|
||||
.addItem(Items.color(new ItemStack(Material.LEATHER_CHESTPLATE), r, g, b))
|
||||
));
|
||||
contents.set(3, 1, ClickableItem.of(
|
||||
Items.color(new ItemStack(Material.LEATHER_LEGGINGS), r, g, b),
|
||||
inventoryClickEvent -> player
|
||||
.getInventory()
|
||||
.addItem(Items.color(new ItemStack(Material.LEATHER_LEGGINGS), r, g, b))
|
||||
));
|
||||
contents.set(4, 1, ClickableItem.of(
|
||||
Items.color(new ItemStack(Material.LEATHER_BOOTS), r, g, b),
|
||||
inventoryClickEvent -> player.getInventory().addItem(Items.color(new ItemStack(Material.LEATHER_BOOTS), r, g, b))
|
||||
));
|
||||
}
|
||||
|
||||
private void setRedItem(Player player, InventoryContents contents, int amount) {
|
||||
contents.set(3, 4, ClickableItem.of(
|
||||
amount == 0 ? Items.create(Material.RED_STAINED_GLASS, "&cRed", LORE) :
|
||||
Items.createHead("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvM2Y0NmMzMWQ2ZWU2ZWE2MTlmNzJlNzg1MjMyY2IwNDhhYjI3MDQ2MmRiMGNiMTQ1NDUxNDQzNjI1MWMxYSJ9fX0=",
|
||||
amount, "&cRed", LORE), inventoryClickEvent -> {
|
||||
Items.createHead(
|
||||
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvM2Y0NmMzMWQ2ZWU2ZWE2MTlmNzJlNzg1MjMyY2IwNDhhYjI3MDQ2MmRiMGNiMTQ1NDUxNDQzNjI1MWMxYSJ9fX0=",
|
||||
amount,
|
||||
"&cRed",
|
||||
LORE
|
||||
), inventoryClickEvent -> {
|
||||
if (inventoryClickEvent.isShiftClick()) {
|
||||
setRedItem(player, contents,
|
||||
inventoryClickEvent.isLeftClick() ? Math.min(amount + 5, 20) : Math.max(amount - 5, 0));
|
||||
inventoryClickEvent.isLeftClick() ? Math.min(amount + 5, 20) : Math.max(amount - 5, 0)
|
||||
);
|
||||
} else {
|
||||
setRedItem(player, contents,
|
||||
inventoryClickEvent.isLeftClick() ? Math.min(amount + 1, 20) : Math.max(amount - 1, 0));
|
||||
inventoryClickEvent.isLeftClick() ? Math.min(amount + 1, 20) : Math.max(amount - 1, 0)
|
||||
);
|
||||
}
|
||||
setLeatherItems(player, contents);
|
||||
}));
|
||||
}
|
||||
|
||||
private void setRedRandomItem(Player player, InventoryContents contents) {
|
||||
contents.set(2, 4, ClickableItem.of(Items.createHead("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTEzMWRlOGU5NTFmZGQ3YjlhM2QyMzlkN2NjM2FhM2U4NjU1YTMzNmI5OTliOWVkYmI0ZmIzMjljYmQ4NyJ9fX0=",
|
||||
1, "&cClick to randomize", ""), inventoryClickEvent -> {
|
||||
contents.set(2, 4, ClickableItem.of(Items.createHead(
|
||||
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTEzMWRlOGU5NTFmZGQ3YjlhM2QyMzlkN2NjM2FhM2U4NjU1YTMzNmI5OTliOWVkYmI0ZmIzMjljYmQ4NyJ9fX0=",
|
||||
1,
|
||||
"&cClick to randomize",
|
||||
""
|
||||
), inventoryClickEvent -> {
|
||||
setRedItem(player, contents, ThreadLocalRandom.current().nextInt(0, 21));
|
||||
setLeatherItems(player, contents);
|
||||
}));
|
||||
@@ -109,22 +132,32 @@ public class ColorMenuProvider implements InventoryProvider {
|
||||
private void setGreenItem(Player player, InventoryContents contents, int amount) {
|
||||
contents.set(3, 5, ClickableItem.of(
|
||||
amount == 0 ? Items.create(Material.GREEN_STAINED_GLASS, "&aGreen", LORE) :
|
||||
Items.createHead("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzZmNjlmN2I3NTM4YjQxZGMzNDM5ZjM2NThhYmJkNTlmYWNjYTM2NmYxOTBiY2YxZDZkMGEwMjZjOGY5NiJ9fX0=",
|
||||
amount, "&aGreen", LORE), inventoryClickEvent -> {
|
||||
Items.createHead(
|
||||
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzZmNjlmN2I3NTM4YjQxZGMzNDM5ZjM2NThhYmJkNTlmYWNjYTM2NmYxOTBiY2YxZDZkMGEwMjZjOGY5NiJ9fX0=",
|
||||
amount,
|
||||
"&aGreen",
|
||||
LORE
|
||||
), inventoryClickEvent -> {
|
||||
if (inventoryClickEvent.isShiftClick()) {
|
||||
setGreenItem(player, contents,
|
||||
inventoryClickEvent.isLeftClick() ? Math.min(amount + 5, 20) : Math.max(amount - 5, 0));
|
||||
inventoryClickEvent.isLeftClick() ? Math.min(amount + 5, 20) : Math.max(amount - 5, 0)
|
||||
);
|
||||
} else {
|
||||
setGreenItem(player, contents,
|
||||
inventoryClickEvent.isLeftClick() ? Math.min(amount + 1, 20) : Math.max(amount - 1, 0));
|
||||
inventoryClickEvent.isLeftClick() ? Math.min(amount + 1, 20) : Math.max(amount - 1, 0)
|
||||
);
|
||||
}
|
||||
setLeatherItems(player, contents);
|
||||
}));
|
||||
}
|
||||
|
||||
private void setGreenRandomItem(Player player, InventoryContents contents) {
|
||||
contents.set(2, 5, ClickableItem.of(Items.createHead("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWMzY2VjNjg3NjlmZTljOTcxMjkxZWRiN2VmOTZhNGUzYjYwNDYyY2ZkNWZiNWJhYTFjYmIzYTcxNTEzZTdiIn19fQ==",
|
||||
1, "&aClick to randomize", ""), inventoryClickEvent -> {
|
||||
contents.set(2, 5, ClickableItem.of(Items.createHead(
|
||||
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWMzY2VjNjg3NjlmZTljOTcxMjkxZWRiN2VmOTZhNGUzYjYwNDYyY2ZkNWZiNWJhYTFjYmIzYTcxNTEzZTdiIn19fQ==",
|
||||
1,
|
||||
"&aClick to randomize",
|
||||
""
|
||||
), inventoryClickEvent -> {
|
||||
setGreenItem(player, contents, ThreadLocalRandom.current().nextInt(0, 21));
|
||||
setLeatherItems(player, contents);
|
||||
}));
|
||||
@@ -133,22 +166,32 @@ public class ColorMenuProvider implements InventoryProvider {
|
||||
private void setBlueItem(Player player, InventoryContents contents, int amount) {
|
||||
contents.set(3, 6, ClickableItem.of(
|
||||
amount == 0 ? Items.create(Material.BLUE_STAINED_GLASS, "&bBlue", LORE) :
|
||||
Items.createHead("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjgzOWUzODFkOWZlZGFiNmY4YjU5Mzk2YTI3NjQyMzhkY2ViMmY3ZWVhODU2ZGM2ZmM0NDc2N2RhMzgyZjEifX19",
|
||||
amount, "&bBlue", LORE), inventoryClickEvent -> {
|
||||
Items.createHead(
|
||||
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjgzOWUzODFkOWZlZGFiNmY4YjU5Mzk2YTI3NjQyMzhkY2ViMmY3ZWVhODU2ZGM2ZmM0NDc2N2RhMzgyZjEifX19",
|
||||
amount,
|
||||
"&bBlue",
|
||||
LORE
|
||||
), inventoryClickEvent -> {
|
||||
if (inventoryClickEvent.isShiftClick()) {
|
||||
setBlueItem(player, contents,
|
||||
inventoryClickEvent.isLeftClick() ? Math.min(amount + 5, 20) : Math.max(amount - 5, 0));
|
||||
inventoryClickEvent.isLeftClick() ? Math.min(amount + 5, 20) : Math.max(amount - 5, 0)
|
||||
);
|
||||
} else {
|
||||
setBlueItem(player, contents,
|
||||
inventoryClickEvent.isLeftClick() ? Math.min(amount + 1, 20) : Math.max(amount - 1, 0));
|
||||
inventoryClickEvent.isLeftClick() ? Math.min(amount + 1, 20) : Math.max(amount - 1, 0)
|
||||
);
|
||||
}
|
||||
setLeatherItems(player, contents);
|
||||
}));
|
||||
}
|
||||
|
||||
private void setBlueRandomItem(Player player, InventoryContents contents) {
|
||||
contents.set(2, 6, ClickableItem.of(Items.createHead("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjMyOGYzNzhmMjhhOTg3MjIyNmY1Y2UwNGQ2ZTFkZmExMTE2MTg1ODdmNDhkZmExZmU4MmQwNDMyMTZhNWNmIn19fQ==",
|
||||
1, "&bClick to randomize", ""), inventoryClickEvent -> {
|
||||
contents.set(2, 6, ClickableItem.of(Items.createHead(
|
||||
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjMyOGYzNzhmMjhhOTg3MjIyNmY1Y2UwNGQ2ZTFkZmExMTE2MTg1ODdmNDhkZmExZmU4MmQwNDMyMTZhNWNmIn19fQ==",
|
||||
1,
|
||||
"&bClick to randomize",
|
||||
""
|
||||
), inventoryClickEvent -> {
|
||||
setBlueItem(player, contents, ThreadLocalRandom.current().nextInt(0, 21));
|
||||
setLeatherItems(player, contents);
|
||||
}));
|
||||
|
||||
@@ -34,21 +34,54 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SecretBlockMenuProvider implements InventoryProvider {
|
||||
|
||||
private static final ItemStack SPAWNER = Items.create(Material.SPAWNER, (short) 0, 1, ChatColor.BLUE + "Spawner", "");
|
||||
private static final ItemStack BARRIER = Items.create(Material.BARRIER, (short) 0, 1, ChatColor.RED + "Barrier", "");
|
||||
private static final ItemStack DRAGON_EGG = Items.create(Material.DRAGON_EGG, (short) 0, 1, ChatColor.LIGHT_PURPLE + "Dragon Egg", "");
|
||||
private static final ItemStack STRUCTURE_VOID = Items.create(Material.STRUCTURE_VOID, (short) 0, 1, ChatColor.DARK_AQUA + "Structure Void", "");
|
||||
private static final ItemStack DEBUG_STICK = Items.create(Material.DEBUG_STICK, (short) 0, 1, ChatColor.AQUA + "Debug Stick", "&7Only works as operator in creative.");
|
||||
private static final ItemStack STRUCTURE_BLOCK = Items.create(Material.STRUCTURE_BLOCK, (short) 0, 1, ChatColor.AQUA + "Structure Block", "");
|
||||
private static final ItemStack DRAGON_EGG = Items.create(
|
||||
Material.DRAGON_EGG,
|
||||
(short) 0,
|
||||
1,
|
||||
ChatColor.LIGHT_PURPLE + "Dragon Egg",
|
||||
""
|
||||
);
|
||||
private static final ItemStack STRUCTURE_VOID = Items.create(
|
||||
Material.STRUCTURE_VOID,
|
||||
(short) 0,
|
||||
1,
|
||||
ChatColor.DARK_AQUA + "Structure Void",
|
||||
""
|
||||
);
|
||||
private static final ItemStack DEBUG_STICK = Items.create(
|
||||
Material.DEBUG_STICK,
|
||||
(short) 0,
|
||||
1,
|
||||
ChatColor.AQUA + "Debug Stick",
|
||||
"&7Only works as operator in creative."
|
||||
);
|
||||
private static final ItemStack STRUCTURE_BLOCK = Items.create(
|
||||
Material.STRUCTURE_BLOCK,
|
||||
(short) 0,
|
||||
1,
|
||||
ChatColor.AQUA + "Structure Block",
|
||||
""
|
||||
);
|
||||
|
||||
@Override
|
||||
public void init(Player player, InventoryContents contents) {
|
||||
contents.set(0, 0, ClickableItem.of(DEBUG_STICK, inventoryClickEvent -> player.getInventory().addItem(DEBUG_STICK)));
|
||||
contents.set(0, 1, ClickableItem.of(SPAWNER, inventoryClickEvent -> player.getInventory().addItem(SPAWNER)));
|
||||
contents.set(0, 2, ClickableItem.of(BARRIER, inventoryClickEvent -> player.getInventory().addItem(BARRIER)));
|
||||
contents.set(0, 3, ClickableItem.of(STRUCTURE_VOID, inventoryClickEvent -> player.getInventory().addItem(STRUCTURE_VOID)));
|
||||
contents.set(
|
||||
0,
|
||||
3,
|
||||
ClickableItem.of(STRUCTURE_VOID, inventoryClickEvent -> player.getInventory().addItem(STRUCTURE_VOID))
|
||||
);
|
||||
contents.set(0, 4, ClickableItem.of(DRAGON_EGG, inventoryClickEvent -> player.getInventory().addItem(DRAGON_EGG)));
|
||||
contents.set(0, 5, ClickableItem.of(STRUCTURE_BLOCK, inventoryClickEvent -> player.getInventory().addItem(STRUCTURE_BLOCK)));
|
||||
contents.set(
|
||||
0,
|
||||
5,
|
||||
ClickableItem.of(STRUCTURE_BLOCK, inventoryClickEvent -> player.getInventory().addItem(STRUCTURE_BLOCK))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class UtilitiesMenuProvider implements InventoryProvider {
|
||||
|
||||
private static final ItemStack ENABLED = Items.create(Material.GREEN_STAINED_GLASS_PANE, "&c", "");
|
||||
private static final ItemStack DISABLED = Items.create(Material.RED_STAINED_GLASS_PANE, "&c", "");
|
||||
private static final ItemStack NO_PERMISSION = Items.create(Material.ORANGE_STAINED_GLASS_PANE, "&c", "");
|
||||
@@ -76,20 +77,26 @@ public class UtilitiesMenuProvider implements InventoryProvider {
|
||||
|
||||
if (!IronTrapdoorListener.ironTrapdoorIds.contains(player.getUniqueId())) {
|
||||
setEnabledGlassPanes(1, true, contents);
|
||||
contents.set(1, 1, ClickableItem.of(Items.create(Material.IRON_TRAPDOOR,
|
||||
"&6Iron Trapdoor Interaction", ENABLED_LORE + IRON_TRAPDOOR_LORE),
|
||||
contents.set(1, 1, ClickableItem.of(
|
||||
Items.create(Material.IRON_TRAPDOOR,
|
||||
"&6Iron Trapdoor Interaction", ENABLED_LORE + IRON_TRAPDOOR_LORE
|
||||
),
|
||||
inventoryClickEvent -> {
|
||||
IronTrapdoorListener.ironTrapdoorIds.add(player.getUniqueId());
|
||||
setIronTrapdoorItem(player, contents);
|
||||
}));
|
||||
}
|
||||
));
|
||||
} else {
|
||||
setEnabledGlassPanes(1, false, contents);
|
||||
contents.set(1, 1, ClickableItem.of(Items.create(Material.IRON_TRAPDOOR,
|
||||
"&6Iron Trapdoor Interaction", DISABLED_LORE + IRON_TRAPDOOR_LORE),
|
||||
contents.set(1, 1, ClickableItem.of(
|
||||
Items.create(Material.IRON_TRAPDOOR,
|
||||
"&6Iron Trapdoor Interaction", DISABLED_LORE + IRON_TRAPDOOR_LORE
|
||||
),
|
||||
inventoryClickEvent -> {
|
||||
IronTrapdoorListener.ironTrapdoorIds.remove(player.getUniqueId());
|
||||
setIronTrapdoorItem(player, contents);
|
||||
}));
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,20 +110,26 @@ public class UtilitiesMenuProvider implements InventoryProvider {
|
||||
|
||||
if (!BlockBreakListener.slabIds.contains(player.getUniqueId())) {
|
||||
setEnabledGlassPanes(2, true, contents);
|
||||
contents.set(1, 2, ClickableItem.of(Items.create(Material.STONE_SLAB,
|
||||
"&6Custom Slab Breaking", ENABLED_LORE + SLAB_BREAKING_LORE),
|
||||
contents.set(1, 2, ClickableItem.of(
|
||||
Items.create(Material.STONE_SLAB,
|
||||
"&6Custom Slab Breaking", ENABLED_LORE + SLAB_BREAKING_LORE
|
||||
),
|
||||
inventoryClickEvent -> {
|
||||
BlockBreakListener.slabIds.add(player.getUniqueId());
|
||||
setSlabItem(player, contents);
|
||||
}));
|
||||
}
|
||||
));
|
||||
} else {
|
||||
setEnabledGlassPanes(2, false, contents);
|
||||
contents.set(1, 2, ClickableItem.of(Items.create(Material.STONE_SLAB,
|
||||
"&6Custom Slab Breaking", DISABLED_LORE + SLAB_BREAKING_LORE),
|
||||
contents.set(1, 2, ClickableItem.of(
|
||||
Items.create(Material.STONE_SLAB,
|
||||
"&6Custom Slab Breaking", DISABLED_LORE + SLAB_BREAKING_LORE
|
||||
),
|
||||
inventoryClickEvent -> {
|
||||
BlockBreakListener.slabIds.remove(player.getUniqueId());
|
||||
setSlabItem(player, contents);
|
||||
}));
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,20 +143,26 @@ public class UtilitiesMenuProvider implements InventoryProvider {
|
||||
|
||||
if (!TerracottaInteractListener.terracottaIds.contains(player.getUniqueId())) {
|
||||
setEnabledGlassPanes(3, true, contents);
|
||||
contents.set(1, 3, ClickableItem.of(Items.create(Material.ORANGE_GLAZED_TERRACOTTA,
|
||||
"&6Glazed Terracotta Rotating", ENABLED_LORE + GLAZED_ROTATING_LORE),
|
||||
contents.set(1, 3, ClickableItem.of(
|
||||
Items.create(Material.ORANGE_GLAZED_TERRACOTTA,
|
||||
"&6Glazed Terracotta Rotating", ENABLED_LORE + GLAZED_ROTATING_LORE
|
||||
),
|
||||
inventoryClickEvent -> {
|
||||
TerracottaInteractListener.terracottaIds.add(player.getUniqueId());
|
||||
setTerracottaItem(player, contents);
|
||||
}));
|
||||
}
|
||||
));
|
||||
} else {
|
||||
setEnabledGlassPanes(3, false, contents);
|
||||
contents.set(1, 3, ClickableItem.of(Items.create(Material.ORANGE_GLAZED_TERRACOTTA,
|
||||
"&6Glazed Terracotta Rotating", DISABLED_LORE + GLAZED_ROTATING_LORE),
|
||||
contents.set(1, 3, ClickableItem.of(
|
||||
Items.create(Material.ORANGE_GLAZED_TERRACOTTA,
|
||||
"&6Glazed Terracotta Rotating", DISABLED_LORE + GLAZED_ROTATING_LORE
|
||||
),
|
||||
inventoryClickEvent -> {
|
||||
TerracottaInteractListener.terracottaIds.remove(player.getUniqueId());
|
||||
setTerracottaItem(player, contents);
|
||||
}));
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -158,20 +177,32 @@ public class UtilitiesMenuProvider implements InventoryProvider {
|
||||
|
||||
if (player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
|
||||
setEnabledGlassPanes(5, true, contents);
|
||||
contents.set(1, 5, ClickableItem.of(Items.create(Material.ENDER_EYE,
|
||||
"&6Night Vision", ENABLED_LORE + NIGHT_VISION_LORE),
|
||||
contents.set(1, 5, ClickableItem.of(
|
||||
Items.create(Material.ENDER_EYE,
|
||||
"&6Night Vision", ENABLED_LORE + NIGHT_VISION_LORE
|
||||
),
|
||||
inventoryClickEvent -> {
|
||||
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||
setNightVisionItem(player, contents);
|
||||
}));
|
||||
}
|
||||
));
|
||||
} else {
|
||||
setEnabledGlassPanes(5, false, contents);
|
||||
contents.set(1, 5, ClickableItem.of(Items.create(Material.ENDER_EYE,
|
||||
"&6Night Vision", DISABLED_LORE + NIGHT_VISION_LORE),
|
||||
contents.set(1, 5, ClickableItem.of(
|
||||
Items.create(Material.ENDER_EYE,
|
||||
"&6Night Vision", DISABLED_LORE + NIGHT_VISION_LORE
|
||||
),
|
||||
inventoryClickEvent -> {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, true, false));
|
||||
player.addPotionEffect(new PotionEffect(
|
||||
PotionEffectType.NIGHT_VISION,
|
||||
Integer.MAX_VALUE,
|
||||
0,
|
||||
true,
|
||||
false
|
||||
));
|
||||
setNightVisionItem(player, contents);
|
||||
}));
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,23 +216,29 @@ public class UtilitiesMenuProvider implements InventoryProvider {
|
||||
|
||||
if (NoClipManager.noClipPlayerIds.contains(player.getUniqueId())) {
|
||||
setEnabledGlassPanes(6, true, contents);
|
||||
contents.set(1, 6, ClickableItem.of(Items.create(Material.COMPASS,
|
||||
"&6No Clip", ENABLED_LORE + NO_CLIP_LORE),
|
||||
contents.set(1, 6, ClickableItem.of(
|
||||
Items.create(Material.COMPASS,
|
||||
"&6No Clip", ENABLED_LORE + NO_CLIP_LORE
|
||||
),
|
||||
inventoryClickEvent -> {
|
||||
NoClipManager.noClipPlayerIds.remove(player.getUniqueId());
|
||||
if (player.getGameMode().equals(GameMode.SPECTATOR)){
|
||||
if (player.getGameMode().equals(GameMode.SPECTATOR)) {
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
}
|
||||
setNoClipItem(player, contents);
|
||||
}));
|
||||
}
|
||||
));
|
||||
} else {
|
||||
setEnabledGlassPanes(6, false, contents);
|
||||
contents.set(1, 6, ClickableItem.of(Items.create(Material.COMPASS,
|
||||
"&6No Clip", DISABLED_LORE + NO_CLIP_LORE),
|
||||
contents.set(1, 6, ClickableItem.of(
|
||||
Items.create(Material.COMPASS,
|
||||
"&6No Clip", DISABLED_LORE + NO_CLIP_LORE
|
||||
),
|
||||
inventoryClickEvent -> {
|
||||
NoClipManager.noClipPlayerIds.add(player.getUniqueId());
|
||||
setNoClipItem(player, contents);
|
||||
}));
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,20 +252,26 @@ public class UtilitiesMenuProvider implements InventoryProvider {
|
||||
|
||||
if (PlayerMoveListener.enabledPlayers.contains(player.getUniqueId())) {
|
||||
setEnabledGlassPanes(7, true, contents);
|
||||
contents.set(1, 7, ClickableItem.of(Items.create(Material.FEATHER,
|
||||
"&6Advanced Fly", ENABLED_LORE + ADVANCED_FLY_LORE),
|
||||
contents.set(1, 7, ClickableItem.of(
|
||||
Items.create(Material.FEATHER,
|
||||
"&6Advanced Fly", ENABLED_LORE + ADVANCED_FLY_LORE
|
||||
),
|
||||
inventoryClickEvent -> {
|
||||
PlayerMoveListener.enabledPlayers.remove(player.getUniqueId());
|
||||
setFlyItem(player, contents);
|
||||
}));
|
||||
}
|
||||
));
|
||||
} else {
|
||||
setEnabledGlassPanes(7, false, contents);
|
||||
contents.set(1, 7, ClickableItem.of(Items.create(Material.FEATHER,
|
||||
"&6Advanced Fly", DISABLED_LORE + ADVANCED_FLY_LORE),
|
||||
contents.set(1, 7, ClickableItem.of(
|
||||
Items.create(Material.FEATHER,
|
||||
"&6Advanced Fly", DISABLED_LORE + ADVANCED_FLY_LORE
|
||||
),
|
||||
inventoryClickEvent -> {
|
||||
PlayerMoveListener.enabledPlayers.add(player.getUniqueId());
|
||||
setFlyItem(player, contents);
|
||||
}));
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,4 +292,5 @@ public class UtilitiesMenuProvider implements InventoryProvider {
|
||||
contents.set(0, col, ClickableItem.empty(NO_PERMISSION));
|
||||
contents.set(2, col, ClickableItem.empty(NO_PERMISSION));
|
||||
}
|
||||
|
||||
}
|
||||
+26
-9
@@ -38,7 +38,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class BannerColorMenuProvider implements InventoryProvider {
|
||||
|
||||
@@ -47,7 +46,10 @@ public class BannerColorMenuProvider implements InventoryProvider {
|
||||
.create(Material.GRAY_STAINED_GLASS_PANE, (short) 0, 1, "&7", "");
|
||||
private static final ItemStack randomizeHead = Items.createHead(
|
||||
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzk3OTU1NDYyZTRlNTc2NjY0NDk5YWM0YTFjNTcyZjYxNDNmMTlhZDJkNjE5NDc3NjE5OGY4ZDEzNmZkYjIifX19",
|
||||
1, "&7Click to randomise", "");
|
||||
1,
|
||||
"&7Click to randomise",
|
||||
""
|
||||
);
|
||||
// private static final ItemStack currentColor = BannerUtil.createBanner("&a", 1, DyeColor.WHITE, "");
|
||||
private static final ItemStack closeButton = Items
|
||||
.create(Material.BARRIER, (short) 0, 1, "&cClick to close", "");
|
||||
@@ -58,15 +60,29 @@ public class BannerColorMenuProvider implements InventoryProvider {
|
||||
public void init(Player player, InventoryContents contents) {
|
||||
contents.fill(ClickableItem.empty(grayPane));
|
||||
contents.set(0, 1, ClickableItem.of(randomizeHead, inventoryClickEvent -> selectRandomColor(player)));
|
||||
contents.set(0, 4, ClickableItem.of(BannerUtil.currentBanner.get(player.getUniqueId()), inventoryClickEvent -> getBanner(player)));
|
||||
contents.set(
|
||||
0,
|
||||
4,
|
||||
ClickableItem.of(BannerUtil.currentBanner.get(player.getUniqueId()), inventoryClickEvent -> getBanner(player))
|
||||
);
|
||||
contents.set(0, 7, ClickableItem.of(closeButton, inventoryClickEvent -> contents.inventory().close(player)));
|
||||
|
||||
int row = 2;
|
||||
int column = 1;
|
||||
for (DyeColor color : BannerUtil.allColors){
|
||||
contents.set(row, column, ClickableItem.of(BannerUtil.createDye("&3" + StringUtils.capitalize(color.toString().toLowerCase().replace("_", " ")), color, "&7__&7click to select"), inventoryClickEvent -> selectColor(player, color)));
|
||||
for (DyeColor color : BannerUtil.allColors) {
|
||||
contents.set(
|
||||
row,
|
||||
column,
|
||||
ClickableItem.of(
|
||||
BannerUtil.createDye("&3" + StringUtils.capitalize(color
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.replace("_", " ")), color, "&7__&7click to select"),
|
||||
inventoryClickEvent -> selectColor(player, color)
|
||||
)
|
||||
);
|
||||
column++;
|
||||
if (column==9){
|
||||
if (column == 9) {
|
||||
column = 1;
|
||||
row++;
|
||||
}
|
||||
@@ -85,18 +101,18 @@ public class BannerColorMenuProvider implements InventoryProvider {
|
||||
// }
|
||||
}
|
||||
|
||||
private void selectRandomColor(Player player){
|
||||
private void selectRandomColor(Player player) {
|
||||
DyeColor dyeColor = BannerUtil.getRandomDye();
|
||||
BannerUtil.selectedColor.put(player.getUniqueId(), dyeColor);
|
||||
Menus.BANNER_MENU_PATTERN.open(player);
|
||||
}
|
||||
|
||||
private void selectColor(Player player, DyeColor dyeColor){
|
||||
private void selectColor(Player player, DyeColor dyeColor) {
|
||||
BannerUtil.selectedColor.put(player.getUniqueId(), dyeColor);
|
||||
Menus.BANNER_MENU_PATTERN.open(player);
|
||||
}
|
||||
|
||||
private void getBanner(Player player){
|
||||
private void getBanner(Player player) {
|
||||
ItemStack banner = BannerUtil.currentBanner.get(player.getUniqueId());
|
||||
ItemMeta meta = banner.getItemMeta();
|
||||
meta.setDisplayName("");
|
||||
@@ -106,4 +122,5 @@ public class BannerColorMenuProvider implements InventoryProvider {
|
||||
player.closeInventory();
|
||||
BannerUtil.currentBanner.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
}
|
||||
+28
-14
@@ -26,21 +26,15 @@ package net.arcaniax.buildersutilities.menus.bannermenus;
|
||||
|
||||
import net.arcaniax.buildersutilities.menus.Menus;
|
||||
import net.arcaniax.buildersutilities.menus.inv.ClickableItem;
|
||||
import net.arcaniax.buildersutilities.menus.inv.SmartInventory;
|
||||
import net.arcaniax.buildersutilities.menus.inv.content.InventoryContents;
|
||||
import net.arcaniax.buildersutilities.menus.inv.content.InventoryProvider;
|
||||
import net.arcaniax.buildersutilities.menus.inv.content.SlotPos;
|
||||
import net.arcaniax.buildersutilities.utils.BannerUtil;
|
||||
import net.arcaniax.buildersutilities.utils.Items;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BannerMenuProvider implements InventoryProvider {
|
||||
|
||||
@@ -48,7 +42,10 @@ public class BannerMenuProvider implements InventoryProvider {
|
||||
.create(Material.GRAY_STAINED_GLASS_PANE, (short) 0, 1, "&7", "");
|
||||
private static final ItemStack randomizeHead = Items.createHead(
|
||||
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzk3OTU1NDYyZTRlNTc2NjY0NDk5YWM0YTFjNTcyZjYxNDNmMTlhZDJkNjE5NDc3NjE5OGY4ZDEzNmZkYjIifX19",
|
||||
1, "&7Click to randomise", "");
|
||||
1,
|
||||
"&7Click to randomise",
|
||||
""
|
||||
);
|
||||
// private static final ItemStack currentColor = BannerUtil.createBanner("&a", 1, DyeColor.WHITE, "");
|
||||
private static final ItemStack closeButton = Items
|
||||
.create(Material.BARRIER, (short) 0, 1, "&cClick to close", "");
|
||||
@@ -64,10 +61,20 @@ public class BannerMenuProvider implements InventoryProvider {
|
||||
|
||||
int row = 2;
|
||||
int column = 1;
|
||||
for (DyeColor color : BannerUtil.allColors){
|
||||
contents.set(row, column, ClickableItem.of(BannerUtil.createBanner("&3" + StringUtils.capitalize(color.toString().toLowerCase().replace("_", " ")), color, "&7__&7Click to select"),inventoryClickEvent -> selectColor(player, color)));
|
||||
for (DyeColor color : BannerUtil.allColors) {
|
||||
contents.set(
|
||||
row,
|
||||
column,
|
||||
ClickableItem.of(
|
||||
BannerUtil.createBanner("&3" + StringUtils.capitalize(color
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.replace("_", " ")), color, "&7__&7Click to select"),
|
||||
inventoryClickEvent -> selectColor(player, color)
|
||||
)
|
||||
);
|
||||
column++;
|
||||
if (column==9){
|
||||
if (column == 9) {
|
||||
column = 1;
|
||||
row++;
|
||||
}
|
||||
@@ -86,14 +93,21 @@ public class BannerMenuProvider implements InventoryProvider {
|
||||
// }
|
||||
}
|
||||
|
||||
private void selectRandomColor(Player player){
|
||||
private void selectRandomColor(Player player) {
|
||||
DyeColor dyeColor = BannerUtil.getRandomDye();
|
||||
BannerUtil.currentBanner.put(player.getUniqueId(), BannerUtil.createBanner("&6Banner", dyeColor, "&7__&7Click to get banner"));
|
||||
BannerUtil.currentBanner.put(
|
||||
player.getUniqueId(),
|
||||
BannerUtil.createBanner("&6Banner", dyeColor, "&7__&7Click to get banner")
|
||||
);
|
||||
Menus.BANNER_MENU_COLOR.open(player);
|
||||
}
|
||||
|
||||
private void selectColor(Player player, DyeColor dyeColor){
|
||||
BannerUtil.currentBanner.put(player.getUniqueId(), BannerUtil.createBanner("&6Banner", dyeColor, "&7__&7Click to get banner"));
|
||||
private void selectColor(Player player, DyeColor dyeColor) {
|
||||
BannerUtil.currentBanner.put(
|
||||
player.getUniqueId(),
|
||||
BannerUtil.createBanner("&6Banner", dyeColor, "&7__&7Click to get banner")
|
||||
);
|
||||
Menus.BANNER_MENU_COLOR.open(player);
|
||||
}
|
||||
|
||||
}
|
||||
+32
-16
@@ -31,7 +31,6 @@ import net.arcaniax.buildersutilities.menus.inv.content.InventoryProvider;
|
||||
import net.arcaniax.buildersutilities.utils.BannerUtil;
|
||||
import net.arcaniax.buildersutilities.utils.Items;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.banner.Pattern;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
@@ -41,7 +40,6 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BannerPatternMenuProvider implements InventoryProvider {
|
||||
|
||||
@@ -49,7 +47,10 @@ public class BannerPatternMenuProvider implements InventoryProvider {
|
||||
.create(Material.GRAY_STAINED_GLASS_PANE, (short) 0, 1, "&7", "");
|
||||
private static final ItemStack randomizeHead = Items.createHead(
|
||||
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzk3OTU1NDYyZTRlNTc2NjY0NDk5YWM0YTFjNTcyZjYxNDNmMTlhZDJkNjE5NDc3NjE5OGY4ZDEzNmZkYjIifX19",
|
||||
1, "&7Click to randomise", "");
|
||||
1,
|
||||
"&7Click to randomise",
|
||||
""
|
||||
);
|
||||
// private static final ItemStack currentColor = BannerUtil.createBanner("&a", 1, DyeColor.WHITE, "");
|
||||
private static final ItemStack closeButton = Items
|
||||
.create(Material.BARRIER, (short) 0, 1, "&cClick to close", "");
|
||||
@@ -60,17 +61,33 @@ public class BannerPatternMenuProvider implements InventoryProvider {
|
||||
public void init(Player player, InventoryContents contents) {
|
||||
contents.fill(ClickableItem.empty(grayPane));
|
||||
contents.set(0, 1, ClickableItem.of(randomizeHead, inventoryClickEvent -> selectRandomPattern(player)));
|
||||
contents.set(0, 4, ClickableItem.of(BannerUtil.currentBanner.get(player.getUniqueId()), inventoryClickEvent -> getBanner(player)));
|
||||
contents.set(
|
||||
0,
|
||||
4,
|
||||
ClickableItem.of(BannerUtil.currentBanner.get(player.getUniqueId()), inventoryClickEvent -> getBanner(player))
|
||||
);
|
||||
contents.set(0, 7, ClickableItem.of(closeButton, inventoryClickEvent -> contents.inventory().close(player)));
|
||||
|
||||
int row = 1;
|
||||
int column = 0;
|
||||
for (PatternType pattern : BannerUtil.allPatterns){
|
||||
for (PatternType pattern : BannerUtil.allPatterns) {
|
||||
List<Pattern> patterns = new ArrayList<>();
|
||||
patterns.add(new Pattern(BannerUtil.selectedColor.get(player.getUniqueId()), pattern));
|
||||
contents.set(row, column, ClickableItem.of(BannerUtil.createBanner("&3" + StringUtils.capitalize(pattern.toString().toLowerCase().replace("_", " ")), BannerUtil.getOppositeBaseColor(BannerUtil.selectedColor.get(player.getUniqueId())), "&7__&7click to select", patterns), inventoryClickEvent -> selectPattern(player, pattern)));
|
||||
contents.set(
|
||||
row,
|
||||
column,
|
||||
ClickableItem.of(BannerUtil.createBanner(
|
||||
"&3" + StringUtils.capitalize(pattern
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.replace("_", " ")),
|
||||
BannerUtil.getOppositeBaseColor(BannerUtil.selectedColor.get(player.getUniqueId())),
|
||||
"&7__&7click to select",
|
||||
patterns
|
||||
), inventoryClickEvent -> selectPattern(player, pattern))
|
||||
);
|
||||
column++;
|
||||
if (column==9){
|
||||
if (column == 9) {
|
||||
column = 0;
|
||||
row++;
|
||||
}
|
||||
@@ -89,36 +106,34 @@ public class BannerPatternMenuProvider implements InventoryProvider {
|
||||
// }
|
||||
}
|
||||
|
||||
private void selectRandomPattern(Player player){
|
||||
private void selectRandomPattern(Player player) {
|
||||
ItemStack banner = BannerUtil.currentBanner.get(player.getUniqueId());
|
||||
|
||||
|
||||
PatternType pattern = BannerUtil.getRandomPattern();
|
||||
BannerUtil.currentBanner.put(player.getUniqueId(), BannerUtil.addPattern(
|
||||
banner, new Pattern(BannerUtil.selectedColor.get(player.getUniqueId()), pattern)));
|
||||
if (BannerUtil.getPatterns(banner).size()==15){
|
||||
if (BannerUtil.getPatterns(banner).size() == 15) {
|
||||
getBanner(player);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
Menus.BANNER_MENU_COLOR.open(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void selectPattern(Player player, PatternType patternType){
|
||||
private void selectPattern(Player player, PatternType patternType) {
|
||||
ItemStack banner = BannerUtil.currentBanner.get(player.getUniqueId());
|
||||
|
||||
BannerUtil.currentBanner.put(player.getUniqueId(), BannerUtil.addPattern(
|
||||
banner, new Pattern(BannerUtil.selectedColor.get(player.getUniqueId()), patternType)));
|
||||
if (BannerUtil.getPatterns(banner).size()==15){
|
||||
if (BannerUtil.getPatterns(banner).size() == 15) {
|
||||
getBanner(player);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
Menus.BANNER_MENU_COLOR.open(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void getBanner(Player player){
|
||||
private void getBanner(Player player) {
|
||||
ItemStack banner = BannerUtil.currentBanner.get(player.getUniqueId());
|
||||
ItemMeta meta = banner.getItemMeta();
|
||||
meta.setDisplayName("");
|
||||
@@ -128,4 +143,5 @@ public class BannerPatternMenuProvider implements InventoryProvider {
|
||||
player.closeInventory();
|
||||
BannerUtil.currentBanner.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,14 +33,25 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.*;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class InventoryManager {
|
||||
|
||||
|
||||
@@ -235,6 +235,7 @@ public class SmartInventory {
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+17
-9
@@ -72,8 +72,10 @@ public interface InventoryContents {
|
||||
|
||||
InventoryContents fillBorders(ClickableItem item);
|
||||
|
||||
InventoryContents fillRect(int fromRow, int fromColumn,
|
||||
int toRow, int toColumn, ClickableItem item);
|
||||
InventoryContents fillRect(
|
||||
int fromRow, int fromColumn,
|
||||
int toRow, int toColumn, ClickableItem item
|
||||
);
|
||||
|
||||
InventoryContents fillRect(SlotPos fromPos, SlotPos toPos, ClickableItem item);
|
||||
|
||||
@@ -116,10 +118,13 @@ public interface InventoryContents {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SlotIterator newIterator(String id, SlotIterator.Type type, int startRow,
|
||||
int startColumn) {
|
||||
public SlotIterator newIterator(
|
||||
String id, SlotIterator.Type type, int startRow,
|
||||
int startColumn
|
||||
) {
|
||||
SlotIterator iterator = new SlotIterator.Impl(this, inv,
|
||||
type, startRow, startColumn);
|
||||
type, startRow, startColumn
|
||||
);
|
||||
|
||||
this.iterators.put(id, iterator);
|
||||
return iterator;
|
||||
@@ -248,8 +253,10 @@ public interface InventoryContents {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryContents fillRect(int fromRow, int fromColumn, int toRow, int toColumn,
|
||||
ClickableItem item) {
|
||||
public InventoryContents fillRect(
|
||||
int fromRow, int fromColumn, int toRow, int toColumn,
|
||||
ClickableItem item
|
||||
) {
|
||||
for (int row = fromRow; row <= toRow; row++) {
|
||||
for (int column = fromColumn; column <= toColumn; column++) {
|
||||
if (row != fromRow && row != toRow && column != fromColumn && column != toColumn) {
|
||||
@@ -266,7 +273,8 @@ public interface InventoryContents {
|
||||
@Override
|
||||
public InventoryContents fillRect(SlotPos fromPos, SlotPos toPos, ClickableItem item) {
|
||||
return fillRect(fromPos.getRow(), fromPos.getColumn(), toPos.getRow(), toPos.getColumn(),
|
||||
item);
|
||||
item
|
||||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -298,4 +306,4 @@ public interface InventoryContents {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -64,9 +64,11 @@ public interface Pagination {
|
||||
|
||||
@Override
|
||||
public ClickableItem[] getPageItems() {
|
||||
return Arrays.copyOfRange(items,
|
||||
return Arrays.copyOfRange(
|
||||
items,
|
||||
currentPage * itemsPerPage,
|
||||
(currentPage + 1) * itemsPerPage);
|
||||
(currentPage + 1) * itemsPerPage
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -77,8 +77,10 @@ public interface SlotIterator {
|
||||
private boolean allowOverride = true;
|
||||
private int row, column;
|
||||
|
||||
public Impl(InventoryContents contents, SmartInventory inv,
|
||||
Type type, int startRow, int startColumn) {
|
||||
public Impl(
|
||||
InventoryContents contents, SmartInventory inv,
|
||||
Type type, int startRow, int startColumn
|
||||
) {
|
||||
|
||||
this.contents = contents;
|
||||
this.inv = inv;
|
||||
@@ -89,8 +91,10 @@ public interface SlotIterator {
|
||||
this.column = startColumn;
|
||||
}
|
||||
|
||||
public Impl(InventoryContents contents, SmartInventory inv,
|
||||
Type type) {
|
||||
public Impl(
|
||||
InventoryContents contents, SmartInventory inv,
|
||||
Type type
|
||||
) {
|
||||
|
||||
this(contents, inv, type, 0, 0);
|
||||
}
|
||||
@@ -241,4 +245,4 @@ public interface SlotIterator {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -37,9 +37,11 @@ public class ChestInventoryOpener implements InventoryOpener {
|
||||
@Override
|
||||
public Inventory open(SmartInventory inv, Player player) {
|
||||
Preconditions.checkArgument(inv.getColumns() == 9,
|
||||
"The column count for the chest inventory must be 9, found: %s.", inv.getColumns());
|
||||
"The column count for the chest inventory must be 9, found: %s.", inv.getColumns()
|
||||
);
|
||||
Preconditions.checkArgument(inv.getRows() >= 1 && inv.getRows() <= 6,
|
||||
"The row count for the chest inventory must be between 1 and 6, found: %s", inv.getRows());
|
||||
"The row count for the chest inventory must be between 1 and 6, found: %s", inv.getRows()
|
||||
);
|
||||
|
||||
InventoryManager manager = inv.getManager();
|
||||
Inventory handle = Bukkit
|
||||
|
||||
@@ -33,9 +33,14 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BannerMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
public class BannerUtil {
|
||||
|
||||
public static final HashMap<UUID, ItemStack> currentBanner = new HashMap<>();
|
||||
public static final HashMap<UUID, DyeColor> selectedColor = new HashMap<>();
|
||||
|
||||
@@ -71,7 +76,13 @@ public class BannerUtil {
|
||||
}
|
||||
|
||||
public static ItemStack createBanner(String name, DyeColor base, String lore, List<Pattern> patterns) {
|
||||
ItemStack item = Items.create(XMaterial.matchXMaterial(base.toString() + "_BANNER").get().parseMaterial(), (short) 0, 1, name, "");
|
||||
ItemStack item = Items.create(
|
||||
XMaterial.matchXMaterial(base.toString() + "_BANNER").get().parseMaterial(),
|
||||
(short) 0,
|
||||
1,
|
||||
name,
|
||||
""
|
||||
);
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
|
||||
meta.setPatterns(patterns);
|
||||
@@ -88,7 +99,13 @@ public class BannerUtil {
|
||||
}
|
||||
|
||||
public static ItemStack createDye(String name, DyeColor base, String lore) {
|
||||
ItemStack item = Items.create(XMaterial.matchXMaterial(base.toString() + "_DYE").get().parseMaterial(), (short) 0, 1, name, "");
|
||||
ItemStack item = Items.create(
|
||||
XMaterial.matchXMaterial(base.toString() + "_DYE").get().parseMaterial(),
|
||||
(short) 0,
|
||||
1,
|
||||
name,
|
||||
""
|
||||
);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (!lore.equals("")) {
|
||||
String[] loreListArray = lore.split("__");
|
||||
@@ -105,7 +122,13 @@ public class BannerUtil {
|
||||
public static ItemStack createBanner(String name, DyeColor base, String lore) {
|
||||
XMaterial.matchXMaterial(base.toString() + "_BANNER").get().parseMaterial();
|
||||
|
||||
ItemStack item = Items.create(XMaterial.matchXMaterial(base.toString() + "_BANNER").get().parseMaterial(), (short) 0, 1, name, "");
|
||||
ItemStack item = Items.create(
|
||||
XMaterial.matchXMaterial(base + "_BANNER").get().parseMaterial(),
|
||||
(short) 0,
|
||||
1,
|
||||
name,
|
||||
""
|
||||
);
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
if (!lore.equals("")) {
|
||||
String[] loreListArray = lore.split("__");
|
||||
@@ -120,7 +143,13 @@ public class BannerUtil {
|
||||
}
|
||||
|
||||
public static ItemStack createBanner(String name, int amount, DyeColor base, String lore, Pattern pat) {
|
||||
ItemStack item = Items.create(XMaterial.matchXMaterial(base.toString() + "_BANNER").get().parseMaterial(), (short) 0, 1, name, "");
|
||||
ItemStack item = Items.create(
|
||||
XMaterial.matchXMaterial(base.toString() + "_BANNER").get().parseMaterial(),
|
||||
(short) 0,
|
||||
1,
|
||||
name,
|
||||
""
|
||||
);
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
meta.addPattern(pat);
|
||||
if (!lore.equals("")) {
|
||||
@@ -164,8 +193,8 @@ public class BannerUtil {
|
||||
return allPatterns.get(random.nextInt(allPatterns.size()));
|
||||
}
|
||||
|
||||
public static DyeColor getOppositeBaseColor(DyeColor dyeColor){
|
||||
switch (dyeColor){
|
||||
public static DyeColor getOppositeBaseColor(DyeColor dyeColor) {
|
||||
switch (dyeColor) {
|
||||
case RED:
|
||||
case BLUE:
|
||||
case CYAN:
|
||||
@@ -187,5 +216,6 @@ public class BannerUtil {
|
||||
return DyeColor.BLACK;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.arcaniax.buildersutilities.utils;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -35,8 +36,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class CustomConfig {
|
||||
|
||||
private static final Logger logger = LogManagerCompat.getLogger();
|
||||
|
||||
@@ -103,4 +103,5 @@ public class Items {
|
||||
item.setItemMeta(headMeta);
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,4 +46,5 @@ public class LogManagerCompat {
|
||||
// 2 - caller caller
|
||||
return lazyStack.get(2).getClassName();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,4 +63,5 @@ public class NmsManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user