commit 73eb21510be9890519598335d5fe35a5151c4e05 Author: erius Date: Thu Apr 27 23:04:42 2023 +0300 first commit diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/mcPlugins.iml b/.idea/mcPlugins.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/mcPlugins.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..bca2da7 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ArmorBlocks/.gitignore b/ArmorBlocks/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/ArmorBlocks/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/ArmorBlocks/build.gradle b/ArmorBlocks/build.gradle new file mode 100644 index 0000000..32e824b --- /dev/null +++ b/ArmorBlocks/build.gradle @@ -0,0 +1,38 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius' +version = '' +def serverPath = 'C:/mc_servers/1.16.5/plugins' + +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +repositories { + mavenCentral() + maven { + name = 'spigotmc-repo' + url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT' +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +jar { + destinationDirectory.set(file(serverPath)) +} diff --git a/ArmorBlocks/gradle.properties b/ArmorBlocks/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/ArmorBlocks/gradle/wrapper/gradle-wrapper.jar b/ArmorBlocks/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/ArmorBlocks/gradle/wrapper/gradle-wrapper.jar differ diff --git a/ArmorBlocks/gradle/wrapper/gradle-wrapper.properties b/ArmorBlocks/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b5f89 --- /dev/null +++ b/ArmorBlocks/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/ArmorBlocks/gradlew b/ArmorBlocks/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/ArmorBlocks/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/ArmorBlocks/gradlew.bat b/ArmorBlocks/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/ArmorBlocks/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/ArmorBlocks/settings.gradle b/ArmorBlocks/settings.gradle new file mode 100644 index 0000000..3cf75a6 --- /dev/null +++ b/ArmorBlocks/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'ArmorBlocks' diff --git a/ArmorBlocks/src/main/java/ru/erius/armorblocks/ArmorBlocks.cfg b/ArmorBlocks/src/main/java/ru/erius/armorblocks/ArmorBlocks.cfg new file mode 100644 index 0000000..1e11928 --- /dev/null +++ b/ArmorBlocks/src/main/java/ru/erius/armorblocks/ArmorBlocks.cfg @@ -0,0 +1,32 @@ +############################################# +# Configuration file for ArmorBlocks plugin # +############################################# + +# Possible potion effects: +# speed, slowness, fast_digging, slow_digging, increase_damage, heal, harm, jump, confusion, weakness, poison, +# regeneration, damage_resistance, fire_resistance, water_breathing, invisibility, blindness, night_vision, hunger, +# wither, health_boost, absorption, saturation, glowing, levitation, luck, unluck, slow_falling, conduit_power, +# dolphins_grace, bad_omen, hero_of_the_village + +STONE=weakness +COBBLESTONE=weakness +DIRT=blindness +COAL_BLOCK=fast_digging +IRON_BLOCK=fast_digging;absorption +GOLD_BLOCK=fast_digging;absorption;saturation +LAPIS_BLOCK=luck +DIAMOND_BLOCK=fast_digging;absorption;saturation;damage_resistance +NETHERITE_BLOCK=fast_digging;absorption;saturation;damage_resistance;fire_resistance +REDSTONE_BLOCK=night_vision;glowing +EMERALD_BLOCK=hero_of_the_village;glowing;luck +SEA_LANTERN=dolphins_grace;water_breathing +OBSIDIAN=slow;damage_resistance;health_boost;absorption +WHITE_WOOL=speed; +OAK_LOG=regeneration;slow +OAK_PLANKS=slow +GLASS=invisibility +HAY_BLOCK=slow_falling +SLIME_BLOCK=jump +MAGMA_BLOCK=fire_resistance;blindness +TNT=increase_damage;blindness +SOUL_SAND=slow;hunger diff --git a/ArmorBlocks/src/main/java/ru/erius/armorblocks/ArmorBlocks.java b/ArmorBlocks/src/main/java/ru/erius/armorblocks/ArmorBlocks.java new file mode 100644 index 0000000..c4fca78 --- /dev/null +++ b/ArmorBlocks/src/main/java/ru/erius/armorblocks/ArmorBlocks.java @@ -0,0 +1,39 @@ +package ru.erius.armorblocks; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.java.JavaPlugin; +import ru.erius.armorblocks.EquipHandle.BlockEffectsInit; + +public class ArmorBlocks extends JavaPlugin { + @Override + public void onEnable() { + super.onEnable(); + BlockEffectsInit.initConfig(); + getLogger().info("ArmorBlocks enabled"); + getServer().getPluginManager().registerEvents(new PlayerEvents(), this); + } + + @Override + public void onDisable() { + super.onDisable(); + getLogger().info("ArmorBlocks disabled"); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + String cmd = command.getName().toLowerCase(); + switch (cmd) { + case "abreset": + boolean reset = BlockEffectsInit.resetConfig(); + sender.sendMessage(reset ? ChatColor.GREEN + "Config reset successful" : ChatColor.RED + "Something went wrong"); + break; + case "abreload": + boolean reload = BlockEffectsInit.reloadConfig(); + sender.sendMessage(reload ? ChatColor.GREEN + "Config reload successful" : ChatColor.RED + "Something went wrong"); + break; + } + return super.onCommand(sender, command, label, args); + } +} diff --git a/ArmorBlocks/src/main/java/ru/erius/armorblocks/EquipHandle/BlockEffectsInit.java b/ArmorBlocks/src/main/java/ru/erius/armorblocks/EquipHandle/BlockEffectsInit.java new file mode 100644 index 0000000..ac317ab --- /dev/null +++ b/ArmorBlocks/src/main/java/ru/erius/armorblocks/EquipHandle/BlockEffectsInit.java @@ -0,0 +1,87 @@ +package ru.erius.armorblocks.EquipHandle; + +import org.bukkit.Material; +import org.bukkit.plugin.Plugin; +import org.bukkit.potion.PotionEffectType; +import ru.erius.armorblocks.ArmorBlocks; + +import java.io.*; +import java.util.HashMap; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class BlockEffectsInit { + + private final static Plugin plugin = ArmorBlocks.getPlugin(ArmorBlocks.class); + public static HashMap> blockEffects; + + public static void initConfig() { + plugin.getLogger().info("Started config init"); + File config = new File("ArmorBlocks.cfg"); + boolean created = true; + if (!config.exists()) + created = createConfig(config); + if (!created) + return; + plugin.getLogger().info("Config init successful"); + plugin.getLogger().info("Reading the config"); + blockEffects = readConfig(config); + plugin.getLogger().info("Config applied"); + } + + public static boolean resetConfig() { + File config = new File("ArmorBlocks.cfg"); + config.delete(); + boolean result = createConfig(config); + reloadConfig(); + return result; + } + + public static boolean reloadConfig() { + File config = new File("ArmorBlocks.cfg"); + blockEffects = readConfig(config); + return true; + } + + private static boolean createConfig(File file) { + plugin.getLogger().info("Creating config"); + try (BufferedWriter writer = new BufferedWriter(new FileWriter(file)); + BufferedReader reader = new BufferedReader(new InputStreamReader(plugin.getResource("ru/erius/ArmorBlocks/ArmorBlocks.cfg")))) { + while (reader.ready()) { + String line = reader.readLine(); + writer.write(line); + writer.newLine(); + } + file.createNewFile(); + } catch (IOException e) { + plugin.getLogger().severe("Something went wrong while setting up a new configuration file"); + e.printStackTrace(); + return false; + } + return true; + } + + private static HashMap> readConfig(File file) { + HashMap> blockEffects = new HashMap<>(); + try (BufferedReader reader = new BufferedReader(new FileReader(file))) { + while (reader.ready()) { + String[] materialPotions = reader.readLine().split("[=;]"); + if (materialPotions.length < 2) + continue; + Material material = Material.getMaterial(materialPotions[0]); + List potions = Stream.of(materialPotions) + .skip(1) + .map(PotionEffectType::getByName) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + blockEffects.put(material, potions); + } + } catch (IOException e) { + plugin.getLogger().severe("Something went wrong while reading a configuration file"); + e.printStackTrace(); + } + return blockEffects; + } +} diff --git a/ArmorBlocks/src/main/java/ru/erius/armorblocks/EquipHandle/InventoryClickHandle.java b/ArmorBlocks/src/main/java/ru/erius/armorblocks/EquipHandle/InventoryClickHandle.java new file mode 100644 index 0000000..c391c13 --- /dev/null +++ b/ArmorBlocks/src/main/java/ru/erius/armorblocks/EquipHandle/InventoryClickHandle.java @@ -0,0 +1,107 @@ +package ru.erius.armorblocks.EquipHandle; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import java.util.List; + +import static ru.erius.armorblocks.EquipHandle.BlockEffectsInit.blockEffects; + +public class InventoryClickHandle { + + private final static int HELMET_SLOT = 39; + + public static void clickHandle(InventoryClickEvent evt) { + Player player = (Player) evt.getWhoClicked(); + ItemStack newHelmet = evt.getCursor(); + newHelmet = newHelmet == null ? new ItemStack(Material.AIR) : new ItemStack(newHelmet); + ItemStack oldHelmet = player.getInventory().getHelmet(); + oldHelmet = oldHelmet == null ? new ItemStack(Material.AIR) : new ItemStack(oldHelmet); + if (evt.getSlot() == HELMET_SLOT) { + switch (evt.getClick()) { + case LEFT: + clearEffects(blockEffects.get(oldHelmet.getType()), player); + int count; + if (newHelmet.getType() == oldHelmet.getType()) { + count = oldHelmet.getAmount() + newHelmet.getAmount(); + if (count <= 64) { + oldHelmet.setAmount(0); + newHelmet.setAmount(count); + } + } else + count = newHelmet.getAmount(); + int amplifier = Math.min(count, 4) - 1; + applyEffects(blockEffects.get(newHelmet.getType()), player, amplifier); + replaceHelmet(player, oldHelmet, newHelmet); + break; + case RIGHT: + clearEffects(blockEffects.get(oldHelmet.getType()), player); + if (oldHelmet.getType() == Material.AIR) { + oldHelmet = new ItemStack(newHelmet); + oldHelmet.setAmount(newHelmet.getAmount() - 1); + newHelmet.setAmount(1); + } else if (oldHelmet.getType() == newHelmet.getType()) { + if (oldHelmet.getAmount() >= 64) + break; + int newHelmetAmount = newHelmet.getAmount(), oldHelmetAmount = oldHelmet.getAmount(); + newHelmet.setAmount(oldHelmetAmount + 1); + oldHelmet.setAmount(newHelmetAmount - 1); + } + amplifier = Math.min(newHelmet.getAmount(), 4) - 1; + applyEffects(blockEffects.get(newHelmet.getType()), player, amplifier); + if (newHelmet.getType() == Material.AIR) { + amplifier = Math.min(oldHelmet.getAmount() / 2, 4) - 1; + if (oldHelmet.getAmount() > 1) + applyEffects(blockEffects.get(oldHelmet.getType()), player, amplifier); + break; + } + replaceHelmet(player, oldHelmet, newHelmet); + break; + case DROP: + if (newHelmet.getType() == Material.AIR && blockEffects.containsKey(oldHelmet.getType())) { + clearEffects(blockEffects.get(oldHelmet.getType()), player); + if (oldHelmet.getAmount() > 1) + applyEffects(blockEffects.get(oldHelmet.getType()), player, Math.min(oldHelmet.getAmount() - 1, 4) - 1); + } + break; + case CONTROL_DROP: + case SHIFT_LEFT: + if (newHelmet.getType() == Material.AIR && blockEffects.containsKey(oldHelmet.getType())) + clearEffects(blockEffects.get(oldHelmet.getType()), player); + default: + break; + } + } + + } + + private static void clearEffects(List potionEffectTypes, Player player) { + if (potionEffectTypes == null) + return; + for (PotionEffectType potionEffectType : potionEffectTypes) + player.removePotionEffect(potionEffectType); + } + + private static void applyEffects(List potionEffectTypes, Player player, int amplifier) { + if (potionEffectTypes == null) + return; + for (PotionEffectType potionEffectType : potionEffectTypes) + player.addPotionEffect(new PotionEffect(potionEffectType, Integer.MAX_VALUE, amplifier)); + } + + private static void replaceHelmet(Player player, ItemStack oldHelmet, ItemStack newHelmet) { + new Thread(() -> { + player.setItemOnCursor(oldHelmet); + try { + Thread.sleep(1); + } catch (InterruptedException e) { + e.printStackTrace(); + } + player.getInventory().setHelmet(newHelmet); + }).start(); + } +} diff --git a/ArmorBlocks/src/main/java/ru/erius/armorblocks/PlayerEvents.java b/ArmorBlocks/src/main/java/ru/erius/armorblocks/PlayerEvents.java new file mode 100644 index 0000000..3570f55 --- /dev/null +++ b/ArmorBlocks/src/main/java/ru/erius/armorblocks/PlayerEvents.java @@ -0,0 +1,14 @@ +package ru.erius.armorblocks; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import ru.erius.armorblocks.EquipHandle.InventoryClickHandle; + +public class PlayerEvents implements Listener { + + @EventHandler + public void onInventoryClick(InventoryClickEvent evt) { + InventoryClickHandle.clickHandle(evt); + } +} diff --git a/ArmorBlocks/src/main/resources/plugin.yml b/ArmorBlocks/src/main/resources/plugin.yml new file mode 100644 index 0000000..e9a223b --- /dev/null +++ b/ArmorBlocks/src/main/resources/plugin.yml @@ -0,0 +1,11 @@ +name: ArmorBlocks +version: 1.0 +main: ru.erius.armorblocks.ArmorBlocks +api-version: 1.16 +authors: [ erius ] +description: allows the player to wear any item as helmet, such helmers will apply potion effects from ArmorBlocks.cfg file +commands: + abreset: + description: resets the config file to default settings + abreload: + description: applies changes made to the config diff --git a/BlockShear/.gitignore b/BlockShear/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/BlockShear/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/BlockShear/build.gradle b/BlockShear/build.gradle new file mode 100644 index 0000000..f57ad70 --- /dev/null +++ b/BlockShear/build.gradle @@ -0,0 +1,43 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius' +version = '1.0-SNAPSHOT' +def serverPath = 'C:/mc_servers/1.17.1/plugins' +def EriusLibPath = 'D:/mc_plugins/EriusLib/build/libs' + +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +repositories { + mavenCentral() + maven { + name = 'spigotmc-repo' + url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } + flatDir { + dirs EriusLibPath + } +} + +dependencies { + compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' + compileOnly fileTree(dir: EriusLibPath, include: '*.jar') +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +jar { + destinationDirectory.set(file(serverPath)) +} diff --git a/BlockShear/gradle.properties b/BlockShear/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/BlockShear/gradle/wrapper/gradle-wrapper.jar b/BlockShear/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/BlockShear/gradle/wrapper/gradle-wrapper.jar differ diff --git a/BlockShear/gradle/wrapper/gradle-wrapper.properties b/BlockShear/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b5f89 --- /dev/null +++ b/BlockShear/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/BlockShear/gradlew b/BlockShear/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/BlockShear/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/BlockShear/gradlew.bat b/BlockShear/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/BlockShear/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/BlockShear/settings.gradle b/BlockShear/settings.gradle new file mode 100644 index 0000000..f1c017e --- /dev/null +++ b/BlockShear/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'BlockShear' diff --git a/BlockShear/src/main/java/ru/erius/blockshear/BlockShear.java b/BlockShear/src/main/java/ru/erius/blockshear/BlockShear.java new file mode 100644 index 0000000..3b2277b --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/BlockShear.java @@ -0,0 +1,24 @@ +package ru.erius.blockshear; + +import org.bukkit.plugin.java.JavaPlugin; +import ru.erius.blockshear.items.InitItems; + +public final class BlockShear extends JavaPlugin { + + public static BlockShear plugin; + + public BlockShear() { + plugin = this; + } + + @Override + public void onEnable() { + InitItems.initItems(); + getLogger().info(getName() + " enabled"); + } + + @Override + public void onDisable() { + getLogger().info(getName() + " disabled"); + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/BlockShears.java b/BlockShear/src/main/java/ru/erius/blockshear/items/BlockShears.java new file mode 100644 index 0000000..c6fd0b7 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/BlockShears.java @@ -0,0 +1,202 @@ +package ru.erius.blockshear.items; + +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.ShapedRecipe; +import ru.erius.blockshear.BlockShear; +import ru.erius.eriuslib.items.CustomItem; + +public class BlockShears extends CustomItem { + + private final static String NAME = "block_shears"; + private final static Material MATERIAL = Material.SHEARS; + + public BlockShears() { + super(NAME, MATERIAL); + } + + @Override + public void addRecipe() { + String[][] recipeShapes = {{"_A", "A_"}, {"A_", "_A"}}; + for (int i = 0; i < recipeShapes.length; i++) { + NamespacedKey key = new NamespacedKey(BlockShear.plugin, NAME + i); + ShapedRecipe newRecipe = new ShapedRecipe(key, new BlockShears()); + newRecipe.shape(recipeShapes[i]); + newRecipe.setIngredient('A', Material.DIAMOND); + Bukkit.addRecipe(newRecipe); + } + } + + @Override + public void onConsume(PlayerItemConsumeEvent evt) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent evt) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent evt) { + Block block = evt.getClickedBlock(); + Player player = evt.getPlayer(); + if (block == null) + return; + switch (block.getType()) { + case DEEPSLATE_COAL_ORE: + ItemStack[] possibleDrops1 = {new ItemStack(Material.COAL), new InfiniteChicken(), new KnockbackSlime(), + new ItemStack(Material.COAL_BLOCK), new ItemStack(Material.TORCH), new ItemStack(Material.FURNACE), + new ItemStack(Material.COOKED_CHICKEN), new ItemStack(Material.COOKED_BEEF), new ItemStack(Material.COOKED_PORKCHOP)}; + handleShear(possibleDrops1, player, block, Color.BLACK, Material.DEEPSLATE); + break; + case COAL_ORE: + ItemStack[] possibleDrops2 = {new ItemStack(Material.COAL), new InfiniteChicken(), new KnockbackSlime(), + new ItemStack(Material.COAL_BLOCK), new ItemStack(Material.TORCH), new ItemStack(Material.FURNACE), + new ItemStack(Material.COOKED_CHICKEN), new ItemStack(Material.COOKED_BEEF), new ItemStack(Material.COOKED_PORKCHOP)}; + handleShear(possibleDrops2, player, block, Color.BLACK, Material.STONE); + break; + case DEEPSLATE_IRON_ORE: + ItemStack[] possibleDrops3 = {new ItemStack(Material.RAW_IRON), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_PICKAXE), + new ItemStack(Material.IRON_SWORD), new ItemStack(Material.IRON_BOOTS), new ItemStack(Material.IRON_LEGGINGS), + new ItemStack(Material.IRON_CHESTPLATE), new ItemStack(Material.IRON_HELMET)}; + handleShear(possibleDrops3, player, block, Color.fromRGB(255, 174, 69), Material.DEEPSLATE); + break; + case IRON_ORE: + ItemStack[] possibleDrops4 = {new ItemStack(Material.RAW_IRON), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_PICKAXE), + new ItemStack(Material.IRON_SWORD), new ItemStack(Material.IRON_BOOTS), new ItemStack(Material.IRON_LEGGINGS), + new ItemStack(Material.IRON_CHESTPLATE), new ItemStack(Material.IRON_HELMET), new ItemStack(Material.IRON_BLOCK)}; + handleShear(possibleDrops4, player, block, Color.fromRGB(255, 174, 69), Material.STONE); + break; + case DEEPSLATE_COPPER_ORE: + ItemStack[] possibleDrops5 = {new ItemStack(Material.COPPER_ORE), new ItemStack(Material.RAW_COPPER), + new ItemStack(Material.COPPER_BLOCK), new InfiniteChicken(), new KnockbackSlime()}; + handleShear(possibleDrops5, player, block, Color.fromRGB(255, 124, 48), Material.DEEPSLATE); + break; + case COPPER_ORE: + ItemStack[] possibleDrops6 = {new ItemStack(Material.COPPER_ORE), new ItemStack(Material.RAW_COPPER), + new ItemStack(Material.COPPER_BLOCK), new InfiniteChicken(), new KnockbackSlime()}; + handleShear(possibleDrops6, player, block, Color.fromRGB(255, 124, 48), Material.STONE); + break; + case DEEPSLATE_GOLD_ORE: + ItemStack[] possibleDrops7 = {new ItemStack(Material.GOLDEN_APPLE), new ItemStack(Material.ENCHANTED_GOLDEN_APPLE), + new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.GOLD_NUGGET), new ItemStack(Material.GOLD_BLOCK), + new ItemStack(Material.GOLDEN_CARROT), new ItemStack(Material.GOLDEN_PICKAXE), new ItemStack(Material.GOLDEN_SWORD)}; + handleShear(possibleDrops7, player, block, Color.YELLOW, Material.DEEPSLATE); + break; + case GOLD_ORE: + ItemStack[] possibleDrops8 = {new ItemStack(Material.GOLDEN_APPLE), new ItemStack(Material.ENCHANTED_GOLDEN_APPLE), + new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.GOLD_NUGGET), new ItemStack(Material.GOLD_BLOCK), + new ItemStack(Material.GOLDEN_CARROT), new ItemStack(Material.GOLDEN_PICKAXE), new ItemStack(Material.GOLDEN_SWORD)}; + handleShear(possibleDrops8, player, block, Color.YELLOW, Material.STONE); + break; + case DEEPSLATE_REDSTONE_ORE: + ItemStack[] possibleDrops9 = {new ItemStack(Material.TNT), new ItemStack(Material.REDSTONE), + new ItemStack(Material.DROPPER), new ItemStack(Material.REDSTONE_TORCH), new ItemStack(Material.REDSTONE_BLOCK), + }; + handleShear(possibleDrops9, player, block, Color.RED, Material.DEEPSLATE); + break; + case REDSTONE_ORE: + ItemStack[] possibleDrops10 = {new ItemStack(Material.TNT), new ItemStack(Material.REDSTONE), + new ItemStack(Material.DROPPER), new ItemStack(Material.REDSTONE_TORCH), new ItemStack(Material.REDSTONE_BLOCK), + }; + handleShear(possibleDrops10, player, block, Color.RED, Material.STONE); + break; + case DEEPSLATE_LAPIS_ORE: + ItemStack[] possibleDrops11 = {new ItemStack(Material.LAPIS_LAZULI), new ItemStack(Material.LAPIS_BLOCK), + new ItemStack(Material.ENCHANTING_TABLE)}; + handleShear(possibleDrops11, player, block, Color.BLUE, Material.DEEPSLATE); + break; + case LAPIS_ORE: + ItemStack[] possibleDrops12 = {new ItemStack(Material.LAPIS_LAZULI), new ItemStack(Material.LAPIS_BLOCK), + new ItemStack(Material.ENCHANTING_TABLE)}; + handleShear(possibleDrops12, player, block, Color.BLUE, Material.STONE); + break; + case DEEPSLATE_DIAMOND_ORE: + ItemStack[] possibleDrops13 = {new ItemStack(Material.DIAMOND), new ItemStack(Material.DIAMOND_BLOCK), + new ItemStack(Material.DIAMOND_BOOTS), new ItemStack(Material.DIAMOND_LEGGINGS), new ItemStack(Material.DIAMOND_CHESTPLATE), + new ItemStack(Material.DIAMOND_HELMET), new ItemStack(Material.DIAMOND_SWORD), new ItemStack(Material.DIAMOND_PICKAXE), + new UltraDiamondBoots(), new UltraDiamondLegs(), new UltraDiamondChest(), new UltraDiamondHelm(), new UltraDiamondSword(), + new DiamondApple()}; + handleShear(possibleDrops13, player, block, Color.TEAL, Material.DEEPSLATE); + break; + case DIAMOND_ORE: + ItemStack[] possibleDrops14 = {new ItemStack(Material.DIAMOND), new ItemStack(Material.DIAMOND_BLOCK), + new ItemStack(Material.DIAMOND_BOOTS), new ItemStack(Material.DIAMOND_LEGGINGS), new ItemStack(Material.DIAMOND_CHESTPLATE), + new ItemStack(Material.DIAMOND_HELMET), new ItemStack(Material.DIAMOND_SWORD), new ItemStack(Material.DIAMOND_PICKAXE), + new UltraDiamondBoots(), new UltraDiamondLegs(), new UltraDiamondChest(), new UltraDiamondHelm(), new UltraDiamondSword(), + new DiamondApple()}; + handleShear(possibleDrops14, player, block, Color.TEAL, Material.STONE); + break; + case DEEPSLATE_EMERALD_ORE: + ItemStack[] possibleDrops15 = {new ItemStack(Material.EMERALD), new ItemStack(Material.EMERALD_BLOCK), + new EmeraldApple(), new ItemStack(Material.TOTEM_OF_UNDYING)}; + handleShear(possibleDrops15, player, block, Color.GREEN, Material.DEEPSLATE); + break; + case EMERALD_ORE: + ItemStack[] possibleDrops16 = {new ItemStack(Material.EMERALD), new ItemStack(Material.EMERALD_BLOCK), + new EmeraldApple(), new ItemStack(Material.TOTEM_OF_UNDYING)}; + handleShear(possibleDrops16, player, block, Color.GREEN, Material.STONE); + break; + case ANCIENT_DEBRIS: + ItemStack[] possibleDrops17 = {new UltraNetheriteBoots(), new UltraNetheriteLegs(), new UltraNetheriteChest(), + new UltraNetheriteHelm(), new UltraNetheriteSword(), new UltraNetheritePickaxe()}; + handleShear(possibleDrops17, player, block, Color.FUCHSIA, Material.OBSIDIAN); + break; + case NETHER_QUARTZ_ORE: + ItemStack[] possibleDrops18 = {new ItemStack(Material.QUARTZ), new ItemStack(Material.QUARTZ_BLOCK)}; + handleShear(possibleDrops18, player, block, Color.WHITE, Material.NETHERRACK); + break; + case NETHER_GOLD_ORE: + ItemStack[] possibleDrops19 = {new ItemStack(Material.GOLDEN_APPLE), new ItemStack(Material.ENCHANTED_GOLDEN_APPLE), + new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.GOLD_NUGGET), new ItemStack(Material.GOLD_BLOCK), + new ItemStack(Material.GOLDEN_CARROT), new ItemStack(Material.GOLDEN_PICKAXE), new ItemStack(Material.GOLDEN_SWORD)}; + handleShear(possibleDrops19, player, block, Color.YELLOW, Material.NETHERRACK); + break; + } + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent evt) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent evt) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent evt) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent evt) { + + } + + private static void coloredParticles(Block block, Color color) { + Location particleLoc = block.getLocation(); + particleLoc.setY(particleLoc.getY() + 0.5); + particleLoc.setX(particleLoc.getX() + 0.5); + particleLoc.setZ(particleLoc.getZ() + 0.5); + block.getWorld().spawnParticle(Particle.REDSTONE, particleLoc, + 75, 0.4F, 0.4F, 0.4F, 1F, new Particle.DustOptions(color, 1F)); + } + + private static void handleShear(ItemStack[] items, Player player, Block block, Color color, Material material) { + block.setType(material); + coloredParticles(block, color); + int rnd = (int) (Math.random() * items.length); + player.getInventory().addItem(items[rnd]); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_SHEEP_SHEAR, 1F, 1F); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_ITEM_PICKUP, 1F, 1F); + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/DiamondApple.java b/BlockShear/src/main/java/ru/erius/blockshear/items/DiamondApple.java new file mode 100644 index 0000000..27cf2f2 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/DiamondApple.java @@ -0,0 +1,65 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import ru.erius.eriuslib.items.CustomItem; + +public class DiamondApple extends CustomItem { + + private final static String NAME = "diamond_apple"; + private final static Material MATERIAL = Material.GOLDEN_APPLE; + + public DiamondApple() { + super(NAME, MATERIAL); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + Player player = playerItemConsumeEvent.getPlayer(); + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 800, 2)); + player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 12000, 1)); + player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 12000, 1)); + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 12000, 1)); + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/EmeraldApple.java b/BlockShear/src/main/java/ru/erius/blockshear/items/EmeraldApple.java new file mode 100644 index 0000000..2af0d69 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/EmeraldApple.java @@ -0,0 +1,66 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import ru.erius.eriuslib.items.CustomItem; + +public class EmeraldApple extends CustomItem { + + private final static String NAME = "emerald_apple"; + private final static Material MATERIAL = Material.GOLDEN_APPLE; + + public EmeraldApple() { + super(NAME, MATERIAL); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + Player player = playerItemConsumeEvent.getPlayer(); + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 1600, 3)); + player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 24000, 2)); + player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 24000, 2)); + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 24000, 2)); + player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 24000, 2)); + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/InfiniteChicken.java b/BlockShear/src/main/java/ru/erius/blockshear/items/InfiniteChicken.java new file mode 100644 index 0000000..5e55ee4 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/InfiniteChicken.java @@ -0,0 +1,63 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.blockshear.BlockShear; +import ru.erius.eriuslib.items.CustomItem; + +public class InfiniteChicken extends CustomItem { + + private final static String NAME = "infinite_chicken"; + private final static Material MATERIAL = Material.COOKED_CHICKEN; + + public InfiniteChicken() { + super(NAME, MATERIAL); + this.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 1); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent evt) { + Bukkit.getScheduler().runTaskLater(BlockShear.plugin, () -> + evt.getPlayer().getInventory().addItem(new InfiniteChicken()), 1); + } + + @Override + public void onRightClickAir(PlayerInteractEvent evt) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent evt) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent evt) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent evt) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent evt) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent evt) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/InitItems.java b/BlockShear/src/main/java/ru/erius/blockshear/items/InitItems.java new file mode 100644 index 0000000..165254f --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/InitItems.java @@ -0,0 +1,22 @@ +package ru.erius.blockshear.items; + +import ru.erius.blockshear.BlockShear; +import ru.erius.eriuslib.items.CustomItem; + +import java.util.Set; + +public class InitItems { + + private static final Set> ITEMS_INIT = Set.of(BlockShears.class, InfiniteChicken.class, KnockbackSlime.class, + DiamondApple.class, EmeraldApple.class, UltraDiamondBoots.class, UltraDiamondLegs.class, UltraDiamondChest.class, + UltraDiamondHelm.class, UltraDiamondSword.class, UltraDiamondPickaxe.class, UltraNetheriteSword.class, + UltraNetheritePickaxe.class, UltraNetheriteBoots.class, UltraNetheriteLegs.class, UltraNetheriteChest.class, + UltraNetheriteHelm.class); + + private final static String packURL = "https://drive.google.com/u/0/uc?id=1sAe93zBaI0hzynvcNUtJwT7oncIG4xoM&export=download"; + + public static void initItems() { + CustomItem.initItems(BlockShear.plugin, ITEMS_INIT); + CustomItem.setPackURL(packURL); + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/KnockbackSlime.java b/BlockShear/src/main/java/ru/erius/blockshear/items/KnockbackSlime.java new file mode 100644 index 0000000..7706878 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/KnockbackSlime.java @@ -0,0 +1,60 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.eriuslib.items.CustomItem; + +public class KnockbackSlime extends CustomItem { + + private final static String NAME = "knockback_slime"; + private final static Material MATERIAL = Material.SLIME_BALL; + + public KnockbackSlime() { + super(NAME, MATERIAL); + this.addUnsafeEnchantment(Enchantment.KNOCKBACK, 10); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent evt) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent evt) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent evt) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent evt) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent evt) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent evt) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent evt) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondBoots.java b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondBoots.java new file mode 100644 index 0000000..f93ac28 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondBoots.java @@ -0,0 +1,64 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.eriuslib.items.CustomItem; + +public class UltraDiamondBoots extends CustomItem { + + private final static String NAME = "ultra_diamond_boots"; + private final static Material MATERIAL = Material.DIAMOND_BOOTS; + + public UltraDiamondBoots() { + super(NAME, MATERIAL); + this.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4); + this.addEnchantment(Enchantment.PROTECTION_FIRE, 4); + this.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 4); + this.addEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 4); + this.addEnchantment(Enchantment.PROTECTION_FALL, 4); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondChest.java b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondChest.java new file mode 100644 index 0000000..581aeb8 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondChest.java @@ -0,0 +1,63 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.eriuslib.items.CustomItem; + +public class UltraDiamondChest extends CustomItem { + + private final static String NAME = "ultra_diamond_chestplate"; + private final static Material MATERIAL = Material.DIAMOND_CHESTPLATE; + + public UltraDiamondChest() { + super(NAME, MATERIAL); + this.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4); + this.addEnchantment(Enchantment.PROTECTION_FIRE, 4); + this.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 4); + this.addEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 4); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondHelm.java b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondHelm.java new file mode 100644 index 0000000..c4ec876 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondHelm.java @@ -0,0 +1,63 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.eriuslib.items.CustomItem; + +public class UltraDiamondHelm extends CustomItem { + + private final static String NAME = "ultra_diamond_helmet"; + private final static Material MATERIAL = Material.DIAMOND_HELMET; + + public UltraDiamondHelm() { + super(NAME, MATERIAL); + this.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4); + this.addEnchantment(Enchantment.PROTECTION_FIRE, 4); + this.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 4); + this.addEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 4); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondLegs.java b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondLegs.java new file mode 100644 index 0000000..8fbccaa --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondLegs.java @@ -0,0 +1,63 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.eriuslib.items.CustomItem; + +public class UltraDiamondLegs extends CustomItem { + + private final static String NAME = "ultra_diamond_leggings"; + private final static Material MATERIAL = Material.DIAMOND_LEGGINGS; + + public UltraDiamondLegs() { + super(NAME, MATERIAL); + this.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4); + this.addEnchantment(Enchantment.PROTECTION_FIRE, 4); + this.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 4); + this.addEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 4); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondPickaxe.java b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondPickaxe.java new file mode 100644 index 0000000..c92b986 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondPickaxe.java @@ -0,0 +1,61 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.eriuslib.items.CustomItem; + +public class UltraDiamondPickaxe extends CustomItem { + + private final static String NAME = "ultra_diamond_pickaxe"; + private final static Material MATERIAL = Material.DIAMOND_PICKAXE; + + public UltraDiamondPickaxe() { + super(NAME, MATERIAL); + this.addEnchantment(Enchantment.DIG_SPEED, 5); + this.addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondSword.java b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondSword.java new file mode 100644 index 0000000..3d04d13 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraDiamondSword.java @@ -0,0 +1,59 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.eriuslib.items.CustomItem; + +public class UltraDiamondSword extends CustomItem { + + private final static String NAME = "ultra_diamond_sword"; + private final static Material MATERIAL = Material.DIAMOND_SWORD; + + public UltraDiamondSword() { + super(NAME, MATERIAL); + + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteBoots.java b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteBoots.java new file mode 100644 index 0000000..93353ed --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteBoots.java @@ -0,0 +1,63 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.eriuslib.items.CustomItem; + +public class UltraNetheriteBoots extends CustomItem { + + private final static String NAME = "ultra_netherite_boots"; + private final static Material MATERIAL = Material.NETHERITE_BOOTS; + + public UltraNetheriteBoots() { + super(NAME, MATERIAL); + this.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 10); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteChest.java b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteChest.java new file mode 100644 index 0000000..bc6e91c --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteChest.java @@ -0,0 +1,63 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.eriuslib.items.CustomItem; + +public class UltraNetheriteChest extends CustomItem { + + private final static String NAME = "ultra_netherite_chestplate"; + private final static Material MATERIAL = Material.NETHERITE_CHESTPLATE; + + public UltraNetheriteChest() { + super(NAME, MATERIAL); + this.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 10); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteHelm.java b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteHelm.java new file mode 100644 index 0000000..b53be70 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteHelm.java @@ -0,0 +1,63 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.eriuslib.items.CustomItem; + +public class UltraNetheriteHelm extends CustomItem { + + private final static String NAME = "ultra_netherite_helmet"; + private final static Material MATERIAL = Material.NETHERITE_HELMET; + + public UltraNetheriteHelm() { + super(NAME, MATERIAL); + this.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 10); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteLegs.java b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteLegs.java new file mode 100644 index 0000000..a14d8f5 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteLegs.java @@ -0,0 +1,63 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.eriuslib.items.CustomItem; + +public class UltraNetheriteLegs extends CustomItem { + + private final static String NAME = "ultra_netherite_leggings"; + private final static Material MATERIAL = Material.NETHERITE_LEGGINGS; + + public UltraNetheriteLegs() { + super(NAME, MATERIAL); + this.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 10); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheritePickaxe.java b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheritePickaxe.java new file mode 100644 index 0000000..34741d8 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheritePickaxe.java @@ -0,0 +1,61 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.eriuslib.items.CustomItem; + +public class UltraNetheritePickaxe extends CustomItem { + + private final static String NAME = "ultra_netherite_pickaxe"; + private final static Material MATERIAL = Material.NETHERITE_PICKAXE; + + public UltraNetheritePickaxe() { + super(NAME, MATERIAL); + this.addUnsafeEnchantment(Enchantment.DIG_SPEED, 10); + this.addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 10); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteSword.java b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteSword.java new file mode 100644 index 0000000..7115094 --- /dev/null +++ b/BlockShear/src/main/java/ru/erius/blockshear/items/UltraNetheriteSword.java @@ -0,0 +1,64 @@ +package ru.erius.blockshear.items; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.eriuslib.items.CustomItem; + +public class UltraNetheriteSword extends CustomItem { + + private final static String NAME = "ultra_netherite_sword"; + private final static Material MATERIAL = Material.NETHERITE_SWORD; + + public UltraNetheriteSword() { + super(NAME, MATERIAL); + this.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10); + this.addUnsafeEnchantment(Enchantment.DAMAGE_ARTHROPODS, 10); + this.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, 10); + this.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 10); + this.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10); + } + + @Override + public void addRecipe() { + + } + + @Override + public void onConsume(PlayerItemConsumeEvent playerItemConsumeEvent) { + + } + + @Override + public void onRightClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onRightClickEntity(PlayerInteractEntityEvent playerInteractEntityEvent) { + + } + + @Override + public void onLeftClickAir(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickBlock(PlayerInteractEvent playerInteractEvent) { + + } + + @Override + public void onLeftClickEntity(EntityDamageByEntityEvent entityDamageByEntityEvent) { + + } +} diff --git a/BlockShear/src/main/resources/plugin.yml b/BlockShear/src/main/resources/plugin.yml new file mode 100644 index 0000000..29b5dea --- /dev/null +++ b/BlockShear/src/main/resources/plugin.yml @@ -0,0 +1,9 @@ +name: BlockShear +version: @version@ +main: ru.erius.blockshear.BlockShear +api-version: 1.17 +authors: [ erius ] +depend: [EriusLib] +description: you can shear blocks (amazing) +commands: + diff --git a/BlocksAreLava/.gitignore b/BlocksAreLava/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/BlocksAreLava/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/BlocksAreLava/build.gradle b/BlocksAreLava/build.gradle new file mode 100644 index 0000000..8a31427 --- /dev/null +++ b/BlocksAreLava/build.gradle @@ -0,0 +1,38 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius' +version = '1.0' +def serverPath = 'C:/mc_servers/1.17.1/plugins' + +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +repositories { + mavenCentral() + maven { + name = 'spigotmc-repo' + url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +jar { + destinationDirectory.set(file(serverPath)) +} diff --git a/BlocksAreLava/gradle.properties b/BlocksAreLava/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/BlocksAreLava/gradle/wrapper/gradle-wrapper.jar b/BlocksAreLava/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/BlocksAreLava/gradle/wrapper/gradle-wrapper.jar differ diff --git a/BlocksAreLava/gradle/wrapper/gradle-wrapper.properties b/BlocksAreLava/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b5f89 --- /dev/null +++ b/BlocksAreLava/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/BlocksAreLava/gradlew b/BlocksAreLava/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/BlocksAreLava/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/BlocksAreLava/gradlew.bat b/BlocksAreLava/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/BlocksAreLava/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/BlocksAreLava/settings.gradle b/BlocksAreLava/settings.gradle new file mode 100644 index 0000000..0532a14 --- /dev/null +++ b/BlocksAreLava/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'BlocksAreLava' diff --git a/BlocksAreLava/src/main/java/ru/erius/blocksarelava/BlocksAreLava.java b/BlocksAreLava/src/main/java/ru/erius/blocksarelava/BlocksAreLava.java new file mode 100644 index 0000000..865daac --- /dev/null +++ b/BlocksAreLava/src/main/java/ru/erius/blocksarelava/BlocksAreLava.java @@ -0,0 +1,39 @@ +package ru.erius.blocksarelava; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.java.JavaPlugin; + + +public final class BlocksAreLava extends JavaPlugin { + + public static BlocksAreLava plugin; + + @Override + public void onEnable() { + super.onEnable(); + plugin = this; + getLogger().info(getName() + " enabled"); + ConfigHandler.reloadConfig(false); + SpecialBoots.addCraftingRecipe(this); + getServer().getPluginManager().registerEvents(new ServerEvents(), this); + } + + @Override + public void onDisable() { + super.onDisable(); + getLogger().info(getName() + " disabled"); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + String cmd = command.getName().toLowerCase(); + if (cmd.equals("blocks")) + BlocksHandler.onCommand(sender); + if (cmd.equals("giveboots")) + SpecialBoots.onCommand(sender, args); + if (cmd.equals("resetconfig")) + ConfigHandler.reloadConfig(true); + return super.onCommand(sender, command, label, args); + } +} diff --git a/BlocksAreLava/src/main/java/ru/erius/blocksarelava/BlocksHandler.java b/BlocksAreLava/src/main/java/ru/erius/blocksarelava/BlocksHandler.java new file mode 100644 index 0000000..7f074ff --- /dev/null +++ b/BlocksAreLava/src/main/java/ru/erius/blocksarelava/BlocksHandler.java @@ -0,0 +1,57 @@ +package ru.erius.blocksarelava; + +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.persistence.PersistentDataType; + +import java.util.List; +import java.util.stream.Collectors; + +public class BlocksHandler { + + private static FileConfiguration config = ConfigHandler.getConfig(); + private final static List blocks = config.getStringList("blocks") + .stream() + .map(Material::valueOf) + .collect(Collectors.toList()); + private static boolean pluginOn = false; + + public static void checkBlock(Player player) { + if (!pluginOn || player.getGameMode() == GameMode.CREATIVE) + return; + Location blockLocation = player.getLocation(); + blockLocation.setY(blockLocation.getY() - 0.1); + Block block = player.getWorld().getBlockAt(blockLocation); + Bukkit.getScheduler().scheduleSyncDelayedTask(BlocksAreLava.plugin, () -> { + if (blocks.contains(block.getType()) && !checkId(player.getInventory().getBoots())) + player.setHealth(0); + }, 1); + } + + public static void onCommand(CommandSender sender) { + if (pluginOn) { + pluginOn = false; + sender.sendMessage(ChatColor.RED + "Blocks no longer kill players"); + } else { + pluginOn = true; + sender.sendMessage(ChatColor.GOLD + "Blocks can kill players now"); + } + } + + private static boolean checkId(ItemStack item) { + if (item != null) { + ItemMeta meta = item.getItemMeta(); + if (meta != null) { + NamespacedKey key = new NamespacedKey(BlocksAreLava.plugin, "item-id"); + String itemId = meta.getPersistentDataContainer().get(key, PersistentDataType.STRING); + return SpecialBoots.ID.equals(itemId); + } + } + return false; + } +} diff --git a/BlocksAreLava/src/main/java/ru/erius/blocksarelava/ConfigHandler.java b/BlocksAreLava/src/main/java/ru/erius/blocksarelava/ConfigHandler.java new file mode 100644 index 0000000..10841ad --- /dev/null +++ b/BlocksAreLava/src/main/java/ru/erius/blocksarelava/ConfigHandler.java @@ -0,0 +1,25 @@ +package ru.erius.blocksarelava; + +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +import java.io.File; + +public class ConfigHandler { + + private final static BlocksAreLava plugin = BlocksAreLava.plugin; + + private final static String fileName = "blocks.yml"; + private final static File file = new File(plugin.getDataFolder(), fileName); + private static FileConfiguration config = null; + + public static FileConfiguration getConfig() { + return config; + } + + public static void reloadConfig(boolean replace) { + plugin.saveResource(fileName, replace); + config = YamlConfiguration.loadConfiguration(file); + plugin.getLogger().info("loaded the config"); + } +} diff --git a/BlocksAreLava/src/main/java/ru/erius/blocksarelava/ServerEvents.java b/BlocksAreLava/src/main/java/ru/erius/blocksarelava/ServerEvents.java new file mode 100644 index 0000000..8574ee1 --- /dev/null +++ b/BlocksAreLava/src/main/java/ru/erius/blocksarelava/ServerEvents.java @@ -0,0 +1,19 @@ +package ru.erius.blocksarelava; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerMoveEvent; + +public class ServerEvents implements Listener { + @EventHandler + private void onPlayerMove(PlayerMoveEvent evt) { + BlocksHandler.checkBlock(evt.getPlayer()); + } + + @EventHandler + private void onInventoryClick(InventoryClickEvent evt) { + BlocksHandler.checkBlock((Player) evt.getWhoClicked()); + } +} diff --git a/BlocksAreLava/src/main/java/ru/erius/blocksarelava/SpecialBoots.java b/BlocksAreLava/src/main/java/ru/erius/blocksarelava/SpecialBoots.java new file mode 100644 index 0000000..c9328f1 --- /dev/null +++ b/BlocksAreLava/src/main/java/ru/erius/blocksarelava/SpecialBoots.java @@ -0,0 +1,90 @@ +package ru.erius.blocksarelava; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.ShapedRecipe; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.persistence.PersistentDataType; +import org.bukkit.plugin.Plugin; + +import java.util.ArrayList; +import java.util.List; + +public class SpecialBoots extends ItemStack { + + private final static Material MATERIAL = Material.NETHERITE_BOOTS; + private final static FileConfiguration CONFIG = ConfigHandler.getConfig(); + private final static List LORE = new ArrayList<>(); + private static String name; + public final static String ID = "special_boots"; + + static { + setNameAndLore(); + } + + public SpecialBoots() { + this.setType(MATERIAL); + this.setAmount(1); + ItemMeta meta = new ItemStack(MATERIAL).getItemMeta(); + meta.setDisplayName(name); + meta.setLore(LORE); + NamespacedKey key = new NamespacedKey(BlocksAreLava.plugin, "item-id"); + meta.getPersistentDataContainer().set(key, PersistentDataType.STRING, ID); + this.setItemMeta(meta); + this.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10); + this.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10); + } + + public static void addCraftingRecipe(Plugin plugin) { + NamespacedKey key = new NamespacedKey(plugin, "special_boots"); + ShapedRecipe recipe = new ShapedRecipe(key, new SpecialBoots()); + recipe.shape(".S.", "IDG", "L.W"); + recipe.setIngredient('L', Material.LAVA_BUCKET); + recipe.setIngredient('I', Material.IRON_BOOTS); + recipe.setIngredient('D', Material.DIAMOND_BOOTS); + recipe.setIngredient('G', Material.GOLDEN_BOOTS); + recipe.setIngredient('W', Material.WATER_BUCKET); + recipe.setIngredient('S', Material.NETHER_STAR); + Bukkit.addRecipe(recipe); + } + + private static void setNameAndLore() { + String nameString = CONFIG.getString("name"), loreString = CONFIG.getString("lore"); + if (loreString != null) + LORE.add(ChatColor.translateAlternateColorCodes('&', loreString)); + else + LORE.add(ChatColor.RED + "Missing lore"); + if (nameString != null) + name = ChatColor.translateAlternateColorCodes('&', nameString); + else + name = ChatColor.RED + "Missing name"; + } + + public static void onCommand(CommandSender sender, String[] args) { + if (args.length < 1) { + if (sender instanceof Player) { + ((Player) sender).getInventory().addItem(new SpecialBoots()); + sender.sendMessage(ChatColor.GREEN + "boots"); + } else + sender.sendMessage(ChatColor.RED + "You are not a player"); + } else { + String name = args[0]; + Player player = BlocksAreLava.plugin.getServer().getPlayer(name); + if (player != null) { + player.getInventory().addItem(new SpecialBoots()); + sender.sendMessage(ChatColor.GREEN + "boots"); + } else + sender.sendMessage(ChatColor.RED + "The player " + name + " is offline or doesn't exist"); + } + } +} diff --git a/BlocksAreLava/src/main/resources/blocks.yml b/BlocksAreLava/src/main/resources/blocks.yml new file mode 100644 index 0000000..1967117 --- /dev/null +++ b/BlocksAreLava/src/main/resources/blocks.yml @@ -0,0 +1,34 @@ +# Configuration file for BlocksAreLava plugin +# Add or remove blocks that will instantly kill you when you step on them under section "blocks" +# Change the name and the lore of the special boots +# Color codes: +# &1 - Dark blue +# &2 - Dark green +# &3 - Dark aqua +# &4 - Dark red +# &5 - Dark purple +# &6 - Gold +# &7 - Gray +# &8 - Dark gray +# &9 - Blue +# &0 - Black +# &a - Green +# &b - Aqua +# &c - Red +# &d - Light purple +# &e - Yellow +# &f - White +# &k - Obfuscated (хуита которая меняется каждую секунду) +# +# Other special formatting: +# &l - Bold +# &m - Strikethrough (перечекрнутый) +# &n - Underline +# &o - Italic +# &r - Reset + +name: "&d&l&k___ &6&lгавнастопы &5&lхуй &d&l&k___" +lore: "&2Супер крутые ультра супер &mгавно&r &2ботинки" +blocks: +- GRASS_BLOCK +- NETHERRACK diff --git a/BlocksAreLava/src/main/resources/plugin.yml b/BlocksAreLava/src/main/resources/plugin.yml new file mode 100644 index 0000000..280bb48 --- /dev/null +++ b/BlocksAreLava/src/main/resources/plugin.yml @@ -0,0 +1,13 @@ +name: BlocksAreLava +version: @version@ +main: ru.erius.blocksarelava.BlocksAreLava +api-version: 1.17 +authors: [ erius ] +description: use the configuration file to choose which blocks the player can't step on +commands: + blocks: + description: toggles the functionality of this plugin on or off + giveboots: + description: gives special boots to a player + resetconfig: + description: resets the config diff --git a/CobbleDiamonds/.gitignore b/CobbleDiamonds/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/CobbleDiamonds/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/CobbleDiamonds/build.gradle b/CobbleDiamonds/build.gradle new file mode 100644 index 0000000..3cd780d --- /dev/null +++ b/CobbleDiamonds/build.gradle @@ -0,0 +1,49 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius' +version = '1.0-SNAPSHOT' +def serverPath = 'C:/mc_servers/1.17.1/plugins' +def EriusLibPath = 'D:/mc_plugins/EriusLib/build/libs' +def devPath = 'D:/spigot_dev' +def spigotJar = 'spigot-1.17.1' +def citizensJar = 'Citizens-2.0.28-b2359'; + +sourceCompatibility = "16" +targetCompatibility = "16" + +repositories { + mavenCentral() + flatDir { + dirs devPath + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly name: spigotJar + compileOnly name: citizensJar + compileOnly fileTree(dir: EriusLibPath, include: '*.jar') +} + +processResources { + duplicatesStrategy = DuplicatesStrategy.INCLUDE + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +build { + doLast { + copy { + from libsDirectory + into serverPath + } + } +} diff --git a/CobbleDiamonds/gradle.properties b/CobbleDiamonds/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/CobbleDiamonds/gradle/wrapper/gradle-wrapper.jar b/CobbleDiamonds/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/CobbleDiamonds/gradle/wrapper/gradle-wrapper.jar differ diff --git a/CobbleDiamonds/gradle/wrapper/gradle-wrapper.properties b/CobbleDiamonds/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..05679dc --- /dev/null +++ b/CobbleDiamonds/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/CobbleDiamonds/gradlew b/CobbleDiamonds/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/CobbleDiamonds/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/CobbleDiamonds/gradlew.bat b/CobbleDiamonds/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/CobbleDiamonds/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/CobbleDiamonds/settings.gradle b/CobbleDiamonds/settings.gradle new file mode 100644 index 0000000..b69a149 --- /dev/null +++ b/CobbleDiamonds/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'CobbleDiamonds' diff --git a/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/CobbleDiamonds.java b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/CobbleDiamonds.java new file mode 100644 index 0000000..a522344 --- /dev/null +++ b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/CobbleDiamonds.java @@ -0,0 +1,32 @@ +package ru.erius.cobblediamonds; + +import org.bukkit.plugin.java.JavaPlugin; +import ru.erius.eriuslib.Registry; + +import java.util.List; + +public final class CobbleDiamonds extends JavaPlugin { + + private static CobbleDiamonds instance; + + { + instance = this; + } + + @Override + public void onEnable() { + Registry.registerAll(this, List.of(), List.of(SpawnNPC.class, DestroyNPCs.class), + List.of(), List.of(KillEvilWalrus.class), List.of(DiamondFromCobble.class)); + getServer().getPluginManager().registerEvents(new SpawnWalrusListener(), this); + getLogger().info(getName() + " enabled"); + } + + @Override + public void onDisable() { + getLogger().info(getName() + " disabled"); + } + + public static CobbleDiamonds getInstance() { + return instance; + } +} diff --git a/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/DestroyNPCs.java b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/DestroyNPCs.java new file mode 100644 index 0000000..aaf4c08 --- /dev/null +++ b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/DestroyNPCs.java @@ -0,0 +1,29 @@ +package ru.erius.cobblediamonds; + +import net.citizensnpcs.api.CitizensAPI; +import net.citizensnpcs.api.npc.NPCRegistry; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import ru.erius.eriuslib.commands.CustomCommand; + +import java.util.List; + +public class DestroyNPCs extends CustomCommand { + + private final static String NAME = "destroynpcs"; + + public DestroyNPCs() { + super(NAME); + } + + @Override + public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { + CitizensAPI.getNPCRegistries().forEach(NPCRegistry::deregisterAll); + return true; + } + + @Override + public List onTabComplete(CommandSender commandSender, Command command, String s, String[] strings) { + return null; + } +} diff --git a/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/DiamondFromCobble.java b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/DiamondFromCobble.java new file mode 100644 index 0000000..698ab20 --- /dev/null +++ b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/DiamondFromCobble.java @@ -0,0 +1,38 @@ +package ru.erius.cobblediamonds; + +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.CraftItemEvent; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.RecipeChoice; +import ru.erius.eriuslib.EriusLib; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.eriuslib.recipes.shaped.CustomShapedRecipe; + +import java.util.Map; + +public class DiamondFromCobble extends CustomShapedRecipe { + + private final static String NAME = "diamond_from_cobblestone"; + private final static NamespacedKey KEY = new NamespacedKey(EriusLib.getInstance(), NAME); + private final static ItemStack RESULT = new ItemStack(Material.DIAMOND); + private final static String[] SHAPE = {"AAA", "AAA", "AAA"}; + private final static Map MAP = Map.of('A', new RecipeChoice.MaterialChoice(Material.COBBLESTONE)); + private final static CustomQuest QUEST = Registry.QuestsRegistry.getQuests().get("kill_evil_walrus"); + + public DiamondFromCobble() { + super(KEY, RESULT, SHAPE, MAP, QUEST); + } + + @EventHandler + private void onCraft(CraftItemEvent evt) { + Player player = (Player) evt.getWhoClicked(); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 0.5F); + } +} diff --git a/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/EvilWalrus.java b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/EvilWalrus.java new file mode 100644 index 0000000..2eecba2 --- /dev/null +++ b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/EvilWalrus.java @@ -0,0 +1,133 @@ +package ru.erius.cobblediamonds; + +import net.citizensnpcs.api.CitizensAPI; +import net.citizensnpcs.api.ai.tree.Behavior; +import net.citizensnpcs.api.ai.tree.BehaviorStatus; +import net.citizensnpcs.api.event.NPCDamageByBlockEvent; +import net.citizensnpcs.api.event.NPCDamageByEntityEvent; +import net.citizensnpcs.api.event.NPCDeathEvent; +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.api.trait.TraitInfo; +import net.citizensnpcs.api.trait.trait.*; +import net.citizensnpcs.trait.HologramTrait; +import net.citizensnpcs.trait.SkinTrait; +import org.bukkit.*; +import org.bukkit.attribute.Attribute; +import org.bukkit.boss.BarColor; +import org.bukkit.boss.BarStyle; +import org.bukkit.boss.BossBar; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.inventory.ItemStack; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +public class EvilWalrus implements Listener { + + private final static List NPCS = new ArrayList<>(); + private final NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, ""); + private final BossBar bossBar = Bukkit.createBossBar(ChatColor.RED + "" + ChatColor.BOLD + "Evil Walrus", + BarColor.RED, BarStyle.SOLID); + private final static int HEALTH = 100; + + public EvilWalrus() { + NPCS.add(npc); + npc.setName("Evil Walrus"); + npc.setProtected(false); + npc.getOrAddTrait(Equipment.class).set(Equipment.EquipmentSlot.HAND, new ItemStack(Material.NETHERITE_SWORD)); + npc.getOrAddTrait(SkinTrait.class).setSkinPersistent("evil_walrus", + "UdL23fFUl28pHbSUy0VVGpNE8uPJEJwT3U4pn90O3xke+je1Ij8mM1rHRRudTMP1eH+JvFVgc110rYFTyWY6a8BHDPOxN6NmTuk4v+ZCfcpUzUU6N3W2fD1vVMlEEghSP/OeN9RixV5GJR3+orAmOgJEGw2kYJsv33BdJxlCEUL982eMHHs0LJXkuXXrzkCVHaGJuQ9Q4uG9rjVXupbheEhVr2c2ueeqmW3/+ho9pfxkCE0hhA7o+X7AIOy3EmopFG8G06aatnxW74Ac8+hFHZILs33pGLRY+3SKQ2bdFvgNP5Uk23B7TpaBEkeA8uAfpMebnKIWJGKtrESBXCf10YmpbI6dtzNqqVAQl/jdOn0Agy8P9Y9OLcXJh7yIyZJY4Lk59SB2uGEuVKc3QLRRFW8w+h4b0Pugl6nfrqX6NlrxcDAgg2KsaVg4d3Z799wfqRRI0ZizrN6xKLBXlVrJTO2fI2yItOodnXWcHI+yDlncMhAQTHC7SdYVRULXmiYQ1A6Un8f/7OqT+dxEi+sIxenV8X9ChEpIKXctjb4zIEMHxrUL0TyMS8jZMWPq9BwyyYNek31HFKNXPMJv5fwlyExidor6gR3zOXWh4fOXj48V92AQwMJEB3hPpsHmaD6UP/GFLYNtQ4KCXTQoCGgiCVwOghkwpVFtYMZHEaLFDSI=", + "ewogICJ0aW1lc3RhbXAiIDogMTYyODcyNjU5MDM5NywKICAicHJvZmlsZUlkIiA6ICJmMTA0NzMxZjljYTU0NmI0OTkzNjM4NTlkZWY5N2NjNiIsCiAgInByb2ZpbGVOYW1lIiA6ICJ6aWFkODciLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGJiOGUyYzY0YjExMWU2ODk0ODA3ZThhNGU1YTVlNjIxZjJlMDI4ZGJmZGZhNGEwZDliMmQ4YTUxYjk0Mjg4MiIKICAgIH0KICB9Cn0="); + Bukkit.getOnlinePlayers().forEach(bossBar::addPlayer); + } + + public void spawn(Location location) { + Behavior behavior = new EvilWalrusBehaviour(); + npc.getDefaultGoalController().addBehavior(behavior, 1); + Bukkit.getPluginManager().registerEvents((Listener) behavior, CobbleDiamonds.getInstance()); + npc.spawn(location); + ((Player) npc.getEntity()).getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(HEALTH); + ((Player) npc.getEntity()).getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).setBaseValue(30); + ((Player) npc.getEntity()).setHealth(HEALTH); + } + + private final class EvilWalrusBehaviour implements Behavior, Listener { + + private BehaviorStatus state = BehaviorStatus.RUNNING; + + @Override + public void reset() { + state = null; + } + + @Override + public BehaviorStatus run() { + checkIfDead(); + switch (state) { + case FAILURE: + break; + case RUNNING: + break; + case SUCCESS: + break; + case RESET_AND_REMOVE: + break; + } + return state; + } + + @Override + public boolean shouldExecute() { + return lockOnTarget(); + } + + private boolean lockOnTarget() { + Optional optional = npc.getEntity().getWorld().getNearbyEntities(npc.getEntity().getLocation(), + 30, 30, 30, e -> e.getType() == EntityType.PLAYER).stream().findFirst(); + if (optional.isPresent() && optional.get() != npc.getEntity()) { + npc.getNavigator().setTarget(optional.get(), true); + return true; + } + return false; + } + + private void onKill() { + Bukkit.getServer().broadcastMessage("u dead"); + npc.getNavigator().setTarget(null, false); + state = BehaviorStatus.RUNNING; + } + + private void checkIfDead() { + if (npc.getEntity().isDead()) + state = BehaviorStatus.RESET_AND_REMOVE; + } + + @EventHandler + private void onNPCDeath(NPCDeathEvent evt) { + bossBar.removeAll(); + npc.destroy(); + evt.getDrops().add(new ItemStack(Material.NETHERITE_SWORD)); + evt.getNPC().getEntity().getWorld().createExplosion(evt.getNPC().getEntity().getLocation(), 2); + SpawnWalrusListener.isAlive = false; + } + + @EventHandler + private void onNPCDamage(NPCDamageByEntityEvent evt) { + updateBossBar(); + } + + @EventHandler + private void onNpcDamage(NPCDamageByBlockEvent evt) { + updateBossBar(); + } + + private void updateBossBar() { + bossBar.setProgress(((Player) npc.getEntity()).getHealth() / HEALTH); + } + } +} diff --git a/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/KillEvilWalrus.java b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/KillEvilWalrus.java new file mode 100644 index 0000000..36d7118 --- /dev/null +++ b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/KillEvilWalrus.java @@ -0,0 +1,32 @@ +package ru.erius.cobblediamonds; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import ru.erius.eriuslib.quests.CustomQuest; + +public class KillEvilWalrus extends CustomQuest { + + private final static String NAME = "kill_evil_walrus"; + private final static String DEFAULT_QUEST_NAME = "Kill the Evil Walrus"; + private final static String DEFAULT_DESCRIPTION = "You must kill the Evil Walrus"; + private final static String DEFAULT_TITLE = ChatColor.GREEN + "Quest completed"; + private final static String DEFAULT_SUBTITLE = ChatColor.GOLD + "New recipe unlocked"; + + public KillEvilWalrus() { + super(NAME, DEFAULT_QUEST_NAME, DEFAULT_DESCRIPTION, DEFAULT_TITLE, DEFAULT_SUBTITLE); + } + + @EventHandler + private void progressQuest(EntityDamageByEntityEvent evt) { + if (!(evt.getDamager() instanceof Player player) || player.hasMetadata("NPC") || this.getCompleted(player)) + return; + if (evt.getEntity() instanceof Player npc) { + if (npc.getHealth() - evt.getFinalDamage() <= 0 && npc.hasMetadata("NPC")) { + this.onCompletion(player); + this.setCompeted(player, true); + } + } + } +} diff --git a/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/SpawnNPC.java b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/SpawnNPC.java new file mode 100644 index 0000000..bacefcc --- /dev/null +++ b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/SpawnNPC.java @@ -0,0 +1,33 @@ +package ru.erius.cobblediamonds; + +import org.bukkit.Bukkit; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import ru.erius.eriuslib.commands.CustomCommand; + +import java.util.List; + +public class SpawnNPC extends CustomCommand { + + private final static String NAME = "spawnnpc"; + + public SpawnNPC() { + super(NAME); + } + + @Override + public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { + if (commandSender instanceof Player player) { + EvilWalrus evilWalrus = new EvilWalrus(); + Bukkit.getPluginManager().registerEvents(evilWalrus, CobbleDiamonds.getInstance()); + evilWalrus.spawn(player.getLocation()); + } + return true; + } + + @Override + public List onTabComplete(CommandSender commandSender, Command command, String s, String[] strings) { + return null; + } +} diff --git a/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/SpawnWalrusListener.java b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/SpawnWalrusListener.java new file mode 100644 index 0000000..fda103b --- /dev/null +++ b/CobbleDiamonds/src/main/java/ru/erius/cobblediamonds/SpawnWalrusListener.java @@ -0,0 +1,24 @@ +package ru.erius.cobblediamonds; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerItemConsumeEvent; + +public class SpawnWalrusListener implements Listener { + + public static boolean isAlive = false; + + @EventHandler + private void test(PlayerItemConsumeEvent evt) { + if (evt.getItem().getType() == Material.ROTTEN_FLESH && !isAlive) { + EvilWalrus evilWalrus = new EvilWalrus(); + Bukkit.getPluginManager().registerEvents(evilWalrus, CobbleDiamonds.getInstance()); + evilWalrus.spawn(evt.getPlayer().getLocation()); + evt.getPlayer().getWorld().playSound(evt.getPlayer().getEyeLocation(), Sound.ENTITY_WITHER_SPAWN, 1F, 0.5F); + isAlive = true; + } + } +} diff --git a/CobbleDiamonds/src/main/resources/plugin.yml b/CobbleDiamonds/src/main/resources/plugin.yml new file mode 100644 index 0000000..522ddc2 --- /dev/null +++ b/CobbleDiamonds/src/main/resources/plugin.yml @@ -0,0 +1,12 @@ +name: CobbleDiamonds +version: @version@ +main: ru.erius.cobblediamonds.CobbleDiamonds +api-version: 1.17 +authors: [ erius ] +depend: [ EriusLib, Citizens ] +description: new recipe for diamonds which is unlocked by completing a quest +commands: + spawnnpc: + description: spawns NPC + destroynpcs: + description: destroys all NPCs diff --git a/EriusLib b/EriusLib new file mode 160000 index 0000000..1c22480 --- /dev/null +++ b/EriusLib @@ -0,0 +1 @@ +Subproject commit 1c224806a7a42a5537a1b32742b9b67e0a599f06 diff --git a/EriusLibPaper/.gitignore b/EriusLibPaper/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/EriusLibPaper/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/EriusLibPaper/build.gradle b/EriusLibPaper/build.gradle new file mode 100644 index 0000000..a424c2e --- /dev/null +++ b/EriusLibPaper/build.gradle @@ -0,0 +1,43 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius' +version = '1.0' +def serverPath = 'C:/mc_servers/1.17.1-paper/plugins' + +sourceCompatibility = '11' +targetCompatibility = '11' + +repositories { + mavenCentral() + maven { + name = 'papermc-repo' + url = 'https://papermc.io/repo/repository/maven-public/' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly 'io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT' +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +build { + doLast { + copy { + from libsDir + into serverPath + } + } +} diff --git a/EriusLibPaper/gradle.properties b/EriusLibPaper/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/EriusLibPaper/gradle/wrapper/gradle-wrapper.jar b/EriusLibPaper/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/EriusLibPaper/gradle/wrapper/gradle-wrapper.jar differ diff --git a/EriusLibPaper/gradle/wrapper/gradle-wrapper.properties b/EriusLibPaper/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b5f89 --- /dev/null +++ b/EriusLibPaper/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/EriusLibPaper/gradlew b/EriusLibPaper/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/EriusLibPaper/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/EriusLibPaper/gradlew.bat b/EriusLibPaper/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/EriusLibPaper/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/EriusLibPaper/settings.gradle b/EriusLibPaper/settings.gradle new file mode 100644 index 0000000..e795a08 --- /dev/null +++ b/EriusLibPaper/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'EriusLibPaper' diff --git a/EriusLibPaper/src/main/resources/plugin.yml b/EriusLibPaper/src/main/resources/plugin.yml new file mode 100644 index 0000000..8862bb4 --- /dev/null +++ b/EriusLibPaper/src/main/resources/plugin.yml @@ -0,0 +1,6 @@ +name: EriusLibPaper +version: @version@ +main: ru.erius.eriuslibpaper.EriusLibPaper +api-version: 1.17 +authors: [ erius ] +description: library plugin for custom items, recipes, quests and more diff --git a/KotlinLib/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock b/KotlinLib/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000..28881df Binary files /dev/null and b/KotlinLib/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock differ diff --git a/KotlinLib/.gradle/7.1/dependencies-accessors/gc.properties b/KotlinLib/.gradle/7.1/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/KotlinLib/.gradle/7.1/executionHistory/executionHistory.bin b/KotlinLib/.gradle/7.1/executionHistory/executionHistory.bin new file mode 100644 index 0000000..bc42aac Binary files /dev/null and b/KotlinLib/.gradle/7.1/executionHistory/executionHistory.bin differ diff --git a/KotlinLib/.gradle/7.1/executionHistory/executionHistory.lock b/KotlinLib/.gradle/7.1/executionHistory/executionHistory.lock new file mode 100644 index 0000000..f21a055 Binary files /dev/null and b/KotlinLib/.gradle/7.1/executionHistory/executionHistory.lock differ diff --git a/KotlinLib/.gradle/7.1/fileChanges/last-build.bin b/KotlinLib/.gradle/7.1/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/KotlinLib/.gradle/7.1/fileChanges/last-build.bin differ diff --git a/KotlinLib/.gradle/7.1/fileHashes/fileHashes.bin b/KotlinLib/.gradle/7.1/fileHashes/fileHashes.bin new file mode 100644 index 0000000..075bedc Binary files /dev/null and b/KotlinLib/.gradle/7.1/fileHashes/fileHashes.bin differ diff --git a/KotlinLib/.gradle/7.1/fileHashes/fileHashes.lock b/KotlinLib/.gradle/7.1/fileHashes/fileHashes.lock new file mode 100644 index 0000000..af1059b Binary files /dev/null and b/KotlinLib/.gradle/7.1/fileHashes/fileHashes.lock differ diff --git a/KotlinLib/.gradle/7.1/gc.properties b/KotlinLib/.gradle/7.1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/KotlinLib/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock b/KotlinLib/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000..0b2d70a Binary files /dev/null and b/KotlinLib/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock differ diff --git a/KotlinLib/.gradle/7.2/dependencies-accessors/gc.properties b/KotlinLib/.gradle/7.2/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/KotlinLib/.gradle/7.2/executionHistory/executionHistory.bin b/KotlinLib/.gradle/7.2/executionHistory/executionHistory.bin new file mode 100644 index 0000000..b8c323d Binary files /dev/null and b/KotlinLib/.gradle/7.2/executionHistory/executionHistory.bin differ diff --git a/KotlinLib/.gradle/7.2/executionHistory/executionHistory.lock b/KotlinLib/.gradle/7.2/executionHistory/executionHistory.lock new file mode 100644 index 0000000..9737d1a Binary files /dev/null and b/KotlinLib/.gradle/7.2/executionHistory/executionHistory.lock differ diff --git a/KotlinLib/.gradle/7.2/fileChanges/last-build.bin b/KotlinLib/.gradle/7.2/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/KotlinLib/.gradle/7.2/fileChanges/last-build.bin differ diff --git a/KotlinLib/.gradle/7.2/fileHashes/fileHashes.bin b/KotlinLib/.gradle/7.2/fileHashes/fileHashes.bin new file mode 100644 index 0000000..ff03410 Binary files /dev/null and b/KotlinLib/.gradle/7.2/fileHashes/fileHashes.bin differ diff --git a/KotlinLib/.gradle/7.2/fileHashes/fileHashes.lock b/KotlinLib/.gradle/7.2/fileHashes/fileHashes.lock new file mode 100644 index 0000000..934353c Binary files /dev/null and b/KotlinLib/.gradle/7.2/fileHashes/fileHashes.lock differ diff --git a/KotlinLib/.gradle/7.2/gc.properties b/KotlinLib/.gradle/7.2/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/KotlinLib/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/KotlinLib/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..a876dc4 Binary files /dev/null and b/KotlinLib/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/KotlinLib/.gradle/buildOutputCleanup/cache.properties b/KotlinLib/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..e1097c7 --- /dev/null +++ b/KotlinLib/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Fri Feb 04 03:54:01 MSK 2022 +gradle.version=7.2 diff --git a/KotlinLib/.gradle/buildOutputCleanup/outputFiles.bin b/KotlinLib/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..7e6fdea Binary files /dev/null and b/KotlinLib/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/KotlinLib/.gradle/checksums/checksums.lock b/KotlinLib/.gradle/checksums/checksums.lock new file mode 100644 index 0000000..55927fb Binary files /dev/null and b/KotlinLib/.gradle/checksums/checksums.lock differ diff --git a/KotlinLib/.gradle/checksums/md5-checksums.bin b/KotlinLib/.gradle/checksums/md5-checksums.bin new file mode 100644 index 0000000..44b593c Binary files /dev/null and b/KotlinLib/.gradle/checksums/md5-checksums.bin differ diff --git a/KotlinLib/.gradle/checksums/sha1-checksums.bin b/KotlinLib/.gradle/checksums/sha1-checksums.bin new file mode 100644 index 0000000..eae0c1a Binary files /dev/null and b/KotlinLib/.gradle/checksums/sha1-checksums.bin differ diff --git a/KotlinLib/.gradle/vcs-1/gc.properties b/KotlinLib/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/KotlinLib/.idea/.gitignore b/KotlinLib/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/KotlinLib/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/KotlinLib/.idea/compiler.xml b/KotlinLib/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/KotlinLib/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/KotlinLib/.idea/gradle.xml b/KotlinLib/.idea/gradle.xml new file mode 100644 index 0000000..611e7c8 --- /dev/null +++ b/KotlinLib/.idea/gradle.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/KotlinLib/.idea/jarRepositories.xml b/KotlinLib/.idea/jarRepositories.xml new file mode 100644 index 0000000..ed1729d --- /dev/null +++ b/KotlinLib/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/KotlinLib/.idea/misc.xml b/KotlinLib/.idea/misc.xml new file mode 100644 index 0000000..5ccf79a --- /dev/null +++ b/KotlinLib/.idea/misc.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/KotlinLib/.idea/modules/KotlinLib.main.iml b/KotlinLib/.idea/modules/KotlinLib.main.iml new file mode 100644 index 0000000..fa63d4b --- /dev/null +++ b/KotlinLib/.idea/modules/KotlinLib.main.iml @@ -0,0 +1,12 @@ + + + + + + + SPIGOT + + + + + \ No newline at end of file diff --git a/KotlinLib/build.gradle.kts b/KotlinLib/build.gradle.kts new file mode 100644 index 0000000..2488e7d --- /dev/null +++ b/KotlinLib/build.gradle.kts @@ -0,0 +1,39 @@ +plugins { + id("com.github.johnrengelman.shadow") version "7.1.2" + kotlin("jvm") version "1.6.10" + java +} + +group = "ru.erius" +version = kotlin.coreLibrariesVersion +val serverPath = "C:/mc_servers/vanilla/plugins" +val mainClass = "$group.${name.toLowerCase()}.$name" + +repositories { + mavenCentral() + maven(url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/") + maven(url = "https://oss.sonatype.org/content/groups/public/") +} + +dependencies { + implementation(kotlin("stdlib")) + compileOnly("org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT") +} + +tasks.processResources { + expand("name" to project.name, "version" to version, "main" to mainClass) +} + +tasks.getByName("test") { + useJUnitPlatform() +} + +tasks.shadowJar { + archiveClassifier.set("") + doLast { + copy { + from(destinationDirectory) + into(serverPath) + } + } +} diff --git a/KotlinLib/build/classes/kotlin/main/META-INF/KotlinLib.kotlin_module b/KotlinLib/build/classes/kotlin/main/META-INF/KotlinLib.kotlin_module new file mode 100644 index 0000000..3a4e3bf Binary files /dev/null and b/KotlinLib/build/classes/kotlin/main/META-INF/KotlinLib.kotlin_module differ diff --git a/KotlinLib/build/classes/kotlin/main/ru/erius/kotlinlib/KotlinLib.class b/KotlinLib/build/classes/kotlin/main/ru/erius/kotlinlib/KotlinLib.class new file mode 100644 index 0000000..865d0bd Binary files /dev/null and b/KotlinLib/build/classes/kotlin/main/ru/erius/kotlinlib/KotlinLib.class differ diff --git a/KotlinLib/build/kotlin/KotlinLib10jar-classes.txt b/KotlinLib/build/kotlin/KotlinLib10jar-classes.txt new file mode 100644 index 0000000..10e6701 --- /dev/null +++ b/KotlinLib/build/kotlin/KotlinLib10jar-classes.txt @@ -0,0 +1 @@ +D:\stuff\mc_stuff\mc_plugins\KotlinLib\build\classes\kotlin\main\ru\erius\kotlinlib\KotlinPlugin.class \ No newline at end of file diff --git a/KotlinLib/build/kotlin/compileKotlin/build-history.bin b/KotlinLib/build/kotlin/compileKotlin/build-history.bin new file mode 100644 index 0000000..25213fe Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/build-history.bin differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab new file mode 100644 index 0000000..bdf584a Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream new file mode 100644 index 0000000..57613a6 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len new file mode 100644 index 0000000..1c69ee4 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len new file mode 100644 index 0000000..2a17e6e Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at new file mode 100644 index 0000000..ce4baa5 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i new file mode 100644 index 0000000..7d5d9a9 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab new file mode 100644 index 0000000..bdf584a Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream new file mode 100644 index 0000000..9e7fd0f Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len new file mode 100644 index 0000000..a930d6b Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len new file mode 100644 index 0000000..2a17e6e Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at new file mode 100644 index 0000000..53b2d29 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i new file mode 100644 index 0000000..67a7f37 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab new file mode 100644 index 0000000..bdf584a Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream new file mode 100644 index 0000000..9e7fd0f Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len new file mode 100644 index 0000000..a930d6b Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len new file mode 100644 index 0000000..2a17e6e Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at new file mode 100644 index 0000000..7aef981 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i new file mode 100644 index 0000000..67a7f37 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab new file mode 100644 index 0000000..bdf584a Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream new file mode 100644 index 0000000..2b427ab Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len new file mode 100644 index 0000000..a930d6b Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len new file mode 100644 index 0000000..2a17e6e Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at new file mode 100644 index 0000000..7aef981 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i new file mode 100644 index 0000000..8fb7029 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab new file mode 100644 index 0000000..da28c7a Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream new file mode 100644 index 0000000..4a6fde8 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len new file mode 100644 index 0000000..79ad34c Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len new file mode 100644 index 0000000..01bdaa1 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at new file mode 100644 index 0000000..8167c0c Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i new file mode 100644 index 0000000..7f55211 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab new file mode 100644 index 0000000..bdf584a Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream new file mode 100644 index 0000000..57613a6 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len new file mode 100644 index 0000000..1c69ee4 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len new file mode 100644 index 0000000..2a17e6e Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at new file mode 100644 index 0000000..2712bcb Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i new file mode 100644 index 0000000..7d5d9a9 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab new file mode 100644 index 0000000..bdf584a Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream new file mode 100644 index 0000000..bfa5200 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len new file mode 100644 index 0000000..4b05c55 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len new file mode 100644 index 0000000..2a17e6e Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at new file mode 100644 index 0000000..f8c1a64 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i new file mode 100644 index 0000000..8dde309 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab new file mode 100644 index 0000000..bdf584a Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream new file mode 100644 index 0000000..9e7fd0f Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len new file mode 100644 index 0000000..a930d6b Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len new file mode 100644 index 0000000..2a17e6e Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at new file mode 100644 index 0000000..cac5ffd Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i new file mode 100644 index 0000000..67a7f37 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab new file mode 100644 index 0000000..166c057 --- /dev/null +++ b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab @@ -0,0 +1,2 @@ +1 +0 \ No newline at end of file diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab new file mode 100644 index 0000000..bdf584a Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream new file mode 100644 index 0000000..57613a6 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len new file mode 100644 index 0000000..1c69ee4 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len new file mode 100644 index 0000000..2a17e6e Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at new file mode 100644 index 0000000..5875372 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i new file mode 100644 index 0000000..4b1132c Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab new file mode 100644 index 0000000..8aad32b Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream new file mode 100644 index 0000000..08e7df1 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len new file mode 100644 index 0000000..b7da01d Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len new file mode 100644 index 0000000..2a17e6e Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at new file mode 100644 index 0000000..7aef981 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab new file mode 100644 index 0000000..515ac72 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream new file mode 100644 index 0000000..8456e23 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len new file mode 100644 index 0000000..783a43b Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len new file mode 100644 index 0000000..385642d Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at new file mode 100644 index 0000000..9d3b89d Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i new file mode 100644 index 0000000..1fa2896 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i differ diff --git a/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len differ diff --git a/KotlinLib/build/kotlin/compileKotlin/last-build.bin b/KotlinLib/build/kotlin/compileKotlin/last-build.bin new file mode 100644 index 0000000..e9c8dc2 Binary files /dev/null and b/KotlinLib/build/kotlin/compileKotlin/last-build.bin differ diff --git a/KotlinLib/build/libs/KotlinLib-1.6.10.jar b/KotlinLib/build/libs/KotlinLib-1.6.10.jar new file mode 100644 index 0000000..28678cc Binary files /dev/null and b/KotlinLib/build/libs/KotlinLib-1.6.10.jar differ diff --git a/KotlinLib/build/resources/main/plugin.yml b/KotlinLib/build/resources/main/plugin.yml new file mode 100644 index 0000000..33ed2c1 --- /dev/null +++ b/KotlinLib/build/resources/main/plugin.yml @@ -0,0 +1,6 @@ +name: KotlinLib +version: 1.6.10 +main: ru.erius.kotlinlib.KotlinLib +api-version: 1.18 +authors: [ erius ] +description: "Shared Kotlin library for plugins using Kotlin language" diff --git a/KotlinLib/build/tmp/jar/MANIFEST.MF b/KotlinLib/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/KotlinLib/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/KotlinLib/build/tmp/shadowJar/MANIFEST.MF b/KotlinLib/build/tmp/shadowJar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/KotlinLib/build/tmp/shadowJar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/KotlinLib/gradle.properties b/KotlinLib/gradle.properties new file mode 100644 index 0000000..29e08e8 --- /dev/null +++ b/KotlinLib/gradle.properties @@ -0,0 +1 @@ +kotlin.code.style=official \ No newline at end of file diff --git a/KotlinLib/gradle/wrapper/gradle-wrapper.jar b/KotlinLib/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..7454180 Binary files /dev/null and b/KotlinLib/gradle/wrapper/gradle-wrapper.jar differ diff --git a/KotlinLib/gradle/wrapper/gradle-wrapper.properties b/KotlinLib/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ffed3a2 --- /dev/null +++ b/KotlinLib/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/KotlinLib/gradlew b/KotlinLib/gradlew new file mode 100644 index 0000000..744e882 --- /dev/null +++ b/KotlinLib/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MSYS* | MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/KotlinLib/gradlew.bat b/KotlinLib/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/KotlinLib/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/KotlinLib/settings.gradle.kts b/KotlinLib/settings.gradle.kts new file mode 100644 index 0000000..8613e5a --- /dev/null +++ b/KotlinLib/settings.gradle.kts @@ -0,0 +1,2 @@ +rootProject.name = "KotlinLib" + diff --git a/KotlinLib/src/main/kotlin/ru/erius/kotlinlib/KotlinLib.kt b/KotlinLib/src/main/kotlin/ru/erius/kotlinlib/KotlinLib.kt new file mode 100644 index 0000000..f5e59c2 --- /dev/null +++ b/KotlinLib/src/main/kotlin/ru/erius/kotlinlib/KotlinLib.kt @@ -0,0 +1,15 @@ +package ru.erius.kotlinlib + +import org.bukkit.plugin.java.JavaPlugin + +class KotlinLib : JavaPlugin() { + override fun onEnable() { + super.onEnable() + logger.info("$name enabled") + } + + override fun onDisable() { + super.onDisable() + logger.info("$name disabled") + } +} \ No newline at end of file diff --git a/KotlinLib/src/main/resources/plugin.yml b/KotlinLib/src/main/resources/plugin.yml new file mode 100644 index 0000000..323778d --- /dev/null +++ b/KotlinLib/src/main/resources/plugin.yml @@ -0,0 +1,6 @@ +name: $name +version: $version +main: $main +api-version: 1.18 +authors: [ erius ] +description: "Shared Kotlin library for plugins using Kotlin language" diff --git a/KotlinPlugin/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock b/KotlinPlugin/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000..cfa50fb Binary files /dev/null and b/KotlinPlugin/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock differ diff --git a/KotlinPlugin/.gradle/7.2/dependencies-accessors/gc.properties b/KotlinPlugin/.gradle/7.2/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/KotlinPlugin/.gradle/7.2/executionHistory/executionHistory.bin b/KotlinPlugin/.gradle/7.2/executionHistory/executionHistory.bin new file mode 100644 index 0000000..e385204 Binary files /dev/null and b/KotlinPlugin/.gradle/7.2/executionHistory/executionHistory.bin differ diff --git a/KotlinPlugin/.gradle/7.2/executionHistory/executionHistory.lock b/KotlinPlugin/.gradle/7.2/executionHistory/executionHistory.lock new file mode 100644 index 0000000..8edf6a4 Binary files /dev/null and b/KotlinPlugin/.gradle/7.2/executionHistory/executionHistory.lock differ diff --git a/KotlinPlugin/.gradle/7.2/fileChanges/last-build.bin b/KotlinPlugin/.gradle/7.2/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/KotlinPlugin/.gradle/7.2/fileChanges/last-build.bin differ diff --git a/KotlinPlugin/.gradle/7.2/fileHashes/fileHashes.bin b/KotlinPlugin/.gradle/7.2/fileHashes/fileHashes.bin new file mode 100644 index 0000000..bcf92ce Binary files /dev/null and b/KotlinPlugin/.gradle/7.2/fileHashes/fileHashes.bin differ diff --git a/KotlinPlugin/.gradle/7.2/fileHashes/fileHashes.lock b/KotlinPlugin/.gradle/7.2/fileHashes/fileHashes.lock new file mode 100644 index 0000000..2eeab89 Binary files /dev/null and b/KotlinPlugin/.gradle/7.2/fileHashes/fileHashes.lock differ diff --git a/KotlinPlugin/.gradle/7.2/gc.properties b/KotlinPlugin/.gradle/7.2/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/KotlinPlugin/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/KotlinPlugin/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..bb35c67 Binary files /dev/null and b/KotlinPlugin/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/KotlinPlugin/.gradle/buildOutputCleanup/cache.properties b/KotlinPlugin/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..09aa2ef --- /dev/null +++ b/KotlinPlugin/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Fri Feb 04 02:04:35 MSK 2022 +gradle.version=7.2 diff --git a/KotlinPlugin/.gradle/buildOutputCleanup/outputFiles.bin b/KotlinPlugin/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..d3ab762 Binary files /dev/null and b/KotlinPlugin/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/KotlinPlugin/.gradle/checksums/checksums.lock b/KotlinPlugin/.gradle/checksums/checksums.lock new file mode 100644 index 0000000..31942fe Binary files /dev/null and b/KotlinPlugin/.gradle/checksums/checksums.lock differ diff --git a/KotlinPlugin/.gradle/checksums/md5-checksums.bin b/KotlinPlugin/.gradle/checksums/md5-checksums.bin new file mode 100644 index 0000000..342022b Binary files /dev/null and b/KotlinPlugin/.gradle/checksums/md5-checksums.bin differ diff --git a/KotlinPlugin/.gradle/checksums/sha1-checksums.bin b/KotlinPlugin/.gradle/checksums/sha1-checksums.bin new file mode 100644 index 0000000..f836520 Binary files /dev/null and b/KotlinPlugin/.gradle/checksums/sha1-checksums.bin differ diff --git a/KotlinPlugin/.gradle/vcs-1/gc.properties b/KotlinPlugin/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/KotlinPlugin/.idea/.gitignore b/KotlinPlugin/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/KotlinPlugin/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/KotlinPlugin/.idea/compiler.xml b/KotlinPlugin/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/KotlinPlugin/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/KotlinPlugin/.idea/gradle.xml b/KotlinPlugin/.idea/gradle.xml new file mode 100644 index 0000000..611e7c8 --- /dev/null +++ b/KotlinPlugin/.idea/gradle.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/KotlinPlugin/.idea/jarRepositories.xml b/KotlinPlugin/.idea/jarRepositories.xml new file mode 100644 index 0000000..e601f51 --- /dev/null +++ b/KotlinPlugin/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/KotlinPlugin/.idea/kotlinScripting.xml b/KotlinPlugin/.idea/kotlinScripting.xml new file mode 100644 index 0000000..bc444de --- /dev/null +++ b/KotlinPlugin/.idea/kotlinScripting.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/KotlinPlugin/.idea/misc.xml b/KotlinPlugin/.idea/misc.xml new file mode 100644 index 0000000..5ccf79a --- /dev/null +++ b/KotlinPlugin/.idea/misc.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/KotlinPlugin/.idea/modules/KotlinPlugin.main.iml b/KotlinPlugin/.idea/modules/KotlinPlugin.main.iml new file mode 100644 index 0000000..fa63d4b --- /dev/null +++ b/KotlinPlugin/.idea/modules/KotlinPlugin.main.iml @@ -0,0 +1,12 @@ + + + + + + + SPIGOT + + + + + \ No newline at end of file diff --git a/KotlinPlugin/build.gradle.kts b/KotlinPlugin/build.gradle.kts new file mode 100644 index 0000000..a02aa33 --- /dev/null +++ b/KotlinPlugin/build.gradle.kts @@ -0,0 +1,28 @@ +plugins { + kotlin("jvm") version "1.6.10" + java +} + +group = "ru.erius" +version = "1.0" +val serverPath = "C:/mc_servers/vanilla/plugins" +val mainClass = "$group.${name.toLowerCase()}.$name" + +repositories { + mavenCentral() + maven(url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/") + maven(url = "https://oss.sonatype.org/content/groups/public/") +} + +dependencies { + implementation(kotlin("stdlib")) + compileOnly("org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT") +} + +tasks.processResources { + expand("name" to project.name, "version" to version, "main" to mainClass) +} + +tasks.jar { + destinationDirectory.set(file(serverPath)) +} diff --git a/KotlinPlugin/build/classes/kotlin/main/META-INF/KotlinPlugin.kotlin_module b/KotlinPlugin/build/classes/kotlin/main/META-INF/KotlinPlugin.kotlin_module new file mode 100644 index 0000000..85e3abe Binary files /dev/null and b/KotlinPlugin/build/classes/kotlin/main/META-INF/KotlinPlugin.kotlin_module differ diff --git a/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/KotlinPlugin$Companion.class b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/KotlinPlugin$Companion.class new file mode 100644 index 0000000..8c06596 Binary files /dev/null and b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/KotlinPlugin$Companion.class differ diff --git a/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/KotlinPlugin.class b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/KotlinPlugin.class new file mode 100644 index 0000000..29d3841 Binary files /dev/null and b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/KotlinPlugin.class differ diff --git a/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/command/CustomCommand.class b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/command/CustomCommand.class new file mode 100644 index 0000000..6a53045 Binary files /dev/null and b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/command/CustomCommand.class differ diff --git a/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/command/GiveItem.class b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/command/GiveItem.class new file mode 100644 index 0000000..a15f44a Binary files /dev/null and b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/command/GiveItem.class differ diff --git a/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/item/CustomItem.class b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/item/CustomItem.class new file mode 100644 index 0000000..713fcee Binary files /dev/null and b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/item/CustomItem.class differ diff --git a/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/item/CustomItemKt.class b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/item/CustomItemKt.class new file mode 100644 index 0000000..4ff8216 Binary files /dev/null and b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/item/CustomItemKt.class differ diff --git a/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/item/SpringBoots.class b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/item/SpringBoots.class new file mode 100644 index 0000000..822b075 Binary files /dev/null and b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/item/SpringBoots.class differ diff --git a/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/registry/Registry$CommandRegistry.class b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/registry/Registry$CommandRegistry.class new file mode 100644 index 0000000..ac6e970 Binary files /dev/null and b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/registry/Registry$CommandRegistry.class differ diff --git a/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/registry/Registry$ItemRegistry.class b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/registry/Registry$ItemRegistry.class new file mode 100644 index 0000000..2dee575 Binary files /dev/null and b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/registry/Registry$ItemRegistry.class differ diff --git a/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/registry/Registry.class b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/registry/Registry.class new file mode 100644 index 0000000..b1e3bda Binary files /dev/null and b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/registry/Registry.class differ diff --git a/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/util/UtilFunctionsKt.class b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/util/UtilFunctionsKt.class new file mode 100644 index 0000000..4875ca4 Binary files /dev/null and b/KotlinPlugin/build/classes/kotlin/main/ru/erius/kotlinplugin/util/UtilFunctionsKt.class differ diff --git a/KotlinPlugin/build/kotlin/KotlinPlugin10jar-classes.txt b/KotlinPlugin/build/kotlin/KotlinPlugin10jar-classes.txt new file mode 100644 index 0000000..8bfd6d9 --- /dev/null +++ b/KotlinPlugin/build/kotlin/KotlinPlugin10jar-classes.txt @@ -0,0 +1 @@ +D:\mc_stuff\mc_plugins\KotlinPlugin\build\classes\kotlin\main\ru\erius\kotlinplugin\KotlinPlugin$Companion.class;D:\mc_stuff\mc_plugins\KotlinPlugin\build\classes\kotlin\main\ru\erius\kotlinplugin\KotlinPlugin.class;D:\mc_stuff\mc_plugins\KotlinPlugin\build\classes\kotlin\main\ru\erius\kotlinplugin\command\CustomCommand.class;D:\mc_stuff\mc_plugins\KotlinPlugin\build\classes\kotlin\main\ru\erius\kotlinplugin\command\GiveItem.class;D:\mc_stuff\mc_plugins\KotlinPlugin\build\classes\kotlin\main\ru\erius\kotlinplugin\item\CustomItem.class;D:\mc_stuff\mc_plugins\KotlinPlugin\build\classes\kotlin\main\ru\erius\kotlinplugin\item\CustomItemKt.class;D:\mc_stuff\mc_plugins\KotlinPlugin\build\classes\kotlin\main\ru\erius\kotlinplugin\item\SpringBoots.class;D:\mc_stuff\mc_plugins\KotlinPlugin\build\classes\kotlin\main\ru\erius\kotlinplugin\registry\Registry$CommandRegistry.class;D:\mc_stuff\mc_plugins\KotlinPlugin\build\classes\kotlin\main\ru\erius\kotlinplugin\registry\Registry$ItemRegistry.class;D:\mc_stuff\mc_plugins\KotlinPlugin\build\classes\kotlin\main\ru\erius\kotlinplugin\registry\Registry.class;D:\mc_stuff\mc_plugins\KotlinPlugin\build\classes\kotlin\main\ru\erius\kotlinplugin\util\UtilFunctionsKt.class \ No newline at end of file diff --git a/KotlinPlugin/build/kotlin/compileKotlin/build-history.bin b/KotlinPlugin/build/kotlin/compileKotlin/build-history.bin new file mode 100644 index 0000000..8589996 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/build-history.bin differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab new file mode 100644 index 0000000..3373445 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream new file mode 100644 index 0000000..93a3b91 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len new file mode 100644 index 0000000..50705e6 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len new file mode 100644 index 0000000..817b326 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at new file mode 100644 index 0000000..ec8bf10 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i new file mode 100644 index 0000000..52fdf1a Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab new file mode 100644 index 0000000..7cbc30c Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream new file mode 100644 index 0000000..0d3bae6 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len new file mode 100644 index 0000000..730fec9 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len new file mode 100644 index 0000000..eb0b8a0 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at new file mode 100644 index 0000000..cc74e23 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i new file mode 100644 index 0000000..5d7f78d Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab new file mode 100644 index 0000000..159a41f Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream new file mode 100644 index 0000000..0d3bae6 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len new file mode 100644 index 0000000..730fec9 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len new file mode 100644 index 0000000..eb0b8a0 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at new file mode 100644 index 0000000..3475ee6 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i new file mode 100644 index 0000000..5d7f78d Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab new file mode 100644 index 0000000..6292518 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream new file mode 100644 index 0000000..968746b Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len new file mode 100644 index 0000000..a123325 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len new file mode 100644 index 0000000..a541356 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at new file mode 100644 index 0000000..80ee5b4 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i new file mode 100644 index 0000000..7115156 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab new file mode 100644 index 0000000..58e60b3 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream new file mode 100644 index 0000000..32c287c Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len new file mode 100644 index 0000000..1a83a7a Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.len new file mode 100644 index 0000000..01bdaa1 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.values.at b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.values.at new file mode 100644 index 0000000..864ab32 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.values.at differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i new file mode 100644 index 0000000..ab4885f Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab new file mode 100644 index 0000000..84c2649 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream new file mode 100644 index 0000000..102ec2d Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len new file mode 100644 index 0000000..3481ad6 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len new file mode 100644 index 0000000..a363176 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values new file mode 100644 index 0000000..fcd7106 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at new file mode 100644 index 0000000..4a1007d Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.s b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.s new file mode 100644 index 0000000..2f5dbfe --- /dev/null +++ b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.s @@ -0,0 +1 @@ +222222222222222222222223 \ No newline at end of file diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i new file mode 100644 index 0000000..d6eea3e Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab new file mode 100644 index 0000000..b451e50 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream new file mode 100644 index 0000000..0a79e31 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len new file mode 100644 index 0000000..50705e6 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len new file mode 100644 index 0000000..817b326 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at new file mode 100644 index 0000000..a0e01b6 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i new file mode 100644 index 0000000..eac1c41 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab new file mode 100644 index 0000000..04056bb Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream new file mode 100644 index 0000000..e824783 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len new file mode 100644 index 0000000..003bc0e Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len new file mode 100644 index 0000000..817b326 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at new file mode 100644 index 0000000..06346d7 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i new file mode 100644 index 0000000..cd05ba5 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab new file mode 100644 index 0000000..e979244 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream new file mode 100644 index 0000000..6bbc03d Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len new file mode 100644 index 0000000..4445403 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len new file mode 100644 index 0000000..ec8f944 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at new file mode 100644 index 0000000..aa30ae7 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i new file mode 100644 index 0000000..06868b6 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab new file mode 100644 index 0000000..cc2fffe --- /dev/null +++ b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab @@ -0,0 +1,2 @@ +69 +0 \ No newline at end of file diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab new file mode 100644 index 0000000..372fe70 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream new file mode 100644 index 0000000..0a79e31 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len new file mode 100644 index 0000000..50705e6 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len new file mode 100644 index 0000000..817b326 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at new file mode 100644 index 0000000..ddbdfd7 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i new file mode 100644 index 0000000..aa64e5d Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab new file mode 100644 index 0000000..2b78f67 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream new file mode 100644 index 0000000..7ba0d54 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len new file mode 100644 index 0000000..1ddb457 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len new file mode 100644 index 0000000..123d5b3 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at new file mode 100644 index 0000000..5669c65 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i new file mode 100644 index 0000000..1cc6235 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab new file mode 100644 index 0000000..80361ee Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream new file mode 100644 index 0000000..2f1583b Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len new file mode 100644 index 0000000..178bcaa Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len new file mode 100644 index 0000000..debac20 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values new file mode 100644 index 0000000..efb2bee Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at new file mode 100644 index 0000000..c53e5e1 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s new file mode 100644 index 0000000..62f9ce4 --- /dev/null +++ b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s @@ -0,0 +1 @@ +ۺ޺ɼ޸Ǻӹ»ǻɺԹصгݵ \ No newline at end of file diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i new file mode 100644 index 0000000..e3e3ab6 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len differ diff --git a/KotlinPlugin/build/kotlin/compileKotlin/last-build.bin b/KotlinPlugin/build/kotlin/compileKotlin/last-build.bin new file mode 100644 index 0000000..cdd2110 Binary files /dev/null and b/KotlinPlugin/build/kotlin/compileKotlin/last-build.bin differ diff --git a/KotlinPlugin/build/resources/main/plugin.yml b/KotlinPlugin/build/resources/main/plugin.yml new file mode 100644 index 0000000..dfa92ac --- /dev/null +++ b/KotlinPlugin/build/resources/main/plugin.yml @@ -0,0 +1,14 @@ +name: KotlinPlugin +version: 1.0 +main: ru.erius.kotlinplugin.KotlinPlugin +api-version: 1.18 +depend: [ KotlinLib ] +authors: [ erius ] +description: "Test Kotlin plugin" +website: https://vk.com/public206307891 +commands: + givecustom: + description: "Gives player an item declared in eriusLibKt registry" + aliases: [ givec, gc ] + permission-message: "You do not have permission to use this command" + usage: "Usage: / [player] [name] [amount]" diff --git a/KotlinPlugin/build/tmp/jar/MANIFEST.MF b/KotlinPlugin/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/KotlinPlugin/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/KotlinPlugin/build/tmp/shadowJar/MANIFEST.MF b/KotlinPlugin/build/tmp/shadowJar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/KotlinPlugin/build/tmp/shadowJar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/KotlinPlugin/gradle.properties b/KotlinPlugin/gradle.properties new file mode 100644 index 0000000..29e08e8 --- /dev/null +++ b/KotlinPlugin/gradle.properties @@ -0,0 +1 @@ +kotlin.code.style=official \ No newline at end of file diff --git a/KotlinPlugin/gradle/wrapper/gradle-wrapper.jar b/KotlinPlugin/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..7454180 Binary files /dev/null and b/KotlinPlugin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/KotlinPlugin/gradle/wrapper/gradle-wrapper.properties b/KotlinPlugin/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ffed3a2 --- /dev/null +++ b/KotlinPlugin/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/KotlinPlugin/gradlew b/KotlinPlugin/gradlew new file mode 100644 index 0000000..744e882 --- /dev/null +++ b/KotlinPlugin/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MSYS* | MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/KotlinPlugin/gradlew.bat b/KotlinPlugin/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/KotlinPlugin/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/KotlinPlugin/settings.gradle.kts b/KotlinPlugin/settings.gradle.kts new file mode 100644 index 0000000..4e3cbe9 --- /dev/null +++ b/KotlinPlugin/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "KotlinPlugin" diff --git a/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/KotlinPlugin.kt b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/KotlinPlugin.kt new file mode 100644 index 0000000..c303741 --- /dev/null +++ b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/KotlinPlugin.kt @@ -0,0 +1,31 @@ +package ru.erius.kotlinplugin + +import org.bukkit.plugin.java.JavaPlugin +import ru.erius.kotlinplugin.command.GiveItem +import ru.erius.kotlinplugin.item.SpringBoots +import ru.erius.kotlinplugin.registry.Registry + +class KotlinPlugin : JavaPlugin() { + + companion object { + lateinit var instance: JavaPlugin + private set + } + + override fun onEnable() { + super.onEnable() + instance = this + registerEverything() + logger.info("$name enabled") + } + + override fun onDisable() { + super.onDisable() + logger.info("$name disabled") + } + + private fun registerEverything() { + Registry.ItemRegistry.registerItems(instance, SpringBoots) + Registry.CommandRegistry.registerCommands(instance, GiveItem) + } +} \ No newline at end of file diff --git a/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/command/CustomCommand.kt b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/command/CustomCommand.kt new file mode 100644 index 0000000..cb55718 --- /dev/null +++ b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/command/CustomCommand.kt @@ -0,0 +1,6 @@ +package ru.erius.kotlinplugin.command + +import org.bukkit.command.CommandExecutor +import org.bukkit.command.TabCompleter + +abstract class CustomCommand(val name: String) : CommandExecutor, TabCompleter diff --git a/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/command/GiveItem.kt b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/command/GiveItem.kt new file mode 100644 index 0000000..5e5cfab --- /dev/null +++ b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/command/GiveItem.kt @@ -0,0 +1,45 @@ +package ru.erius.kotlinplugin.command + +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.command.Command +import org.bukkit.command.CommandSender +import org.bukkit.inventory.ItemStack +import ru.erius.kotlinplugin.KotlinPlugin +import ru.erius.kotlinplugin.registry.Registry +import ru.erius.kotlinplugin.util.intOrDefault + +object GiveItem : CustomCommand("givecustom") { + override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array): Boolean { + return when (args.size) { + 0, 1 -> false + 2 -> giveItem(sender, args[0], args[1], 1) + else -> giveItem(sender, args[0], args[1], args[2].intOrDefault(1)) + } + } + + override fun onTabComplete( + sender: CommandSender, + command: Command, + label: String, + args: Array + ): MutableList? = when (args.size) { + 1 -> Bukkit.getOnlinePlayers().map { it.name }.toMutableList() + 2 -> Registry.ItemRegistry.items.keys.toMutableList() + else -> null + } + + private fun giveItem(sender: CommandSender, nickname: String, itemId: String, amount: Int): Boolean { + val player = Bukkit.getPlayer(nickname) ?: + sender.sendMessage("${ChatColor.RED}Player $nickname is offline or doesn't exist").let { return false } + val customItem = Registry.ItemRegistry.items[itemId] ?: + sender.sendMessage("${ChatColor.RED}Item $itemId is not registered").let { return false } + val item = ItemStack(customItem) + item.amount = amount.coerceIn(1..64) + player.inventory.addItem(item) + val msg = "${ChatColor.GREEN}Gave $amount [$itemId] to $nickname" + sender.sendMessage(msg) + KotlinPlugin.instance.logger.info(ChatColor.stripColor(msg)) + return true + } +} \ No newline at end of file diff --git a/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/item/CustomItem.kt b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/item/CustomItem.kt new file mode 100644 index 0000000..f5ec9f7 --- /dev/null +++ b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/item/CustomItem.kt @@ -0,0 +1,45 @@ +package ru.erius.kotlinplugin.item + +import org.bukkit.Material +import org.bukkit.NamespacedKey +import org.bukkit.event.Listener +import org.bukkit.inventory.ItemStack +import org.bukkit.persistence.PersistentDataType +import ru.erius.kotlinplugin.KotlinPlugin + +private val idKey = NamespacedKey(KotlinPlugin.instance, "id") + +var ItemStack.id: String? + get() = itemMeta?.persistentDataContainer?.get(idKey, PersistentDataType.STRING) + set(value) { + val meta = itemMeta ?: return + meta.persistentDataContainer.set(idKey, PersistentDataType.STRING, value ?: "") + itemMeta = meta + } + +var ItemStack.customModelData: Int? + get() = itemMeta?.customModelData + internal set(value) { + val meta = itemMeta + meta?.setCustomModelData(value) + itemMeta = meta + } + +open class CustomItem( + val id: String, + material: Material, + displayName: String = id, + amount: Int = 1, + lore: String = "", + isUnbreakable: Boolean = false +) : + ItemStack(material, amount), Listener { + + init { + val meta = itemMeta!! + meta.setDisplayName(displayName) + meta.lore = listOf(lore) + meta.isUnbreakable = isUnbreakable + itemMeta = meta + } +} \ No newline at end of file diff --git a/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/item/SpringBoots.kt b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/item/SpringBoots.kt new file mode 100644 index 0000000..09d3496 --- /dev/null +++ b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/item/SpringBoots.kt @@ -0,0 +1,47 @@ +package ru.erius.kotlinplugin.item + +import org.bukkit.Bukkit +import org.bukkit.Material +import org.bukkit.Sound +import org.bukkit.event.EventHandler +import org.bukkit.event.player.PlayerToggleSneakEvent +import org.bukkit.util.Vector +import ru.erius.kotlinplugin.KotlinPlugin +import ru.erius.kotlinplugin.util.checkOnGround + +object SpringBoots : CustomItem("spring_boots", Material.LEATHER_BOOTS, "Spring Boots", isUnbreakable = true) { + + private const val boostMultiplier = 1 + + private var sneakTaskId: Int = -1 + + @EventHandler + fun whileSneaking(evt: PlayerToggleSneakEvent) { + val bootsId = evt.player.inventory.boots?.id ?: return + if (bootsId != id) return + val player = evt.player + if (!player.checkOnGround()) { + Bukkit.getScheduler().cancelTask(sneakTaskId) + player.exp = 0F + return + } + if (evt.isSneaking) { + player.exp = 0F + sneakTaskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(KotlinPlugin.instance, { + player.exp += 0.02F + player.playSound(player, Sound.ENTITY_CHICKEN_EGG, 1F, 2F) + if (player.exp >= 0.98F) { + player.exp = 1F + Bukkit.getScheduler().cancelTask(sneakTaskId) + } + }, 0L, 1L) + } else { + Bukkit.getScheduler().cancelTask(sneakTaskId) + val x = player.velocity.x + player.eyeLocation.direction.x * player.exp + val y = player.velocity.y + player.eyeLocation.direction.y + player.exp * boostMultiplier + val z = player.velocity.z + player.eyeLocation.direction.z * player.exp + player.velocity = Vector(x, y, z) + player.exp = 0F + } + } +} \ No newline at end of file diff --git a/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/registry/Registry.kt b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/registry/Registry.kt new file mode 100644 index 0000000..5cd2b9b --- /dev/null +++ b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/registry/Registry.kt @@ -0,0 +1,50 @@ +package ru.erius.kotlinplugin.registry + +import org.bukkit.Bukkit +import org.bukkit.inventory.ItemStack +import org.bukkit.plugin.Plugin +import ru.erius.kotlinplugin.KotlinPlugin +import ru.erius.kotlinplugin.command.CustomCommand +import ru.erius.kotlinplugin.item.CustomItem +import ru.erius.kotlinplugin.item.customModelData +import ru.erius.kotlinplugin.item.id + +object Registry { + + object ItemRegistry { + + val items = mutableMapOf() + + fun registerItem(plugin: Plugin, item: CustomItem) { + val id = item.id + item.customModelData = items.size + (item as ItemStack).id = id + Bukkit.getServer().pluginManager.registerEvents(item, KotlinPlugin.instance) + if (items.containsKey(id)) + KotlinPlugin.instance.logger.warning("Duplicate declaration of item $id from plugin $plugin, overriding the old item with the new one...") + items[id] = item + KotlinPlugin.instance.logger.info("Registered item $id from plugin $plugin") + } + + fun registerItems(plugin: Plugin, vararg items: CustomItem) = items.forEach { registerItem(plugin, it) } + + } + + object CommandRegistry { + + fun registerCommand(plugin: Plugin, command: CustomCommand) { + val pluginCommand = plugin.server.getPluginCommand(command.name) ?: KotlinPlugin.instance.logger.warning( + "Failed to register command ${command.name} " + + "from plugin $plugin, it is not declared in plugin.yml" + ).let { return } + pluginCommand.setExecutor(command) + pluginCommand.tabCompleter = command + KotlinPlugin.instance.logger.info("Registered command ${command.name} from plugin $plugin") + } + + fun registerCommands(plugin: Plugin, vararg commands: CustomCommand) = + commands.forEach { registerCommand(plugin, it) } + + } + +} \ No newline at end of file diff --git a/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/util/UtilFunctions.kt b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/util/UtilFunctions.kt new file mode 100644 index 0000000..17ba6a7 --- /dev/null +++ b/KotlinPlugin/src/main/kotlin/ru/erius/kotlinplugin/util/UtilFunctions.kt @@ -0,0 +1,17 @@ +package ru.erius.kotlinplugin.util + +import org.bukkit.entity.Player + +fun String.intOrDefault(default: Int) = this.toIntOrNull() ?: default + +fun String.longOrDefault(default: Long) = this.toLongOrNull() ?: default + +fun String.doubleOrDefault(default: Double) = this.toDoubleOrNull() ?: default + +fun String.floatOrDefault(default: Float) = this.toFloatOrNull() ?: default + +fun String.byteOrDefault(default: Byte) = this.toByteOrNull() ?: default + +fun String.shortOrDefault(default: Short) = this.toShortOrNull() ?: default + +fun Player.checkOnGround(): Boolean = !this.isFlying && this.velocity.y != 0.0 diff --git a/KotlinPlugin/src/main/resources/plugin.yml b/KotlinPlugin/src/main/resources/plugin.yml new file mode 100644 index 0000000..1f03907 --- /dev/null +++ b/KotlinPlugin/src/main/resources/plugin.yml @@ -0,0 +1,14 @@ +name: $name +version: $version +main: $main +api-version: 1.18 +depend: [ KotlinLib ] +authors: [ erius ] +description: "Test Kotlin plugin" +website: https://vk.com/public206307891 +commands: + givecustom: + description: "Gives player an item declared in eriusLibKt registry" + aliases: [ givec, gc ] + permission-message: "You do not have permission to use this command" + usage: "Usage: / [player] [name] [amount]" diff --git a/LifeAsAxolotl/.gitignore b/LifeAsAxolotl/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/LifeAsAxolotl/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/LifeAsAxolotl/build.gradle b/LifeAsAxolotl/build.gradle new file mode 100644 index 0000000..4c360ca --- /dev/null +++ b/LifeAsAxolotl/build.gradle @@ -0,0 +1,38 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius' +version = '1.0' +def serverPath = 'C:/mc_servers/1.17.1/plugins' + +sourceCompatibility = '11' +targetCompatibility = '11' + +repositories { + mavenCentral() + maven { + name = 'spigotmc-repo' + url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +jar { + destinationDirectory.set(file(serverPath)) +} diff --git a/LifeAsAxolotl/gradle.properties b/LifeAsAxolotl/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/LifeAsAxolotl/gradle/wrapper/gradle-wrapper.jar b/LifeAsAxolotl/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/LifeAsAxolotl/gradle/wrapper/gradle-wrapper.jar differ diff --git a/LifeAsAxolotl/gradle/wrapper/gradle-wrapper.properties b/LifeAsAxolotl/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b5f89 --- /dev/null +++ b/LifeAsAxolotl/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/LifeAsAxolotl/gradlew b/LifeAsAxolotl/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/LifeAsAxolotl/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/LifeAsAxolotl/gradlew.bat b/LifeAsAxolotl/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/LifeAsAxolotl/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/LifeAsAxolotl/settings.gradle b/LifeAsAxolotl/settings.gradle new file mode 100644 index 0000000..bbc553b --- /dev/null +++ b/LifeAsAxolotl/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'LifeAsAxolotl' diff --git a/LifeAsAxolotl/src/main/java/ru/erius/lifeasaxolotl/AxolotlHandler/Transform.java b/LifeAsAxolotl/src/main/java/ru/erius/lifeasaxolotl/AxolotlHandler/Transform.java new file mode 100644 index 0000000..a8651c9 --- /dev/null +++ b/LifeAsAxolotl/src/main/java/ru/erius/lifeasaxolotl/AxolotlHandler/Transform.java @@ -0,0 +1,39 @@ +package ru.erius.lifeasaxolotl.AxolotlHandler; + +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Axolotl; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import ru.erius.lifeasaxolotl.ConfigHandler; +import ru.erius.lifeasaxolotl.LifeAsAxolotl; + +public class Transform { + + private final static LifeAsAxolotl plugin = LifeAsAxolotl.plugin; + private final static FileConfiguration config = ConfigHandler.getConfig(); + private static Axolotl axolotl; + + public static void onAxolotlCommand(CommandSender sender) { + if (sender instanceof Player) + transformPlayer((Player) sender); + else + plugin.getLogger().info("You are not a player!"); + } + + private static void transformPlayer(Player player) { + ArmorStand armorStand = (ArmorStand) player.getWorld().spawnEntity(player.getLocation(), EntityType.ARMOR_STAND); + armorStand.setInvisible(true); + Axolotl.Variant variant = Axolotl.Variant.valueOf(config.getConfigurationSection("axolotl").getString("variant")); + boolean isBaby = config.getConfigurationSection("axolotl").getBoolean("is-baby"); + axolotl = (Axolotl) player.getWorld().spawnEntity(player.getLocation(), EntityType.AXOLOTL); + axolotl.setVariant(variant); + if (isBaby) + axolotl.setBaby(); + axolotl.setAI(false); + player.setInvisible(true); + } +} diff --git a/LifeAsAxolotl/src/main/java/ru/erius/lifeasaxolotl/ConfigHandler.java b/LifeAsAxolotl/src/main/java/ru/erius/lifeasaxolotl/ConfigHandler.java new file mode 100644 index 0000000..2945178 --- /dev/null +++ b/LifeAsAxolotl/src/main/java/ru/erius/lifeasaxolotl/ConfigHandler.java @@ -0,0 +1,31 @@ +package ru.erius.lifeasaxolotl; + +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +public class ConfigHandler { + + private final static LifeAsAxolotl plugin = LifeAsAxolotl.plugin; + + private final static String fileName = "life-as-axolotl.yml"; + private final static File file = new File(plugin.getDataFolder(), fileName); + private static FileConfiguration config = null; + + public static FileConfiguration getConfig() { + return config; + } + + public static void reloadConfig() { + config = YamlConfiguration.loadConfiguration(file); + } + + public static void defaultConfig(boolean replace) { + plugin.saveResource(fileName, replace); + reloadConfig(); + } +} diff --git a/LifeAsAxolotl/src/main/java/ru/erius/lifeasaxolotl/LifeAsAxolotl.java b/LifeAsAxolotl/src/main/java/ru/erius/lifeasaxolotl/LifeAsAxolotl.java new file mode 100644 index 0000000..171afdd --- /dev/null +++ b/LifeAsAxolotl/src/main/java/ru/erius/lifeasaxolotl/LifeAsAxolotl.java @@ -0,0 +1,35 @@ +package ru.erius.lifeasaxolotl; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.java.JavaPlugin; +import ru.erius.lifeasaxolotl.AxolotlHandler.Transform; + +public final class LifeAsAxolotl extends JavaPlugin { + + public static LifeAsAxolotl plugin; + + @Override + public void onEnable() { + super.onEnable(); + plugin = this; + ConfigHandler.defaultConfig(false); + getLogger().info("LifeAsAxolotl enabled"); + getServer().getPluginManager().registerEvents(new ServerEvents(), this); + } + + @Override + public void onDisable() { + super.onDisable(); + getLogger().info("LifeAsAxolotl disabled"); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + String cmd = command.getName().toLowerCase(); + if (cmd.equals("axolotl")) { + Transform.onAxolotlCommand(sender); + } + return super.onCommand(sender, command, label, args); + } +} diff --git a/LifeAsAxolotl/src/main/java/ru/erius/lifeasaxolotl/ServerEvents.java b/LifeAsAxolotl/src/main/java/ru/erius/lifeasaxolotl/ServerEvents.java new file mode 100644 index 0000000..f24db43 --- /dev/null +++ b/LifeAsAxolotl/src/main/java/ru/erius/lifeasaxolotl/ServerEvents.java @@ -0,0 +1,12 @@ +package ru.erius.lifeasaxolotl; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerMoveEvent; + +public class ServerEvents implements Listener { + @EventHandler + private void test(PlayerMoveEvent evt) { + System.out.println("a"); + } +} diff --git a/LifeAsAxolotl/src/main/resources/life-as-axolotl.yml b/LifeAsAxolotl/src/main/resources/life-as-axolotl.yml new file mode 100644 index 0000000..733fd47 --- /dev/null +++ b/LifeAsAxolotl/src/main/resources/life-as-axolotl.yml @@ -0,0 +1,6 @@ +# Configuration file for Life As Axolotl plugin +# Possible axolotl variants: WILD, BLUE, CYAN, GOLD, LUCY + +axolotl: + variant: LUCY + is-baby: false diff --git a/LifeAsAxolotl/src/main/resources/plugin.yml b/LifeAsAxolotl/src/main/resources/plugin.yml new file mode 100644 index 0000000..0838e12 --- /dev/null +++ b/LifeAsAxolotl/src/main/resources/plugin.yml @@ -0,0 +1,9 @@ +name: LifeAsAxolotl +version: @version@ +main: ru.erius.lifeasaxolotl.LifeAsAxolotl +api-version: 1.17 +authors: [ erius ] +description: with this plugin you can become an axolotl! (also you have some special axolotl abilities) +commands: + axolotl: + description: transforms a player into axolotl diff --git a/LifeAsTNT/.gitignore b/LifeAsTNT/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/LifeAsTNT/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/LifeAsTNT/build.gradle b/LifeAsTNT/build.gradle new file mode 100644 index 0000000..916683d --- /dev/null +++ b/LifeAsTNT/build.gradle @@ -0,0 +1,38 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius' +version = '1.0-SNAPSHOT' +def serverPath = 'C:/mc_servers/1.17.1/plugins' + +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +repositories { + mavenCentral() + maven { + name = 'spigotmc-repo' + url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +jar { + destinationDirectory.set(file(serverPath)) +} diff --git a/LifeAsTNT/gradle.properties b/LifeAsTNT/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/LifeAsTNT/gradle/wrapper/gradle-wrapper.jar b/LifeAsTNT/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/LifeAsTNT/gradle/wrapper/gradle-wrapper.jar differ diff --git a/LifeAsTNT/gradle/wrapper/gradle-wrapper.properties b/LifeAsTNT/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b5f89 --- /dev/null +++ b/LifeAsTNT/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/LifeAsTNT/gradlew b/LifeAsTNT/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/LifeAsTNT/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/LifeAsTNT/gradlew.bat b/LifeAsTNT/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/LifeAsTNT/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/LifeAsTNT/settings.gradle b/LifeAsTNT/settings.gradle new file mode 100644 index 0000000..5810555 --- /dev/null +++ b/LifeAsTNT/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'LifeAsTNT' diff --git a/LifeAsTNT/src/main/java/ru/erius/lifeastnt/ConfigHandler.java b/LifeAsTNT/src/main/java/ru/erius/lifeastnt/ConfigHandler.java new file mode 100644 index 0000000..2176bd4 --- /dev/null +++ b/LifeAsTNT/src/main/java/ru/erius/lifeastnt/ConfigHandler.java @@ -0,0 +1,25 @@ +package ru.erius.lifeastnt; + +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +import java.io.File; + +public class ConfigHandler { + + private final static LifeAsTNT plugin = LifeAsTNT.plugin; + + private final static String fileName = "tnt.yml"; + private final static File file = new File(plugin.getDataFolder(), fileName); + private static FileConfiguration config = null; + + public static FileConfiguration getConfig() { + return config; + } + + public static void reloadConfig(boolean replace) { + plugin.saveResource(fileName, replace); + config = YamlConfiguration.loadConfiguration(file); + plugin.getLogger().info("loaded the config"); + } +} diff --git a/LifeAsTNT/src/main/java/ru/erius/lifeastnt/LifeAsTNT.java b/LifeAsTNT/src/main/java/ru/erius/lifeastnt/LifeAsTNT.java new file mode 100644 index 0000000..08256a4 --- /dev/null +++ b/LifeAsTNT/src/main/java/ru/erius/lifeastnt/LifeAsTNT.java @@ -0,0 +1,35 @@ +package ru.erius.lifeastnt; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.java.JavaPlugin; +import ru.erius.lifeastnt.TNTHandler.TransformTNT; + +public final class LifeAsTNT extends JavaPlugin { + + public static LifeAsTNT plugin; + + @Override + public void onEnable() { + super.onEnable(); + plugin = this; + getLogger().info(getName() + " enabled"); + getServer().getPluginManager().registerEvents(new ServerEvents(), this); + } + + @Override + public void onDisable() { + super.onDisable(); + getLogger().info(getName() + " disabled"); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + String cmd = command.getName().toLowerCase(); + switch (cmd) { + case "transform": + TransformTNT.onCommand(sender, args); + } + return super.onCommand(sender, command, label, args); + } +} diff --git a/LifeAsTNT/src/main/java/ru/erius/lifeastnt/ServerEvents.java b/LifeAsTNT/src/main/java/ru/erius/lifeastnt/ServerEvents.java new file mode 100644 index 0000000..2648ad7 --- /dev/null +++ b/LifeAsTNT/src/main/java/ru/erius/lifeastnt/ServerEvents.java @@ -0,0 +1,12 @@ +package ru.erius.lifeastnt; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDeathEvent; + +public class ServerEvents implements Listener { + @EventHandler + private void onEntityDeath(EntityDeathEvent evt) { + + } +} diff --git a/LifeAsTNT/src/main/java/ru/erius/lifeastnt/TNTHandler/TransformTNT.java b/LifeAsTNT/src/main/java/ru/erius/lifeastnt/TNTHandler/TransformTNT.java new file mode 100644 index 0000000..a16c508 --- /dev/null +++ b/LifeAsTNT/src/main/java/ru/erius/lifeastnt/TNTHandler/TransformTNT.java @@ -0,0 +1,82 @@ +package ru.erius.lifeastnt.TNTHandler; + +import org.bukkit.*; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Player; +import org.bukkit.persistence.PersistentDataType; +import org.bukkit.util.Vector; +import ru.erius.lifeastnt.LifeAsTNT; + +import java.util.HashMap; + +public class TransformTNT { + + public final static HashMap playerTask = new HashMap<>(); + + private static void transformPlayer(Player player) { + FallingBlock tnt = player.getWorld().spawnFallingBlock(player.getLocation(), Material.TNT.createBlockData()); + tnt.setGravity(false); + tnt.setDropItem(false); + tnt.setInvulnerable(true); + tnt.getPersistentDataContainer().set(new NamespacedKey(LifeAsTNT.plugin, "time"), PersistentDataType.INTEGER, -1); + player.setInvisible(true); + Vector from = player.getLocation().toVector(); + int taskId = Bukkit.getScheduler().runTaskTimer(LifeAsTNT.plugin, () -> { + Vector to = player.getLocation().toVector(); + tnt.setVelocity(from.subtract(to).multiply(-1)); + from.copy(to); + }, 0, 1).getTaskId(); + playerTask.put(player, new TaskEntry(tnt, taskId)); + } + + private static void undoTransformation(Player player) { + player.setInvisible(false); + Bukkit.getScheduler().cancelTask(playerTask.get(player).getTaskId()); + playerTask.get(player).getTnt().remove(); + playerTask.remove(player); + } + + public static void onCommand(CommandSender sender, String[] args) { + if (args.length == 0) + if (sender instanceof Player) + checkMap(sender, (Player) sender); + else + sender.sendMessage(ChatColor.RED + "You are not a player"); + else { + Player player = Bukkit.getServer().getPlayer(args[0]); + if (player != null) + checkMap(sender, player); + else + sender.sendMessage(ChatColor.RED + "Such player is offline or doesn't exist"); + } + } + + private static void checkMap(CommandSender sender, Player player) { + if (playerTask.containsKey(player)) { + undoTransformation(player); + sender.sendMessage(ChatColor.GREEN + "Undoing the transformation"); + } else { + transformPlayer(player); + sender.sendMessage(ChatColor.GREEN + "Transforming"); + } + } + + private static class TaskEntry { + private final FallingBlock tnt; + private final int taskId; + + public TaskEntry(FallingBlock tnt, int taskId) { + this.tnt = tnt; + this.taskId = taskId; + } + + public FallingBlock getTnt() { + return tnt; + } + + public int getTaskId() { + return taskId; + } + } +} diff --git a/LifeAsTNT/src/main/resources/plugin.yml b/LifeAsTNT/src/main/resources/plugin.yml new file mode 100644 index 0000000..24cb20e --- /dev/null +++ b/LifeAsTNT/src/main/resources/plugin.yml @@ -0,0 +1,9 @@ +name: LifeAsTNT +version: @version@ +main: ru.erius.lifeastnt.LifeAsTNT +api-version: 1.17 +authors: [ erius ] +description: you tnt +commands: + transform: + description: transforms or undoes the transformation of a player into tnt diff --git a/LifeAsTNT/src/main/resources/tnt.yml b/LifeAsTNT/src/main/resources/tnt.yml new file mode 100644 index 0000000..e69de29 diff --git a/MilkBlock/.gitignore b/MilkBlock/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/MilkBlock/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/MilkBlock/build.gradle b/MilkBlock/build.gradle new file mode 100644 index 0000000..7a523ba --- /dev/null +++ b/MilkBlock/build.gradle @@ -0,0 +1,65 @@ +plugins { + id 'java' +} + +group = 'ru.erius' +version = '1.0' +def serverPath = 'C:/mc_servers/1.17.1/plugins' +def EriusLibPath = 'D:/mc_plugins/EriusLib/build/libs' +def devPath = 'D:/spigot_dev' +def spigotJar = 'spigot-1.17.1' + +repositories { + mavenCentral() + flatDir { + dirs devPath + } + maven { + name = 'papermc-repo' + url = 'https://papermc.io/repo/repository/maven-public/' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly 'io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT' + compileOnly name: spigotJar + compileOnly fileTree(dir: EriusLibPath, include: '*.jar') +} + +def targetJavaVersion = 16 +java { + def javaVersion = JavaVersion.toVersion(targetJavaVersion) + sourceCompatibility = javaVersion + targetCompatibility = javaVersion + if (JavaVersion.current() < javaVersion) { + toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) + } +} + +tasks.withType(JavaCompile).configureEach { + if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { + options.release = targetJavaVersion + } +} + +processResources { + def props = [version: version] + inputs.properties props + filteringCharset 'UTF-8' + filesMatching('plugin.yml') { + expand props + } +} + +build { + doLast { + copy { + from libsDirectory + into serverPath + } + } +} diff --git a/MilkBlock/gradle.properties b/MilkBlock/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/MilkBlock/gradle/wrapper/gradle-wrapper.jar b/MilkBlock/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..7454180 Binary files /dev/null and b/MilkBlock/gradle/wrapper/gradle-wrapper.jar differ diff --git a/MilkBlock/gradle/wrapper/gradle-wrapper.properties b/MilkBlock/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..05679dc --- /dev/null +++ b/MilkBlock/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/MilkBlock/gradlew b/MilkBlock/gradlew new file mode 100644 index 0000000..744e882 --- /dev/null +++ b/MilkBlock/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MSYS* | MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/MilkBlock/gradlew.bat b/MilkBlock/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/MilkBlock/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/MilkBlock/settings.gradle b/MilkBlock/settings.gradle new file mode 100644 index 0000000..7ee3878 --- /dev/null +++ b/MilkBlock/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'MilkBlock' diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/MilkBlock.java b/MilkBlock/src/main/java/ru/erius/milkblock/MilkBlock.java new file mode 100644 index 0000000..bd6a29f --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/MilkBlock.java @@ -0,0 +1,60 @@ +package ru.erius.milkblock; + +import org.bukkit.Keyed; +import org.bukkit.plugin.java.JavaPlugin; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.milkblock.items.bucket.*; +import ru.erius.milkblock.recipes.EmptyBlockBucketRecipe; + +import java.util.List; + +public final class MilkBlock extends JavaPlugin { + + private static MilkBlock INSTANCE; + + { + INSTANCE = this; + } + + private final static List> ITEMS_INIT = List.of( + EmptyBlockBucket.class, + AirBlockBucket.class, + BedrockBlockBucket.class, + ChestBlockBucket.class, + CoalOreBlockBucket.class, + CraftingTableBlockBucket.class, + DiamondOreBlockBucket.class, + DirtBlockBucket.class, + EndStoneBlockBucket.class, + FurnaceBlockBucket.class, + GrassBlockBucket.class, + GravelBlockBucket.class, + IronOreBlockBucket.class, + NetherBricksBlockBucket.class, + NetherrackBlockBucket.class, + ObsidianBlockBucket.class, + SandBlockBucket.class, + StoneBlockBucket.class, + WoodBlockBucket.class + ); + private final static List> RECIPES_INIT = List.of( + EmptyBlockBucketRecipe.class + ); + private final static String RESOURCE_PACK = "https://drive.google.com/u/0/uc?id=1TE0lfOOXsVykar2atZdil5UiBYiKcgsV&export=download"; + + @Override + public void onEnable() { + Registry.registerAll(this, ITEMS_INIT, null, null, null, RECIPES_INIT, RESOURCE_PACK); + this.getLogger().info(this.getName() + " enabled"); + } + + @Override + public void onDisable() { + this.getLogger().info(this.getName() + " disabled"); + } + + public static MilkBlock getInstance() { + return INSTANCE; + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/AbstractBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/AbstractBlockBucket.java new file mode 100644 index 0000000..a5116b3 --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/AbstractBlockBucket.java @@ -0,0 +1,25 @@ +package ru.erius.milkblock.items; + +import org.bukkit.Material; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.ItemStack; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.milkblock.items.bucket.EmptyBlockBucket; + +public abstract class AbstractBlockBucket extends CustomItem { + + private final static Material MATERIAL = Material.MILK_BUCKET; + + public AbstractBlockBucket(String name, String defaultTitle) { + super(name, MATERIAL, defaultTitle); + } + + public abstract void onConsume(PlayerItemConsumeEvent evt); + + protected void replaceBucket(PlayerItemConsumeEvent evt) { + evt.setItem(new ItemStack(Material.AIR)); + evt.setReplacement(new ItemStack(Registry.ItemsRegistry.getCustomItem(EmptyBlockBucket.NAME))); + EmptyBlockBucket.startBucketCountdown(evt.getPlayer()); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/Buckets.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/Buckets.java new file mode 100644 index 0000000..a817883 --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/Buckets.java @@ -0,0 +1,44 @@ +package ru.erius.milkblock.items; + +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.milkblock.items.bucket.*; + +import java.util.Map; + +public class Buckets { + + private final static Map BLOCK_BUCKET = Map.ofEntries( + Map.entry(Material.BEDROCK, Registry.ItemsRegistry.getCustomItem(BedrockBlockBucket.NAME)), + Map.entry(Material.CHEST, Registry.ItemsRegistry.getCustomItem(ChestBlockBucket.NAME)), + Map.entry(Material.COAL_ORE, Registry.ItemsRegistry.getCustomItem(CoalOreBlockBucket.NAME)), + Map.entry(Material.DEEPSLATE_COAL_ORE, Registry.ItemsRegistry.getCustomItem(CoalOreBlockBucket.NAME)), + Map.entry(Material.CRAFTING_TABLE, Registry.ItemsRegistry.getCustomItem(CraftingTableBlockBucket.NAME)), + Map.entry(Material.DIAMOND_ORE, Registry.ItemsRegistry.getCustomItem(DiamondOreBlockBucket.NAME)), + Map.entry(Material.DEEPSLATE_DIAMOND_ORE, Registry.ItemsRegistry.getCustomItem(DiamondOreBlockBucket.NAME)), + Map.entry(Material.DIRT, Registry.ItemsRegistry.getCustomItem(DirtBlockBucket.NAME)), + Map.entry(Material.END_STONE, Registry.ItemsRegistry.getCustomItem(EndStoneBlockBucket.NAME)), + Map.entry(Material.FURNACE, Registry.ItemsRegistry.getCustomItem(FurnaceBlockBucket.NAME)), + Map.entry(Material.GRASS_BLOCK, Registry.ItemsRegistry.getCustomItem(GrassBlockBucket.NAME)), + Map.entry(Material.GRAVEL, Registry.ItemsRegistry.getCustomItem(GravelBlockBucket.NAME)), + Map.entry(Material.IRON_ORE, Registry.ItemsRegistry.getCustomItem(IronOreBlockBucket.NAME)), + Map.entry(Material.DEEPSLATE_IRON_ORE, Registry.ItemsRegistry.getCustomItem(IronOreBlockBucket.NAME)), + Map.entry(Material.NETHER_BRICKS, Registry.ItemsRegistry.getCustomItem(NetherBricksBlockBucket.NAME)), + Map.entry(Material.NETHERRACK, Registry.ItemsRegistry.getCustomItem(NetherrackBlockBucket.NAME)), + Map.entry(Material.OBSIDIAN, Registry.ItemsRegistry.getCustomItem(ObsidianBlockBucket.NAME)), + Map.entry(Material.SAND, Registry.ItemsRegistry.getCustomItem(SandBlockBucket.NAME)), + Map.entry(Material.STONE, Registry.ItemsRegistry.getCustomItem(StoneBlockBucket.NAME)), + Map.entry(Material.OAK_LOG, Registry.ItemsRegistry.getCustomItem(WoodBlockBucket.NAME)), + Map.entry(Material.SPRUCE_LOG, Registry.ItemsRegistry.getCustomItem(WoodBlockBucket.NAME)), + Map.entry(Material.BIRCH_LOG, Registry.ItemsRegistry.getCustomItem(WoodBlockBucket.NAME)), + Map.entry(Material.JUNGLE_LOG, Registry.ItemsRegistry.getCustomItem(WoodBlockBucket.NAME)), + Map.entry(Material.ACACIA_LOG, Registry.ItemsRegistry.getCustomItem(WoodBlockBucket.NAME)), + Map.entry(Material.DARK_OAK_LOG, Registry.ItemsRegistry.getCustomItem(WoodBlockBucket.NAME)) + ); + + public static ItemStack giveBucket(Material material) { + return BLOCK_BUCKET.containsKey(material) ? new ItemStack(BLOCK_BUCKET.get(material)) : null; + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/AirBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/AirBlockBucket.java new file mode 100644 index 0000000..74f9480 --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/AirBlockBucket.java @@ -0,0 +1,24 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.Sound; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.milkblock.items.AbstractBlockBucket; + +public class AirBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "air_block_bucket"; + private final static String DEFAULT_TITLE = "Air block bucket"; + + public AirBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + evt.getPlayer().setVelocity(evt.getPlayer().getEyeLocation().getDirection().multiply(5)); + evt.getPlayer().getWorld().playSound(evt.getPlayer().getEyeLocation(), Sound.ENTITY_ENDER_DRAGON_FLAP, 1.0F, 1.5F); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/BedrockBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/BedrockBlockBucket.java new file mode 100644 index 0000000..511ba49 --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/BedrockBlockBucket.java @@ -0,0 +1,45 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import ru.erius.milkblock.MilkBlock; +import ru.erius.milkblock.items.AbstractBlockBucket; + +public class BedrockBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "bedrock_block_bucket"; + private final static String DEFAULT_TITLE = "Bedrock block bucket"; + + public BedrockBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override + @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + World end = Bukkit.getWorlds().get(2); + if (evt.getPlayer().getWorld().equals(end)) { + evt.getPlayer().getWorld().playSound(evt.getPlayer().getEyeLocation(), Sound.ENTITY_BLAZE_DEATH, 1.0F, 0.5F); + return; + } + Location teleportTo = new Location(end, 0.0D, 72.0D, 0.0D); + int radius = 3; + for (int x = radius; x >= -radius; x--) + for (int y = radius; y >= -radius; y--) + for (int z = radius; z >= -radius; z--) { + Block block = end.getBlockAt(x, y, z); + block.setType(Material.AIR); + } + Location setPlatform = teleportTo.add(0.0D, -1.0D, 0.0D); + end.getBlockAt(setPlatform).setType(Material.OBSIDIAN); + Bukkit.getScheduler().runTaskLater(MilkBlock.getInstance(), () -> { + evt.getPlayer().teleport(teleportTo, PlayerTeleportEvent.TeleportCause.PLUGIN); + end.playSound(evt.getPlayer().getEyeLocation(), Sound.BLOCK_PORTAL_TRAVEL, 1.0F, 1.5F); + }, 1L); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/ChestBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/ChestBlockBucket.java new file mode 100644 index 0000000..8169beb --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/ChestBlockBucket.java @@ -0,0 +1,25 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.Sound; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.milkblock.items.AbstractBlockBucket; + +public class ChestBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "chest_block_bucket"; + private final static String DEFAULT_TITLE = "Chest block bucket"; + + public ChestBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override + @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + evt.getPlayer().openInventory(evt.getPlayer().getEnderChest()); + evt.getPlayer().getWorld().playSound(evt.getPlayer().getEyeLocation(), Sound.BLOCK_ENDER_CHEST_OPEN, 1.0F, 1.5F); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/CoalOreBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/CoalOreBlockBucket.java new file mode 100644 index 0000000..3de3cf0 --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/CoalOreBlockBucket.java @@ -0,0 +1,34 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import ru.erius.milkblock.items.AbstractBlockBucket; + +import java.util.List; + +public class CoalOreBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "coal_ore_block_bucket"; + private final static String DEFAULT_TITLE = "Coal ore block bucket"; + private final static List POTION_EFFECTS = List.of( + new PotionEffect(PotionEffectType.NIGHT_VISION, 2400, 0), + new PotionEffect(PotionEffectType.ABSORPTION, 2400, 0) + ); + + public CoalOreBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + POTION_EFFECTS.forEach(potionEffect -> { + if (potionEffect.equals(evt.getPlayer().getPotionEffect(potionEffect.getType()))) + evt.getPlayer().removePotionEffect(potionEffect.getType()); + evt.getPlayer().addPotionEffect(potionEffect); + }); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/CraftingTableBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/CraftingTableBlockBucket.java new file mode 100644 index 0000000..b2f58fb --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/CraftingTableBlockBucket.java @@ -0,0 +1,22 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import ru.erius.milkblock.items.AbstractBlockBucket; + +public class CraftingTableBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "crafting_table_block_bucket"; + private final static String DEFAULT_TITLE = "Crafting table block bucket"; + + public CraftingTableBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + evt.getPlayer().openWorkbench(null, true); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/DiamondOreBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/DiamondOreBlockBucket.java new file mode 100644 index 0000000..e064ecf --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/DiamondOreBlockBucket.java @@ -0,0 +1,53 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import ru.erius.milkblock.items.AbstractBlockBucket; + +import java.util.Arrays; +import java.util.List; + +public class DiamondOreBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "diamond_ore_block_bucket"; + private final static String DEFAULT_TITLE = "Diamond block bucket"; + private final static List POTION_EFFECTS = List.of( + new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 2400, 2), + new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 2400, 1), + new PotionEffect(PotionEffectType.ABSORPTION, 2400, 2), + new PotionEffect(PotionEffectType.LUCK, 2400, 2), + new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 2400, 0) + ); + private final static ItemStack[] EQUIPMENT = { + new ItemStack(Material.DIAMOND_HELMET), + new ItemStack(Material.DIAMOND_CHESTPLATE), + new ItemStack(Material.DIAMOND_LEGGINGS), + new ItemStack(Material.DIAMOND_BOOTS) + }; + + static { + Arrays.stream(EQUIPMENT).forEach(itemStack -> itemStack.addEnchantment(Enchantment.BINDING_CURSE, 1)); + } + + public DiamondOreBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + POTION_EFFECTS.forEach(potionEffect -> { + if (potionEffect.equals(evt.getPlayer().getPotionEffect(potionEffect.getType()))) + evt.getPlayer().removePotionEffect(potionEffect.getType()); + evt.getPlayer().addPotionEffect(potionEffect); + }); + ItemStack equip = EQUIPMENT[(int) (Math.random() * EQUIPMENT.length)]; + evt.getPlayer().getInventory().setItem(equip.getType().getEquipmentSlot(), equip); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/DirtBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/DirtBlockBucket.java new file mode 100644 index 0000000..87a1a2c --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/DirtBlockBucket.java @@ -0,0 +1,35 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import ru.erius.milkblock.items.AbstractBlockBucket; + +import java.util.List; + +public class DirtBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "dirt_block_bucket"; + private final static String DEFAULT_TITLE = "Dirt block bucket"; + private final static List POTION_EFFECTS = List.of( + new PotionEffect(PotionEffectType.SLOW, 600, 1), + new PotionEffect(PotionEffectType.POISON, 100, 2) + ); + + + public DirtBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + POTION_EFFECTS.forEach(potionEffect -> { + if (potionEffect.equals(evt.getPlayer().getPotionEffect(potionEffect.getType()))) + evt.getPlayer().removePotionEffect(potionEffect.getType()); + evt.getPlayer().addPotionEffect(potionEffect); + }); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/EmptyBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/EmptyBlockBucket.java new file mode 100644 index 0000000..d973d21 --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/EmptyBlockBucket.java @@ -0,0 +1,85 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.Particle; +import org.bukkit.Sound; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.*; +import org.bukkit.inventory.ItemStack; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.milkblock.MilkBlock; +import ru.erius.milkblock.items.Buckets; + +import java.util.HashMap; + + +public class EmptyBlockBucket extends CustomItem { + + public final static String NAME = "empty_block_bucket"; + private final static Material MATERIAL = Material.BUCKET; + private final static String DEFAULT_TITLE = "Empty block bucket"; + private final static HashMap GET_AIR_BUCKET_CD = new HashMap<>(); + + public EmptyBlockBucket() { + super(NAME, MATERIAL, DEFAULT_TITLE); + this.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 1); + } + + @EventHandler + private void onPlayerFillThis(PlayerInteractEvent evt) { + ItemStack item = evt.getPlayer().getInventory().getItem(evt.getHand()); + if (!this.isThisItem(item)) return; + if (evt.getAction() == Action.RIGHT_CLICK_BLOCK) { + ItemStack bucket = Buckets.giveBucket(evt.getClickedBlock().getType()); + if (bucket == null) return; + evt.getPlayer().getInventory().getItem(evt.getHand()).setAmount(item.getAmount() - 1); + if (evt.getPlayer().getInventory().getItem(evt.getHand()).getAmount() == 0) + evt.getPlayer().getInventory().setItem(evt.getHand(), bucket); + else { + HashMap notFit = evt.getPlayer().getInventory().addItem(bucket); + notFit.values().forEach(itemStack -> evt.getPlayer().getWorld().dropItem(evt.getPlayer().getLocation(), itemStack)); + } + evt.getPlayer().getWorld().playSound(evt.getClickedBlock().getLocation(), Sound.ENTITY_COW_MILK, 1.0F, 1.0F); + evt.getPlayer().getWorld().spawnParticle(Particle.BLOCK_CRACK, evt.getClickedBlock().getLocation().add(0.5D, 0.5D, 0.5D), + 100, 0.3D, 0.3D, 0.3D, evt.getClickedBlock().getBlockData()); + Bukkit.getScheduler().runTaskLater(MilkBlock.getInstance(), () -> evt.getClickedBlock().setType(Material.AIR), 1L); + } else if (evt.getAction() == Action.RIGHT_CLICK_AIR && this.canBucketBecomeAir(evt.getPlayer())) { + ItemStack airBucket = new ItemStack(Registry.ItemsRegistry.getCustomItem(AirBlockBucket.NAME)); + evt.getPlayer().getInventory().getItem(evt.getHand()).setAmount(item.getAmount() - 1); + if (evt.getPlayer().getInventory().getItem(evt.getHand()).getAmount() == 0) + evt.getPlayer().getInventory().setItem(evt.getHand(), airBucket); + else { + HashMap notFit = evt.getPlayer().getInventory().addItem(airBucket); + notFit.values().forEach(itemStack -> evt.getPlayer().getWorld().dropItem(evt.getPlayer().getLocation(), itemStack)); + } + evt.getPlayer().getWorld().playSound(evt.getPlayer().getEyeLocation(), Sound.ENTITY_COW_MILK, 1.0F, 1.0F); + } + } + + @EventHandler + private void onPlayerMilkCow(PlayerInteractEntityEvent evt) { + if (this.isThisItem(evt.getPlayer().getInventory().getItem(evt.getHand())) && + evt.getRightClicked().getType() == EntityType.COW) evt.setCancelled(true); + } + + @EventHandler + private void onPlayerFillBucket(PlayerBucketFillEvent evt) { + if (this.isThisItem(evt.getPlayer().getInventory().getItem(evt.getHand()))) evt.setCancelled(true); + } + + private boolean canBucketBecomeAir(Player player) { + if (!GET_AIR_BUCKET_CD.containsKey(player)) GET_AIR_BUCKET_CD.put(player, true); + return GET_AIR_BUCKET_CD.get(player); + } + + public static void startBucketCountdown(Player player) { + GET_AIR_BUCKET_CD.put(player, false); + Bukkit.getScheduler().runTaskLater(MilkBlock.getInstance(), () -> GET_AIR_BUCKET_CD.put(player, true), 30L); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/EndStoneBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/EndStoneBlockBucket.java new file mode 100644 index 0000000..e6baa90 --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/EndStoneBlockBucket.java @@ -0,0 +1,35 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.Bukkit; +import org.bukkit.Particle; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import ru.erius.milkblock.MilkBlock; +import ru.erius.milkblock.items.AbstractBlockBucket; + +public class EndStoneBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "end_stone_block_bucket"; + private final static String DEFAULT_TITLE = "End stone block bucket"; + + public EndStoneBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override + @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + Block block = evt.getPlayer().getTargetBlock(64); + if (block == null) return; + evt.getPlayer().teleport(block.getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + Bukkit.getScheduler().runTaskLater(MilkBlock.getInstance(), () -> { + evt.getPlayer().getWorld().playSound(block.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1.0F, 1.5F); + evt.getPlayer().getWorld().spawnParticle(Particle.DRAGON_BREATH, block.getLocation(), 100, 1.0D, 1.0D, 1.0D); + }, 1L); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/FurnaceBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/FurnaceBlockBucket.java new file mode 100644 index 0000000..8edbc40 --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/FurnaceBlockBucket.java @@ -0,0 +1,45 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import ru.erius.milkblock.items.AbstractBlockBucket; + +public class FurnaceBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "furnace_block_bucket"; + private final static String DEFAULT_TITLE = "Furnace block bucket"; + private final static ItemStack[] FURNACE_ITEMS = { + new ItemStack(Material.BAKED_POTATO), + new ItemStack(Material.COOKED_BEEF), + new ItemStack(Material.COOKED_PORKCHOP), + new ItemStack(Material.COOKED_MUTTON), + new ItemStack(Material.COOKED_RABBIT), + new ItemStack(Material.COOKED_CHICKEN), + new ItemStack(Material.COOKED_COD), + new ItemStack(Material.COOKED_SALMON) + }; + + public FurnaceBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override + @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + Inventory furnace = Bukkit.createInventory(evt.getPlayer(), InventoryType.FURNACE); + ItemStack coal = new ItemStack(Material.COAL); + coal.setAmount(8); + furnace.setItem(1, coal); + ItemStack food = FURNACE_ITEMS[(int) (Math.random() * FURNACE_ITEMS.length)]; + food.setAmount((int) (Math.random() * 8 + 1)); + furnace.setItem(2, food); + evt.getPlayer().openInventory(furnace); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/GrassBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/GrassBlockBucket.java new file mode 100644 index 0000000..c894c3b --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/GrassBlockBucket.java @@ -0,0 +1,66 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import ru.erius.milkblock.MilkBlock; +import ru.erius.milkblock.items.AbstractBlockBucket; + +import java.util.List; + +public class GrassBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "grass_block_bucket"; + private final static String DEFAULT_TITLE = "Grass block bucket"; + private final static List POTION_EFFECTS = List.of( + new PotionEffect(PotionEffectType.SPEED, 1200, 2), + new PotionEffect(PotionEffectType.REGENERATION, 100, 1) + ); + + public GrassBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + POTION_EFFECTS.forEach(potionEffect -> { + if (potionEffect.equals(evt.getPlayer().getPotionEffect(potionEffect.getType()))) + evt.getPlayer().removePotionEffect(potionEffect.getType()); + evt.getPlayer().addPotionEffect(potionEffect); + }); + World over = Bukkit.getWorlds().get(0); + if (evt.getPlayer().getWorld().equals(over)) { + final long[] t = {0}; + Bukkit.getScheduler().runTaskTimer(MilkBlock.getInstance(), bukkitTask -> { + t[0]++; + Block block = evt.getPlayer().getWorld().getBlockAt(evt.getPlayer().getLocation().add(0.0D, -1.0D, 0.0D)); + block.applyBoneMeal(BlockFace.UP); + if (t[0] > 100) + bukkitTask.cancel(); + }, 0L, 1L); + } else { + Location playerLoc = evt.getPlayer().getLocation(); + Location teleportTo = new Location(over, playerLoc.getX() * 8, 128.0D, playerLoc.getZ() * 8); + int radius = 3; + for (int x = radius; x >= -radius; x--) + for (int y = radius; y >= -radius; y--) + for (int z = radius; z >= -radius; z--) { + Block block = over.getBlockAt(x, y, z); + block.setType(Material.AIR); + } + Location setPlatform = teleportTo.add(0.0D, -1.0D, 0.0D); + over.getBlockAt(setPlatform).setType(Material.OBSIDIAN); + Bukkit.getScheduler().runTaskLater(MilkBlock.getInstance(), () -> { + evt.getPlayer().teleport(teleportTo, PlayerTeleportEvent.TeleportCause.PLUGIN); + over.playSound(evt.getPlayer().getEyeLocation(), Sound.BLOCK_PORTAL_TRAVEL, 1.0F, 1.5F); + }, 1L); + } + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/GravelBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/GravelBlockBucket.java new file mode 100644 index 0000000..e8f53cb --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/GravelBlockBucket.java @@ -0,0 +1,34 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.Bukkit; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.util.Vector; +import ru.erius.milkblock.MilkBlock; +import ru.erius.milkblock.items.AbstractBlockBucket; + +public class GravelBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "gravel_block_bucket"; + private final static String DEFAULT_TITLE = "Gravel block bucket"; + + public GravelBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override + @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + final long[] t = {0}; + Bukkit.getScheduler().runTaskTimer(MilkBlock.getInstance(), bukkitTask -> { + t[0]++; + Vector fallUp = new Vector(0.0D, Math.min(t[0] / 10.0D, 1.0D), 0.0D); + evt.getPlayer().getNearbyEntities(64.0D, 64.0D, 64.0D).forEach(entity -> entity.setVelocity(fallUp)); + evt.getPlayer().setVelocity(fallUp); + if (t[0] > 30) + bukkitTask.cancel(); + }, 0L, 1L); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/IronOreBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/IronOreBlockBucket.java new file mode 100644 index 0000000..eb01e03 --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/IronOreBlockBucket.java @@ -0,0 +1,38 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.ItemStack; +import ru.erius.milkblock.items.AbstractBlockBucket; + +import java.util.Arrays; + +public class IronOreBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "iron_ore_block_bucket"; + private final static String DEFAULT_TITLE = "Iron ore block bucket"; + private final static ItemStack[] EQUIPMENT = { + new ItemStack(Material.IRON_HELMET), + new ItemStack(Material.IRON_CHESTPLATE), + new ItemStack(Material.IRON_LEGGINGS), + new ItemStack(Material.IRON_BOOTS) + }; + + static { + Arrays.stream(EQUIPMENT).forEach(itemStack -> itemStack.addEnchantment(Enchantment.BINDING_CURSE, 1)); + } + + public IronOreBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + ItemStack equip = EQUIPMENT[(int) (Math.random() * EQUIPMENT.length)]; + evt.getPlayer().getInventory().setItem(equip.getType().getEquipmentSlot(), equip); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/NetherBricksBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/NetherBricksBlockBucket.java new file mode 100644 index 0000000..56fafae --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/NetherBricksBlockBucket.java @@ -0,0 +1,64 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Fireball; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.EquipmentSlot; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; +import ru.erius.milkblock.MilkBlock; +import ru.erius.milkblock.items.AbstractBlockBucket; + +import java.util.HashMap; +import java.util.List; + +public class NetherBricksBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "nether_bricks_block_bucket"; + private final static String DEFAULT_TITLE = "Nether bricks block bucket"; + private final static List POTION_EFFECTS = List.of( + new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 1200, 0) + ); + private final static HashMap PLAYER_SHOOT = new HashMap<>(); + + public NetherBricksBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + POTION_EFFECTS.forEach(potionEffect -> { + if (potionEffect.equals(evt.getPlayer().getPotionEffect(potionEffect.getType()))) + evt.getPlayer().removePotionEffect(potionEffect.getType()); + evt.getPlayer().addPotionEffect(potionEffect); + }); + PLAYER_SHOOT.put(evt.getPlayer(), true); + Bukkit.getScheduler().runTaskLater(MilkBlock.getInstance(), () -> PLAYER_SHOOT.put(evt.getPlayer(), false), 200L); + } + + @EventHandler + private void onPlayerRightClickAir(PlayerInteractEvent evt) { + if (!canShoot(evt.getPlayer()) || evt.getHand() == EquipmentSlot.OFF_HAND || evt.getAction() != Action.LEFT_CLICK_AIR && evt.getAction() != Action.LEFT_CLICK_BLOCK) return; + Location spawnLoc = evt.getPlayer().getEyeLocation().add(evt.getPlayer().getEyeLocation().getDirection()); + Entity fireball = evt.getPlayer().getWorld().spawnEntity(spawnLoc, EntityType.FIREBALL); + Vector fireballVelocity = evt.getPlayer().getEyeLocation().getDirection().multiply(3); + fireball.setVelocity(fireballVelocity); + evt.getPlayer().getWorld().playSound(evt.getPlayer().getEyeLocation(), Sound.ENTITY_BLAZE_SHOOT, 1.0F, 1.5F); + } + + private boolean canShoot(Player player) { + if (!PLAYER_SHOOT.containsKey(player)) PLAYER_SHOOT.put(player, false); + return PLAYER_SHOOT.get(player); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/NetherrackBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/NetherrackBlockBucket.java new file mode 100644 index 0000000..f08583c --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/NetherrackBlockBucket.java @@ -0,0 +1,46 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import ru.erius.milkblock.MilkBlock; +import ru.erius.milkblock.items.AbstractBlockBucket; + +import java.util.List; + +public class NetherrackBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "netherrack_block_bucket"; + private final static String DEFAULT_TITLE = "Netherrack block bucket"; + private final static List POTION_EFFECTS = List.of( + new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 600, 0) + ); + + public NetherrackBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + POTION_EFFECTS.forEach(potionEffect -> { + if (potionEffect.equals(evt.getPlayer().getPotionEffect(potionEffect.getType()))) + evt.getPlayer().removePotionEffect(potionEffect.getType()); + evt.getPlayer().addPotionEffect(potionEffect); + }); + final long[] t = {0}; + Bukkit.getScheduler().runTaskTimer(MilkBlock.getInstance(), bukkitTask -> { + t[0]++; + Location locIgnite = evt.getPlayer().getLocation(); + locIgnite.getBlock().setType(Material.FIRE); + if (t[0] > 300) + bukkitTask.cancel(); + }, 0L, 1L); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/ObsidianBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/ObsidianBlockBucket.java new file mode 100644 index 0000000..409fd22 --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/ObsidianBlockBucket.java @@ -0,0 +1,46 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import ru.erius.milkblock.MilkBlock; +import ru.erius.milkblock.items.AbstractBlockBucket; + +public class ObsidianBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "obsidian_block_bucket"; + private final static String DEFAULT_TITLE = "Obsidian block bucket"; + + public ObsidianBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override + @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + World nether = Bukkit.getWorlds().get(1); + if (evt.getPlayer().getWorld().equals(nether)) { + evt.getPlayer().getWorld().playSound(evt.getPlayer().getEyeLocation(), Sound.ENTITY_BLAZE_DEATH, 1.0F, 0.5F); + return; + } + Location playerLoc = evt.getPlayer().getLocation(); + Location teleportTo = new Location(nether, playerLoc.getX() / 8, 64.0D, playerLoc.getZ() / 8); + int radius = 3; + for (int x = radius; x >= -radius; x--) + for (int y = radius; y >= -radius; y--) + for (int z = radius; z >= -radius; z--) { + Block block = nether.getBlockAt(x, y, z); + block.setType(Material.AIR); + } + Location setPlatform = teleportTo.add(0.0D, -1.0D, 0.0D); + nether.getBlockAt(setPlatform).setType(Material.OBSIDIAN); + Bukkit.getScheduler().runTaskLater(MilkBlock.getInstance(), () -> { + evt.getPlayer().teleport(teleportTo, PlayerTeleportEvent.TeleportCause.PLUGIN); + nether.playSound(evt.getPlayer().getEyeLocation(), Sound.BLOCK_PORTAL_TRAVEL, 1.0F, 1.5F); + }, 1L); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/SandBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/SandBlockBucket.java new file mode 100644 index 0000000..1e8212a --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/SandBlockBucket.java @@ -0,0 +1,49 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.EquipmentSlot; +import ru.erius.milkblock.MilkBlock; +import ru.erius.milkblock.items.AbstractBlockBucket; + +import java.util.HashMap; + +public class SandBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "sand_block_bucket"; + private final static String DEFAULT_TITLE = "Sand block bucket"; + private final static HashMap PLAYER_SAND = new HashMap<>(); + + public SandBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + PLAYER_SAND.put(evt.getPlayer(), true); + Bukkit.getScheduler().runTaskLater(MilkBlock.getInstance(), () -> PLAYER_SAND.put(evt.getPlayer(), false), 600L); + } + + @EventHandler + private void onPlayerRightClickAir(PlayerInteractEvent evt) { + if (!canPlace(evt.getPlayer()) || evt.getHand() == EquipmentSlot.OFF_HAND || evt.getAction() != Action.LEFT_CLICK_AIR && evt.getAction() != Action.LEFT_CLICK_BLOCK) return; + Block block = evt.getPlayer().getTargetBlock(64); + if (block == null) return; + evt.getPlayer().getWorld().spawnFallingBlock(block.getLocation().add(0.0D, 1.0D, 0.0D), Material.SAND.createBlockData()); + evt.getPlayer().getWorld().playSound(evt.getPlayer().getEyeLocation(), Sound.BLOCK_SAND_PLACE, 1.0F, 1.5F); + } + + private boolean canPlace(Player player) { + if (!PLAYER_SAND.containsKey(player)) PLAYER_SAND.put(player, false); + return PLAYER_SAND.get(player); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/StoneBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/StoneBlockBucket.java new file mode 100644 index 0000000..8f13aff --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/StoneBlockBucket.java @@ -0,0 +1,49 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.*; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.EquipmentSlot; +import org.bukkit.util.Vector; +import ru.erius.milkblock.MilkBlock; +import ru.erius.milkblock.items.AbstractBlockBucket; + +import java.util.HashMap; + +public class StoneBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "stone_block_bucket"; + private final static String DEFAULT_TITLE = "Stone block bucket"; + private final static HashMap PLAYER_BREAK = new HashMap<>(); + + public StoneBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + PLAYER_BREAK.put(evt.getPlayer(), true); + Bukkit.getScheduler().runTaskLater(MilkBlock.getInstance(), () -> PLAYER_BREAK.put(evt.getPlayer(), false), 600L); + } + + @EventHandler + private void onPlayerLeftClickBlock(PlayerInteractEvent evt) { + if (!canBreak(evt.getPlayer()) || evt.getHand() == EquipmentSlot.OFF_HAND || evt.getAction() != Action.LEFT_CLICK_BLOCK) return; + evt.getClickedBlock().setType(Material.AIR); + evt.getPlayer().getWorld().spawnParticle(Particle.BLOCK_CRACK, evt.getClickedBlock().getLocation().add(0.5D, 0.5D, 0.5D), + 100, 0.3D, 0.3D, 0.3D, evt.getClickedBlock().getBlockData()); + evt.getPlayer().getWorld().playSound(evt.getClickedBlock().getLocation(), Sound.BLOCK_ANVIL_FALL, 1.0F, 1.0F); + } + + private boolean canBreak(Player player) { + if (!PLAYER_BREAK.containsKey(player)) PLAYER_BREAK.put(player, false); + return PLAYER_BREAK.get(player); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/WoodBlockBucket.java b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/WoodBlockBucket.java new file mode 100644 index 0000000..5366bcb --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/items/bucket/WoodBlockBucket.java @@ -0,0 +1,34 @@ +package ru.erius.milkblock.items.bucket; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import ru.erius.milkblock.items.AbstractBlockBucket; + +import java.util.List; + +public class WoodBlockBucket extends AbstractBlockBucket { + + public final static String NAME = "wood_block_bucket"; + private final static String DEFAULT_TITLE = "Wood block bucket"; + private final static List POTION_EFFECTS = List.of( + new PotionEffect(PotionEffectType.SATURATION, 300, 2), + new PotionEffect(PotionEffectType.REGENERATION, 300, 2) + ); + + public WoodBlockBucket() { + super(NAME, DEFAULT_TITLE); + } + + @Override @EventHandler + public void onConsume(PlayerItemConsumeEvent evt) { + if (!this.isThisItem(evt.getItem())) return; + replaceBucket(evt); + POTION_EFFECTS.forEach(potionEffect -> { + if (potionEffect.equals(evt.getPlayer().getPotionEffect(potionEffect.getType()))) + evt.getPlayer().removePotionEffect(potionEffect.getType()); + evt.getPlayer().addPotionEffect(potionEffect); + }); + } +} diff --git a/MilkBlock/src/main/java/ru/erius/milkblock/recipes/EmptyBlockBucketRecipe.java b/MilkBlock/src/main/java/ru/erius/milkblock/recipes/EmptyBlockBucketRecipe.java new file mode 100644 index 0000000..a8d4c6e --- /dev/null +++ b/MilkBlock/src/main/java/ru/erius/milkblock/recipes/EmptyBlockBucketRecipe.java @@ -0,0 +1,26 @@ +package ru.erius.milkblock.recipes; + +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.RecipeChoice; +import ru.erius.eriuslib.recipes.shaped.CustomShapedRecipe; +import ru.erius.milkblock.MilkBlock; +import ru.erius.milkblock.items.bucket.EmptyBlockBucket; + +import java.util.Map; + +public class EmptyBlockBucketRecipe extends CustomShapedRecipe { + + private final static NamespacedKey KEY = new NamespacedKey(MilkBlock.getInstance(), "empty_block_bukcet_recipe"); + private final static ItemStack RESULT = new EmptyBlockBucket(); + private final static String[] SHAPE = { + "A.A", + ".A." + }; + private final static Map MAP = Map.of('A', new RecipeChoice.MaterialChoice(Material.IRON_BLOCK)); + + public EmptyBlockBucketRecipe() { + super(KEY, RESULT, SHAPE, MAP); + } +} diff --git a/MilkBlock/src/main/resources/plugin.yml b/MilkBlock/src/main/resources/plugin.yml new file mode 100644 index 0000000..36f5f41 --- /dev/null +++ b/MilkBlock/src/main/resources/plugin.yml @@ -0,0 +1,8 @@ +name: MilkBlock +version: '${version}' +main: ru.erius.milkblock.MilkBlock +api-version: 1.17 +depend: [ EriusLib ] +authors: [ erius ] +description: allows player to get milk from blocks and drink it +commands: diff --git a/MobFromOre/.gitignore b/MobFromOre/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/MobFromOre/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/MobFromOre/build.gradle b/MobFromOre/build.gradle new file mode 100644 index 0000000..32e824b --- /dev/null +++ b/MobFromOre/build.gradle @@ -0,0 +1,38 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius' +version = '' +def serverPath = 'C:/mc_servers/1.16.5/plugins' + +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +repositories { + mavenCentral() + maven { + name = 'spigotmc-repo' + url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT' +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +jar { + destinationDirectory.set(file(serverPath)) +} diff --git a/MobFromOre/gradle.properties b/MobFromOre/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/MobFromOre/gradle/wrapper/gradle-wrapper.jar b/MobFromOre/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/MobFromOre/gradle/wrapper/gradle-wrapper.jar differ diff --git a/MobFromOre/gradle/wrapper/gradle-wrapper.properties b/MobFromOre/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b5f89 --- /dev/null +++ b/MobFromOre/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/MobFromOre/gradlew b/MobFromOre/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/MobFromOre/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/MobFromOre/gradlew.bat b/MobFromOre/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/MobFromOre/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/MobFromOre/settings.gradle b/MobFromOre/settings.gradle new file mode 100644 index 0000000..df4b3d3 --- /dev/null +++ b/MobFromOre/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'MobFromOre' diff --git a/MobFromOre/src/main/java/ru/erius/mobfromore/MobFromOre.java b/MobFromOre/src/main/java/ru/erius/mobfromore/MobFromOre.java new file mode 100644 index 0000000..ee03ca9 --- /dev/null +++ b/MobFromOre/src/main/java/ru/erius/mobfromore/MobFromOre.java @@ -0,0 +1,39 @@ +package ru.erius.mobfromore; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.java.JavaPlugin; + +public class MobFromOre extends JavaPlugin { + @Override + public void onEnable() { + super.onEnable(); + getLogger().info("MobFromOre enabled"); + getServer().getPluginManager().registerEvents(new PlayerEvents(), this); + } + + @Override + public void onDisable() { + super.onDisable(); + getLogger().info("MobFromOre disabled"); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + String cmd = command.getName().toLowerCase(); + if (cmd.equals("mobchance")) + try { + float newRate = Integer.parseInt(args[0]) / 100F; + if (newRate < 0 || newRate > 1) { + sender.sendMessage(ChatColor.RED + "The value must be within [0, 100]"); + } else { + PlayerEvents.spawnRate = newRate; + sender.sendMessage(ChatColor.GOLD + "Changed the mob spawn rate from ores successfully"); + } + } catch (NumberFormatException e) { + sender.sendMessage(ChatColor.RED + "The value must be an integer"); + } + return super.onCommand(sender, command, label, args); + } +} diff --git a/MobFromOre/src/main/java/ru/erius/mobfromore/PlayerEvents.java b/MobFromOre/src/main/java/ru/erius/mobfromore/PlayerEvents.java new file mode 100644 index 0000000..74a5ecc --- /dev/null +++ b/MobFromOre/src/main/java/ru/erius/mobfromore/PlayerEvents.java @@ -0,0 +1,41 @@ +package ru.erius.mobfromore; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.*; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class PlayerEvents implements Listener { + final static List ores = Arrays.asList(Material.COAL_ORE, Material.IRON_ORE, Material.GOLD_ORE, + Material.REDSTONE_ORE, Material.LAPIS_ORE, Material.DIAMOND_ORE, Material.EMERALD_ORE, + Material.NETHER_GOLD_ORE, Material.NETHER_QUARTZ_ORE); + + final static List mobs = Stream.concat(Stream.of(EntityType.values()) + .filter(v -> v.getEntityClass() != null && Mob.class.isAssignableFrom(v.getEntityClass())), Stream.of(EntityType.ENDER_DRAGON)) + .collect(Collectors.toList()); + + static float spawnRate = 0.25F; + + @EventHandler + public void onMining(BlockBreakEvent evt) { + Block block = evt.getBlock(); + if (ores.contains(block.getType())) { + if (Math.random() < spawnRate) { + int index = (int) (Math.random() * mobs.size()); + Location spawnLocation = block.getLocation(); + EntityType mob = mobs.get(index); + Entity entity = spawnLocation.getWorld().spawnEntity(spawnLocation, mob); + if (entity instanceof EnderDragon) + ((EnderDragon) entity).setPhase(EnderDragon.Phase.CIRCLING); + } + } + } +} diff --git a/MobFromOre/src/main/resources/plugin.yml b/MobFromOre/src/main/resources/plugin.yml new file mode 100644 index 0000000..82a4785 --- /dev/null +++ b/MobFromOre/src/main/resources/plugin.yml @@ -0,0 +1,9 @@ +name: MobFromOre +version: 1.0 +main: ru.erius.mobfromore.MobFromOre +api-version: 1.16 +authors: [ erius ] +description: adds a chance for a random mob to spawn upon breaking any ore +commands: + mobchance: + description: changes the rate of mobs spawning from ores (from 0% to 100%) diff --git a/MobSword/.gitignore b/MobSword/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/MobSword/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/MobSword/build.gradle b/MobSword/build.gradle new file mode 100644 index 0000000..916683d --- /dev/null +++ b/MobSword/build.gradle @@ -0,0 +1,38 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius' +version = '1.0-SNAPSHOT' +def serverPath = 'C:/mc_servers/1.17.1/plugins' + +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +repositories { + mavenCentral() + maven { + name = 'spigotmc-repo' + url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +jar { + destinationDirectory.set(file(serverPath)) +} diff --git a/MobSword/gradle.properties b/MobSword/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/MobSword/gradle/wrapper/gradle-wrapper.jar b/MobSword/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/MobSword/gradle/wrapper/gradle-wrapper.jar differ diff --git a/MobSword/gradle/wrapper/gradle-wrapper.properties b/MobSword/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b5f89 --- /dev/null +++ b/MobSword/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/MobSword/gradlew b/MobSword/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/MobSword/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/MobSword/gradlew.bat b/MobSword/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/MobSword/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/MobSword/settings.gradle b/MobSword/settings.gradle new file mode 100644 index 0000000..7fb2cd4 --- /dev/null +++ b/MobSword/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'MobSword' diff --git a/MobSword/src/main/java/ru/erius/mobsword/CommandHandler.java b/MobSword/src/main/java/ru/erius/mobsword/CommandHandler.java new file mode 100644 index 0000000..771e186 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/CommandHandler.java @@ -0,0 +1,82 @@ +package ru.erius.mobsword; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.attribute.Attribute; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import ru.erius.mobsword.PluginInit.ItemsInit.Items; + + +public class CommandHandler { + + private static final String PACK_URL = "https://drive.google.com/u/0/uc?id=1SqL--WIs1juyAvbXav_DY311X4wTO8Bo&export=download"; + + public static void onCommand(CommandSender sender, Command command, String[] args) { + String cmd = command.getName().toLowerCase(); + switch (cmd) { + case "give": + giveItem(sender, args); + break; + case "pack": + offerPack(sender); + break; + case "hearts": + removeHearts(sender); + break; + } + } + + public static void removeHearts(CommandSender sender) { + if (sender instanceof Player) { + Player player = (Player) sender; + player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20); + player.sendMessage(ChatColor.GREEN + "Resetting health..."); + } else + sender.sendMessage(ChatColor.RED + "You are not a player"); + } + + public static void offerPack(CommandSender sender) { + if (sender instanceof Player) { + Player player = (Player) sender; + try { + player.setResourcePack(PACK_URL); + } catch (IllegalArgumentException e) { + player.sendMessage(ChatColor.RED + "Failed ro load the resource pack"); + return; + } + player.sendMessage(ChatColor.GREEN + "Downloading..."); + } else + sender.sendMessage(ChatColor.RED + "You are not a player"); + } + + private static void giveItem(CommandSender sender, String[] args) { + if (args.length != 3) { + sender.sendMessage(ChatColor.RED + "Wrong usage of command"); + return; + } + String name = args[0], idStr = args[1], amountStr = args[2]; + int id, amount; + try { + id = Integer.parseInt(idStr); + amount = Integer.parseInt(amountStr); + } catch (NumberFormatException e) { + sender.sendMessage(ChatColor.RED + "The ID and amount must be integer"); + return; + } + Player player = Bukkit.getPlayer(name); + if (player == null) { + sender.sendMessage(ChatColor.RED + "Such player is offline or doesn't exist"); + return; + } + ItemStack item = Items.getItem(id, amount); + if (item == null) { + sender.sendMessage(ChatColor.RED + "No such item exists"); + return; + } + player.getInventory().addItem(item); + sender.sendMessage(ChatColor.GREEN + "Gave " + amount + " [" + item.getItemMeta().getDisplayName() + ChatColor.GREEN + "] to " + name); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/ConfigHandler.java b/MobSword/src/main/java/ru/erius/mobsword/ConfigHandler.java new file mode 100644 index 0000000..5835e4f --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/ConfigHandler.java @@ -0,0 +1,25 @@ +package ru.erius.mobsword; + +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +import java.io.File; + +public class ConfigHandler { + + private final static MobSword plugin = MobSword.plugin; + + private final static String fileName = "mob_sword.yml"; + private final static File file = new File(plugin.getDataFolder(), fileName); + private static FileConfiguration config = null; + + public static FileConfiguration getConfig() { + return config; + } + + public static void reloadConfig(boolean replace) { + plugin.saveResource(fileName, replace); + config = YamlConfiguration.loadConfiguration(file); + plugin.getLogger().info("loaded the config"); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/MobSword.java b/MobSword/src/main/java/ru/erius/mobsword/MobSword.java new file mode 100644 index 0000000..61bb31e --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/MobSword.java @@ -0,0 +1,33 @@ +package ru.erius.mobsword; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.java.JavaPlugin; +import ru.erius.mobsword.PluginInit.ItemsInit.Items; + +public final class MobSword extends JavaPlugin { + + public static MobSword plugin; + + @Override + public void onEnable() { + super.onEnable(); + plugin = this; + ConfigHandler.reloadConfig(false); + getServer().getPluginManager().registerEvents(new ServerEvents(), this); + Items.initItems(); + getLogger().info(getName() + " enabled"); + } + + @Override + public void onDisable() { + super.onDisable(); + getLogger().info(getName() + " disabled"); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + CommandHandler.onCommand(sender, command, args); + return super.onCommand(sender, command, label, args); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsEvents.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsEvents.java new file mode 100644 index 0000000..32180b4 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsEvents.java @@ -0,0 +1,101 @@ +package ru.erius.mobsword.PluginInit; + +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.EquipmentSlot; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.util.Vector; +import ru.erius.mobsword.PluginInit.ItemsInit.Consumable; +import ru.erius.mobsword.PluginInit.ItemsInit.Items; +import ru.erius.mobsword.PluginInit.ItemsInit.MyItem; +import ru.erius.mobsword.PluginInit.ItemsInit.Swords.Sword; + +public class ItemsEvents { + + public static void addDrops(EntityDeathEvent evt) { + if (Items.getMobDrop().containsKey(evt.getEntityType())) { + ItemStack drop = new ItemStack(Items.getMobDrop().get(evt.getEntityType())); + evt.getDrops().add(drop); + } + } + + public static void handleAirSwing(PlayerInteractEvent evt) { + ItemStack item = evt.getItem(); + Sword sword = getSword(item); + if (sword != null) + sword.onAirSwing(evt.getPlayer()); + } + + public static void handleBlockSwing(PlayerInteractEvent evt) { + ItemStack item = evt.getItem(); + Sword sword = getSword(item); + if (sword != null) + sword.onBlockSwing(evt.getPlayer(), evt.getClickedBlock()); + } + + public static void handleAirUse(PlayerInteractEvent evt) { + ItemStack item = evt.getItem(); + Sword sword = getSword(item); + if (sword != null) + sword.onAirUse(evt.getPlayer()); + } + + public static void handleBlockUse(PlayerInteractEvent evt) { + ItemStack item = evt.getItem(); + Sword sword = getSword(item); + if (sword != null) + sword.onBlockUse(evt.getPlayer(), evt.getClickedBlock()); + } + + public static void handleEntityUse(PlayerInteractAtEntityEvent evt) { + if (evt.getHand() != EquipmentSlot.HAND) + return; + ItemStack item = evt.getPlayer().getInventory().getItemInMainHand(); + Sword sword = getSword(item); + if (sword != null) + sword.onEntityUse(evt.getPlayer(), evt.getRightClicked()); + } + + public static void handleDamage(EntityDamageByEntityEvent evt) { + if (evt.getDamager() instanceof Player) { + Player player = (Player) evt.getDamager(); + ItemStack item = player.getInventory().getItemInMainHand(); + Sword sword = getSword(item); + if (sword != null) + sword.onDamageEntity(player, evt.getEntity()); + } + } + + private static Sword getSword(ItemStack item) { + if (item == null) + return null; + ItemMeta meta = item.getItemMeta(); + return meta != null && meta.hasCustomModelData() ? Items.getSwordType().get(meta.getCustomModelData()) : null; + } + + public static boolean getLookingAt(Player player, Entity entity) { + Location eye = player.getEyeLocation(); + Vector toEntity = entity.getLocation().toVector().subtract(eye.toVector()); + double dot = toEntity.normalize().dot(eye.getDirection()); + return dot > 0.9; + } + + public static void handleConsume(PlayerItemConsumeEvent evt) { + ItemStack item = evt.getItem(); + ItemMeta meta = item.getItemMeta(); + if (meta != null && meta.hasCustomModelData() && Items.getItems().containsKey(meta.getCustomModelData())) { + evt.setCancelled(true); + MyItem myItem = Items.getItems().get(meta.getCustomModelData()); + if (myItem instanceof Consumable) + ((Consumable) myItem).onConsumed(evt.getPlayer()); + evt.getPlayer().getInventory().getItemInMainHand().setAmount(item.getAmount() - 1); + } + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Consumable.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Consumable.java new file mode 100644 index 0000000..33e7dbd --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Consumable.java @@ -0,0 +1,7 @@ +package ru.erius.mobsword.PluginInit.ItemsInit; + +import org.bukkit.entity.Player; + +public interface Consumable { + void onConsumed(Player player); +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Items.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Items.java new file mode 100644 index 0000000..5920741 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Items.java @@ -0,0 +1,141 @@ +package ru.erius.mobsword.PluginInit.ItemsInit; + +import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; +import ru.erius.mobsword.MobSword; +import ru.erius.mobsword.PluginInit.ItemsInit.Souls.*; +import ru.erius.mobsword.PluginInit.ItemsInit.Swords.*; + +import java.util.HashMap; + +public class Items { + + private final static HashMap items = new HashMap<>(); + private final static HashMap consumableItems = new HashMap<>(); + private final static HashMap mobDrop = new HashMap<>(); + private final static HashMap swordType = new HashMap<>(); + + public static void initItems() { + registerDrops(); + registerRecipes(); + } + + public static ItemStack getItem(int id, int amount) { + if (items.containsKey(id)) { + ItemStack item = new ItemStack(items.get(id)); + item.setAmount(amount); + return item; + } else + return null; + } + + private static void registerDrops() { + //creeper_soul + Soul soul = new CreeperSoul(); + consumableItems.put(soul.getId(), soul); + //skeleton_soul + soul = new SkeletonSoul(); + consumableItems.put(soul.getId(), soul); + //zombie_soul + soul = new ZombieSoul(); + consumableItems.put(soul.getId(), soul); + //enderman_soul + soul = new EndermanSoul(); + consumableItems.put(soul.getId(), soul); + //pig_soul + soul = new PigSoul(); + consumableItems.put(soul.getId(), soul); + //blaze_soul + soul = new BlazeSoul(); + consumableItems.put(soul.getId(), soul); + //chicken_soul + soul = new ChickenSoul(); + consumableItems.put(soul.getId(), soul); + //cow_soul + soul = new CowSoul(); + consumableItems.put(soul.getId(), soul); + //sheep_soul + soul = new SheepSoul(); + consumableItems.put(soul.getId(), soul); + //axolotl_soul + soul = new AxolotlSoul(); + consumableItems.put(soul.getId(), soul); + //ender_dragon_soul + soul = new EnderDragonSoul(); + consumableItems.put(soul.getId(), soul); + //walrus_milk + WalrusMilk milk = new WalrusMilk(); + consumableItems.put(milk.getId(), milk); + consumableItems.values().forEach(s -> { + if (s instanceof MyItem) { + MyItem item = (MyItem) s; + items.put(item.getId(), item); + if (item instanceof Soul) { + Soul mySoul = (Soul) item; + mobDrop.put(mySoul.getEntityType(), mySoul); + } + } + }); + //add ender_dragon_soul recipe + new EnderDragonSoul().addRecipe(); + MobSword.plugin.getLogger().info("Registered new drops"); + } + + private static void registerRecipes() { + //creeper_sword + Sword sword = new CreeperSword(); + swordType.put(sword.getId(), sword); + //pig_sword + sword = new PigSword(); + swordType.put(sword.getId(), sword); + //skeleton_sword + sword = new SkeletonSword(); + swordType.put(sword.getId(), sword); + //enderman_sword + sword = new EndermanSword(); + swordType.put(sword.getId(), sword); + //zombie_sword + sword = new ZombieSword(); + swordType.put(sword.getId(), sword); + //blaze_sword + sword = new BlazeSword(); + swordType.put(sword.getId(), sword); + //chicken_sword + sword = new ChickenSword(); + swordType.put(sword.getId(), sword); + //cow_sword + sword = new CowSword(); + swordType.put(sword.getId(), sword); + //sheep_sword + sword = new SheepSword(); + swordType.put(sword.getId(), sword); + //axolotl_sword + sword = new AxolotlSword(); + swordType.put(sword.getId(), sword); + //ender_dragon_sword + sword = new EnderDragonSword(); + swordType.put(sword.getId(), sword); + //init recipes + swordType.values().forEach(s -> { + items.put(s.getId(), s); + s.addRecipe(); + }); + MobSword.plugin.getLogger().info("Registered new recipes"); + } + + public static HashMap getItems() { + return items; + } + + public static HashMap getMobDrop() { + return mobDrop; + } + + public static HashMap getSwordType() { + return swordType; + } + + public static HashMap getConsumableItems() { + return consumableItems; + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/MyItem.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/MyItem.java new file mode 100644 index 0000000..26bfa02 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/MyItem.java @@ -0,0 +1,40 @@ +package ru.erius.mobsword.PluginInit.ItemsInit; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import ru.erius.mobsword.ConfigHandler; + +public abstract class MyItem extends ItemStack { + + private final Material MATERIAL; + private final String NAME; + private final int ID; + + public MyItem(int id, String name, Material material) { + this.ID = id; + this.NAME = name; + this.MATERIAL = material; + this.setAmount(1); + this.setType(MATERIAL); + ItemMeta meta = this.getItemMeta(); + String displayName = ConfigHandler.getConfig().getString(NAME); + displayName = displayName == null ? "" : ChatColor.translateAlternateColorCodes('&', displayName); + meta.setDisplayName(displayName); + meta.setCustomModelData(ID); + this.setItemMeta(meta); + } + + public Material getMaterial() { + return MATERIAL; + } + + public String getName() { + return NAME; + } + + public int getId() { + return ID; + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/AxolotlSoul.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/AxolotlSoul.java new file mode 100644 index 0000000..8daa33c --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/AxolotlSoul.java @@ -0,0 +1,22 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Souls; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class AxolotlSoul extends Soul { + + private final static int ID = 10; + private final static String NAME = "axolotl_soul"; + private final static EntityType ENTITY_TYPE = EntityType.AXOLOTL; + + public AxolotlSoul() { + super(ID, NAME, ENTITY_TYPE); + } + + @Override + public void onConsumed(Player player) { + player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 600, 0)); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/BlazeSoul.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/BlazeSoul.java new file mode 100644 index 0000000..1357173 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/BlazeSoul.java @@ -0,0 +1,22 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Souls; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class BlazeSoul extends Soul { + + private final static int ID = 6; + private final static String NAME = "blaze_soul"; + private final static EntityType ENTITY_TYPE = EntityType.BLAZE; + + public BlazeSoul() { + super(ID, NAME, ENTITY_TYPE); + } + + @Override + public void onConsumed(Player player) { + player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 600, 0)); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/ChickenSoul.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/ChickenSoul.java new file mode 100644 index 0000000..bec7f1d --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/ChickenSoul.java @@ -0,0 +1,22 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Souls; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class ChickenSoul extends Soul { + + private final static int ID = 7; + private final static String NAME = "chicken_soul"; + private final static EntityType ENTITY_TYPE = EntityType.CHICKEN; + + public ChickenSoul() { + super(ID, NAME, ENTITY_TYPE); + } + + @Override + public void onConsumed(Player player) { + player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 600, 0)); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/CowSoul.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/CowSoul.java new file mode 100644 index 0000000..282506a --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/CowSoul.java @@ -0,0 +1,22 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Souls; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class CowSoul extends Soul { + + private final static int ID = 8; + private final static String NAME = "cow_soul"; + private final static EntityType ENTITY_TYPE = EntityType.COW; + + public CowSoul() { + super(ID, NAME, ENTITY_TYPE); + } + + @Override + public void onConsumed(Player player) { + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 600, 0)); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/CreeperSoul.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/CreeperSoul.java new file mode 100644 index 0000000..5efcb03 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/CreeperSoul.java @@ -0,0 +1,22 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Souls; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class CreeperSoul extends Soul { + + private final static int ID = 1; + private final static String NAME = "creeper_soul"; + private final static EntityType ENTITY_TYPE = EntityType.CREEPER; + + public CreeperSoul() { + super(ID, NAME, ENTITY_TYPE); + } + + @Override + public void onConsumed(Player player) { + player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 600, 0)); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/EnderDragonSoul.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/EnderDragonSoul.java new file mode 100644 index 0000000..0e6914b --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/EnderDragonSoul.java @@ -0,0 +1,37 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Souls; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.attribute.Attribute; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.ShapelessRecipe; +import ru.erius.mobsword.MobSword; + +public class EnderDragonSoul extends Soul { + + private final static int ID = 11; + private final static String NAME = "ender_dragon_soul"; + private final static EntityType ENTITY_TYPE = EntityType.ENDER_DRAGON; + + public EnderDragonSoul() { + super(ID, NAME, ENTITY_TYPE); + } + + @Override + public void onConsumed(Player player) { + double health = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); + player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(health + 4); + } + + public void addRecipe() { + NamespacedKey key = new NamespacedKey(MobSword.plugin, getName().toLowerCase().replace(" ", "_")); + ItemStack result = new ItemStack(this); + result.setAmount(9); + ShapelessRecipe recipe = new ShapelessRecipe(key, result); + recipe.addIngredient(1, Material.DRAGON_EGG); + Bukkit.addRecipe(recipe); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/EndermanSoul.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/EndermanSoul.java new file mode 100644 index 0000000..fb92e84 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/EndermanSoul.java @@ -0,0 +1,20 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Souls; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public class EndermanSoul extends Soul { + + private final static int ID = 4; + private final static String NAME = "enderman_soul"; + private final static EntityType ENTITY_TYPE = EntityType.ENDERMAN; + + public EndermanSoul() { + super(ID, NAME, ENTITY_TYPE); + } + + @Override + public void onConsumed(Player player) { + + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/PigSoul.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/PigSoul.java new file mode 100644 index 0000000..e739a01 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/PigSoul.java @@ -0,0 +1,22 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Souls; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class PigSoul extends Soul { + + private final static int ID = 5; + private final static String NAME = "pig_soul"; + private final static EntityType ENTITY_TYPE = EntityType.PIG; + + public PigSoul() { + super(ID, NAME, ENTITY_TYPE); + } + + @Override + public void onConsumed(Player player) { + player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 600, 0)); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/SheepSoul.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/SheepSoul.java new file mode 100644 index 0000000..5a44e06 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/SheepSoul.java @@ -0,0 +1,22 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Souls; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class SheepSoul extends Soul { + + private final static int ID = 9; + private final static String NAME = "sheep_soul"; + private final static EntityType ENTITY_TYPE = EntityType.SHEEP; + + public SheepSoul() { + super(ID, NAME, ENTITY_TYPE); + } + + @Override + public void onConsumed(Player player) { + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 600, 0)); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/SkeletonSoul.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/SkeletonSoul.java new file mode 100644 index 0000000..1553659 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/SkeletonSoul.java @@ -0,0 +1,22 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Souls; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class SkeletonSoul extends Soul { + + private final static int ID = 2; + private final static String NAME = "skeleton_soul"; + private final static EntityType ENTITY_TYPE = EntityType.SKELETON; + + public SkeletonSoul() { + super(ID, NAME, ENTITY_TYPE); + } + + @Override + public void onConsumed(Player player) { + player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 600, 0)); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/Soul.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/Soul.java new file mode 100644 index 0000000..9ad7b61 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/Soul.java @@ -0,0 +1,25 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Souls; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import ru.erius.mobsword.PluginInit.ItemsInit.Consumable; +import ru.erius.mobsword.PluginInit.ItemsInit.MyItem; + +public abstract class Soul extends MyItem implements Consumable { + + private final EntityType entityType; + private final static Material MATERIAL = Material.GOLDEN_APPLE; + + public Soul(int id, String name, EntityType entityType) { + super(id, name, MATERIAL); + this.entityType = entityType; + this.setType(MATERIAL); + } + + public EntityType getEntityType() { + return entityType; + } + + public abstract void onConsumed(Player player); +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/ZombieSoul.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/ZombieSoul.java new file mode 100644 index 0000000..bd97e84 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Souls/ZombieSoul.java @@ -0,0 +1,22 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Souls; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class ZombieSoul extends Soul { + + private final static int ID = 3; + private final static String NAME = "zombie_soul"; + private final static EntityType ENTITY_TYPE = EntityType.ZOMBIE; + + public ZombieSoul() { + super(ID, NAME, ENTITY_TYPE); + } + + @Override + public void onConsumed(Player player) { + player.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 600, 0)); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/AxolotlSword.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/AxolotlSword.java new file mode 100644 index 0000000..ea47664 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/AxolotlSword.java @@ -0,0 +1,73 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Swords; + +import org.bukkit.Material; +import org.bukkit.Particle; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; +import ru.erius.mobsword.PluginInit.ItemsInit.Souls.AxolotlSoul; + +public class AxolotlSword extends Sword { + + private final static int ID = 21; + private final static String NAME = "axolotl_sword"; + private final static ItemStack COMPONENT = new AxolotlSoul(); + private final static int DAMAGE = 12; + + public AxolotlSword() { + super(ID, NAME, COMPONENT, DAMAGE); + } + + @Override + public void onAirSwing(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_AXOLOTL_IDLE_AIR, 1F, pitch); + } + + @Override + public void onBlockSwing(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_AXOLOTL_IDLE_AIR, 1F, pitch); + } + + @Override + public void onAirUse(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_FISHING_BOBBER_SPLASH, 1F, pitch); + for (int i = 0; i < 40; i++) { + FallingBlock water = player.getWorld().spawnFallingBlock(player.getLocation(), Material.WATER.createBlockData()); + player.spawnParticle(Particle.WATER_DROP, player.getEyeLocation(), 10, 1, 1, 1); + double x = Math.random() * 2 - 1, z = Math.random() * 2 - 1; + water.setVelocity(new Vector(x, 0.5, z)); + } + } + + @Override + public void onBlockUse(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_FISHING_BOBBER_SPLASH, 1F, pitch); + for (int i = 0; i < 40; i++) { + FallingBlock water = player.getWorld().spawnFallingBlock(player.getLocation(), Material.WATER.createBlockData()); + player.spawnParticle(Particle.WATER_DROP, player.getEyeLocation(), 10, 1, 1, 1); + double x = Math.random() * 2 - 1, z = Math.random() * 2 - 1; + water.setVelocity(new Vector(x, 0.5, z)); + } + } + + @Override + public void onEntityUse(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_FISHING_BOBBER_SPLASH, 1F, pitch); + } + + @Override + public void onDamageEntity(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_AXOLOTL_IDLE_AIR, 1F, pitch); + player.getWorld().spawnParticle(Particle.WATER_DROP, entity.getLocation(), 100, 1, 1, 1); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/BlazeSword.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/BlazeSword.java new file mode 100644 index 0000000..c128216 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/BlazeSword.java @@ -0,0 +1,68 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Swords; + +import org.bukkit.Location; +import org.bukkit.Particle; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import ru.erius.mobsword.PluginInit.ItemsInit.Souls.BlazeSoul; + +public class BlazeSword extends Sword { + + private final static int ID = 17; + private final static String NAME = "blaze_sword"; + private final static ItemStack COMPONENT = new BlazeSoul(); + private final static int DAMAGE = 8; + + public BlazeSword() { + super(ID, NAME, COMPONENT, DAMAGE); + this.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 10); + } + + @Override + public void onAirSwing(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_BLAZE_AMBIENT, 1F, pitch); + } + + @Override + public void onBlockSwing(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_BLAZE_AMBIENT, 1F, pitch); + } + + @Override + public void onAirUse(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_BLAZE_SHOOT, 1F, pitch); + Location loc = player.getEyeLocation(); + Entity entity = player.getWorld().spawnEntity(loc, EntityType.FIREBALL); + entity.setVelocity(loc.getDirection().multiply(2)); + } + + @Override + public void onBlockUse(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_BLAZE_SHOOT, 1F, pitch); + Location loc = player.getEyeLocation(); + Entity entity = player.getWorld().spawnEntity(loc, EntityType.FIREBALL); + entity.setVelocity(loc.getDirection().multiply(2)); + } + + @Override + public void onEntityUse(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_BLAZE_SHOOT, 1F, pitch); + } + + @Override + public void onDamageEntity(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_BLAZE_AMBIENT, 1F, pitch); + player.getWorld().spawnParticle(Particle.FLAME, entity.getLocation(), 100, 1, 1, 1); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/ChickenSword.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/ChickenSword.java new file mode 100644 index 0000000..9e0b5cf --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/ChickenSword.java @@ -0,0 +1,69 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Swords; + +import org.bukkit.Particle; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Mob; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; +import ru.erius.mobsword.PluginInit.ItemsInit.Souls.ChickenSoul; + +public class ChickenSword extends Sword { + private final static int ID = 18; + private final static String NAME = "chicken_sword"; + private final static ItemStack COMPONENT = new ChickenSoul(); + private final static int DAMAGE = 3; + + public ChickenSword() { + super(ID, NAME, COMPONENT, DAMAGE); + } + + @Override + public void onAirSwing(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_CHICKEN_AMBIENT, 1F, pitch); + } + + @Override + public void onBlockSwing(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_CHICKEN_AMBIENT, 1F, pitch); + } + + @Override + public void onAirUse(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_PHANTOM_FLAP, 1F, pitch); + Vector dir = player.getEyeLocation().getDirection().normalize().multiply(0.5); + dir.setY(0.5); + player.setVelocity(dir); + } + + @Override + public void onBlockUse(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_PHANTOM_FLAP, 1F, pitch); + Vector dir = player.getEyeLocation().getDirection().normalize().multiply(0.5); + dir.setY(0.5); + player.setVelocity(dir); + } + + @Override + public void onEntityUse(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_PHANTOM_FLAP, 1F, pitch); + } + + @Override + public void onDamageEntity(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_CHICKEN_AMBIENT, 1F, pitch); + if (entity instanceof Mob) + ((Mob) entity).addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 100, 0)); + player.getWorld().spawnParticle(Particle.CLOUD, entity.getLocation(), 100, 1, 1, 1); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/CowSword.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/CowSword.java new file mode 100644 index 0000000..2185d22 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/CowSword.java @@ -0,0 +1,63 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Swords; + +import org.bukkit.Particle; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import ru.erius.mobsword.PluginInit.ItemsInit.Souls.CowSoul; +import ru.erius.mobsword.PluginInit.ItemsInit.WalrusMilk; + +public class CowSword extends Sword { + + private final static int ID = 19; + private final static String NAME = "cow_sword"; + private final static ItemStack COMPONENT = new CowSoul(); + private final static int DAMAGE = 4; + + public CowSword() { + super(ID, NAME, COMPONENT, DAMAGE); + } + + @Override + public void onAirSwing(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_COW_AMBIENT, 1F, pitch); + } + + @Override + public void onBlockSwing(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_COW_AMBIENT, 1F, pitch); + } + + @Override + public void onAirUse(Player player) { + + } + + @Override + public void onBlockUse(Player player, Block block) { + + } + + @Override + public void onEntityUse(Player player, Entity entity) { + + } + + @Override + public void onDamageEntity(Player player, Entity entity) { + if ((int) (Math.random() * 4) == 0) { + player.getInventory().addItem(new WalrusMilk()); + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_COW_MILK, 1F, pitch); + player.getWorld().spawnParticle(Particle.HEART, player.getEyeLocation(), 100, 1, 1, 1); + } else { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_COW_AMBIENT, 1F, pitch); + player.getWorld().spawnParticle(Particle.SMOKE_LARGE, entity.getLocation(), 100, 1, 1, 1); + } + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/CreeperSword.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/CreeperSword.java new file mode 100644 index 0000000..d33547b --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/CreeperSword.java @@ -0,0 +1,68 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Swords; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import ru.erius.mobsword.PluginInit.ItemsInit.Souls.CreeperSoul; + +public class CreeperSword extends Sword { + + private final static int ID = 12; + private final static String NAME = "creeper_sword"; + private final static ItemStack COMPONENT = new CreeperSoul(); + private final static int DAMAGE = 6; + + + public CreeperSword() { + super(ID, NAME, COMPONENT, DAMAGE); + } + + @Override + public void onAirSwing(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_CREEPER_PRIMED, 1F, pitch); + } + + @Override + public void onBlockSwing(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_CREEPER_PRIMED, 1F, pitch); + } + + @Override + public void onAirUse(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_TNT_PRIMED, 1F, pitch); + Location loc = player.getEyeLocation(); + Entity entity = player.getWorld().spawnEntity(loc, EntityType.PRIMED_TNT); + entity.setVelocity(loc.getDirection().multiply(2)); + } + + @Override + public void onBlockUse(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_TNT_PRIMED, 1F, pitch); + Location loc = player.getEyeLocation(); + Entity entity = player.getWorld().spawnEntity(loc, EntityType.PRIMED_TNT); + entity.setVelocity(loc.getDirection().multiply(2)); + } + + @Override + public void onEntityUse(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_TNT_PRIMED, 1F, pitch); + } + + @Override + public void onDamageEntity(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_CREEPER_PRIMED, 1F, pitch); + player.setInvulnerable(true); + player.getWorld().createExplosion(entity.getLocation(), 3); + player.setInvulnerable(false); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/EnderDragonSword.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/EnderDragonSword.java new file mode 100644 index 0000000..4ef5062 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/EnderDragonSword.java @@ -0,0 +1,89 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Swords; + +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitRunnable; +import ru.erius.mobsword.MobSword; +import ru.erius.mobsword.PluginInit.ItemsInit.Souls.EnderDragonSoul; + +public class EnderDragonSword extends Sword { + + private final static int ID = 22; + private final static String NAME = "ender_dragon_sword"; + private final static ItemStack COMPONENT = new EnderDragonSoul(); + private final static int DAMAGE = 100; + + public EnderDragonSword() { + super(ID, NAME, COMPONENT, DAMAGE); + this.addUnsafeEnchantment(Enchantment.KNOCKBACK, 10); + } + + @Override + public void onAirSwing(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1F, pitch); + } + + @Override + public void onBlockSwing(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1F, pitch); + } + + @Override + public void onAirUse(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDER_DRAGON_SHOOT, 1F, pitch); + Location loc = player.getEyeLocation(); + Entity entity = player.getWorld().spawnEntity(loc, EntityType.DRAGON_FIREBALL); + entity.setVelocity(loc.getDirection().multiply(2)); + } + + @Override + public void onBlockUse(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDER_DRAGON_SHOOT, 1F, pitch); + Location loc = player.getEyeLocation(); + Entity entity = player.getWorld().spawnEntity(loc, EntityType.DRAGON_FIREBALL); + entity.setVelocity(loc.getDirection().multiply(2)); + } + + @Override + public void onEntityUse(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDER_DRAGON_SHOOT, 1F, pitch); + } + + @Override + public void onDamageEntity(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1F, pitch); + player.spawnParticle(Particle.GLOW, entity.getLocation(), 100, 1, 1, 1); + } + + + public static void onHolding(Player player) { + new BukkitRunnable() { + @Override + public void run() { + ItemMeta meta = player.getInventory().getItemInMainHand().getItemMeta(); + if (meta != null && meta.hasCustomModelData() && meta.getCustomModelData() == ID) { + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 4)); + player.setAllowFlight(true); + } else { + player.removePotionEffect(PotionEffectType.SPEED); + if (player.getGameMode() != GameMode.CREATIVE && player.getGameMode() != GameMode.SPECTATOR) + player.setAllowFlight(false); + } + } + }.runTaskTimer(MobSword.plugin, 0, 1); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/EndermanSword.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/EndermanSword.java new file mode 100644 index 0000000..b57c428 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/EndermanSword.java @@ -0,0 +1,73 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Swords; + +import org.bukkit.Location; +import org.bukkit.Particle; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.EnderPearl; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class EndermanSword extends Sword { + + private final static int ID = 16; + private final static String NAME = "enderman_sword"; + private final static ItemStack COMPONENT = new EndermanSword(); + private final static int DAMAGE = 10; + + public EndermanSword() { + super(ID, NAME, COMPONENT, DAMAGE); + } + + @Override + public void onAirSwing(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDERMAN_AMBIENT, 1F, pitch); + } + + @Override + public void onBlockSwing(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDERMAN_AMBIENT, 1F, pitch); + } + + @Override + public void onAirUse(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1F, pitch); + Location loc = player.getEyeLocation(); + Entity entity = player.getWorld().spawnEntity(loc, EntityType.ENDER_PEARL); + EnderPearl pearl = (EnderPearl) entity; + pearl.setShooter(player); + entity.setVelocity(loc.getDirection().multiply(2)); + } + + @Override + public void onBlockUse(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1F, pitch); + Location loc = player.getEyeLocation(); + Entity entity = player.getWorld().spawnEntity(loc, EntityType.ENDER_PEARL); + EnderPearl pearl = (EnderPearl) entity; + pearl.setShooter(player); + entity.setVelocity(loc.getDirection().multiply(2)); + } + + @Override + public void onEntityUse(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1F, pitch); + } + + @Override + public void onDamageEntity(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDERMAN_AMBIENT, 1F, pitch); + Location loc = entity.getLocation(); + player.spawnParticle(Particle.DRAGON_BREATH, entity.getLocation(), 100, 1, 1, 1); + double x = Math.random() * 20 + loc.getX() - 10, y = Math.random() * 5 + loc.getY(), z = Math.random() * 20 + loc.getZ() - 10; + entity.teleport(new Location(entity.getWorld(), x, y, z)); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/PigSword.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/PigSword.java new file mode 100644 index 0000000..fb22e65 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/PigSword.java @@ -0,0 +1,78 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Swords; + +import org.bukkit.Location; +import org.bukkit.Particle; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.*; +import org.bukkit.inventory.ItemStack; +import org.bukkit.scheduler.BukkitRunnable; +import ru.erius.mobsword.MobSword; +import ru.erius.mobsword.PluginInit.ItemsInit.Souls.PigSoul; + +public class PigSword extends Sword { + + private final static int ID = 15; + private final static String NAME = "pig_sword"; + private final static ItemStack COMPONENT = new PigSoul(); + private final static int DAMAGE = 4; + + public PigSword() { + super(ID, NAME, COMPONENT, DAMAGE); + } + + @Override + public void onAirSwing(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_PIG_AMBIENT, 1F, pitch); + } + + @Override + public void onBlockSwing(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_PIG_AMBIENT, 1F, pitch); + } + + @Override + public void onAirUse(Player player) { + + } + + @Override + public void onBlockUse(Player player, Block block) { + + } + + @Override + public void onEntityUse(Player player, Entity entity) { + if (player.getPassengers().size() == 0) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_CHICKEN_EGG, 1F, pitch); + player.addPassenger(entity); + } else { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_EGG_THROW, 1F, pitch); + Entity passenger = player.getPassengers().get(0); + player.eject(); + Location loc = player.getEyeLocation(); + passenger.setVelocity(loc.getDirection().multiply(3)); + new BukkitRunnable() { + @Override + public void run() { + Location loc = entity.getLocation(); + loc.setY(loc.getY() + 1); + entity.getWorld().spawnParticle(Particle.HEART, loc, 1); + if (entity.isOnGround()) + cancel(); + } + }.runTaskTimer(MobSword.plugin, 0, 1); + } + } + + @Override + public void onDamageEntity(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_PIG_AMBIENT, 1F, pitch); + player.getWorld().spawnParticle(Particle.CLOUD, entity.getLocation(), 100, 1, 1, 1); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/SheepSword.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/SheepSword.java new file mode 100644 index 0000000..cf234cf --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/SheepSword.java @@ -0,0 +1,76 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Swords; + +import org.bukkit.Particle; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; +import ru.erius.mobsword.PluginInit.ItemsInit.Souls.SheepSoul; + +public class SheepSword extends Sword { + + private final static int ID = 20; + private final static String NAME = "sheep_sword"; + private final static ItemStack COMPONENT = new SheepSoul(); + private final static int DAMAGE = 4; + + public SheepSword() { + super(ID, NAME, COMPONENT, DAMAGE); + } + + @Override + public void onAirSwing(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_SHEEP_AMBIENT, 1F, pitch); + } + + @Override + public void onBlockSwing(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_SHEEP_AMBIENT, 1F, pitch); + } + + @Override + public void onAirUse(Player player) { + for (Entity e : player.getNearbyEntities(20, 20, 20)) { + Vector entityVector = e.getLocation().getDirection(), playerVector = player.getLocation().getDirection(); + Vector push = playerVector.subtract(entityVector).normalize(); + push.multiply(3); + push.setY(0.5); + e.setVelocity(push); + } + } + + @Override + public void onBlockUse(Player player, Block block) { + for (Entity e : player.getNearbyEntities(20, 20, 20)) { + Vector entityVector = e.getLocation().getDirection(), playerVector = player.getLocation().getDirection(); + Vector push = playerVector.subtract(entityVector).normalize(); + push.multiply(3); + push.setY(0.5); + e.setVelocity(push); + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.AMBIENT_CAVE, 1F, pitch); + } + } + + @Override + public void onEntityUse(Player player, Entity entity) { + for (Entity e : player.getNearbyEntities(10, 10, 10)) { + Vector entityVector = e.getLocation().getDirection(), playerVector = player.getLocation().getDirection(); + Vector push = playerVector.subtract(entityVector).normalize(); + push.multiply(3); + push.setY(0.5); + e.setVelocity(push); + } + } + + @Override + public void onDamageEntity(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_SHEEP_AMBIENT, 1F, pitch); + player.getWorld().spawnParticle(Particle.ELECTRIC_SPARK, entity.getLocation(), 100, 1, 1, 1); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/SkeletonSword.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/SkeletonSword.java new file mode 100644 index 0000000..4913771 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/SkeletonSword.java @@ -0,0 +1,71 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Swords; + +import org.bukkit.Location; +import org.bukkit.Particle; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Mob; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import ru.erius.mobsword.PluginInit.ItemsInit.Souls.SkeletonSoul; + +public class SkeletonSword extends Sword { + + private final static int ID = 13; + private final static String NAME = "skeleton_sword"; + private final static ItemStack COMPONENT = new SkeletonSoul(); + private final static int DAMAGE = 6; + + public SkeletonSword() { + super(ID, NAME, COMPONENT, DAMAGE); + } + + @Override + public void onAirSwing(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_SKELETON_AMBIENT, 1F, pitch); + } + + @Override + public void onBlockSwing(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_SKELETON_AMBIENT, 1F, pitch); + } + + @Override + public void onAirUse(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ARROW_SHOOT, 1F, pitch); + Location loc = player.getEyeLocation(); + Entity arrow = player.getWorld().spawnEntity(loc, EntityType.ARROW); + arrow.setVelocity(loc.getDirection().multiply(4)); + } + + @Override + public void onBlockUse(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ARROW_SHOOT, 1F, pitch); + Location loc = player.getEyeLocation(); + Entity arrow = player.getWorld().spawnEntity(loc, EntityType.ARROW); + arrow.setVelocity(loc.getDirection().multiply(4)); + } + + @Override + public void onEntityUse(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ARROW_SHOOT, 1F, pitch); + } + + @Override + public void onDamageEntity(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_SKELETON_AMBIENT, 1F, pitch); + player.spawnParticle(Particle.END_ROD, entity.getLocation(), 100, 1, 1, 1); + if (entity instanceof Mob) + ((Mob) entity).addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 1200, 0)); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/Sword.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/Sword.java new file mode 100644 index 0000000..742419b --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/Sword.java @@ -0,0 +1,73 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Swords; + +import org.bukkit.*; +import org.bukkit.attribute.Attribute; +import org.bukkit.attribute.AttributeModifier; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.inventory.EquipmentSlot; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.RecipeChoice; +import org.bukkit.inventory.ShapedRecipe; +import org.bukkit.inventory.meta.ItemMeta; +import ru.erius.mobsword.MobSword; +import ru.erius.mobsword.PluginInit.ItemsInit.MyItem; + +import java.util.UUID; + +public abstract class Sword extends MyItem { + + private final static Material MATERIAL = Material.IRON_SWORD; + private final static String[][] recipeShape = { + {"H..", "H..", "S.."}, + {".H.", ".H.", ".S."}, + {"..H", "..H", "..S"} + }; + private final static Material STICK = Material.STICK; + private final int DAMAGE; + private final ItemStack COMPONENT; + + public Sword(int id, String name, ItemStack component, int damage) { + super(id, name, MATERIAL); + this.COMPONENT = component; + this.DAMAGE = damage; + ItemMeta meta = this.getItemMeta(); + Attribute damageAttribute = Attribute.GENERIC_ATTACK_DAMAGE; + AttributeModifier damageModifier = new AttributeModifier(UUID.randomUUID(), damageAttribute.getKey().getKey(), + damage, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND); + meta.addAttributeModifier(damageAttribute, damageModifier); + this.setItemMeta(meta); + } + + abstract public void onAirSwing(Player player); + + abstract public void onBlockSwing(Player player, Block block); + + abstract public void onAirUse(Player player); + + abstract public void onBlockUse(Player player, Block block); + + abstract public void onEntityUse(Player player, Entity entity); + + abstract public void onDamageEntity(Player player, Entity entity); + + public void addRecipe() { + for (int i = 0; i < recipeShape.length; i++) { + NamespacedKey key = new NamespacedKey(MobSword.plugin, getName() + i); + ShapedRecipe recipe = new ShapedRecipe(key, this); + recipe.shape(recipeShape[i]); + recipe.setIngredient('H', new RecipeChoice.ExactChoice(COMPONENT)); + recipe.setIngredient('S', STICK); + Bukkit.addRecipe(recipe); + } + } + + public ItemStack getComponent() { + return COMPONENT; + } + + public int getDamage() { + return DAMAGE; + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/ZombieSword.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/ZombieSword.java new file mode 100644 index 0000000..00aa52d --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/Swords/ZombieSword.java @@ -0,0 +1,61 @@ +package ru.erius.mobsword.PluginInit.ItemsInit.Swords; + +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Mob; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import ru.erius.mobsword.PluginInit.ItemsInit.Souls.ZombieSoul; + +public class ZombieSword extends Sword { + + private final static int ID = 14; + private final static String NAME = "zombie_sword"; + private final static ItemStack COMPONENT = new ZombieSoul(); + private final static int DAMAGE = 5; + + public ZombieSword() { + super(ID, NAME, COMPONENT, DAMAGE); + } + + @Override + public void onAirSwing(Player player) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ZOMBIE_AMBIENT, 1F, pitch); + } + + @Override + public void onBlockSwing(Player player, Block block) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ZOMBIE_AMBIENT, 1F, pitch); + } + + @Override + public void onAirUse(Player player) { + + } + + @Override + public void onBlockUse(Player player, Block block) { + + } + + @Override + public void onEntityUse(Player player, Entity entity) { + if (entity instanceof Mob) + ((Mob) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100, 9)); + player.playSound(player.getEyeLocation(), Sound.BLOCK_AMETHYST_BLOCK_STEP, 1, 1); + } + + @Override + public void onDamageEntity(Player player, Entity entity) { + float pitch = (float) (Math.random() * 2 + 0.1); + player.playSound(player.getEyeLocation(), Sound.ENTITY_ZOMBIE_AMBIENT, 1F, pitch); + PotionEffect potion = player.getPotionEffect(PotionEffectType.ABSORPTION); + int amplifier = potion == null ? 0 : potion.getAmplifier() + 1; + player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 100, amplifier)); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/WalrusMilk.java b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/WalrusMilk.java new file mode 100644 index 0000000..465f160 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/PluginInit/ItemsInit/WalrusMilk.java @@ -0,0 +1,26 @@ +package ru.erius.mobsword.PluginInit.ItemsInit; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class WalrusMilk extends MyItem implements Consumable { + + private final static int ID = 23; + private final static String NAME = "walrus_milk"; + private final static Material MATERIAL = Material.MILK_BUCKET; + + public WalrusMilk() { + super(ID, NAME, MATERIAL); + } + + public void onConsumed(Player player) { + PotionEffectType[] effectTypes = PotionEffectType.values(); + int duration = (int) (600 + Math.random() * 1801); + int amplifier = (int) (Math.random() * 4); + int effectId = (int) (1 + Math.random() * (effectTypes.length - 1)); + PotionEffectType effectType = effectTypes[effectId]; + player.addPotionEffect(new PotionEffect(effectType, duration, amplifier)); + } +} diff --git a/MobSword/src/main/java/ru/erius/mobsword/ServerEvents.java b/MobSword/src/main/java/ru/erius/mobsword/ServerEvents.java new file mode 100644 index 0000000..10d1a51 --- /dev/null +++ b/MobSword/src/main/java/ru/erius/mobsword/ServerEvents.java @@ -0,0 +1,58 @@ +package ru.erius.mobsword; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import ru.erius.mobsword.PluginInit.ItemsEvents; +import ru.erius.mobsword.PluginInit.ItemsInit.Swords.EnderDragonSword; + +public class ServerEvents implements Listener { + @EventHandler + private void onEntityDeath(EntityDeathEvent evt) { + ItemsEvents.addDrops(evt); + } + + @EventHandler + private void onPlayerInteract(PlayerInteractEvent evt) { + switch (evt.getAction()) { + case LEFT_CLICK_AIR: + ItemsEvents.handleAirSwing(evt); + break; + case LEFT_CLICK_BLOCK: + ItemsEvents.handleBlockSwing(evt); + break; + case RIGHT_CLICK_AIR: + ItemsEvents.handleAirUse(evt); + break; + case RIGHT_CLICK_BLOCK: + ItemsEvents.handleBlockUse(evt); + break; + } + } + + @EventHandler + private void onEntityDamageByEntity(EntityDamageByEntityEvent evt) { + ItemsEvents.handleDamage(evt); + } + + @EventHandler + private void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent evt) { + ItemsEvents.handleEntityUse(evt); + } + + @EventHandler + private void onPlayerItemConsume(PlayerItemConsumeEvent evt) { + ItemsEvents.handleConsume(evt); + } + + @EventHandler + private void onPlayerJoin(PlayerJoinEvent evt) { + CommandHandler.offerPack(evt.getPlayer()); + EnderDragonSword.onHolding(evt.getPlayer()); + } +} diff --git a/MobSword/src/main/resources/mob_sword.yml b/MobSword/src/main/resources/mob_sword.yml new file mode 100644 index 0000000..094ad12 --- /dev/null +++ b/MobSword/src/main/resources/mob_sword.yml @@ -0,0 +1,50 @@ +# Config for MobSword plugin +# Color codes: +# &1 - Dark blue +# &2 - Dark green +# &3 - Dark aqua +# &4 - Dark red +# &5 - Dark purple +# &6 - Gold +# &7 - Gray +# &8 - Dark gray +# &9 - Blue +# &0 - Black +# &a - Green +# &b - Aqua +# &c - Red +# &d - Light purple +# &e - Yellow +# &f - White +# &k - Obfuscated (хуита которая меняется каждую секунду) +# +# Other special formatting: +# &l - Bold +# &m - Strikethrough (перечекрнутый) +# &n - Underline +# &o - Italic +# &r - Reset + +axolotl_soul: "Душа аксолотля" +blaze_soul: "Душа ифрита" +chicken_soul: "Душа курицы" +cow_soul: "Душа коровы" +creeper_soul: "Душа крипера" +ender_dragon_soul: "Душа Эндер Дракона" +enderman_soul: "Душа эндермена" +pig_soul: "Душа свиньи" +sheep_soul: "Душа овцы" +skeleton_soul: "Душа скелета" +zombie_soul: "Душа зомби" +axolotl_sword: "Меч аксолотля" +blaze_sword: "Меч ифрита" +chicken_sword: "Меч курицы" +cow_sword: "Меч коровы" +creeper_sword: "Меч крипер" +ender_dragon_sword: "Меч Эндер Дракона" +enderman_sword: "Меч эндермена" +pig_sword: "Меч свиньи" +sheep_sword: "Меч овцы" +skeleton_sword: "Меч скелета" +zombie_sword: "Меч зомби" +walrus_milk: "Молоко для Валруса" diff --git a/MobSword/src/main/resources/plugin.yml b/MobSword/src/main/resources/plugin.yml new file mode 100644 index 0000000..b5321a0 --- /dev/null +++ b/MobSword/src/main/resources/plugin.yml @@ -0,0 +1,13 @@ +name: MobSword +version: @version@ +main: ru.erius.mobsword.MobSword +api-version: 1.17 +authors: [ erius ] +description: adds new swords with special abilities that are made from the mobs flesh +commands: + give: + description: gives some item with id to a spedcified player + pack: + desctiption: get resource pack for this plugin + hearts: + description: resets players healths to base value (20) \ No newline at end of file diff --git a/OPMobs/.gitignore b/OPMobs/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/OPMobs/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/OPMobs/build.gradle b/OPMobs/build.gradle new file mode 100644 index 0000000..32e824b --- /dev/null +++ b/OPMobs/build.gradle @@ -0,0 +1,38 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius' +version = '' +def serverPath = 'C:/mc_servers/1.16.5/plugins' + +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +repositories { + mavenCentral() + maven { + name = 'spigotmc-repo' + url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT' +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +jar { + destinationDirectory.set(file(serverPath)) +} diff --git a/OPMobs/gradle.properties b/OPMobs/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/OPMobs/gradle/wrapper/gradle-wrapper.jar b/OPMobs/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/OPMobs/gradle/wrapper/gradle-wrapper.jar differ diff --git a/OPMobs/gradle/wrapper/gradle-wrapper.properties b/OPMobs/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b5f89 --- /dev/null +++ b/OPMobs/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/OPMobs/gradlew b/OPMobs/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/OPMobs/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/OPMobs/gradlew.bat b/OPMobs/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/OPMobs/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/OPMobs/settings.gradle b/OPMobs/settings.gradle new file mode 100644 index 0000000..0961c00 --- /dev/null +++ b/OPMobs/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'OPMobs' diff --git a/OPMobs/src/main/java/ru/erius/opmobs/OPHandler/MobEvents.java b/OPMobs/src/main/java/ru/erius/opmobs/OPHandler/MobEvents.java new file mode 100644 index 0000000..7413b03 --- /dev/null +++ b/OPMobs/src/main/java/ru/erius/opmobs/OPHandler/MobEvents.java @@ -0,0 +1,34 @@ +package ru.erius.opmobs.OPHandler; + +import org.bukkit.entity.*; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityExplodeEvent; + +public class MobEvents { + + public static boolean doMobsOneShot = false; + public static boolean areMobsImmortal = false; + + public static void mobsOneShot(EntityDamageByEntityEvent evt) { + Entity damager = evt.getDamager(); + if (doMobsOneShot && + evt.getEntity() instanceof Player && !(damager instanceof Player) && + !(damager instanceof Projectile && ((Projectile) damager).getShooter() instanceof Player || + damager instanceof FallingBlock || damager instanceof TNTPrimed || damager instanceof EnderCrystal)) { + evt.setDamage(1000F); + } + } + + + public static void dealZeroDamageToMob(EntityDamageEvent evt) { + if (areMobsImmortal && evt.getEntity() instanceof Mob) + evt.setDamage(0); + } + + + public static void onCreeperExplosion(EntityExplodeEvent evt) { + if (areMobsImmortal) + evt.getEntity().getWorld().spawnEntity(evt.getLocation(), evt.getEntityType()); + } +} diff --git a/OPMobs/src/main/java/ru/erius/opmobs/OPMobs.java b/OPMobs/src/main/java/ru/erius/opmobs/OPMobs.java new file mode 100644 index 0000000..902f0cb --- /dev/null +++ b/OPMobs/src/main/java/ru/erius/opmobs/OPMobs.java @@ -0,0 +1,56 @@ +package ru.erius.opmobs; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.java.JavaPlugin; +import ru.erius.opmobs.OPHandler.MobEvents; + +public class OPMobs extends JavaPlugin { + @Override + public void onEnable() { + super.onEnable(); + getLogger().info("OPMobs enabled"); + getServer().getPluginManager().registerEvents(new ServerEvents(), this); + } + + @Override + public void onDisable() { + super.onDisable(); + getLogger().info("OPMobs disabled"); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + String cmd = command.getName().toLowerCase(); + if (cmd.equals("mop")) { + if (args.length >= 1) { + switch (args[0]) { + case "oneshot": + if (MobEvents.doMobsOneShot) { + sender.sendMessage(ChatColor.RED + "Mobs no longer can instantly kill you"); + MobEvents.doMobsOneShot = false; + } else { + sender.sendMessage(ChatColor.GREEN + "Mobs can instantly kill you now"); + MobEvents.doMobsOneShot = true; + } + break; + case "immortality": + if (MobEvents.areMobsImmortal) { + sender.sendMessage(ChatColor.RED + "Mobs are no longer immortal"); + MobEvents.areMobsImmortal = false; + } else { + sender.sendMessage(ChatColor.GREEN + "Mobs are immortal now"); + MobEvents.areMobsImmortal = true; + } + break; + default: + sender.sendMessage(ChatColor.RED + "Incorrect argument for command"); + break; + } + } else + sender.sendMessage(ChatColor.RED + "Not enough arguments"); + } + return super.onCommand(sender, command, label, args); + } +} diff --git a/OPMobs/src/main/java/ru/erius/opmobs/ServerEvents.java b/OPMobs/src/main/java/ru/erius/opmobs/ServerEvents.java new file mode 100644 index 0000000..28dda3c --- /dev/null +++ b/OPMobs/src/main/java/ru/erius/opmobs/ServerEvents.java @@ -0,0 +1,26 @@ +package ru.erius.opmobs; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import ru.erius.opmobs.OPHandler.MobEvents; + +public class ServerEvents implements Listener { + + @EventHandler + public void onEntityDamage(EntityDamageEvent evt) { + MobEvents.dealZeroDamageToMob(evt); + } + + @EventHandler + public void onEntityDamageByEntity(EntityDamageByEntityEvent evt) { + MobEvents.mobsOneShot(evt); + } + + @EventHandler + public void onEntityExplode(EntityExplodeEvent evt) { + MobEvents.onCreeperExplosion(evt); + } +} diff --git a/OPMobs/src/main/resources/plugin.yml b/OPMobs/src/main/resources/plugin.yml new file mode 100644 index 0000000..2897c81 --- /dev/null +++ b/OPMobs/src/main/resources/plugin.yml @@ -0,0 +1,9 @@ +name: OPMobs +version: 1.0 +main: ru.erius.opmobs.OPMobs +api-version: 1.16 +authors: [ erius ] +description: makes mobs op (grants them immortality or immense strength) +commands: + mop: + description: requires 1 argument - which function to toggle on or off. "oneshot" will make mobs damage extremely high, "immortality" will nullify all damage dealt to mobs diff --git a/OreChest/.gitignore b/OreChest/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/OreChest/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/OreChest/build.gradle b/OreChest/build.gradle new file mode 100644 index 0000000..3cc58ef --- /dev/null +++ b/OreChest/build.gradle @@ -0,0 +1,47 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius' +version = '1.0-SNAPSHOT' +def serverPath = 'C:/mc_servers/1.17.1/plugins' +def EriusLibPath = 'D:/mc_plugins/EriusLib/build/libs' +def devPath = 'D:/spigot_dev' +def spigotJar = 'spigot-1.17.1' + +sourceCompatibility = "16" +targetCompatibility = "16" + +repositories { + mavenCentral() + flatDir { + dirs devPath + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly name: spigotJar + compileOnly fileTree(dir: EriusLibPath, include: '*.jar') +} + +processResources { + duplicatesStrategy = DuplicatesStrategy.INCLUDE + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +build { + doLast { + copy { + from libsDirectory + into serverPath + } + } +} diff --git a/OreChest/gradle.properties b/OreChest/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/OreChest/gradle/wrapper/gradle-wrapper.jar b/OreChest/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/OreChest/gradle/wrapper/gradle-wrapper.jar differ diff --git a/OreChest/gradle/wrapper/gradle-wrapper.properties b/OreChest/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..05679dc --- /dev/null +++ b/OreChest/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/OreChest/gradlew b/OreChest/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/OreChest/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/OreChest/gradlew.bat b/OreChest/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/OreChest/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/OreChest/settings.gradle b/OreChest/settings.gradle new file mode 100644 index 0000000..9440f2e --- /dev/null +++ b/OreChest/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'OreChest' diff --git a/OreChest/src/main/java/ru/erius/orechest/ConfigHandler.java b/OreChest/src/main/java/ru/erius/orechest/ConfigHandler.java new file mode 100644 index 0000000..2af6cc8 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/ConfigHandler.java @@ -0,0 +1,47 @@ +package ru.erius.orechest; + +import org.bukkit.configuration.InvalidConfigurationException; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; +import ru.erius.eriuslib.EriusLib; + +import java.io.File; +import java.io.IOException; + +public class ConfigHandler { + + private static FileConfiguration config; + private static File configFile; + private final static String fileName = "config.yml"; + + public static FileConfiguration getConfig() { + return config; + } + + public static void saveConfigs() { + try { + config.save(configFile); + } catch (IOException e) { + OreChest.getInstance().getLogger().severe("Failed to save to config!"); + e.printStackTrace(); + } + createConfig(); + } + + public static void createConfig() { + configFile = new File(OreChest.getInstance().getDataFolder(), fileName); + if (!configFile.exists()) { + OreChest.getInstance().getLogger().info("Configuration file was not found. Creating a new one..."); + configFile.getParentFile().mkdirs(); + OreChest.getInstance().saveResource(fileName, false); + } + config = new YamlConfiguration(); + try { + config.load(configFile); + } catch (IOException | InvalidConfigurationException e) { + OreChest.getInstance().getLogger().severe("Something went wrong while loading the config"); + e.printStackTrace(); + OreChest.getInstance().getPluginLoader().disablePlugin(OreChest.getInstance()); + } + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/OreChest.java b/OreChest/src/main/java/ru/erius/orechest/OreChest.java new file mode 100644 index 0000000..2e1c96b --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/OreChest.java @@ -0,0 +1,55 @@ +package ru.erius.orechest; + +import org.bukkit.Keyed; +import org.bukkit.plugin.java.JavaPlugin; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.gui.CustomGUI; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.orechest.guis.LootTables; +import ru.erius.orechest.guis.OreChestGUI; +import ru.erius.orechest.items.pickaxes.*; +import ru.erius.orechest.quests.CraftChestedCoalPickQuest; +import ru.erius.orechest.quests.CraftChestedDiamondPickQuest; +import ru.erius.orechest.quests.CraftChestedIronPickQuest; +import ru.erius.orechest.recipes.*; + +import java.util.List; + +public final class OreChest extends JavaPlugin { + + private static OreChest instance; + + private final static List> ITEMS = List.of(ChestedCoalPick.class, ChestedCopperPick.class, + ChestedDiamondPick.class, ChestedEmeraldPick.class, ChestedGoldenPick.class, ChestedIronPick.class, + ChestedLapisPick.class, ChestedNetheritePick.class, ChestedQuartzPick.class, ChestedRedstonePick.class); + private final static List> RECIPES = List.of(ChestedCoalPickRecipe.class, ChestedCopperPickRecipe.class, + ChestedDiamondPickRecipe.class, ChestedEmeraldPickRecipe.class, ChestedGoldenPickRecipe.class, ChestedIronPickRecipe.class, + ChestedLapisPickRecipe.class, ChestedNetheritePickRecipe.class, ChestedQuartzPickRecipe.class, ChestedRedstonePickRecipe.class); + private final static List> QUESTS = List.of(CraftChestedCoalPickQuest.class, + CraftChestedIronPickQuest.class, CraftChestedDiamondPickQuest.class); + private final static List> GUIS = List.of(OreChestGUI.class); + private final static String PACK = "https://drive.google.com/u/0/uc?id=1MMF-0HSbj03r4UEGwGLo3dVspA8YVwyS&export=download"; + + { + instance = this; + ConfigHandler.createConfig(); + } + + @Override + public void onEnable() { + Registry.registerAll(this, ITEMS, null, GUIS, QUESTS, RECIPES, PACK); + LootTables.readOreContents(); + getLogger().info(getName() + " enabled"); + } + + @Override + public void onDisable() { + LootTables.writeOreContents(); + getLogger().info(getName() + " disabled"); + } + + public static OreChest getInstance() { + return instance; + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/guis/LootTables.java b/OreChest/src/main/java/ru/erius/orechest/guis/LootTables.java new file mode 100644 index 0000000..2657178 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/guis/LootTables.java @@ -0,0 +1,291 @@ +package ru.erius.orechest.guis; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryHolder; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.EnchantmentStorageMeta; +import org.bukkit.util.io.BukkitObjectInputStream; +import org.bukkit.util.io.BukkitObjectOutputStream; +import ru.erius.orechest.OreChest; + +import java.io.*; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Stream; + +public class LootTables { + + private final static List ORES = List.of( + Material.COAL_ORE, Material.DEEPSLATE_COAL_ORE, Material.COPPER_ORE, Material.DEEPSLATE_COPPER_ORE, + Material.DIAMOND_ORE, Material.DEEPSLATE_DIAMOND_ORE, Material.EMERALD_ORE, Material.DEEPSLATE_EMERALD_ORE, + Material.GOLD_ORE, Material.DEEPSLATE_GOLD_ORE, Material.NETHER_GOLD_ORE, Material.IRON_ORE, + Material.DEEPSLATE_IRON_ORE, Material.LAPIS_ORE, Material.DEEPSLATE_LAPIS_ORE, Material.ANCIENT_DEBRIS, + Material.NETHER_QUARTZ_ORE, Material.REDSTONE_ORE, Material.DEEPSLATE_REDSTONE_ORE + ); + + private final static String FILE_NAME = "ore_contents.dat"; + public static HashMap ORE_CONTENTS; + + public final static ItemProbability[] COAL_ORE_ITEMS = { + new ItemProbability(new ItemStack(Material.AIR), 500, 1), + new ItemProbability(new ItemStack(Material.COAL), 80, 8), + new ItemProbability(new ItemStack(Material.OAK_PLANKS), 80, 16), + new ItemProbability(new ItemStack(Material.TORCH), 60, 12), + new ItemProbability(new ItemStack(Material.COOKED_CHICKEN), 40, 8), + new ItemProbability(new ItemStack(Material.COOKED_PORKCHOP), 40, 8), + new ItemProbability(new ItemStack(Material.COOKED_BEEF), 40, 8), + new ItemProbability(new ItemStack(Material.OAK_LOG), 40, 8), + new ItemProbability(new ItemStack(Material.COAL_BLOCK), 20, 2) + }; + public final static ItemProbability[] COPPER_ORE_ITEMS = { + new ItemProbability(new ItemStack(Material.AIR), 500, 1), + new ItemProbability(new ItemStack(Material.RAW_COPPER), 100, 8), + new ItemProbability(new ItemStack(Material.COPPER_INGOT), 80, 8), + new ItemProbability(new ItemStack(Material.CHAINMAIL_HELMET), 40, 8), + new ItemProbability(new ItemStack(Material.CHAINMAIL_CHESTPLATE), 40, 8), + new ItemProbability(new ItemStack(Material.CHAINMAIL_LEGGINGS), 40, 8), + new ItemProbability(new ItemStack(Material.CHAINMAIL_BOOTS), 40, 8), + new ItemProbability(new ItemStack(Material.COPPER_BLOCK), 20, 2) + }; + public final static ItemProbability[] DIAMOND_ORE_ITEMS = { + new ItemProbability(new ItemStack(Material.AIR), 500, 1), + new ItemProbability(new ItemStack(Material.DIAMOND), 80, 4), + new ItemProbability(new ItemStack(Material.DIAMOND_PICKAXE), 20, 1), + new ItemProbability(new ItemStack(Material.DIAMOND_SWORD), 20, 1), + new ItemProbability(new ItemStack(Material.DIAMOND_AXE), 20, 1), + new ItemProbability(new ItemStack(Material.DIAMOND_HOE), 40, 1), + new ItemProbability(new ItemStack(Material.DIAMOND_SHOVEL), 40, 1), + new ItemProbability(new ItemStack(Material.DIAMOND_HELMET), 20, 1), + new ItemProbability(new ItemStack(Material.DIAMOND_CHESTPLATE), 20, 1), + new ItemProbability(new ItemStack(Material.DIAMOND_LEGGINGS), 20, 1), + new ItemProbability(new ItemStack(Material.DIAMOND_BOOTS), 20, 1), + new ItemProbability(new ItemStack(Material.DIAMOND_HORSE_ARMOR), 40, 1), + new ItemProbability(new ItemStack(Material.DIAMOND_BLOCK), 5, 1), + }; + public final static ItemProbability[] EMERALD_ORE_ITEMS = { + new ItemProbability(new ItemStack(Material.AIR), 500, 1), + new ItemProbability(new ItemStack(Material.POPPY), 100, 8), + new ItemProbability(new ItemStack(Material.EMERALD), 80, 4), + new ItemProbability(new ItemStack(Material.ENDER_PEARL), 60, 4), + new ItemProbability(new ItemStack(Material.ENDER_EYE), 50, 3), + new ItemProbability(new ItemStack(Material.BELL), 40, 1), + new ItemProbability(new ItemStack(Material.ZOMBIE_VILLAGER_SPAWN_EGG), 40, 3), + new ItemProbability(new ItemStack(Material.VILLAGER_SPAWN_EGG), 20, 2), + new ItemProbability(new ItemStack(Material.EMERALD_BLOCK), 10, 1), + new ItemProbability(new ItemStack(Material.TRIDENT), 5, 1), + new ItemProbability(new ItemStack(Material.TOTEM_OF_UNDYING), 5, 1) + }; + public final static ItemProbability[] GOLD_ORE_ITEMS = { + new ItemProbability(new ItemStack(Material.AIR), 500, 1), + new ItemProbability(new ItemStack(Material.GOLD_NUGGET), 150, 16), + new ItemProbability(new ItemStack(Material.RAW_GOLD), 100, 8), + new ItemProbability(new ItemStack(Material.GOLD_INGOT), 80, 8), + new ItemProbability(new ItemStack(Material.GOLDEN_PICKAXE), 40, 1), + new ItemProbability(new ItemStack(Material.GOLDEN_SWORD), 40, 1), + new ItemProbability(new ItemStack(Material.GOLDEN_AXE), 40, 1), + new ItemProbability(new ItemStack(Material.GOLDEN_HOE), 40, 1), + new ItemProbability(new ItemStack(Material.GOLDEN_SHOVEL), 40, 1), + new ItemProbability(new ItemStack(Material.GOLDEN_HELMET), 30, 1), + new ItemProbability(new ItemStack(Material.GOLDEN_CHESTPLATE), 30, 1), + new ItemProbability(new ItemStack(Material.GOLDEN_LEGGINGS), 30, 1), + new ItemProbability(new ItemStack(Material.GOLDEN_BOOTS), 30, 1), + new ItemProbability(new ItemStack(Material.GOLDEN_HORSE_ARMOR), 40, 1), + new ItemProbability(new ItemStack(Material.GOLDEN_APPLE), 20, 2), + new ItemProbability(new ItemStack(Material.GOLD_BLOCK), 10, 2), + new ItemProbability(new ItemStack(Material.ENCHANTED_GOLDEN_APPLE), 5, 1) + }; + public final static ItemProbability[] IRON_ORE_ITEMS = { + new ItemProbability(new ItemStack(Material.AIR), 500, 1), + new ItemProbability(new ItemStack(Material.IRON_NUGGET), 150, 16), + new ItemProbability(new ItemStack(Material.RAW_IRON), 100, 8), + new ItemProbability(new ItemStack(Material.IRON_INGOT), 80, 8), + new ItemProbability(new ItemStack(Material.IRON_PICKAXE), 30, 1), + new ItemProbability(new ItemStack(Material.IRON_SWORD), 30, 1), + new ItemProbability(new ItemStack(Material.IRON_AXE), 30, 1), + new ItemProbability(new ItemStack(Material.IRON_HOE), 40, 1), + new ItemProbability(new ItemStack(Material.IRON_SHOVEL), 40, 1), + new ItemProbability(new ItemStack(Material.IRON_HELMET), 30, 1), + new ItemProbability(new ItemStack(Material.IRON_CHESTPLATE), 30, 1), + new ItemProbability(new ItemStack(Material.IRON_LEGGINGS), 30, 1), + new ItemProbability(new ItemStack(Material.IRON_BOOTS), 30, 1), + new ItemProbability(new ItemStack(Material.IRON_HORSE_ARMOR), 40, 1), + new ItemProbability(new ItemStack(Material.IRON_BLOCK), 10, 2), + new ItemProbability(new ItemStack(Material.ANVIL), 5, 1) + }; + public final static ItemProbability[] LAPIS_ORE_ITEMS = { + new ItemProbability(new ItemStack(Material.AIR), 500, 1), + new ItemProbability(new ItemStack(Material.LAPIS_LAZULI), 80, 16), + new ItemProbability(new ItemStack(Material.BOOK), 80, 4), + new ItemProbability(new ItemStack(Material.EXPERIENCE_BOTTLE), 50, 8), + new ItemProbability(new ItemStack(Material.BOOKSHELF), 20, 2), + new ItemProbability(new ItemStack(Material.LAPIS_BLOCK), 20, 4), + new ItemProbability(new ItemStack(Material.ENCHANTING_TABLE), 10, 1) + }; + public final static ItemProbability[] NETHERITE_ORE_ITEMS = { + new ItemProbability(new ItemStack(Material.AIR), 500, 1), + new ItemProbability(new ItemStack(Material.NETHERITE_INGOT), 80, 4), + new ItemProbability(new ItemStack(Material.NETHERITE_PICKAXE), 10, 1), + new ItemProbability(new ItemStack(Material.NETHERITE_SWORD), 10, 1), + new ItemProbability(new ItemStack(Material.NETHERITE_AXE), 10, 1), + new ItemProbability(new ItemStack(Material.NETHERITE_HOE), 30, 1), + new ItemProbability(new ItemStack(Material.NETHERITE_SHOVEL), 30, 1), + new ItemProbability(new ItemStack(Material.NETHERITE_HELMET), 20, 1), + new ItemProbability(new ItemStack(Material.NETHERITE_CHESTPLATE), 20, 1), + new ItemProbability(new ItemStack(Material.NETHERITE_LEGGINGS), 20, 1), + new ItemProbability(new ItemStack(Material.NETHERITE_BOOTS), 20, 1), + new ItemProbability(new ItemStack(Material.NETHERITE_BLOCK), 10, 1), + new ItemProbability(new ItemStack(Material.SHULKER_BOX), 5, 1), + new ItemProbability(new ItemStack(Material.ELYTRA), 5, 1), + new ItemProbability(new ItemStack(Material.NETHER_STAR), 5, 1) + }; + public final static ItemProbability[] QUARTZ_ORE_ITEMS = { + new ItemProbability(new ItemStack(Material.AIR), 500, 1), + new ItemProbability(new ItemStack(Material.QUARTZ), 100, 16), + new ItemProbability(new ItemStack(Material.NETHER_WART), 80, 8), + new ItemProbability(new ItemStack(Material.BLAZE_POWDER), 60, 6), + new ItemProbability(new ItemStack(Material.BLAZE_ROD), 20, 2), + new ItemProbability(new ItemStack(Material.CAKE), 20, 1), + new ItemProbability(new ItemStack(Material.QUARTZ_BLOCK), 10, 4) + }; + public final static ItemProbability[] REDSTONE_ORE_ITEMS = { + new ItemProbability(new ItemStack(Material.AIR), 500, 1), + new ItemProbability(new ItemStack(Material.REDSTONE), 80, 16), + new ItemProbability(new ItemStack(Material.TNT), 60, 8), + new ItemProbability(new ItemStack(Material.REDSTONE_TORCH), 60, 4), + new ItemProbability(new ItemStack(Material.PISTON), 40, 4), + new ItemProbability(new ItemStack(Material.STICKY_PISTON), 40, 4), + new ItemProbability(new ItemStack(Material.REPEATER), 40, 2), + new ItemProbability(new ItemStack(Material.COMPARATOR), 40, 2), + new ItemProbability(new ItemStack(Material.SLIME_BLOCK), 20, 2), + new ItemProbability(new ItemStack(Material.HONEY_BLOCK), 20, 2), + new ItemProbability(new ItemStack(Material.OBSERVER), 20, 2), + new ItemProbability(new ItemStack(Material.REDSTONE_BLOCK), 10, 4) + }; + + + public record ItemProbability(ItemStack item, int weight, int maxAmount) { + } + + public record OreInventory(Block block) implements InventoryHolder { + + @Override + public Inventory getInventory() { + return null; + } + + public Block getBlock() { + return block; + } + } + + public static ItemStack[] generateLoot(Block block, int slots) { + if (ORE_CONTENTS.containsKey(block.getLocation())) + return ORE_CONTENTS.get(block.getLocation()); + else { + ItemProbability[] array = getArrayForBlock(block); + ItemStack[] loot = new ItemStack[slots]; + boolean isLapis = block.getType() == Material.LAPIS_ORE || block.getType() == Material.DEEPSLATE_LAPIS_ORE; + for (int i = 0; i < loot.length; i++) + loot[i] = getRandomItem(array, isLapis); + ORE_CONTENTS.put(block.getLocation(), loot); + return loot; + } + } + + private static ItemStack getRandomItem(ItemProbability[] array, boolean isLapis) { + if (isLapis) + array = Stream.of(array, + new ItemProbability[]{new ItemProbability(randomEnchantedBook(), 50, 1)}) + .flatMap(Stream::of) + .toArray(ItemProbability[]::new); + int totalWeight = 0; + for (ItemProbability element : array) + totalWeight += element.weight; + int position = (int) (Math.random() * totalWeight); + ItemStack item; + for (ItemProbability element : array) { + if (position < element.weight) { + item = new ItemStack(element.item); + item.setAmount((int) (Math.random() * element.maxAmount + 1)); + return item; + } + position -= element.weight; + } + throw new IllegalStateException("Couldn't choose a random item from array, the elements weight might be broken?"); + } + + private static LootTables.ItemProbability[] getArrayForBlock(Block block) { + return switch (block.getType()) { + case COAL_ORE, DEEPSLATE_COAL_ORE -> COAL_ORE_ITEMS; + case COPPER_ORE, DEEPSLATE_COPPER_ORE -> COPPER_ORE_ITEMS; + case DIAMOND_ORE, DEEPSLATE_DIAMOND_ORE -> DIAMOND_ORE_ITEMS; + case EMERALD_ORE, DEEPSLATE_EMERALD_ORE -> EMERALD_ORE_ITEMS; + case GOLD_ORE, DEEPSLATE_GOLD_ORE, NETHER_GOLD_ORE -> GOLD_ORE_ITEMS; + case IRON_ORE, DEEPSLATE_IRON_ORE -> IRON_ORE_ITEMS; + case LAPIS_ORE, DEEPSLATE_LAPIS_ORE -> LAPIS_ORE_ITEMS; + case ANCIENT_DEBRIS -> NETHERITE_ORE_ITEMS; + case NETHER_QUARTZ_ORE -> QUARTZ_ORE_ITEMS; + case REDSTONE_ORE, DEEPSLATE_REDSTONE_ORE -> REDSTONE_ORE_ITEMS; + default -> throw new IllegalStateException("No corresponding item probability array for block type " + block.getType().name()); + }; + } + + public static void addToMap(Block block, int slots) { + if (!ORES.contains(block.getType())) return; + ItemStack[] items = new ItemStack[slots]; + Arrays.fill(items, new ItemStack(Material.AIR)); + ORE_CONTENTS.put(block.getLocation(), items); + } + + @SuppressWarnings("unchecked") + public static void readOreContents() { + File file = new File(OreChest.getInstance().getDataFolder(), FILE_NAME); + if (!file.exists()) { + file.getParentFile().mkdirs(); + try { + file.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + ORE_CONTENTS = new HashMap<>(); + } else { + try (BukkitObjectInputStream objectInputStream = new BukkitObjectInputStream(new FileInputStream(file))) { + ORE_CONTENTS = (HashMap) objectInputStream.readObject(); + } catch (IOException | ClassNotFoundException e) { + ORE_CONTENTS = new HashMap<>(); + OreChest.getInstance().getLogger().severe("Couldn't read ore contents from " + FILE_NAME); + e.printStackTrace(); + } + if (ORE_CONTENTS == null) + ORE_CONTENTS = new HashMap<>(); + } + } + + public static void writeOreContents() { + File file = new File(OreChest.getInstance().getDataFolder(), FILE_NAME); + if (file.exists()) { + try (BukkitObjectOutputStream objectOutputStream = new BukkitObjectOutputStream(new FileOutputStream(file))) { + objectOutputStream.writeObject(ORE_CONTENTS); + } catch (IOException e) { + OreChest.getInstance().getLogger().severe("Couldn't write ore contents to " + FILE_NAME); + e.printStackTrace(); + } + } + } + + private static ItemStack randomEnchantedBook() { + ItemStack book = new ItemStack(Material.ENCHANTED_BOOK); + Enchantment[] enchantments = Enchantment.values(); + EnchantmentStorageMeta meta = (EnchantmentStorageMeta) book.getItemMeta(); + Enchantment enchantment = enchantments[(int) (Math.random() * enchantments.length)]; + int level = (int) (Math.random() * enchantment.getMaxLevel() + 1); + meta.addStoredEnchant(enchantment, level, false); + book.setItemMeta(meta); + return book; + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/guis/OreChestGUI.java b/OreChest/src/main/java/ru/erius/orechest/guis/OreChestGUI.java new file mode 100644 index 0000000..6861a42 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/guis/OreChestGUI.java @@ -0,0 +1,64 @@ +package ru.erius.orechest.guis; + +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.InventoryHolder; +import org.bukkit.inventory.InventoryView; +import ru.erius.eriuslib.gui.CustomGUI; +import ru.erius.orechest.ConfigHandler; +import ru.erius.orechest.OreChest; + +public class OreChestGUI extends CustomGUI { + + private final static String NAME = "ore_chest_gui"; + private final static String DEFAULT_TITLE = "Ore"; + private final static InventoryType INVENTORY_TYPE = InventoryType.CHEST; + private final static boolean doPlayerPlacedOresHaveLoot = ConfigHandler.getConfig().getBoolean("do_player_placed_ores_have_loot"); + + public OreChestGUI() { + super(NAME, DEFAULT_TITLE, INVENTORY_TYPE, null); + } + + public OreChestGUI(Block block, Player player) { + super(NAME, DEFAULT_TITLE, INVENTORY_TYPE, new LootTables.OreInventory(block)); + this.getInventory().setContents(LootTables.generateLoot(block, INVENTORY_TYPE.getDefaultSize())); + block.getWorld().playSound(block.getLocation(), Sound.BLOCK_CHEST_OPEN, 1F, 0.8F); + player.openInventory(this.getInventory()); + } + + @EventHandler + private void onBlockPlace(BlockPlaceEvent evt) { + if (!doPlayerPlacedOresHaveLoot) + LootTables.addToMap(evt.getBlock(), INVENTORY_TYPE.getDefaultSize()); + } + + @EventHandler + private void onInventoryClick(InventoryClickEvent evt) { + InventoryView view = evt.getView(); + if (!isThisGUI(view)) return; + InventoryHolder holder = view.getTopInventory().getHolder(); + if (!(holder instanceof LootTables.OreInventory oreInventory)) return; + Bukkit.getScheduler().runTaskLater(OreChest.getInstance(), () -> + LootTables.ORE_CONTENTS.put(oreInventory.getBlock().getLocation(), view.getTopInventory().getContents()), 1); + } + + @EventHandler + private void onInventoryClose(InventoryCloseEvent evt) { + InventoryView view = evt.getView(); + if (!isThisGUI(view)) return; + InventoryHolder holder = view.getTopInventory().getHolder(); + if (!(holder instanceof LootTables.OreInventory oreInventory)) return; + evt.getPlayer().getWorld().playSound(oreInventory.getBlock().getLocation(), Sound.BLOCK_CHEST_CLOSE, 1F, 0.8F); + } + + public static String getGUIName() { + return NAME; + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedCoalPick.java b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedCoalPick.java new file mode 100644 index 0000000..b7ae70e --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedCoalPick.java @@ -0,0 +1,38 @@ +package ru.erius.orechest.items.pickaxes; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.orechest.guis.OreChestGUI; + +import java.util.List; + +public class ChestedCoalPick extends CustomItem { + + private final static String NAME = "chested_coal_pickaxe"; + private final static Material MATERIAL = Material.WOODEN_PICKAXE; + private final static String DEFAULT_TITLE = "Chested coal pickaxe"; + private final static List BLOCK_TYPES = List.of(Material.COAL_ORE, Material.DEEPSLATE_COAL_ORE); + + public ChestedCoalPick() { + super(NAME, MATERIAL, DEFAULT_TITLE); + } + + public static String getItemName() { + return NAME; + } + + @EventHandler + private void onBlockRightClick(PlayerInteractEvent evt) { + if (evt.getAction() != Action.RIGHT_CLICK_BLOCK || !this.isThisItem(evt.getItem())) return; + Block block = evt.getClickedBlock(); + if (block != null && BLOCK_TYPES.contains(block.getType())) + new OreChestGUI(block, evt.getPlayer()); + else + evt.getPlayer().getWorld().playSound(evt.getClickedBlock().getLocation(), Sound.BLOCK_CHEST_LOCKED, 1F, 1.2F); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedCopperPick.java b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedCopperPick.java new file mode 100644 index 0000000..b8dc179 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedCopperPick.java @@ -0,0 +1,38 @@ +package ru.erius.orechest.items.pickaxes; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.orechest.guis.OreChestGUI; + +import java.util.List; + +public class ChestedCopperPick extends CustomItem { + + private final static String NAME = "chested_copper_pickaxe"; + private final static Material MATERIAL = Material.GOLDEN_PICKAXE; + private final static String DEFAULT_TITLE = "Chested copper pickaxe"; + private final static List BLOCK_TYPES = List.of(Material.COPPER_ORE, Material.DEEPSLATE_COPPER_ORE); + + public ChestedCopperPick() { + super(NAME, MATERIAL, DEFAULT_TITLE); + } + + public static String getItemName() { + return NAME; + } + + @EventHandler + private void onBlockRightClick(PlayerInteractEvent evt) { + if (evt.getAction() != Action.RIGHT_CLICK_BLOCK || !this.isThisItem(evt.getItem())) return; + Block block = evt.getClickedBlock(); + if (block != null && BLOCK_TYPES.contains(block.getType())) + new OreChestGUI(block, evt.getPlayer()); + else + evt.getPlayer().getWorld().playSound(evt.getClickedBlock().getLocation(), Sound.BLOCK_CHEST_LOCKED, 1F, 1.2F); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedDiamondPick.java b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedDiamondPick.java new file mode 100644 index 0000000..6a8d39f --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedDiamondPick.java @@ -0,0 +1,38 @@ +package ru.erius.orechest.items.pickaxes; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.orechest.guis.OreChestGUI; + +import java.util.List; + +public class ChestedDiamondPick extends CustomItem { + + private final static String NAME = "chested_diamond_pickaxe"; + private final static Material MATERIAL = Material.DIAMOND_PICKAXE; + private final static String DEFAULT_TITLE = "Chested diamond pickaxe"; + private final static List BLOCK_TYPES = List.of(Material.DIAMOND_ORE, Material.DEEPSLATE_DIAMOND_ORE); + + public ChestedDiamondPick() { + super(NAME, MATERIAL, DEFAULT_TITLE); + } + + public static String getItemName() { + return NAME; + } + + @EventHandler + private void onBlockRightClick(PlayerInteractEvent evt) { + if (evt.getAction() != Action.RIGHT_CLICK_BLOCK || !this.isThisItem(evt.getItem())) return; + Block block = evt.getClickedBlock(); + if (block != null && BLOCK_TYPES.contains(block.getType())) + new OreChestGUI(block, evt.getPlayer()); + else + evt.getPlayer().getWorld().playSound(evt.getClickedBlock().getLocation(), Sound.BLOCK_CHEST_LOCKED, 1F, 1.2F); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedEmeraldPick.java b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedEmeraldPick.java new file mode 100644 index 0000000..066b3ed --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedEmeraldPick.java @@ -0,0 +1,38 @@ +package ru.erius.orechest.items.pickaxes; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.orechest.guis.OreChestGUI; + +import java.util.List; + +public class ChestedEmeraldPick extends CustomItem { + + private final static String NAME = "chested_emerald_pickaxe"; + private final static Material MATERIAL = Material.DIAMOND_PICKAXE; + private final static String DEFAULT_TITLE = "Chested emerald pickaxe"; + private final static List BLOCK_TYPES = List.of(Material.EMERALD_ORE, Material.DEEPSLATE_EMERALD_ORE); + + public ChestedEmeraldPick() { + super(NAME, MATERIAL, DEFAULT_TITLE); + } + + public static String getItemName() { + return NAME; + } + + @EventHandler + private void onBlockRightClick(PlayerInteractEvent evt) { + if (evt.getAction() != Action.RIGHT_CLICK_BLOCK || !this.isThisItem(evt.getItem())) return; + Block block = evt.getClickedBlock(); + if (block != null && BLOCK_TYPES.contains(block.getType())) + new OreChestGUI(block, evt.getPlayer()); + else + evt.getPlayer().getWorld().playSound(evt.getClickedBlock().getLocation(), Sound.BLOCK_CHEST_LOCKED, 1F, 1.2F); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedGoldenPick.java b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedGoldenPick.java new file mode 100644 index 0000000..c2f9a67 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedGoldenPick.java @@ -0,0 +1,38 @@ +package ru.erius.orechest.items.pickaxes; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.orechest.guis.OreChestGUI; + +import java.util.List; + +public class ChestedGoldenPick extends CustomItem { + + private final static String NAME = "chested_golden_pickaxe"; + private final static Material MATERIAL = Material.GOLDEN_PICKAXE; + private final static String DEFAULT_TITLE = "Chested golden pickaxe"; + private final static List BLOCK_TYPES = List.of(Material.GOLD_ORE, Material.DEEPSLATE_GOLD_ORE, Material.NETHER_GOLD_ORE); + + public ChestedGoldenPick() { + super(NAME, MATERIAL, DEFAULT_TITLE); + } + + public static String getItemName() { + return NAME; + } + + @EventHandler + private void onBlockRightClick(PlayerInteractEvent evt) { + if (evt.getAction() != Action.RIGHT_CLICK_BLOCK || !this.isThisItem(evt.getItem())) return; + Block block = evt.getClickedBlock(); + if (block != null && BLOCK_TYPES.contains(block.getType())) + new OreChestGUI(block, evt.getPlayer()); + else + evt.getPlayer().getWorld().playSound(evt.getClickedBlock().getLocation(), Sound.BLOCK_CHEST_LOCKED, 1F, 1.2F); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedIronPick.java b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedIronPick.java new file mode 100644 index 0000000..17880e3 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedIronPick.java @@ -0,0 +1,38 @@ +package ru.erius.orechest.items.pickaxes; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.orechest.guis.OreChestGUI; + +import java.util.List; + +public class ChestedIronPick extends CustomItem { + + private final static String NAME = "chested_iron_pickaxe"; + private final static Material MATERIAL = Material.IRON_PICKAXE; + private final static String DEFAULT_TITLE = "Chested iron pickaxe"; + private final static List BLOCK_TYPES = List.of(Material.IRON_ORE, Material.DEEPSLATE_IRON_ORE); + + public ChestedIronPick() { + super(NAME, MATERIAL, DEFAULT_TITLE); + } + + public static String getItemName() { + return NAME; + } + + @EventHandler + private void onBlockRightClick(PlayerInteractEvent evt) { + if (evt.getAction() != Action.RIGHT_CLICK_BLOCK || !this.isThisItem(evt.getItem())) return; + Block block = evt.getClickedBlock(); + if (block != null && BLOCK_TYPES.contains(block.getType())) + new OreChestGUI(block, evt.getPlayer()); + else + evt.getPlayer().getWorld().playSound(evt.getClickedBlock().getLocation(), Sound.BLOCK_CHEST_LOCKED, 1F, 1.2F); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedLapisPick.java b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedLapisPick.java new file mode 100644 index 0000000..e18db89 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedLapisPick.java @@ -0,0 +1,38 @@ +package ru.erius.orechest.items.pickaxes; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.orechest.guis.OreChestGUI; + +import java.util.List; + +public class ChestedLapisPick extends CustomItem { + + private final static String NAME = "chested_lapis_pickaxe"; + private final static Material MATERIAL = Material.STONE_PICKAXE; + private final static String DEFAULT_TITLE = "Chested lapis pickaxe"; + private final static List BLOCK_TYPES = List.of(Material.LAPIS_ORE, Material.DEEPSLATE_LAPIS_ORE); + + public ChestedLapisPick() { + super(NAME, MATERIAL, DEFAULT_TITLE); + } + + public static String getItemName() { + return NAME; + } + + @EventHandler + private void onBlockRightClick(PlayerInteractEvent evt) { + if (evt.getAction() != Action.RIGHT_CLICK_BLOCK || !this.isThisItem(evt.getItem())) return; + Block block = evt.getClickedBlock(); + if (block != null && BLOCK_TYPES.contains(block.getType())) + new OreChestGUI(block, evt.getPlayer()); + else + evt.getPlayer().getWorld().playSound(evt.getClickedBlock().getLocation(), Sound.BLOCK_CHEST_LOCKED, 1F, 1.2F); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedNetheritePick.java b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedNetheritePick.java new file mode 100644 index 0000000..9003870 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedNetheritePick.java @@ -0,0 +1,38 @@ +package ru.erius.orechest.items.pickaxes; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.orechest.guis.OreChestGUI; + +import java.util.List; + +public class ChestedNetheritePick extends CustomItem { + + private final static String NAME = "chested_netherite_pickaxe"; + private final static Material MATERIAL = Material.NETHERITE_PICKAXE; + private final static String DEFAULT_TITLE = "Chested netherite pickaxe"; + private final static List BLOCK_TYPES = List.of(Material.ANCIENT_DEBRIS); + + public ChestedNetheritePick() { + super(NAME, MATERIAL, DEFAULT_TITLE); + } + + public static String getItemName() { + return NAME; + } + + @EventHandler + private void onBlockRightClick(PlayerInteractEvent evt) { + if (evt.getAction() != Action.RIGHT_CLICK_BLOCK || !this.isThisItem(evt.getItem())) return; + Block block = evt.getClickedBlock(); + if (block != null && BLOCK_TYPES.contains(block.getType())) + new OreChestGUI(block, evt.getPlayer()); + else + evt.getPlayer().getWorld().playSound(evt.getClickedBlock().getLocation(), Sound.BLOCK_CHEST_LOCKED, 1F, 1.2F); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedQuartzPick.java b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedQuartzPick.java new file mode 100644 index 0000000..059532b --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedQuartzPick.java @@ -0,0 +1,38 @@ +package ru.erius.orechest.items.pickaxes; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.orechest.guis.OreChestGUI; + +import java.util.List; + +public class ChestedQuartzPick extends CustomItem { + + private final static String NAME = "chested_quartz_pickaxe"; + private final static Material MATERIAL = Material.WOODEN_PICKAXE; + private final static String DEFAULT_TITLE = "Chested quartz pickaxe"; + private final static List BLOCK_TYPES = List.of(Material.NETHER_QUARTZ_ORE); + + public ChestedQuartzPick() { + super(NAME, MATERIAL, DEFAULT_TITLE); + } + + public static String getItemName() { + return NAME; + } + + @EventHandler + private void onBlockRightClick(PlayerInteractEvent evt) { + if (evt.getAction() != Action.RIGHT_CLICK_BLOCK || !this.isThisItem(evt.getItem())) return; + Block block = evt.getClickedBlock(); + if (block != null && BLOCK_TYPES.contains(block.getType())) + new OreChestGUI(block, evt.getPlayer()); + else + evt.getPlayer().getWorld().playSound(evt.getClickedBlock().getLocation(), Sound.BLOCK_CHEST_LOCKED, 1F, 1.2F); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedRedstonePick.java b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedRedstonePick.java new file mode 100644 index 0000000..eb60f77 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/items/pickaxes/ChestedRedstonePick.java @@ -0,0 +1,38 @@ +package ru.erius.orechest.items.pickaxes; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.orechest.guis.OreChestGUI; + +import java.util.List; + +public class ChestedRedstonePick extends CustomItem { + + private final static String NAME = "chested_redstone_pickaxe"; + private final static Material MATERIAL = Material.IRON_PICKAXE; + private final static String DEFAULT_TITLE = "Chested redstone pickaxe"; + private final static List BLOCK_TYPES = List.of(Material.REDSTONE_ORE, Material.DEEPSLATE_REDSTONE_ORE); + + public ChestedRedstonePick() { + super(NAME, MATERIAL, DEFAULT_TITLE); + } + + public static String getItemName() { + return NAME; + } + + @EventHandler + private void onBlockRightClick(PlayerInteractEvent evt) { + if (evt.getAction() != Action.RIGHT_CLICK_BLOCK || !this.isThisItem(evt.getItem())) return; + Block block = evt.getClickedBlock(); + if (block != null && BLOCK_TYPES.contains(block.getType())) + new OreChestGUI(block, evt.getPlayer()); + else + evt.getPlayer().getWorld().playSound(evt.getClickedBlock().getLocation(), Sound.BLOCK_CHEST_LOCKED, 1F, 1.2F); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/quests/CraftChestedCoalPickQuest.java b/OreChest/src/main/java/ru/erius/orechest/quests/CraftChestedCoalPickQuest.java new file mode 100644 index 0000000..2791106 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/quests/CraftChestedCoalPickQuest.java @@ -0,0 +1,32 @@ +package ru.erius.orechest.quests; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.CraftItemEvent; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.orechest.items.pickaxes.ChestedCoalPick; + +public class CraftChestedCoalPickQuest extends CustomQuest { + + private final static String NAME = "craft_chested_coal_pick"; + private final static String DEFAULT_QUEST_NAME = ChatColor.GOLD + "Get a chested coal pickaxe"; + private final static String DEFAULT_DESCRIPTION = ChatColor.AQUA + "Craft a chested coal pickaxe out of coal, sticks and chest"; + private final static String DEFAULT_TITLE = ChatColor.GREEN + "Quest Completed"; + private final static String DEFAULT_SUBTITLE = ChatColor.GOLD + "New recipes unlocked"; + + public CraftChestedCoalPickQuest() { + super(NAME, DEFAULT_QUEST_NAME, DEFAULT_DESCRIPTION, DEFAULT_TITLE, DEFAULT_SUBTITLE); + } + + @EventHandler + private void progressQuest(CraftItemEvent evt) { + if (Registry.ItemsRegistry.getCustomItem(ChestedCoalPick.getItemName()).isThisItem(evt.getRecipe().getResult())) + this.onCompletion((Player) evt.getWhoClicked()); + } + + public static String getQuestsName() { + return NAME; + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/quests/CraftChestedDiamondPickQuest.java b/OreChest/src/main/java/ru/erius/orechest/quests/CraftChestedDiamondPickQuest.java new file mode 100644 index 0000000..6020cac --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/quests/CraftChestedDiamondPickQuest.java @@ -0,0 +1,32 @@ +package ru.erius.orechest.quests; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.CraftItemEvent; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.orechest.items.pickaxes.ChestedDiamondPick; + +public class CraftChestedDiamondPickQuest extends CustomQuest { + + private final static String NAME = "craft_chested_diamond_pick"; + private final static String DEFAULT_QUEST_NAME = ChatColor.GOLD + "Get a chested diamond pickaxe"; + private final static String DEFAULT_DESCRIPTION = ChatColor.AQUA + "Craft a chested diamond pickaxe out of diamonds, sticks and chest"; + private final static String DEFAULT_TITLE = ChatColor.GREEN + "Quest Completed"; + private final static String DEFAULT_SUBTITLE = ChatColor.GOLD + "New recipes unlocked"; + + public CraftChestedDiamondPickQuest() { + super(NAME, DEFAULT_QUEST_NAME, DEFAULT_DESCRIPTION, DEFAULT_TITLE, DEFAULT_SUBTITLE); + } + + @EventHandler + private void progressQuest(CraftItemEvent evt) { + if (Registry.ItemsRegistry.getCustomItem(ChestedDiamondPick.getItemName()).isThisItem(evt.getRecipe().getResult())) + this.onCompletion((Player) evt.getWhoClicked()); + } + + public static String getQuestsName() { + return NAME; + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/quests/CraftChestedIronPickQuest.java b/OreChest/src/main/java/ru/erius/orechest/quests/CraftChestedIronPickQuest.java new file mode 100644 index 0000000..c89593d --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/quests/CraftChestedIronPickQuest.java @@ -0,0 +1,32 @@ +package ru.erius.orechest.quests; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.CraftItemEvent; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.orechest.items.pickaxes.ChestedIronPick; + +public class CraftChestedIronPickQuest extends CustomQuest { + + private final static String NAME = "craft_chested_iron_pick"; + private final static String DEFAULT_QUEST_NAME = ChatColor.GOLD + "Get a chested iron pickaxe"; + private final static String DEFAULT_DESCRIPTION = ChatColor.AQUA + "Craft a chested coal pickaxe out of iron, sticks and chest"; + private final static String DEFAULT_TITLE = ChatColor.GREEN + "Quest Completed"; + private final static String DEFAULT_SUBTITLE = ChatColor.GOLD + "New recipes unlocked"; + + public CraftChestedIronPickQuest() { + super(NAME, DEFAULT_QUEST_NAME, DEFAULT_DESCRIPTION, DEFAULT_TITLE, DEFAULT_SUBTITLE); + } + + @EventHandler + private void progressQuest(CraftItemEvent evt) { + if (Registry.ItemsRegistry.getCustomItem(ChestedIronPick.getItemName()).isThisItem(evt.getRecipe().getResult())) + this.onCompletion((Player) evt.getWhoClicked()); + } + + public static String getQuestsName() { + return NAME; + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedCoalPickRecipe.java b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedCoalPickRecipe.java new file mode 100644 index 0000000..b3941e2 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedCoalPickRecipe.java @@ -0,0 +1,34 @@ +package ru.erius.orechest.recipes; + +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.RecipeChoice; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.eriuslib.recipes.shaped.CustomShapedRecipe; +import ru.erius.orechest.OreChest; + +import java.util.Map; + +public class ChestedCoalPickRecipe extends CustomShapedRecipe { + + private final static NamespacedKey KEY = new NamespacedKey(OreChest.getInstance(), "chested_coal_pickaxe"); + private final static CustomItem RESULT = Registry.ItemsRegistry.getCustomItem("chested_coal_pickaxe"); + private final static String[] SHAPE = { + "ABA", + "CDC", + "_D_" + }; + private final static Map MAP = Map.of( + 'A', new RecipeChoice.MaterialChoice(Material.COAL_BLOCK), + 'B', new RecipeChoice.MaterialChoice(Material.CHEST), + 'C', new RecipeChoice.MaterialChoice(Material.COAL), + 'D', new RecipeChoice.MaterialChoice(Material.STICK) + ); + private final static CustomQuest QUEST = null; + + public ChestedCoalPickRecipe() { + super(KEY, RESULT, SHAPE, MAP, QUEST); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedCopperPickRecipe.java b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedCopperPickRecipe.java new file mode 100644 index 0000000..5ff8d10 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedCopperPickRecipe.java @@ -0,0 +1,35 @@ +package ru.erius.orechest.recipes; + +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.RecipeChoice; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.eriuslib.recipes.shaped.CustomShapedRecipe; +import ru.erius.orechest.OreChest; +import ru.erius.orechest.quests.CraftChestedCoalPickQuest; + +import java.util.Map; + +public class ChestedCopperPickRecipe extends CustomShapedRecipe { + + private final static NamespacedKey KEY = new NamespacedKey(OreChest.getInstance(), "chested_copper_pickaxe"); + private final static CustomItem RESULT = Registry.ItemsRegistry.getCustomItem("chested_copper_pickaxe"); + private final static String[] SHAPE = { + "ABA", + "CDC", + "_D_" + }; + private final static Map MAP = Map.of( + 'A', new RecipeChoice.MaterialChoice(Material.COPPER_BLOCK), + 'B', new RecipeChoice.MaterialChoice(Material.CHEST), + 'C', new RecipeChoice.MaterialChoice(Material.COPPER_INGOT), + 'D', new RecipeChoice.MaterialChoice(Material.STICK) + ); + private final static CustomQuest QUEST = Registry.QuestsRegistry.getCustomQuest(CraftChestedCoalPickQuest.getQuestsName()); + + public ChestedCopperPickRecipe() { + super(KEY, RESULT, SHAPE, MAP, QUEST); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedDiamondPickRecipe.java b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedDiamondPickRecipe.java new file mode 100644 index 0000000..ca6d533 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedDiamondPickRecipe.java @@ -0,0 +1,35 @@ +package ru.erius.orechest.recipes; + +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.RecipeChoice; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.eriuslib.recipes.shaped.CustomShapedRecipe; +import ru.erius.orechest.OreChest; +import ru.erius.orechest.quests.CraftChestedIronPickQuest; + +import java.util.Map; + +public class ChestedDiamondPickRecipe extends CustomShapedRecipe { + + private final static NamespacedKey KEY = new NamespacedKey(OreChest.getInstance(), "chested_diamond_pickaxe"); + private final static CustomItem RESULT = Registry.ItemsRegistry.getCustomItem("chested_diamond_pickaxe"); + private final static String[] SHAPE = { + "ABA", + "CDC", + "_D_" + }; + private final static Map MAP = Map.of( + 'A', new RecipeChoice.MaterialChoice(Material.DIAMOND_BLOCK), + 'B', new RecipeChoice.MaterialChoice(Material.CHEST), + 'C', new RecipeChoice.MaterialChoice(Material.DIAMOND), + 'D', new RecipeChoice.MaterialChoice(Material.STICK) + ); + private final static CustomQuest QUEST = Registry.QuestsRegistry.getCustomQuest(CraftChestedIronPickQuest.getQuestsName()); + + public ChestedDiamondPickRecipe() { + super(KEY, RESULT, SHAPE, MAP, QUEST); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedEmeraldPickRecipe.java b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedEmeraldPickRecipe.java new file mode 100644 index 0000000..33fda3a --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedEmeraldPickRecipe.java @@ -0,0 +1,35 @@ +package ru.erius.orechest.recipes; + +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.RecipeChoice; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.eriuslib.recipes.shaped.CustomShapedRecipe; +import ru.erius.orechest.OreChest; +import ru.erius.orechest.quests.CraftChestedIronPickQuest; + +import java.util.Map; + +public class ChestedEmeraldPickRecipe extends CustomShapedRecipe { + + private final static NamespacedKey KEY = new NamespacedKey(OreChest.getInstance(), "chested_emerald_pickaxe"); + private final static CustomItem RESULT = Registry.ItemsRegistry.getCustomItem("chested_emerald_pickaxe"); + private final static String[] SHAPE = { + "ABA", + "CDC", + "_D_" + }; + private final static Map MAP = Map.of( + 'A', new RecipeChoice.MaterialChoice(Material.EMERALD_BLOCK), + 'B', new RecipeChoice.MaterialChoice(Material.CHEST), + 'C', new RecipeChoice.MaterialChoice(Material.EMERALD), + 'D', new RecipeChoice.MaterialChoice(Material.STICK) + ); + private final static CustomQuest QUEST = Registry.QuestsRegistry.getCustomQuest(CraftChestedIronPickQuest.getQuestsName()); + + public ChestedEmeraldPickRecipe() { + super(KEY, RESULT, SHAPE, MAP, QUEST); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedGoldenPickRecipe.java b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedGoldenPickRecipe.java new file mode 100644 index 0000000..e1ad40a --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedGoldenPickRecipe.java @@ -0,0 +1,35 @@ +package ru.erius.orechest.recipes; + +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.RecipeChoice; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.eriuslib.recipes.shaped.CustomShapedRecipe; +import ru.erius.orechest.OreChest; +import ru.erius.orechest.quests.CraftChestedIronPickQuest; + +import java.util.Map; + +public class ChestedGoldenPickRecipe extends CustomShapedRecipe { + + private final static NamespacedKey KEY = new NamespacedKey(OreChest.getInstance(), "chested_golden_pickaxe"); + private final static CustomItem RESULT = Registry.ItemsRegistry.getCustomItem("chested_golden_pickaxe"); + private final static String[] SHAPE = { + "ABA", + "CDC", + "_D_" + }; + private final static Map MAP = Map.of( + 'A', new RecipeChoice.MaterialChoice(Material.GOLD_BLOCK), + 'B', new RecipeChoice.MaterialChoice(Material.CHEST), + 'C', new RecipeChoice.MaterialChoice(Material.GOLD_INGOT), + 'D', new RecipeChoice.MaterialChoice(Material.STICK) + ); + private final static CustomQuest QUEST = Registry.QuestsRegistry.getCustomQuest(CraftChestedIronPickQuest.getQuestsName()); + + public ChestedGoldenPickRecipe() { + super(KEY, RESULT, SHAPE, MAP, QUEST); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedIronPickRecipe.java b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedIronPickRecipe.java new file mode 100644 index 0000000..6ed8246 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedIronPickRecipe.java @@ -0,0 +1,35 @@ +package ru.erius.orechest.recipes; + +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.RecipeChoice; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.eriuslib.recipes.shaped.CustomShapedRecipe; +import ru.erius.orechest.OreChest; +import ru.erius.orechest.quests.CraftChestedCoalPickQuest; + +import java.util.Map; + +public class ChestedIronPickRecipe extends CustomShapedRecipe { + + private final static NamespacedKey KEY = new NamespacedKey(OreChest.getInstance(), "chested_iron_pickaxe"); + private final static CustomItem RESULT = Registry.ItemsRegistry.getCustomItem("chested_iron_pickaxe"); + private final static String[] SHAPE = { + "ABA", + "CDC", + "_D_" + }; + private final static Map MAP = Map.of( + 'A', new RecipeChoice.MaterialChoice(Material.IRON_BLOCK), + 'B', new RecipeChoice.MaterialChoice(Material.CHEST), + 'C', new RecipeChoice.MaterialChoice(Material.IRON_INGOT), + 'D', new RecipeChoice.MaterialChoice(Material.STICK) + ); + private final static CustomQuest QUEST = Registry.QuestsRegistry.getCustomQuest(CraftChestedCoalPickQuest.getQuestsName()); + + public ChestedIronPickRecipe() { + super(KEY, RESULT, SHAPE, MAP, QUEST); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedLapisPickRecipe.java b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedLapisPickRecipe.java new file mode 100644 index 0000000..dbb0a9b --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedLapisPickRecipe.java @@ -0,0 +1,35 @@ +package ru.erius.orechest.recipes; + +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.RecipeChoice; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.eriuslib.recipes.shaped.CustomShapedRecipe; +import ru.erius.orechest.OreChest; +import ru.erius.orechest.quests.CraftChestedIronPickQuest; + +import java.util.Map; + +public class ChestedLapisPickRecipe extends CustomShapedRecipe { + + private final static NamespacedKey KEY = new NamespacedKey(OreChest.getInstance(), "chested_lapis_pickaxe"); + private final static CustomItem RESULT = Registry.ItemsRegistry.getCustomItem("chested_lapis_pickaxe"); + private final static String[] SHAPE = { + "ABA", + "CDC", + "_D_" + }; + private final static Map MAP = Map.of( + 'A', new RecipeChoice.MaterialChoice(Material.LAPIS_BLOCK), + 'B', new RecipeChoice.MaterialChoice(Material.CHEST), + 'C', new RecipeChoice.MaterialChoice(Material.LAPIS_LAZULI), + 'D', new RecipeChoice.MaterialChoice(Material.STICK) + ); + private final static CustomQuest QUEST = Registry.QuestsRegistry.getCustomQuest(CraftChestedIronPickQuest.getQuestsName()); + + public ChestedLapisPickRecipe() { + super(KEY, RESULT, SHAPE, MAP, QUEST); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedNetheritePickRecipe.java b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedNetheritePickRecipe.java new file mode 100644 index 0000000..30ab34c --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedNetheritePickRecipe.java @@ -0,0 +1,35 @@ +package ru.erius.orechest.recipes; + +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.RecipeChoice; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.eriuslib.recipes.shaped.CustomShapedRecipe; +import ru.erius.orechest.OreChest; +import ru.erius.orechest.quests.CraftChestedDiamondPickQuest; + +import java.util.Map; + +public class ChestedNetheritePickRecipe extends CustomShapedRecipe { + + private final static NamespacedKey KEY = new NamespacedKey(OreChest.getInstance(), "chested_netherite_pickaxe"); + private final static CustomItem RESULT = Registry.ItemsRegistry.getCustomItem("chested_netherite_pickaxe"); + private final static String[] SHAPE = { + "ABA", + "CDC", + "_D_" + }; + private final static Map MAP = Map.of( + 'A', new RecipeChoice.MaterialChoice(Material.NETHERITE_BLOCK), + 'B', new RecipeChoice.MaterialChoice(Material.CHEST), + 'C', new RecipeChoice.MaterialChoice(Material.NETHERITE_INGOT), + 'D', new RecipeChoice.MaterialChoice(Material.STICK) + ); + private final static CustomQuest QUEST = Registry.QuestsRegistry.getCustomQuest(CraftChestedDiamondPickQuest.getQuestsName()); + + public ChestedNetheritePickRecipe() { + super(KEY, RESULT, SHAPE, MAP, QUEST); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedQuartzPickRecipe.java b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedQuartzPickRecipe.java new file mode 100644 index 0000000..c9c38c4 --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedQuartzPickRecipe.java @@ -0,0 +1,34 @@ +package ru.erius.orechest.recipes; + +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.RecipeChoice; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.eriuslib.recipes.shaped.CustomShapedRecipe; +import ru.erius.orechest.OreChest; + +import java.util.Map; + +public class ChestedQuartzPickRecipe extends CustomShapedRecipe { + + private final static NamespacedKey KEY = new NamespacedKey(OreChest.getInstance(), "chested_quartz_pickaxe"); + private final static CustomItem RESULT = Registry.ItemsRegistry.getCustomItem("chested_quartz_pickaxe"); + private final static String[] SHAPE = { + "ABA", + "CDC", + "_D_" + }; + private final static Map MAP = Map.of( + 'A', new RecipeChoice.MaterialChoice(Material.QUARTZ_BLOCK), + 'B', new RecipeChoice.MaterialChoice(Material.CHEST), + 'C', new RecipeChoice.MaterialChoice(Material.QUARTZ), + 'D', new RecipeChoice.MaterialChoice(Material.STICK) + ); + private final static CustomQuest QUEST = null; + + public ChestedQuartzPickRecipe() { + super(KEY, RESULT, SHAPE, MAP, QUEST); + } +} diff --git a/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedRedstonePickRecipe.java b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedRedstonePickRecipe.java new file mode 100644 index 0000000..92caafb --- /dev/null +++ b/OreChest/src/main/java/ru/erius/orechest/recipes/ChestedRedstonePickRecipe.java @@ -0,0 +1,35 @@ +package ru.erius.orechest.recipes; + +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.RecipeChoice; +import ru.erius.eriuslib.Registry; +import ru.erius.eriuslib.items.CustomItem; +import ru.erius.eriuslib.quests.CustomQuest; +import ru.erius.eriuslib.recipes.shaped.CustomShapedRecipe; +import ru.erius.orechest.OreChest; +import ru.erius.orechest.quests.CraftChestedIronPickQuest; + +import java.util.Map; + +public class ChestedRedstonePickRecipe extends CustomShapedRecipe { + + private final static NamespacedKey KEY = new NamespacedKey(OreChest.getInstance(), "chested_redstone_pickaxe"); + private final static CustomItem RESULT = Registry.ItemsRegistry.getCustomItem("chested_redstone_pickaxe"); + private final static String[] SHAPE = { + "ABA", + "CDC", + "_D_" + }; + private final static Map MAP = Map.of( + 'A', new RecipeChoice.MaterialChoice(Material.REDSTONE_BLOCK), + 'B', new RecipeChoice.MaterialChoice(Material.CHEST), + 'C', new RecipeChoice.MaterialChoice(Material.REDSTONE), + 'D', new RecipeChoice.MaterialChoice(Material.STICK) + ); + private final static CustomQuest QUEST = Registry.QuestsRegistry.getCustomQuest(CraftChestedIronPickQuest.getQuestsName()); + + public ChestedRedstonePickRecipe() { + super(KEY, RESULT, SHAPE, MAP, QUEST); + } +} diff --git a/OreChest/src/main/resources/config.yml b/OreChest/src/main/resources/config.yml new file mode 100644 index 0000000..91c77a9 --- /dev/null +++ b/OreChest/src/main/resources/config.yml @@ -0,0 +1,3 @@ +# Configuration file for OreChest plugin + +do_player_placed_ores_have_loot: false diff --git a/OreChest/src/main/resources/plugin.yml b/OreChest/src/main/resources/plugin.yml new file mode 100644 index 0000000..933107b --- /dev/null +++ b/OreChest/src/main/resources/plugin.yml @@ -0,0 +1,7 @@ +name: OreChest +version: @version@ +main: ru.erius.orechest.OreChest +api-version: 1.17 +depend: [ EriusLib ] +authors: [ erius ] +description: turns ore into chests diff --git a/SharedHealth/.gitignore b/SharedHealth/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/SharedHealth/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/SharedHealth/build.gradle b/SharedHealth/build.gradle new file mode 100644 index 0000000..59f6542 --- /dev/null +++ b/SharedHealth/build.gradle @@ -0,0 +1,45 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius' +version = '1.0-SNAPSHOT' +def serverPath = 'C:/mc_servers/1.17.1/plugins' +def EriusLibPath = 'D:/mc_plugins/EriusLib/build/libs' + +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +repositories { + mavenCentral() + maven { + name = 'spigotmc-repo' + url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' + compileOnly fileTree(dir: EriusLibPath, include: '*.jar') +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +build { + doLast { + copy { + from libsDir + into serverPath + } + } +} diff --git a/SharedHealth/gradle.properties b/SharedHealth/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/SharedHealth/gradle/wrapper/gradle-wrapper.jar b/SharedHealth/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/SharedHealth/gradle/wrapper/gradle-wrapper.jar differ diff --git a/SharedHealth/gradle/wrapper/gradle-wrapper.properties b/SharedHealth/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b5f89 --- /dev/null +++ b/SharedHealth/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/SharedHealth/gradlew b/SharedHealth/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/SharedHealth/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/SharedHealth/gradlew.bat b/SharedHealth/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/SharedHealth/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/SharedHealth/settings.gradle b/SharedHealth/settings.gradle new file mode 100644 index 0000000..ea54fe1 --- /dev/null +++ b/SharedHealth/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'SharedHealth' diff --git a/SharedHealth/src/main/java/ru/erius/sharedhealth/PlayersHealthPool.java b/SharedHealth/src/main/java/ru/erius/sharedhealth/PlayersHealthPool.java new file mode 100644 index 0000000..7c23740 --- /dev/null +++ b/SharedHealth/src/main/java/ru/erius/sharedhealth/PlayersHealthPool.java @@ -0,0 +1,98 @@ +package ru.erius.sharedhealth; + +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityPotionEffectEvent; +import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import java.util.ArrayList; +import java.util.List; + +public class PlayersHealthPool implements Listener { + + private final static List ALL_LINKED_PLAYERS = new ArrayList<>(); + private final static List ALL_INSTANCES = new ArrayList<>(); + + private final List players = new ArrayList<>(); + private double health = 20D; + + public PlayersHealthPool(List players) { + for (Player player : players) + if (ALL_LINKED_PLAYERS.contains(player)) + throw new IllegalArgumentException("Player " + player.getName() + " is already linked"); + ALL_LINKED_PLAYERS.addAll(players); + this.players.addAll(players); + this.players.forEach(p -> { + p.setHealth(health); + p.setFoodLevel(20); + }); + } + + @EventHandler + private void onPlayerHurt(EntityDamageEvent evt) { + if (!(evt.getEntity() instanceof Player)) + return; + Player player = (Player) evt.getEntity(); + if (!players.contains(player)) + return; + health -= evt.getDamage(); + if (health <= 0) { + players.forEach(p -> { + if (p != player) + p.setHealth(0); + Bukkit.getScheduler().runTaskLater(SharedHealth.getInstance(), () -> + p.spigot().respawn(), 1); + }); + health = 20; + } else { + players.forEach(p -> { + if (p != player) { + p.playSound(p.getEyeLocation(), Sound.ENTITY_PLAYER_HURT, 1, 1); + p.setHealth(health); + } + }); + } + } + + @EventHandler + private void onPlayerHeal(EntityRegainHealthEvent evt) { + if (!(evt.getEntity() instanceof Player)) + return; + Player player = (Player) evt.getEntity(); + if (!players.contains(player)) + return; + health = Math.min(health + evt.getAmount(), 20); + players.forEach(p -> { + if (p != player) + p.setHealth(health); + }); + } + + @EventHandler + private void onPlayerAbsorption(EntityPotionEffectEvent evt) { + if (!(evt.getNewEffect() == null || evt.getCause() == EntityPotionEffectEvent.Cause.PLUGIN)) { + PotionEffect effect = evt.getNewEffect(); + if (evt.getEntity() instanceof Player && effect.getType().equals(PotionEffectType.ABSORPTION)) { + Player player = (Player) evt.getEntity(); + players.forEach(p -> { + if (p != player && !player.hasPotionEffect(PotionEffectType.ABSORPTION)) + p.addPotionEffect(effect); + }); + } + } + } + + public static List getAllInstances() { + return ALL_INSTANCES; + } + + public static List getAllLinkedPlayers() { + return ALL_LINKED_PLAYERS; + } +} diff --git a/SharedHealth/src/main/java/ru/erius/sharedhealth/SharedHealth.java b/SharedHealth/src/main/java/ru/erius/sharedhealth/SharedHealth.java new file mode 100644 index 0000000..ac2d553 --- /dev/null +++ b/SharedHealth/src/main/java/ru/erius/sharedhealth/SharedHealth.java @@ -0,0 +1,34 @@ +package ru.erius.sharedhealth; + +import org.bukkit.plugin.java.JavaPlugin; +import ru.erius.eriuslib.commands.MyCommand; +import ru.erius.sharedhealth.commands.Link; +import ru.erius.sharedhealth.commands.Unlink; + +import java.util.Set; + +public final class SharedHealth extends JavaPlugin { + + private static SharedHealth instance; + + private final static Set> commands = Set.of(Link.class, Unlink.class); + + { + instance = this; + } + + @Override + public void onEnable() { + MyCommand.initCommands(this, commands); + getLogger().info(getName() + " enabled"); + } + + @Override + public void onDisable() { + getLogger().info(getName() + " disabled"); + } + + public static SharedHealth getInstance() { + return instance; + } +} diff --git a/SharedHealth/src/main/java/ru/erius/sharedhealth/commands/Link.java b/SharedHealth/src/main/java/ru/erius/sharedhealth/commands/Link.java new file mode 100644 index 0000000..3e0a94b --- /dev/null +++ b/SharedHealth/src/main/java/ru/erius/sharedhealth/commands/Link.java @@ -0,0 +1,47 @@ +package ru.erius.sharedhealth.commands; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import ru.erius.eriuslib.commands.MyCommand; +import ru.erius.sharedhealth.PlayersHealthPool; +import ru.erius.sharedhealth.SharedHealth; + +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +public class Link extends MyCommand { + + private final static String NAME = "link"; + + public Link() { + super(NAME); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (args.length >= 2) { + List players = Arrays.stream(args) + .map(Bukkit::getPlayer) + .distinct() + .filter(Objects::nonNull) + .collect(Collectors.toList()); + if (players.size() < 2) + return false; + Bukkit.getServer().getPluginManager().registerEvents(new PlayersHealthPool(players), SharedHealth.getInstance()); + Bukkit.getLogger().info(sender.getName() + " executed the /" + NAME + " command"); + sender.sendMessage(ChatColor.GREEN + "Successfully linked the players"); + return true; + } else + return false; + } + + @Override + public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { + return null; + } +} diff --git a/SharedHealth/src/main/java/ru/erius/sharedhealth/commands/Unlink.java b/SharedHealth/src/main/java/ru/erius/sharedhealth/commands/Unlink.java new file mode 100644 index 0000000..1145003 --- /dev/null +++ b/SharedHealth/src/main/java/ru/erius/sharedhealth/commands/Unlink.java @@ -0,0 +1,34 @@ +package ru.erius.sharedhealth.commands; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.event.HandlerList; +import ru.erius.eriuslib.commands.MyCommand; +import ru.erius.sharedhealth.PlayersHealthPool; + +import java.util.List; + +public class Unlink extends MyCommand { + + private final static String NAME = "unlink"; + + public Unlink() { + super(NAME); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + PlayersHealthPool.getAllLinkedPlayers().clear(); + PlayersHealthPool.getAllInstances().forEach(HandlerList::unregisterAll); + Bukkit.getLogger().info(sender.getName() + " executed the /" + NAME + " command"); + sender.sendMessage(ChatColor.GREEN + "Successfully unlinked all players"); + return true; + } + + @Override + public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { + return null; + } +} diff --git a/SharedHealth/src/main/resources/plugin.yml b/SharedHealth/src/main/resources/plugin.yml new file mode 100644 index 0000000..76e1aba --- /dev/null +++ b/SharedHealth/src/main/resources/plugin.yml @@ -0,0 +1,17 @@ +name: SharedHealth +version: @version@ +main: ru.erius.sharedhealth.SharedHealth +api-version: 1.17 +authors: [ erius ] +depend: [ EriusLib ] +description: "allows for players to share their health" +website: https://vk.com/public206307891 +commands: + link: + description: "links two players health" + permission-message: "You do not have permission to use this command" + usage: "Wrong usage of command! Usage: / [player] [player]" + unlink: + description: "unlinks every players health" + permission-message: "You do not have permission to use this command" + usage: "Wrong usage of command! Usage: /" diff --git a/StuffTres/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock b/StuffTres/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000..c234a40 Binary files /dev/null and b/StuffTres/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock differ diff --git a/StuffTres/.gradle/7.1/dependencies-accessors/gc.properties b/StuffTres/.gradle/7.1/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/StuffTres/.gradle/7.1/executionHistory/executionHistory.bin b/StuffTres/.gradle/7.1/executionHistory/executionHistory.bin new file mode 100644 index 0000000..89bd895 Binary files /dev/null and b/StuffTres/.gradle/7.1/executionHistory/executionHistory.bin differ diff --git a/StuffTres/.gradle/7.1/executionHistory/executionHistory.lock b/StuffTres/.gradle/7.1/executionHistory/executionHistory.lock new file mode 100644 index 0000000..a4b6c1a Binary files /dev/null and b/StuffTres/.gradle/7.1/executionHistory/executionHistory.lock differ diff --git a/StuffTres/.gradle/7.1/fileChanges/last-build.bin b/StuffTres/.gradle/7.1/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/StuffTres/.gradle/7.1/fileChanges/last-build.bin differ diff --git a/StuffTres/.gradle/7.1/fileHashes/fileHashes.bin b/StuffTres/.gradle/7.1/fileHashes/fileHashes.bin new file mode 100644 index 0000000..f363a25 Binary files /dev/null and b/StuffTres/.gradle/7.1/fileHashes/fileHashes.bin differ diff --git a/StuffTres/.gradle/7.1/fileHashes/fileHashes.lock b/StuffTres/.gradle/7.1/fileHashes/fileHashes.lock new file mode 100644 index 0000000..7fbc05b Binary files /dev/null and b/StuffTres/.gradle/7.1/fileHashes/fileHashes.lock differ diff --git a/StuffTres/.gradle/7.1/gc.properties b/StuffTres/.gradle/7.1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/StuffTres/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock b/StuffTres/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000..0b3a6ee Binary files /dev/null and b/StuffTres/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock differ diff --git a/StuffTres/.gradle/7.2/dependencies-accessors/gc.properties b/StuffTres/.gradle/7.2/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/StuffTres/.gradle/7.2/executionHistory/executionHistory.bin b/StuffTres/.gradle/7.2/executionHistory/executionHistory.bin new file mode 100644 index 0000000..8e94957 Binary files /dev/null and b/StuffTres/.gradle/7.2/executionHistory/executionHistory.bin differ diff --git a/StuffTres/.gradle/7.2/executionHistory/executionHistory.lock b/StuffTres/.gradle/7.2/executionHistory/executionHistory.lock new file mode 100644 index 0000000..4a48558 Binary files /dev/null and b/StuffTres/.gradle/7.2/executionHistory/executionHistory.lock differ diff --git a/StuffTres/.gradle/7.2/fileChanges/last-build.bin b/StuffTres/.gradle/7.2/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/StuffTres/.gradle/7.2/fileChanges/last-build.bin differ diff --git a/StuffTres/.gradle/7.2/fileHashes/fileHashes.bin b/StuffTres/.gradle/7.2/fileHashes/fileHashes.bin new file mode 100644 index 0000000..93dcb14 Binary files /dev/null and b/StuffTres/.gradle/7.2/fileHashes/fileHashes.bin differ diff --git a/StuffTres/.gradle/7.2/fileHashes/fileHashes.lock b/StuffTres/.gradle/7.2/fileHashes/fileHashes.lock new file mode 100644 index 0000000..869e3b0 Binary files /dev/null and b/StuffTres/.gradle/7.2/fileHashes/fileHashes.lock differ diff --git a/StuffTres/.gradle/7.2/gc.properties b/StuffTres/.gradle/7.2/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/StuffTres/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/StuffTres/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..fb01be8 Binary files /dev/null and b/StuffTres/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/StuffTres/.gradle/buildOutputCleanup/cache.properties b/StuffTres/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..d3a8ab1 --- /dev/null +++ b/StuffTres/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Fri Feb 04 16:36:48 MSK 2022 +gradle.version=7.2 diff --git a/StuffTres/.gradle/buildOutputCleanup/outputFiles.bin b/StuffTres/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..591bf90 Binary files /dev/null and b/StuffTres/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/StuffTres/.gradle/checksums/checksums.lock b/StuffTres/.gradle/checksums/checksums.lock new file mode 100644 index 0000000..9de0af5 Binary files /dev/null and b/StuffTres/.gradle/checksums/checksums.lock differ diff --git a/StuffTres/.gradle/checksums/md5-checksums.bin b/StuffTres/.gradle/checksums/md5-checksums.bin new file mode 100644 index 0000000..004d204 Binary files /dev/null and b/StuffTres/.gradle/checksums/md5-checksums.bin differ diff --git a/StuffTres/.gradle/checksums/sha1-checksums.bin b/StuffTres/.gradle/checksums/sha1-checksums.bin new file mode 100644 index 0000000..8a28e59 Binary files /dev/null and b/StuffTres/.gradle/checksums/sha1-checksums.bin differ diff --git a/StuffTres/.gradle/vcs-1/gc.properties b/StuffTres/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/StuffTres/.idea/.gitignore b/StuffTres/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/StuffTres/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/StuffTres/.idea/compiler.xml b/StuffTres/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/StuffTres/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/StuffTres/.idea/gradle.xml b/StuffTres/.idea/gradle.xml new file mode 100644 index 0000000..611e7c8 --- /dev/null +++ b/StuffTres/.idea/gradle.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/StuffTres/.idea/jarRepositories.xml b/StuffTres/.idea/jarRepositories.xml new file mode 100644 index 0000000..ed1729d --- /dev/null +++ b/StuffTres/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/StuffTres/.idea/misc.xml b/StuffTres/.idea/misc.xml new file mode 100644 index 0000000..5ccf79a --- /dev/null +++ b/StuffTres/.idea/misc.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/StuffTres/.idea/modules/StuffTres.main.iml b/StuffTres/.idea/modules/StuffTres.main.iml new file mode 100644 index 0000000..fa63d4b --- /dev/null +++ b/StuffTres/.idea/modules/StuffTres.main.iml @@ -0,0 +1,12 @@ + + + + + + + SPIGOT + + + + + \ No newline at end of file diff --git a/StuffTres/build.gradle.kts b/StuffTres/build.gradle.kts new file mode 100644 index 0000000..6ea2013 --- /dev/null +++ b/StuffTres/build.gradle.kts @@ -0,0 +1,37 @@ +plugins { + kotlin("jvm") version "1.6.10" + java +} + +group = "ru.erius" +version = kotlin.coreLibrariesVersion +val serverPath = "C:/mc_servers/vanilla/plugins" +val mainClass = "$group.${name.toLowerCase()}.$name" + +repositories { + mavenCentral() + maven(url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/") + maven(url = "https://oss.sonatype.org/content/groups/public/") +} + +dependencies { + implementation(kotlin("stdlib")) + compileOnly("org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT") +} + +tasks.processResources { + expand("name" to project.name, "version" to version, "main" to mainClass) +} + +tasks.getByName("test") { + useJUnitPlatform() +} + +tasks.jar { + doLast { + copy { + from(destinationDirectory) + into(serverPath) + } + } +} \ No newline at end of file diff --git a/StuffTres/build/classes/kotlin/main/META-INF/StuffTres.kotlin_module b/StuffTres/build/classes/kotlin/main/META-INF/StuffTres.kotlin_module new file mode 100644 index 0000000..6dac5cf Binary files /dev/null and b/StuffTres/build/classes/kotlin/main/META-INF/StuffTres.kotlin_module differ diff --git a/StuffTres/build/classes/kotlin/main/ru/erius/stufftres/StuffKt.class b/StuffTres/build/classes/kotlin/main/ru/erius/stufftres/StuffKt.class new file mode 100644 index 0000000..75788f8 Binary files /dev/null and b/StuffTres/build/classes/kotlin/main/ru/erius/stufftres/StuffKt.class differ diff --git a/StuffTres/build/classes/kotlin/main/ru/erius/stufftres/StuffTres$Companion.class b/StuffTres/build/classes/kotlin/main/ru/erius/stufftres/StuffTres$Companion.class new file mode 100644 index 0000000..1741a4c Binary files /dev/null and b/StuffTres/build/classes/kotlin/main/ru/erius/stufftres/StuffTres$Companion.class differ diff --git a/StuffTres/build/classes/kotlin/main/ru/erius/stufftres/StuffTres.class b/StuffTres/build/classes/kotlin/main/ru/erius/stufftres/StuffTres.class new file mode 100644 index 0000000..80ab908 Binary files /dev/null and b/StuffTres/build/classes/kotlin/main/ru/erius/stufftres/StuffTres.class differ diff --git a/StuffTres/build/kotlin/StuffTres1610jar-classes.txt b/StuffTres/build/kotlin/StuffTres1610jar-classes.txt new file mode 100644 index 0000000..76a26bf --- /dev/null +++ b/StuffTres/build/kotlin/StuffTres1610jar-classes.txt @@ -0,0 +1 @@ +D:\stuff\mc_stuff\mc_plugins\StuffTres\build\classes\kotlin\main\ru\erius\stufftres\StuffKt.class;D:\stuff\mc_stuff\mc_plugins\StuffTres\build\classes\kotlin\main\ru\erius\stufftres\StuffTres$Companion.class;D:\stuff\mc_stuff\mc_plugins\StuffTres\build\classes\kotlin\main\ru\erius\stufftres\StuffTres.class \ No newline at end of file diff --git a/StuffTres/build/kotlin/compileKotlin/build-history.bin b/StuffTres/build/kotlin/compileKotlin/build-history.bin new file mode 100644 index 0000000..e7c4f8a Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/build-history.bin differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab new file mode 100644 index 0000000..7fedd70 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream new file mode 100644 index 0000000..e5f8b47 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len new file mode 100644 index 0000000..e5009a4 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len new file mode 100644 index 0000000..01bdaa1 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at new file mode 100644 index 0000000..ea81ac6 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i new file mode 100644 index 0000000..7a29d6d Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab new file mode 100644 index 0000000..89457dc Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream new file mode 100644 index 0000000..f7d3f8b Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len new file mode 100644 index 0000000..70ec52b Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len new file mode 100644 index 0000000..01bdaa1 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at new file mode 100644 index 0000000..8f28327 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i new file mode 100644 index 0000000..46880a3 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab new file mode 100644 index 0000000..a86f5db Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream new file mode 100644 index 0000000..f7d3f8b Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len new file mode 100644 index 0000000..70ec52b Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len new file mode 100644 index 0000000..01bdaa1 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at new file mode 100644 index 0000000..35f402f Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i new file mode 100644 index 0000000..46880a3 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab new file mode 100644 index 0000000..fc23269 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream new file mode 100644 index 0000000..a6b792f Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len new file mode 100644 index 0000000..1e42780 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len new file mode 100644 index 0000000..a9f80ae Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at new file mode 100644 index 0000000..369e6b7 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i new file mode 100644 index 0000000..c22fa44 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab new file mode 100644 index 0000000..bdf584a Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream new file mode 100644 index 0000000..5a39856 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len new file mode 100644 index 0000000..38069db Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.len new file mode 100644 index 0000000..2a17e6e Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.values.at b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.values.at new file mode 100644 index 0000000..46d6744 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.values.at differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i new file mode 100644 index 0000000..023a0d2 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab new file mode 100644 index 0000000..a0b8d1b Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream new file mode 100644 index 0000000..3a7c7c9 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len new file mode 100644 index 0000000..7ab8050 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len new file mode 100644 index 0000000..93a595b Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at new file mode 100644 index 0000000..ff10719 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i new file mode 100644 index 0000000..88ce376 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab new file mode 100644 index 0000000..f6bf42e Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream new file mode 100644 index 0000000..e5f8b47 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len new file mode 100644 index 0000000..e5009a4 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len new file mode 100644 index 0000000..01bdaa1 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at new file mode 100644 index 0000000..c33a4db Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i new file mode 100644 index 0000000..7a29d6d Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab new file mode 100644 index 0000000..1fc95d6 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream new file mode 100644 index 0000000..bfa5200 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len new file mode 100644 index 0000000..4b05c55 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len new file mode 100644 index 0000000..2a17e6e Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at new file mode 100644 index 0000000..7fc0402 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i new file mode 100644 index 0000000..8dde309 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab new file mode 100644 index 0000000..1d74806 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream new file mode 100644 index 0000000..c4c4195 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len new file mode 100644 index 0000000..a930d6b Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len new file mode 100644 index 0000000..2a17e6e Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at new file mode 100644 index 0000000..c814985 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i new file mode 100644 index 0000000..af54544 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab new file mode 100644 index 0000000..c393a51 --- /dev/null +++ b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab @@ -0,0 +1,2 @@ +3 +0 \ No newline at end of file diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab new file mode 100644 index 0000000..9cd0eb7 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream new file mode 100644 index 0000000..e5f8b47 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len new file mode 100644 index 0000000..e5009a4 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len new file mode 100644 index 0000000..01bdaa1 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at new file mode 100644 index 0000000..9f383b5 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i new file mode 100644 index 0000000..07abc96 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab new file mode 100644 index 0000000..195d3c4 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream new file mode 100644 index 0000000..636f34a Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len new file mode 100644 index 0000000..29ce11c Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len new file mode 100644 index 0000000..a9f80ae Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at new file mode 100644 index 0000000..a0891a6 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i new file mode 100644 index 0000000..e9905b3 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab new file mode 100644 index 0000000..da8cb94 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream new file mode 100644 index 0000000..9637583 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len new file mode 100644 index 0000000..7420fef Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len new file mode 100644 index 0000000..b31f54b Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at new file mode 100644 index 0000000..870ff62 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i new file mode 100644 index 0000000..ced1b18 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i differ diff --git a/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len differ diff --git a/StuffTres/build/kotlin/compileKotlin/last-build.bin b/StuffTres/build/kotlin/compileKotlin/last-build.bin new file mode 100644 index 0000000..5ceb1b2 Binary files /dev/null and b/StuffTres/build/kotlin/compileKotlin/last-build.bin differ diff --git a/StuffTres/build/libs/StuffTres-1.6.10.jar b/StuffTres/build/libs/StuffTres-1.6.10.jar new file mode 100644 index 0000000..0dd1f46 Binary files /dev/null and b/StuffTres/build/libs/StuffTres-1.6.10.jar differ diff --git a/StuffTres/build/resources/main/plugin.yml b/StuffTres/build/resources/main/plugin.yml new file mode 100644 index 0000000..1ec9a24 --- /dev/null +++ b/StuffTres/build/resources/main/plugin.yml @@ -0,0 +1,7 @@ +name: StuffTres +version: 1.6.10 +main: ru.erius.stufftres.StuffTres +api-version: 1.18 +depend: [ KotlinLib ] +authors: [ erius ] +description: "stuff3" diff --git a/StuffTres/build/tmp/jar/MANIFEST.MF b/StuffTres/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/StuffTres/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/StuffTres/gradle.properties b/StuffTres/gradle.properties new file mode 100644 index 0000000..29e08e8 --- /dev/null +++ b/StuffTres/gradle.properties @@ -0,0 +1 @@ +kotlin.code.style=official \ No newline at end of file diff --git a/StuffTres/gradle/wrapper/gradle-wrapper.jar b/StuffTres/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..7454180 Binary files /dev/null and b/StuffTres/gradle/wrapper/gradle-wrapper.jar differ diff --git a/StuffTres/gradle/wrapper/gradle-wrapper.properties b/StuffTres/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ffed3a2 --- /dev/null +++ b/StuffTres/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/StuffTres/gradlew b/StuffTres/gradlew new file mode 100644 index 0000000..744e882 --- /dev/null +++ b/StuffTres/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MSYS* | MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/StuffTres/gradlew.bat b/StuffTres/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/StuffTres/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/StuffTres/settings.gradle.kts b/StuffTres/settings.gradle.kts new file mode 100644 index 0000000..1f4f22d --- /dev/null +++ b/StuffTres/settings.gradle.kts @@ -0,0 +1,2 @@ +rootProject.name = "StuffTres" + diff --git a/StuffTres/src/main/kotlin/ru/erius/stufftres/StuffTres.kt b/StuffTres/src/main/kotlin/ru/erius/stufftres/StuffTres.kt new file mode 100644 index 0000000..46e61ff --- /dev/null +++ b/StuffTres/src/main/kotlin/ru/erius/stufftres/StuffTres.kt @@ -0,0 +1,21 @@ +package ru.erius.stufftres + +import org.bukkit.plugin.java.JavaPlugin + +class StuffTres: JavaPlugin() { + + companion object { + lateinit var plugin: StuffTres + private set + } + + override fun onEnable() { + super.onEnable() + logger.info("$name enabled") + } + + override fun onDisable() { + super.onDisable() + logger.info("$name disabled") + } +} diff --git a/StuffTres/src/main/kotlin/ru/erius/stufftres/items/ChargeHoe.kt b/StuffTres/src/main/kotlin/ru/erius/stufftres/items/ChargeHoe.kt new file mode 100644 index 0000000..2b1d286 --- /dev/null +++ b/StuffTres/src/main/kotlin/ru/erius/stufftres/items/ChargeHoe.kt @@ -0,0 +1,10 @@ +package ru.erius.stufftres.items + +import org.bukkit.Material +import org.bukkit.inventory.ItemStack + +object ChargeHoe: ItemStack(Material.WOODEN_HOE, 1) { + init { + this.itemMeta = ItemFabric.createMeta(this.type, "") + } +} \ No newline at end of file diff --git a/StuffTres/src/main/kotlin/ru/erius/stufftres/items/ItemFabric.kt b/StuffTres/src/main/kotlin/ru/erius/stufftres/items/ItemFabric.kt new file mode 100644 index 0000000..91cc7b2 --- /dev/null +++ b/StuffTres/src/main/kotlin/ru/erius/stufftres/items/ItemFabric.kt @@ -0,0 +1,35 @@ +package ru.erius.stufftres.items + +import org.bukkit.Material +import org.bukkit.inventory.ItemStack +import org.bukkit.inventory.meta.ItemMeta + +object ItemFabric { + + private val items = hashMapOf() + + fun createMeta( material: Material = Material.BARRIER, + displayName: String = "none", + lore: String = "", + isUnbreakable: Boolean = false + ): ItemMeta { + val meta = ItemStack(material).itemMeta!! + meta.setDisplayName(displayName) + meta.lore = listOf(lore) + meta.isUnbreakable = isUnbreakable + return meta + } + + fun createAndAddItem( id: String, + material: Material = Material.BARRIER, + displayName: String = "none", + lore: String = "", + isUnbreakable: Boolean = false + ) { + val item = ItemStack(material) + item.itemMeta = createMeta(material, displayName, lore, isUnbreakable) + registerItem(id, item) + } + + private fun registerItem(id: String, item: ItemStack) { items[id] = item } +} \ No newline at end of file diff --git a/StuffTres/src/main/resources/plugin.yml b/StuffTres/src/main/resources/plugin.yml new file mode 100644 index 0000000..c5a0209 --- /dev/null +++ b/StuffTres/src/main/resources/plugin.yml @@ -0,0 +1,7 @@ +name: $name +version: $version +main: $main +api-version: 1.18 +depend: [ KotlinLib ] +authors: [ erius ] +description: "stuff3" diff --git a/WalrusGaming/.gitignore b/WalrusGaming/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/WalrusGaming/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/WalrusGaming/build.gradle b/WalrusGaming/build.gradle new file mode 100644 index 0000000..916683d --- /dev/null +++ b/WalrusGaming/build.gradle @@ -0,0 +1,38 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius' +version = '1.0-SNAPSHOT' +def serverPath = 'C:/mc_servers/1.17.1/plugins' + +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +repositories { + mavenCentral() + maven { + name = 'spigotmc-repo' + url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +jar { + destinationDirectory.set(file(serverPath)) +} diff --git a/WalrusGaming/gradle.properties b/WalrusGaming/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/WalrusGaming/gradle/wrapper/gradle-wrapper.jar b/WalrusGaming/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/WalrusGaming/gradle/wrapper/gradle-wrapper.jar differ diff --git a/WalrusGaming/gradle/wrapper/gradle-wrapper.properties b/WalrusGaming/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b5f89 --- /dev/null +++ b/WalrusGaming/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/WalrusGaming/gradlew b/WalrusGaming/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/WalrusGaming/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/WalrusGaming/gradlew.bat b/WalrusGaming/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/WalrusGaming/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/WalrusGaming/settings.gradle b/WalrusGaming/settings.gradle new file mode 100644 index 0000000..e14a66a --- /dev/null +++ b/WalrusGaming/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'WalrusGaming' diff --git a/WalrusGaming/src/main/java/ru/erius/walrusgaming/ConfigHandler.java b/WalrusGaming/src/main/java/ru/erius/walrusgaming/ConfigHandler.java new file mode 100644 index 0000000..0c8c819 --- /dev/null +++ b/WalrusGaming/src/main/java/ru/erius/walrusgaming/ConfigHandler.java @@ -0,0 +1,25 @@ +package ru.erius.walrusgaming; + +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +import java.io.File; + +public class ConfigHandler { + + private final static WalrusGaming plugin = WalrusGaming.plugin; + + private final static String fileName = "walrus.yml"; + private final static File file = new File(plugin.getDataFolder(), fileName); + private static FileConfiguration config = null; + + public static FileConfiguration getConfig() { + return config; + } + + public static void reloadConfig(boolean replace) { + plugin.saveResource(fileName, replace); + config = YamlConfiguration.loadConfiguration(file); + plugin.getLogger().info("loaded the config"); + } +} diff --git a/WalrusGaming/src/main/java/ru/erius/walrusgaming/MessageHandler.java b/WalrusGaming/src/main/java/ru/erius/walrusgaming/MessageHandler.java new file mode 100644 index 0000000..e72e9e8 --- /dev/null +++ b/WalrusGaming/src/main/java/ru/erius/walrusgaming/MessageHandler.java @@ -0,0 +1,157 @@ +package ru.erius.walrusgaming; + +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BookMeta; + +import java.util.ArrayList; +import java.util.List; + +public class MessageHandler { + + private final static FileConfiguration CONFIG = ConfigHandler.getConfig(); + private final static BaseComponent[] MESSAGE = createMessage(); + private final static ItemStack BOOK = createBook(); + + public static void heal(CommandSender sender) { + if (sender instanceof Player) + ((Player) sender).setHealth(20); + else + sender.sendMessage(ChatColor.RED + "You are not a player"); + } + + public static void feed(CommandSender sender) { + if (sender instanceof Player) + ((Player) sender).setFoodLevel(20); + else + sender.sendMessage(ChatColor.RED + "You are not a player"); + } + + public static void printMessage(CommandSender sender, String[] args) { + if (args.length == 0) + sender.spigot().sendMessage(MESSAGE); + else { + Player player = Bukkit.getServer().getPlayer(args[0]); + if (player == null) + sender.sendMessage(ChatColor.RED + "Such player is offline or doesn't exist"); + else + player.spigot().sendMessage(MESSAGE); + } + } + + public static void giveBook(CommandSender sender, String[] args) { + if (args.length == 0) { + if (sender instanceof Player) { + ((Player) sender).getInventory().addItem(BOOK); + sender.sendMessage(ChatColor.GREEN + "book"); + } else + sender.sendMessage(ChatColor.RED + "You are not a player"); + } else { + Player player = Bukkit.getServer().getPlayer(args[0]); + if (player != null) { + sender.sendMessage(ChatColor.GREEN + "book"); + player.getInventory().addItem(BOOK); + } else + sender.sendMessage(ChatColor.RED + "Such player is offline or doesn't exist"); + } + } + + private static ItemStack createBook() { + ItemStack book = new ItemStack(Material.WRITTEN_BOOK); + BookMeta meta = (BookMeta) book.getItemMeta(); + if (meta == null) + return new ItemStack(Material.DIRT); + List pages = new ArrayList<>(); + ConfigurationSection bookSection = CONFIG.getConfigurationSection("book"); + if (bookSection == null) + return book; + String title = bookSection.getString("title"); + meta.setTitle(title == null ? "Missing title" : ChatColor.translateAlternateColorCodes('&', title)); + String lore = bookSection.getString("lore"); + if (lore != null) + meta.setLore(List.of(ChatColor.translateAlternateColorCodes('&', lore))); + else + meta.setLore(List.of("Missing lore")); + String author = bookSection.getString("author"); + meta.setAuthor(author == null ? "Missing author" : ChatColor.translateAlternateColorCodes('&', author)); + ConfigurationSection pagesSection = bookSection.getConfigurationSection("pages"); + if (pagesSection == null) + return new ItemStack(Material.DIRT); + int i = 1; + ConfigurationSection pageSection = pagesSection.getConfigurationSection("page" + i); + while (pageSection != null) { + i++; + int j = 1; + ConfigurationSection part = pageSection.getConfigurationSection("t" + j); + ComponentBuilder builder = new ComponentBuilder(); + while (part != null) { + j++; + appendJSON(part, builder, j); + part = pageSection.getConfigurationSection("t" + j); + } + pages.add(builder.create()); + pageSection = pagesSection.getConfigurationSection("page" + i); + } + meta.spigot().setPages(pages); + book.setItemMeta(meta); + return book; + } + + private static BaseComponent[] createMessage() { + ComponentBuilder builder = new ComponentBuilder(); + ConfigurationSection msg = CONFIG.getConfigurationSection("message"); + if (msg == null) + return new ComponentBuilder().append("Missing text. Check walrus.yml").color(ChatColor.RED).create(); + int i = 1; + ConfigurationSection part = msg.getConfigurationSection("t" + i); + while (part != null) { + i++; + appendJSON(part, builder, i); + part = msg.getConfigurationSection("t" + i); + } + return builder.create(); + } + + private static void appendJSON(ConfigurationSection part, ComponentBuilder builder, int i) { + if (part == null) + return; + String text = part.getString("text"); + text = text == null ? "" : text; + String colorTxt = part.getString("color"); + colorTxt = colorTxt != null ? colorTxt : ""; + net.md_5.bungee.api.ChatColor color; + try { + color = ChatColor.of(colorTxt); + } catch (IllegalArgumentException e) { + WalrusGaming.plugin.getLogger().severe("Wrong color name in section t" + i); + color = ChatColor.WHITE; + } + boolean bold = part.getBoolean("bold"); + boolean italic = part.getBoolean("italic"); + boolean underlined = part.getBoolean("underlined"); + boolean strikethrough = part.getBoolean("strikethrough"); + boolean obfuscated = part.getBoolean("obfuscated"); + builder.append(text).color(color).bold(bold).italic(italic).underlined(underlined) + .strikethrough(strikethrough).obfuscated(obfuscated); + ConfigurationSection click = part.getConfigurationSection("click_event"); + if (click != null) { + String action = click.getString("action"); + String value = click.getString("value"); + try { + ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.valueOf(action), value); + builder.event(clickEvent); + } catch (IllegalArgumentException e) { + WalrusGaming.plugin.getLogger().severe("Wrong click event action in section t" + i); + } + } + } +} diff --git a/WalrusGaming/src/main/java/ru/erius/walrusgaming/ServerEvents.java b/WalrusGaming/src/main/java/ru/erius/walrusgaming/ServerEvents.java new file mode 100644 index 0000000..6331784 --- /dev/null +++ b/WalrusGaming/src/main/java/ru/erius/walrusgaming/ServerEvents.java @@ -0,0 +1,7 @@ +package ru.erius.walrusgaming; + +import org.bukkit.event.Listener; + +public class ServerEvents implements Listener { + +} diff --git a/WalrusGaming/src/main/java/ru/erius/walrusgaming/WalrusGaming.java b/WalrusGaming/src/main/java/ru/erius/walrusgaming/WalrusGaming.java new file mode 100644 index 0000000..5f2c9cf --- /dev/null +++ b/WalrusGaming/src/main/java/ru/erius/walrusgaming/WalrusGaming.java @@ -0,0 +1,48 @@ +package ru.erius.walrusgaming; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.java.JavaPlugin; + +public final class WalrusGaming extends JavaPlugin { + + public static WalrusGaming plugin; + + @Override + public void onEnable() { + super.onEnable(); + plugin = this; + getLogger().info(getName() + " enabled"); + ConfigHandler.reloadConfig(false); + getServer().getPluginManager().registerEvents(new ServerEvents(), this); + } + + @Override + public void onDisable() { + super.onDisable(); + getLogger().info(getName() + " disabled"); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + String cmd = command.getName().toLowerCase(); + switch (cmd) { + case "walrusreset": + ConfigHandler.reloadConfig(true); + break; + case "todo": + MessageHandler.printMessage(sender, args); + break; + case "book": + MessageHandler.giveBook(sender, args); + break; + case "heal": + MessageHandler.heal(sender); + break; + case "feed": + MessageHandler.feed(sender); + break; + } + return super.onCommand(sender, command, label, args); + } +} diff --git a/WalrusGaming/src/main/resources/plugin.yml b/WalrusGaming/src/main/resources/plugin.yml new file mode 100644 index 0000000..b042d58 --- /dev/null +++ b/WalrusGaming/src/main/resources/plugin.yml @@ -0,0 +1,17 @@ +name: WalrusGaming +version: @version@ +main: ru.erius.walrusgaming.WalrusGaming +api-version: 1.17 +authors: [ erius ] +description: plugin for walrus +commands: + todo: + description: prints the text from config + walrusreset: + description: resets config + book: + description: gives a book with instructions written in config file + heal: + description: heal walrus + feed: + description: feed walrus diff --git a/WalrusGaming/src/main/resources/walrus.yml b/WalrusGaming/src/main/resources/walrus.yml new file mode 100644 index 0000000..8ee3858 --- /dev/null +++ b/WalrusGaming/src/main/resources/walrus.yml @@ -0,0 +1,102 @@ +# Configuration file for WalrusGaming plugin +# (ссылка на вики, там написаны все компоненты json текста - https://minecraft.fandom.com/wiki/Raw_JSON_text_format) +# +# For book title, lore and author sections use MOTD color codes: +# &1 - Dark blue +# &2 - Dark green +# &3 - Dark aqua +# &4 - Dark red +# &5 - Dark purple +# &6 - Gold +# &7 - Gray +# &8 - Dark gray +# &9 - Blue +# &0 - Black +# &a - Green +# &b - Aqua +# &c - Red +# &d - Light purple +# &e - Yellow +# &f - White +# &k - Obfuscated (хуита которая меняется каждую секунду) +# +# Other special formatting: +# &l - Bold +# &m - Strikethrough (перечекрнутый) +# &n - Underline +# &o - Italic +# &r - Reset + +book: + title: '&l&2книга' + lore: '&l&3тест' + author: 'erius' + pages: + page1: + t1: + text: 'всем привет нажми ' + color: 'green' + bold: true + t2: + text: 'сюда' + color: 'red' + bold: true + underlined: true + click_event: + action: 'OPEN_URL' + value: 'https://sun9-67.userapi.com/impg/ylqg7I-ay-JZcyPsT70oiGyxMx4kP4rXQYAkeg/hZZK5OVugss.jpg?size=360x202&quality=96&sign=46ac90781b2268a3c7ab63f6e8592ab5&type=album' + t3: + text: ' тут ссылка. ' + color: 'green' + bold: true + page2: + t1: + text: 'нажми ' + color: 'green' + bold: true + t2: + text: 'сюда' + color: 'yellow' + bold: true + underlined: true + click_event: + action: 'RUN_COMMAND' + value: '/playsound minecraft:entity.ender_dragon.growl player @s' + t3: + text: ' тут команда' + color: 'green' + bold: true + +message: + t1: + text: 'всем привет нажми ' + color: 'green' + bold: true + t2: + text: 'сюда' + color: 'red' + bold: true + underlined: true + click_event: + action: 'OPEN_URL' + value: 'https://sun9-67.userapi.com/impg/ylqg7I-ay-JZcyPsT70oiGyxMx4kP4rXQYAkeg/hZZK5OVugss.jpg?size=360x202&quality=96&sign=46ac90781b2268a3c7ab63f6e8592ab5&type=album' + t3: + text: ' тут ссылка. ' + color: 'green' + bold: true + t4: + text: 'нажми ' + color: 'green' + bold: true + t5: + text: 'сюда' + color: 'yellow' + bold: true + underlined: true + click_event: + action: 'RUN_COMMAND' + value: '/playsound minecraft:entity.ender_dragon.growl player @s' + t6: + text: ' тут команда' + color: 'green' + bold : true diff --git a/Wands/.gitignore b/Wands/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/Wands/.gitignore @@ -0,0 +1,118 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ + +# Common working directory +run/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/Wands/build.gradle b/Wands/build.gradle new file mode 100644 index 0000000..f44ddec --- /dev/null +++ b/Wands/build.gradle @@ -0,0 +1,38 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'ru.erius.wands' +version = '' +def serverPath = 'C:/mc_servers/1.16.5/plugins' + +sourceCompatibility = '11' +targetCompatibility = '11' + +repositories { + mavenCentral() + maven { + name = 'spigotmc-repo' + url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT' +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +jar { + destinationDirectory.set(file(serverPath)) +} diff --git a/Wands/gradle.properties b/Wands/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/Wands/gradle/wrapper/gradle-wrapper.jar b/Wands/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/Wands/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Wands/gradle/wrapper/gradle-wrapper.properties b/Wands/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b5f89 --- /dev/null +++ b/Wands/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/Wands/gradlew b/Wands/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/Wands/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/Wands/gradlew.bat b/Wands/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/Wands/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/Wands/settings.gradle b/Wands/settings.gradle new file mode 100644 index 0000000..77e5509 --- /dev/null +++ b/Wands/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'Wands' diff --git a/Wands/src/main/java/ru/erius/wands/Wands.java b/Wands/src/main/java/ru/erius/wands/Wands.java new file mode 100644 index 0000000..954acb9 --- /dev/null +++ b/Wands/src/main/java/ru/erius/wands/Wands.java @@ -0,0 +1,17 @@ +package ru.erius.wands; + +import org.bukkit.plugin.java.JavaPlugin; + +public final class Wands extends JavaPlugin { + + @Override + public void onEnable() { + // Plugin startup logic + getLogger().info("james"); + } + + @Override + public void onDisable() { + // Plugin shutdown logic + } +} diff --git a/Wands/src/main/resources/plugin.yml b/Wands/src/main/resources/plugin.yml new file mode 100644 index 0000000..c007aae --- /dev/null +++ b/Wands/src/main/resources/plugin.yml @@ -0,0 +1,6 @@ +name: Wands +version: 1.0 +main: ru.erius.wands.Wands +api-version: 1.16 +authors: [ erius ] +description: adds some cool magic wands (retextured hoes with some functionality)