commit c55694a2290f087035fa70e125d68bcbc53e0526 Author: Marco-Byte-1 <65880363+Marco-Byte-1@users.noreply.github.com> Date: Thu Mar 4 18:24:18 2021 +0530 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c37caf --- /dev/null +++ b/.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/build.gradle b/build.gradle new file mode 100644 index 0000000..eac6b6a --- /dev/null +++ b/build.gradle @@ -0,0 +1,47 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id 'java' +} + +group = 'io.github.simpledev' +version = '1.0-SNAPSHOT' + +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +repositories { + mavenCentral() + maven { + name = 'papermc-repo' + url = 'https://papermc.io/repo/repository/maven-public/' + } + + maven { + name = 'minecraft-repo' + url = 'https://libraries.minecraft.net/' + } + + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/groups/public/' + } +} + +dependencies { + compileOnly 'com.destroystokyo.paper:paper-api:1.16.4-R0.1-SNAPSHOT' + compile 'com.mojang:authlib:1.5.21' +} + +processResources { + from(sourceSets.main.resources.srcDirs) { + filter ReplaceTokens, tokens: [version: version] + } +} + +task copyJar(type: Copy) { + from jar + into "C:/Users/Valdemar/Desktop/mc/TestServer1.16.5/plugins" +} + +build.finalizedBy copyJar diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..59b5f89 --- /dev/null +++ b/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/gradlew b/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/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/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/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/settings.gradle b/settings.gradle new file mode 100644 index 0000000..ae8c3dc --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'strike' diff --git a/src/main/java/io/github/simplexdev/simplexcore/strike/StrikeCommand.java b/src/main/java/io/github/simplexdev/simplexcore/strike/StrikeCommand.java new file mode 100644 index 0000000..7da7eb5 --- /dev/null +++ b/src/main/java/io/github/simplexdev/simplexcore/strike/StrikeCommand.java @@ -0,0 +1,47 @@ +/* */ package io.github.simplexdev.simplexcore.strike; +/* */ +/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser; +/* */ import java.util.Arrays; +/* */ import org.bukkit.command.Command; +/* */ import org.bukkit.command.CommandExecutor; +/* */ import org.bukkit.command.CommandSender; +/* */ import org.bukkit.plugin.java.JavaPlugin; +/* */ +/* */ +/* */ public class StrikeCommand +/* */ implements CommandExecutor +/* */ { +/* */ private static ConfigUser[] configUsers; +/* */ private final JavaPlugin plugin; +/* */ +/* */ public StrikeCommand(JavaPlugin plugin) { +/* 18 */ this.plugin = plugin; +/* */ } +/* */ +/* */ public static void loadInstances(ConfigUser... configUsers) { +/* 22 */ StrikeCommand.configUsers = configUsers; +/* */ } +/* */ +/* */ +/* */ +/* */ public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { +/* 28 */ if (args[0].isEmpty() || args.length > 1) { +/* 29 */ return true; +/* */ } +/* 31 */ switch (args[0].toLowerCase()) { +/* */ case "reload": +/* 33 */ this.plugin.reloadConfig(); +/* 34 */ Arrays.stream(configUsers).forEach(configUser -> configUser.refresh()); +/* */ break; +/* */ } +/* */ +/* */ +/* 39 */ return true; +/* */ } +/* */ } + + +/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\StrikeCommand.class + * Java compiler version: 8 (52.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file diff --git a/src/main/java/io/github/simplexdev/simplexcore/strike/StrikePlugin.java b/src/main/java/io/github/simplexdev/simplexcore/strike/StrikePlugin.java new file mode 100644 index 0000000..3b0c0d8 --- /dev/null +++ b/src/main/java/io/github/simplexdev/simplexcore/strike/StrikePlugin.java @@ -0,0 +1,57 @@ +/* */ package io.github.simplexdev.simplexcore.strike; +/* */ +/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser; +/* */ import io.github.simplexdev.simplexcore.strike.api.Spawn; +/* */ import io.github.simplexdev.simplexcore.strike.listeners.Grenade; +/* */ import io.github.simplexdev.simplexcore.strike.listeners.Gun; +/* */ import io.github.simplexdev.simplexcore.strike.listeners.Jumper; +/* */ import io.github.simplexdev.simplexcore.strike.listeners.SpawnController; +/* */ import org.bukkit.event.Listener; +/* */ import org.bukkit.plugin.Plugin; +/* */ import org.bukkit.plugin.java.JavaPlugin; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public final class StrikePlugin +/* */ extends JavaPlugin +/* */ { +/* */ public void onEnable() { +/* 32 */ saveDefaultConfig(); +/* 33 */ Spawn.loadConfig(this); +/* */ +/* 35 */ Gun gun = new Gun(this); +/* 36 */ Jumper jumper = new Jumper(this); +/* 37 */ SpawnController spawnController = new SpawnController(this); +/* */ +/* 39 */ getServer().getPluginManager().registerEvents((Listener)gun, (Plugin)this); +/* 40 */ getServer().getPluginManager().registerEvents((Listener)jumper, (Plugin)this); +/* */ +/* 42 */ getServer().getPluginManager().registerEvents((Listener)new Grenade(this), (Plugin)this); +/* 43 */ getServer().getPluginManager().registerEvents((Listener)spawnController, (Plugin)this); +/* */ +/* 45 */ getCommand("strike").setExecutor(new StrikeCommand(this)); +/* */ +/* 47 */ StrikeCommand.loadInstances(new ConfigUser[] { (ConfigUser)gun, (ConfigUser)jumper, (ConfigUser)spawnController }); +/* */ } +/* */ +/* */ public void onDisable() {} +/* */ } + + +/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\StrikePlugin.class + * Java compiler version: 8 (52.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file diff --git a/src/main/java/io/github/simplexdev/simplexcore/strike/api/ConfigUser.java b/src/main/java/io/github/simplexdev/simplexcore/strike/api/ConfigUser.java new file mode 100644 index 0000000..a87be5c --- /dev/null +++ b/src/main/java/io/github/simplexdev/simplexcore/strike/api/ConfigUser.java @@ -0,0 +1,13 @@ +package io.github.simplexdev.simplexcore.strike.api; + +import org.bukkit.event.Listener; + +public interface ConfigUser extends Listener { + void refresh(); +} + + +/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\api\ConfigUser.class + * Java compiler version: 8 (52.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file diff --git a/src/main/java/io/github/simplexdev/simplexcore/strike/api/Spawn.java b/src/main/java/io/github/simplexdev/simplexcore/strike/api/Spawn.java new file mode 100644 index 0000000..587ae89 --- /dev/null +++ b/src/main/java/io/github/simplexdev/simplexcore/strike/api/Spawn.java @@ -0,0 +1,46 @@ +/* */ package io.github.simplexdev.simplexcore.strike.api; +/* */ +/* */ import org.bukkit.Location; +/* */ import org.bukkit.World; +/* */ import org.bukkit.configuration.file.FileConfiguration; +/* */ import org.bukkit.plugin.java.JavaPlugin; +/* */ +/* */ public class Spawn { +/* 9 */ private static World world = null; +/* 10 */ private static Location spawn = null; +/* */ +/* */ public static void loadConfig(JavaPlugin plugin) { +/* 13 */ FileConfiguration config = plugin.getConfig(); +/* */ +/* 15 */ world = plugin.getServer().getWorld(config.getString("spawn.world")); +/* 16 */ spawn = new Location(world, config.getInt("spawn.location.x"), config.getInt("spawn.location.y"), config.getInt("spawn.location.z")); +/* */ } +/* */ +/* */ public static void setSpawn(Location spawn, JavaPlugin plugin) { +/* 20 */ FileConfiguration config = plugin.getConfig(); +/* 21 */ config.set("spawn.coords.x", Double.valueOf(spawn.getX())); +/* 22 */ config.set("spawn.coords.y", Double.valueOf(spawn.getY())); +/* 23 */ config.set("spawn.coords.z", Double.valueOf(spawn.getZ())); +/* */ +/* 25 */ Spawn.spawn = spawn; +/* */ } +/* */ +/* */ public static void setWorld(World world, JavaPlugin plugin) { +/* 29 */ plugin.getConfig().set("spawn.world", world.getName()); +/* 30 */ Spawn.world = world; +/* */ } +/* */ +/* */ public static World getWorld() { +/* 34 */ return world; +/* */ } +/* */ +/* */ public static Location getSpawn() { +/* 38 */ return spawn; +/* */ } +/* */ } + + +/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\api\Spawn.class + * Java compiler version: 8 (52.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file diff --git a/src/main/java/io/github/simplexdev/simplexcore/strike/events/GrenadeKillEvent.java b/src/main/java/io/github/simplexdev/simplexcore/strike/events/GrenadeKillEvent.java new file mode 100644 index 0000000..800fc25 --- /dev/null +++ b/src/main/java/io/github/simplexdev/simplexcore/strike/events/GrenadeKillEvent.java @@ -0,0 +1,44 @@ +/* */ package io.github.simplexdev.simplexcore.strike.events; +/* */ +/* */ import java.util.List; +/* */ import org.bukkit.entity.LivingEntity; +/* */ import org.bukkit.entity.Player; +/* */ import org.bukkit.event.Event; +/* */ import org.bukkit.event.HandlerList; +/* */ +/* */ public class GrenadeKillEvent +/* */ extends Event +/* */ { +/* 12 */ private static final HandlerList handlers = new HandlerList(); +/* */ private final Player killer; +/* */ private final List deadList; +/* */ +/* */ public GrenadeKillEvent(Player killer, List deadList) { +/* 17 */ this.killer = killer; +/* 18 */ this.deadList = deadList; +/* */ } +/* */ +/* */ public Player getKiller() { +/* 22 */ return this.killer; +/* */ } +/* */ +/* */ public List getDeadList() { +/* 26 */ return this.deadList; +/* */ } +/* */ +/* */ +/* */ public HandlerList getHandlers() { +/* 31 */ return handlers; +/* */ } +/* */ +/* */ +/* */ public static HandlerList getHandlerList() { +/* 36 */ return handlers; +/* */ } +/* */ } + + +/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\events\GrenadeKillEvent.class + * Java compiler version: 8 (52.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file diff --git a/src/main/java/io/github/simplexdev/simplexcore/strike/events/GunKillEvent.java b/src/main/java/io/github/simplexdev/simplexcore/strike/events/GunKillEvent.java new file mode 100644 index 0000000..807b028 --- /dev/null +++ b/src/main/java/io/github/simplexdev/simplexcore/strike/events/GunKillEvent.java @@ -0,0 +1,42 @@ +/* */ package io.github.simplexdev.simplexcore.strike.events; +/* */ +/* */ import org.bukkit.entity.LivingEntity; +/* */ import org.bukkit.entity.Player; +/* */ import org.bukkit.event.Event; +/* */ import org.bukkit.event.HandlerList; +/* */ +/* */ public class GunKillEvent +/* */ extends Event { +/* 10 */ private static final HandlerList handlers = new HandlerList(); +/* */ private final Player killer; +/* */ private final LivingEntity dead; +/* */ +/* */ public GunKillEvent(Player killer, LivingEntity dead) { +/* 15 */ this.killer = killer; +/* 16 */ this.dead = dead; +/* */ } +/* */ +/* */ public Player getKiller() { +/* 20 */ return this.killer; +/* */ } +/* */ +/* */ public LivingEntity getDead() { +/* 24 */ return this.dead; +/* */ } +/* */ +/* */ +/* */ public HandlerList getHandlers() { +/* 29 */ return handlers; +/* */ } +/* */ +/* */ +/* */ public static HandlerList getHandlerList() { +/* 34 */ return handlers; +/* */ } +/* */ } + + +/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\events\GunKillEvent.class + * Java compiler version: 8 (52.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file diff --git a/src/main/java/io/github/simplexdev/simplexcore/strike/events/UseHealthPackageEvent.java b/src/main/java/io/github/simplexdev/simplexcore/strike/events/UseHealthPackageEvent.java new file mode 100644 index 0000000..8e5607c --- /dev/null +++ b/src/main/java/io/github/simplexdev/simplexcore/strike/events/UseHealthPackageEvent.java @@ -0,0 +1,35 @@ +/* */ package io.github.simplexdev.simplexcore.strike.events; +/* */ +/* */ import org.bukkit.entity.Player; +/* */ import org.bukkit.event.Event; +/* */ import org.bukkit.event.HandlerList; +/* */ +/* */ public class UseHealthPackageEvent +/* */ extends Event { +/* 9 */ private static final HandlerList handlers = new HandlerList(); +/* */ private final Player player; +/* */ +/* */ public UseHealthPackageEvent(Player player) { +/* 13 */ this.player = player; +/* */ } +/* */ +/* */ public Player getPlayer() { +/* 17 */ return this.player; +/* */ } +/* */ +/* */ +/* */ public HandlerList getHandlers() { +/* 22 */ return handlers; +/* */ } +/* */ +/* */ +/* */ public static HandlerList getHandlerList() { +/* 27 */ return handlers; +/* */ } +/* */ } + + +/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\events\UseHealthPackageEvent.class + * Java compiler version: 8 (52.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file diff --git a/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/Grenade.java b/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/Grenade.java new file mode 100644 index 0000000..cebb073 --- /dev/null +++ b/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/Grenade.java @@ -0,0 +1,127 @@ +/* */ package io.github.simplexdev.simplexcore.strike.listeners; +/* */ +/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser; +/* */ import io.github.simplexdev.simplexcore.strike.api.Spawn; +/* */ import java.util.ArrayList; +/* */ import java.util.Collection; +/* */ import java.util.HashMap; +/* */ import java.util.List; +/* */ import java.util.Map; +/* */ import org.bukkit.ChatColor; +/* */ import org.bukkit.GameMode; +/* */ import org.bukkit.Material; +/* */ import org.bukkit.entity.Item; +/* */ import org.bukkit.entity.LivingEntity; +/* */ import org.bukkit.entity.Player; +/* */ import org.bukkit.event.EventHandler; +/* */ import org.bukkit.event.entity.EntityDamageEvent; +/* */ import org.bukkit.event.player.PlayerAttemptPickupItemEvent; +/* */ import org.bukkit.event.player.PlayerInteractEvent; +/* */ import org.bukkit.inventory.ItemStack; +/* */ import org.bukkit.inventory.meta.ItemMeta; +/* */ import org.bukkit.plugin.Plugin; +/* */ import org.bukkit.plugin.java.JavaPlugin; +/* */ import org.bukkit.scheduler.BukkitRunnable; +/* */ +/* */ public class Grenade +/* */ implements ConfigUser { +/* 28 */ private static List items = new ArrayList<>(); +/* 29 */ private static Map> map = new HashMap<>(); +/* */ private final ItemStack grenadeItem; +/* */ private final JavaPlugin plugin; +/* */ private int explosionTime; +/* */ +/* */ public Grenade(JavaPlugin plugin) { +/* 35 */ this.plugin = plugin; +/* 36 */ this.grenadeItem = createItem(); +/* 37 */ this.explosionTime = plugin.getConfig().getInt("grenade.explosion-time", 1); +/* */ } +/* */ +/* */ +/* */ public ItemStack createItem() { +/* 42 */ ItemStack stack = new ItemStack(Material.MAGMA_CREAM, 1); +/* 43 */ ItemMeta meta = this.plugin.getServer().getItemFactory().getItemMeta(Material.MAGMA_CREAM); +/* */ +/* 45 */ meta.setDisplayName(ChatColor.RED + "Grenade"); +/* */ +/* 47 */ stack.setItemMeta(meta); +/* */ +/* 49 */ this.plugin.getServer().getOnlinePlayers().forEach(player -> player.getInventory().addItem(new ItemStack[] { stack })); +/* */ +/* 51 */ return stack; +/* */ } +/* */ +/* */ +/* */ +/* */ @EventHandler +/* */ private void throwGrenade(PlayerInteractEvent e) { +/* 58 */ ItemStack itemStack = e.getItem(); +/* 59 */ final Player player = e.getPlayer(); +/* */ +/* 61 */ if (!player.getWorld().equals(Spawn.getWorld()) || itemStack == null || !itemStack.isSimilar(this.grenadeItem) || e.getAction().toString().startsWith("LEFT")) { +/* */ return; +/* */ } +/* 64 */ if (player.getGameMode() != GameMode.CREATIVE) { +/* 65 */ if (itemStack.getAmount() == 1) { +/* 66 */ itemStack = null; +/* */ } else { +/* 68 */ itemStack.setAmount(itemStack.getAmount() - 1); +/* */ } +/* 70 */ player.getInventory().setItemInMainHand(itemStack); +/* */ } +/* */ +/* 73 */ final Item item = player.getWorld().dropItem(player.getEyeLocation(), new ItemStack(Material.MAGMA_CREAM)); +/* 74 */ item.setVelocity(player.getEyeLocation().getDirection().multiply(0.75D)); +/* */ +/* 76 */ (new BukkitRunnable() +/* */ { +/* */ public void run() { +/* 79 */ if (item != null) { +/* 80 */ item.getLocation().createExplosion(4.0F, false, false); +/* 81 */ Collection entities = item.getLocation().getNearbyLivingEntities(4.0D); +/* */ +/* 83 */ List players = new ArrayList<>(); +/* */ +/* 85 */ entities.forEach(livingEntity -> { +/* */ if (livingEntity instanceof Player) { +/* */ players.add((Player)livingEntity); +/* */ } +/* */ }); +/* 90 */ Grenade.map.put(player, players); +/* */ +/* 92 */ Grenade.items.remove(item); +/* 93 */ item.remove(); +/* */ } +/* */ } +/* 96 */ }).runTaskLater((Plugin)this.plugin, (20 * this.explosionTime)); +/* */ +/* 98 */ items.add(item); +/* */ } +/* */ +/* */ +/* */ @EventHandler +/* */ private void onPlayerDamage(EntityDamageEvent e) { +/* 104 */ if (!e.getEntity().getWorld().equals(Spawn.getWorld()) || !(e.getEntity() instanceof Player)) { +/* */ return; +/* */ } +/* */ +/* 108 */ Player player = (Player)e.getEntity(); +/* */ +/* 110 */ map.values().forEach(players -> System.out.println(players)); +/* */ } +/* */ +/* */ @EventHandler +/* */ private void cancelPickup(PlayerAttemptPickupItemEvent e) { +/* 115 */ if (!items.contains(e.getItem())) +/* */ return; +/* 117 */ e.setCancelled(true); +/* */ } +/* */ +/* */ public void refresh() {} +/* */ } + + +/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\listeners\Grenade.class + * Java compiler version: 8 (52.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file diff --git a/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/Gun.java b/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/Gun.java new file mode 100644 index 0000000..6cac2e6 --- /dev/null +++ b/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/Gun.java @@ -0,0 +1,183 @@ +/* */ package io.github.simplexdev.simplexcore.strike.listeners; +/* */ import io.github.simplexdev.simplexcore.strike.api.Spawn; +/* */ import java.util.Collection; +/* */ import java.util.HashMap; +/* */ import org.bukkit.ChatColor; +/* */ import org.bukkit.Location; +/* */ import org.bukkit.Material; +/* */ import org.bukkit.World; +/* */ import org.bukkit.entity.Entity; +/* */ import org.bukkit.entity.LivingEntity; +/* */ import org.bukkit.entity.Player; +/* */ import org.bukkit.event.Event; +/* */ import org.bukkit.event.EventHandler; +/* */ import org.bukkit.event.block.Action; +/* */ import org.bukkit.event.player.PlayerInteractEvent; +/* */ import org.bukkit.event.player.PlayerItemHeldEvent; +/* */ import org.bukkit.inventory.ItemStack; +/* */ import org.bukkit.inventory.meta.ItemMeta; +/* */ import org.bukkit.plugin.Plugin; +/* */ import org.bukkit.plugin.java.JavaPlugin; +/* */ import org.bukkit.scheduler.BukkitRunnable; +/* */ +/* */ public final class Gun implements ConfigUser { +/* 24 */ private static final HashMap ammoMap = new HashMap<>(); +/* */ +/* */ private final ItemStack gunItemStack; +/* */ +/* */ private final JavaPlugin plugin; +/* */ +/* */ private int maxAmmo; +/* */ +/* */ private int maxDistance; +/* */ +/* */ +/* */ public Gun(JavaPlugin plugin) { +/* 36 */ this.plugin = plugin; +/* 37 */ this.gunItemStack = createItem(); +/* 38 */ this.maxAmmo = plugin.getConfig().getInt("gun.ammo"); +/* 39 */ this.maxDistance = plugin.getConfig().getInt("gun.range"); +/* */ } +/* */ +/* */ public ItemStack createItem() { +/* 43 */ ItemStack stack = new ItemStack(Material.IRON_HORSE_ARMOR, 1); +/* 44 */ ItemMeta meta = this.plugin.getServer().getItemFactory().getItemMeta(Material.IRON_HORSE_ARMOR); +/* */ +/* 46 */ meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', this.plugin.getConfig().getString("gun.name"))); +/* */ +/* 48 */ stack.setItemMeta(meta); +/* */ +/* 50 */ this.plugin.getServer().getOnlinePlayers().forEach(player -> player.getInventory().addItem(new ItemStack[] { stack })); +/* */ +/* 52 */ return stack; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ @EventHandler +/* */ private void activeActionBar(PlayerItemHeldEvent e) { +/* 75 */ final Player player = e.getPlayer(); +/* */ +/* 77 */ if (!player.getWorld().equals(Spawn.getWorld()) || player.getInventory().getItem(e.getNewSlot()) == null || !player.getInventory().getItem(e.getNewSlot()).equals(this.gunItemStack)) { +/* */ return; +/* */ } +/* 80 */ (new BukkitRunnable() +/* */ { +/* */ public void run() { +/* 83 */ ItemStack mainHandItem = player.getInventory().getItemInMainHand(); +/* 84 */ if (!mainHandItem.isSimilar(Gun.this.gunItemStack)) { +/* 85 */ cancel(); +/* */ +/* */ return; +/* */ } +/* 89 */ String ammoText = (Gun.ammoMap.containsKey(mainHandItem) ? ((Integer)Gun.ammoMap.get(mainHandItem)).intValue() : Gun.this.maxAmmo) + " | " + Gun.this.maxAmmo; +/* */ +/* 91 */ player.sendActionBar(ammoText); +/* */ } +/* 94 */ }).runTaskTimer((Plugin)this.plugin, 0L, 7L); +/* */ } +/* */ +/* */ +/* */ +/* */ @EventHandler +/* */ private void onRightClick(PlayerInteractEvent e) { +/* 101 */ final ItemStack itemStack = e.getItem(); +/* 102 */ Player player = e.getPlayer(); +/* 103 */ Action action = e.getAction(); +/* */ +/* 105 */ if (!player.getWorld().equals(Spawn.getWorld()) || itemStack == null || !itemStack.equals(this.gunItemStack) || !action.toString().startsWith("RIGHT_CLICK")) { +/* */ return; +/* */ } +/* 108 */ int ammo = this.maxAmmo; +/* */ +/* 110 */ if (!ammoMap.containsKey(itemStack)) { +/* 111 */ ammoMap.put(itemStack, Integer.valueOf(this.maxAmmo - 1)); +/* */ } else { +/* */ +/* 114 */ ammo = ((Integer)ammoMap.get(itemStack)).intValue(); +/* */ +/* 116 */ if (ammo == 1) +/* */ { +/* 118 */ (new BukkitRunnable() +/* */ { +/* */ public void run() { +/* 121 */ Gun.ammoMap.replace(itemStack, Integer.valueOf(Gun.this.maxAmmo)); +/* */ } +/* 123 */ }).runTaskLater((Plugin)this.plugin, 20L * this.plugin.getConfig().getInt("gun.reload-time")); +/* */ } +/* */ +/* 126 */ if (((Integer)ammoMap.get(itemStack)).intValue() != 0) { +/* 127 */ ammoMap.replace(itemStack, Integer.valueOf(ammo - 1)); +/* */ } +/* */ } +/* 130 */ if (ammo <= 0) { +/* */ return; +/* */ } +/* 133 */ player.sendMessage(String.valueOf(ammo)); +/* */ +/* 135 */ spawnParticle(player, player.getEyeLocation().clone(), 0.0D); +/* 136 */ Entity entity = player.getTargetEntity(this.maxDistance); +/* */ +/* 138 */ if (!(entity instanceof LivingEntity)) { +/* */ return; +/* */ } +/* 141 */ LivingEntity livingEntity = (LivingEntity)entity; +/* 142 */ double currentHealth = livingEntity.getHealth(); +/* 143 */ double damageHealth = this.plugin.getConfig().getInt("gun.damage"); +/* */ +/* 145 */ if (currentHealth <= damageHealth) { +/* 146 */ Bukkit.getServer().getPluginManager().callEvent((Event)new GunKillEvent(player, livingEntity)); +/* */ } +/* 148 */ livingEntity.damage(damageHealth); +/* */ } +/* */ +/* */ +/* */ +/* */ private void spawnParticle(Player player, Location location, double distance) { +/* 154 */ World world = location.getWorld(); +/* */ +/* 156 */ location.add(location.getDirection().multiply(0.1D)); +/* 157 */ world.spawnParticle(Particle.CRIT, location, 1, 0.0D, 0.0D, 0.0D, 0.001D); +/* */ +/* 159 */ distance += 0.1D; +/* */ +/* 161 */ if (location.getBlock().getType() != Material.AIR || distance > this.maxDistance) { +/* */ return; +/* */ } +/* 164 */ Collection entities = location.getNearbyLivingEntities(0.1D); +/* */ +/* 166 */ if (!entities.isEmpty() && entities.size() == 1 && !entities.contains(player)) { +/* */ return; +/* */ } +/* 169 */ spawnParticle(player, location, distance); +/* */ } +/* */ +/* */ +/* */ +/* */ public void refresh() { +/* 175 */ this.maxAmmo = this.plugin.getConfig().getInt("gun.ammo"); +/* 176 */ this.maxDistance = this.plugin.getConfig().getInt("gun.range"); +/* */ } +/* */ } + + +/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\listeners\Gun.class + * Java compiler version: 8 (52.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file diff --git a/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/HealthPackage.java b/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/HealthPackage.java new file mode 100644 index 0000000..b938a4f --- /dev/null +++ b/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/HealthPackage.java @@ -0,0 +1,92 @@ +/* */ package io.github.simplexdev.simplexcore.strike.listeners; +/* */ +/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser; +/* */ import io.github.simplexdev.simplexcore.strike.api.Spawn; +/* */ import io.github.simplexdev.simplexcore.strike.events.GunKillEvent; +/* */ import io.github.simplexdev.simplexcore.strike.utils.SkullCreator; +/* */ import org.bukkit.ChatColor; +/* */ import org.bukkit.entity.Player; +/* */ import org.bukkit.event.EventHandler; +/* */ import org.bukkit.event.block.Action; +/* */ import org.bukkit.event.entity.PlayerDeathEvent; +/* */ import org.bukkit.event.player.PlayerInteractEvent; +/* */ import org.bukkit.inventory.ItemStack; +/* */ import org.bukkit.inventory.meta.ItemMeta; +/* */ import org.bukkit.plugin.java.JavaPlugin; +/* */ +/* */ public class HealthPackage +/* */ implements ConfigUser +/* */ { +/* */ private final ItemStack healthPackage; +/* */ private final JavaPlugin plugin; +/* */ private String usedMessage; +/* */ private int regainHealth; +/* */ +/* */ public HealthPackage(JavaPlugin plugin) { +/* 26 */ this.plugin = plugin; +/* 27 */ this.usedMessage = plugin.getConfig().getString("health-package.restore-health-message", "You have restored your health"); +/* 28 */ this.regainHealth = plugin.getConfig().getInt("health-package.restore-health"); +/* 29 */ this.healthPackage = createHealthPackage(); +/* */ } +/* */ +/* */ @EventHandler +/* */ public void onInteract(PlayerInteractEvent e) { +/* 34 */ Player player = e.getPlayer(); +/* 35 */ ItemStack item = player.getInventory().getItemInMainHand(); +/* */ +/* 37 */ if (!player.getWorld().equals(Spawn.getWorld())) { +/* */ return; +/* */ } +/* 40 */ if (player.getInventory().getItemInMainHand().isSimilar(this.healthPackage)) { +/* 41 */ if (e.getAction().equals(Action.LEFT_CLICK_BLOCK) || e.getAction().equals(Action.LEFT_CLICK_AIR)) { +/* */ return; +/* */ } +/* 44 */ player.setHealth(this.regainHealth); +/* 45 */ player.sendMessage(ChatColor.translateAlternateColorCodes('&', "usedMessage")); +/* */ +/* 47 */ if (item.getAmount() == 1) { +/* 48 */ player.getInventory().setItemInMainHand(null); +/* */ } else { +/* */ +/* 51 */ item.setAmount(item.getAmount() - 1); +/* */ } +/* 53 */ e.setCancelled(true); +/* */ } +/* */ } +/* */ public ItemStack createHealthPackage() { +/* 57 */ String base64 = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGExNTU4YTgzZjQwMjZkYjIzMmY4MGJjOTYxNWNjM2JhNDE1ZGM0MDk0MGE1YTEzYWUyYThjOTBiMTVjM2MzZSJ9fX0="; +/* */ +/* 59 */ ItemStack healthPackage = SkullCreator.itemFromBase64(base64); +/* 60 */ ItemMeta meta = healthPackage.getItemMeta(); +/* 61 */ meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', this.plugin.getConfig().getString("health-package.name"))); +/* 62 */ healthPackage.setItemMeta(meta); +/* */ +/* 64 */ return healthPackage; +/* */ } +/* */ +/* */ @EventHandler +/* */ public void onDeath(PlayerDeathEvent e) { +/* 69 */ Player player = e.getEntity(); +/* */ +/* 71 */ if (!player.getWorld().equals(Spawn.getWorld())) { +/* */ return; +/* */ } +/* 74 */ if (player.getWorld().equals(Spawn.getWorld())) { +/* 75 */ player.getKiller().getInventory().addItem(new ItemStack[] { this.healthPackage }); +/* */ } +/* */ } +/* */ +/* */ @EventHandler +/* */ private void onDeath(GunKillEvent e) { +/* 81 */ if (e.getDead() instanceof Player) +/* 82 */ e.getKiller().getInventory().addItem(new ItemStack[] { this.healthPackage }); +/* */ } +/* */ +/* */ public void refresh() {} +/* */ } + + +/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\listeners\HealthPackage.class + * Java compiler version: 8 (52.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file diff --git a/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/Jumper.java b/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/Jumper.java new file mode 100644 index 0000000..1955372 --- /dev/null +++ b/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/Jumper.java @@ -0,0 +1,80 @@ +/* */ package io.github.simplexdev.simplexcore.strike.listeners; +/* */ +/* */ import com.destroystokyo.paper.event.player.PlayerJumpEvent; +/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser; +/* */ import java.util.HashMap; +/* */ import java.util.Map; +/* */ import java.util.UUID; +/* */ import org.bukkit.ChatColor; +/* */ import org.bukkit.GameMode; +/* */ import org.bukkit.entity.Player; +/* */ import org.bukkit.event.EventHandler; +/* */ import org.bukkit.event.player.PlayerToggleFlightEvent; +/* */ import org.bukkit.plugin.Plugin; +/* */ import org.bukkit.plugin.java.JavaPlugin; +/* */ import org.bukkit.scheduler.BukkitRunnable; +/* */ +/* */ public final class Jumper +/* */ implements ConfigUser +/* */ { +/* 20 */ private static final Map playersOnCoolDown = new HashMap<>(); +/* */ private final JavaPlugin plugin; +/* */ private Integer coolDownTime; +/* */ +/* */ public Jumper(JavaPlugin plugin) { +/* 25 */ this.plugin = plugin; +/* 26 */ this.coolDownTime = Integer.valueOf(plugin.getConfig().getInt("double-jump.cooldown")); +/* */ } +/* */ +/* */ +/* */ +/* */ @EventHandler +/* */ private void onPlayerJump(PlayerJumpEvent e) { +/* 33 */ Player player = e.getPlayer(); +/* 34 */ GameMode mode = player.getGameMode(); +/* */ +/* 36 */ if (mode == GameMode.CREATIVE || mode == GameMode.SPECTATOR) { +/* */ return; +/* */ } +/* 39 */ if (playersOnCoolDown.containsKey(player.getUniqueId())) { +/* */ return; +/* */ } +/* 42 */ player.setAllowFlight(true); +/* */ } +/* */ +/* */ +/* */ @EventHandler +/* */ private void onFlightAccessChange(PlayerToggleFlightEvent e) { +/* 48 */ final Player player = e.getPlayer(); +/* 49 */ GameMode mode = player.getGameMode(); +/* */ +/* 51 */ if (mode == GameMode.CREATIVE || mode == GameMode.SPECTATOR) { +/* */ return; +/* */ } +/* 54 */ e.setCancelled(true); +/* 55 */ player.setAllowFlight(false); +/* */ +/* 57 */ player.setVelocity(player.getLocation().getDirection().multiply(0.5D).setY(0.5D)); +/* */ +/* 59 */ playersOnCoolDown.put(player.getPlayer().getUniqueId(), Long.valueOf((this.coolDownTime.intValue() * 1000) + System.currentTimeMillis())); +/* */ +/* 61 */ (new BukkitRunnable() +/* */ { +/* */ public void run() { +/* 64 */ Jumper.playersOnCoolDown.remove(player.getPlayer().getUniqueId()); +/* 65 */ player.sendMessage(ChatColor.translateAlternateColorCodes('&', Jumper.this.plugin.getConfig().getString("double-jump.cooldown-finish-message"))); +/* */ } +/* 67 */ }).runTaskLater((Plugin)this.plugin, 20L * this.coolDownTime.intValue()); +/* */ } +/* */ +/* */ +/* */ public void refresh() { +/* 72 */ this.coolDownTime = Integer.valueOf(this.plugin.getConfig().getInt("double-jump.cooldown")); +/* */ } +/* */ } + + +/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\listeners\Jumper.class + * Java compiler version: 8 (52.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file diff --git a/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/SpawnController.java b/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/SpawnController.java new file mode 100644 index 0000000..18ed3be --- /dev/null +++ b/src/main/java/io/github/simplexdev/simplexcore/strike/listeners/SpawnController.java @@ -0,0 +1,57 @@ +/* */ package io.github.simplexdev.simplexcore.strike.listeners; +/* */ +/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser; +/* */ import io.github.simplexdev.simplexcore.strike.api.Spawn; +/* */ import org.bukkit.Material; +/* */ import org.bukkit.entity.Player; +/* */ import org.bukkit.event.EventHandler; +/* */ import org.bukkit.event.EventPriority; +/* */ import org.bukkit.event.entity.PlayerDeathEvent; +/* */ import org.bukkit.event.player.PlayerRespawnEvent; +/* */ import org.bukkit.inventory.ItemStack; +/* */ import org.bukkit.plugin.java.JavaPlugin; +/* */ +/* */ +/* */ public class SpawnController +/* */ implements ConfigUser +/* */ { +/* */ private final JavaPlugin plugin; +/* */ +/* */ public SpawnController(JavaPlugin plugin) { +/* 21 */ this.plugin = plugin; +/* */ } +/* */ +/* */ @EventHandler +/* */ private void onDeath(PlayerDeathEvent e) { +/* 26 */ Player player = e.getEntity(); +/* */ +/* 28 */ if (player.getWorld().equals(Spawn.getWorld())) +/* 29 */ player.getInventory().clear(); +/* */ } +/* */ +/* */ @EventHandler(priority = EventPriority.HIGH) +/* */ private void onRespawn(PlayerRespawnEvent e) { +/* 34 */ if (e.getPlayer().getWorld().equals(Spawn.getWorld())) { +/* 35 */ e.setRespawnLocation(Spawn.getSpawn()); +/* 36 */ giveItems(e.getPlayer()); +/* */ } +/* */ } +/* */ +/* */ +/* */ private void giveItems(Player player) { +/* 42 */ player.getInventory().addItem(new ItemStack[] { (new Gun(this.plugin)).createItem() }); +/* 43 */ player.getInventory().addItem(new ItemStack[] { (new Grenade(this.plugin)).createItem() }); +/* 44 */ player.getInventory().addItem(new ItemStack[] { new ItemStack(Material.WOODEN_SWORD) }); +/* */ } +/* */ +/* */ +/* */ public void refresh() { +/* 49 */ Spawn.loadConfig(this.plugin); +/* */ } +/* */ } + + +/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\listeners\SpawnController.class + * Java compiler version: 8 (52.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file diff --git a/src/main/java/io/github/simplexdev/simplexcore/strike/utils/SkullCreator.java b/src/main/java/io/github/simplexdev/simplexcore/strike/utils/SkullCreator.java new file mode 100644 index 0000000..a414704 --- /dev/null +++ b/src/main/java/io/github/simplexdev/simplexcore/strike/utils/SkullCreator.java @@ -0,0 +1,240 @@ + package io.github.simplexdev.simplexcore.strike.utils; + + import com.mojang.authlib.GameProfile; + import com.mojang.authlib.properties.Property; + import java.lang.reflect.Field; + import java.lang.reflect.Method; + import java.net.URI; + import java.net.URISyntaxException; + import java.util.Base64; + import java.util.UUID; + import org.bukkit.Bukkit; + import org.bukkit.Material; + import org.bukkit.SkullType; + import org.bukkit.block.Block; + import org.bukkit.block.Skull; + import org.bukkit.inventory.ItemStack; + import org.bukkit.inventory.meta.ItemMeta; + import org.bukkit.inventory.meta.SkullMeta; + + + + + + + + + + public class SkullCreator { + private static boolean warningPosted = false; + private static Field blockProfileField; + private static Method metaSetProfileMethod; + private static Field metaProfileField; + + public static ItemStack createSkull() { + checkLegacy(); + + try { + return new ItemStack(Material.valueOf("PLAYER_HEAD")); + } catch (IllegalArgumentException e) { + return new ItemStack(Material.valueOf("SKULL_ITEM"), 1, (short) 3); + } + } + + + public static ItemStack itemFromName(String name) { + return itemWithName(createSkull(), name); + } + + + public static ItemStack itemFromUuid(UUID id) { + return itemWithUuid(createSkull(), id); + } + + + public static ItemStack itemFromUrl(String url) { + return itemWithUrl(createSkull(), url); + } + + + public static ItemStack itemFromBase64(String base64) { + return itemWithBase64(createSkull(), base64); + } + + + @Deprecated + public static ItemStack itemWithName(ItemStack item, String name) { + notNull(item, "item"); + notNull(name, "name"); + + SkullMeta meta = (SkullMeta) item.getItemMeta(); + meta.setOwner(name); + item.setItemMeta((ItemMeta) meta); + + return item; + } + + + public static ItemStack itemWithUuid(ItemStack item, UUID id) { + notNull(item, "item"); + notNull(id, "id"); + + SkullMeta meta = (SkullMeta) item.getItemMeta(); + meta.setOwner(Bukkit.getOfflinePlayer(id).getName()); + item.setItemMeta((ItemMeta) meta); + + return item; + } + + + public static ItemStack itemWithUrl(ItemStack item, String url) { + notNull(item, "item"); + notNull(url, "url"); + + return itemWithBase64(item, urlToBase64(url)); + } + + + public static ItemStack itemWithBase64(ItemStack item, String base64) { + notNull(item, "item"); + notNull(base64, "base64"); + + if (!(item.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) item.getItemMeta(); + mutateItemMeta(meta, base64); + item.setItemMeta((ItemMeta) meta); + + return item; + } + + + @Deprecated + public static void blockWithName(Block block, String name) { + notNull(block, "block"); + notNull(name, "name"); + + Skull state = (Skull) block.getState(); + state.setOwner(name); + state.update(false, false); + } + + + public static void blockWithUuid(Block block, UUID id) { + notNull(block, "block"); + notNull(id, "id"); + + setToSkull(block); + Skull state = (Skull) block.getState(); + state.setOwner(Bukkit.getOfflinePlayer(id).getName()); + state.update(false, false); + } + + + public static void blockWithUrl(Block block, String url) { + notNull(block, "block"); + notNull(url, "url"); + + blockWithBase64(block, urlToBase64(url)); + } + + + public static void blockWithBase64(Block block, String base64) { + notNull(block, "block"); + notNull(base64, "base64"); + + setToSkull(block); + Skull state = (Skull) block.getState(); + mutateBlockState(state, base64); + state.update(false, false); + } + + private static void setToSkull(Block block) { + checkLegacy(); + + try { + block.setType(Material.valueOf("PLAYER_HEAD"), false); + } catch (IllegalArgumentException e) { + block.setType(Material.valueOf("SKULL"), false); + Skull state = (Skull) block.getState(); + state.setSkullType(SkullType.PLAYER); + state.update(false, false); + } + } + + private static void notNull(Object o, String name) { + if (o == null) { + throw new NullPointerException(name + " should not be null!"); + } + } + + + private static String urlToBase64(String url) { + URI actualUrl; + try { + actualUrl = new URI(url); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + String toEncode = "{\"textures\":{\"SKIN\":{\"url\":\"" + actualUrl.toString() + "\"}}}"; + return Base64.getEncoder().encodeToString(toEncode.getBytes()); + } + + + private static GameProfile makeProfile(String b64) { + UUID id = new UUID(b64.substring(b64.length() - 20).hashCode(), b64.substring(b64.length() - 10).hashCode()); + + GameProfile profile = new GameProfile(id, "aaaaa"); + profile.getProperties().put("textures", new Property("textures", b64)); + return profile; + } + + private static void mutateBlockState(Skull block, String b64) { + try { + if (blockProfileField == null) { + blockProfileField = block.getClass().getDeclaredField("profile"); + blockProfileField.setAccessible(true); + } + blockProfileField.set(block, makeProfile(b64)); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + } + + private static void mutateItemMeta(SkullMeta meta, String b64) { + try { + if (metaSetProfileMethod == null) { + metaSetProfileMethod = meta.getClass().getDeclaredMethod("setProfile", new Class[]{GameProfile.class}); + metaSetProfileMethod.setAccessible(true); + } + metaSetProfileMethod.invoke(meta, new Object[]{makeProfile(b64)}); + } catch (NoSuchMethodException | IllegalAccessException | java.lang.reflect.InvocationTargetException ex) { + + + try { + if (metaProfileField == null) { + metaProfileField = meta.getClass().getDeclaredField("profile"); + metaProfileField.setAccessible(true); + } + metaProfileField.set(meta, makeProfile(b64)); + } catch (NoSuchFieldException | IllegalAccessException ex2) { + ex2.printStackTrace(); + } + } + } + + + private static void checkLegacy() { + try { + Material.class.getDeclaredField("PLAYER_HEAD"); + Material.valueOf("SKULL"); + + if (!warningPosted) { + Bukkit.getLogger().warning("SKULLCREATOR API - Using the legacy bukkit API with 1.13+ bukkit versions is not supported!"); + warningPosted = true; + } + } catch (NoSuchFieldException | IllegalArgumentException noSuchFieldException) { + } + } + } \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..348c077 --- /dev/null +++ b/src/main/resources/plugin.yml @@ -0,0 +1,4 @@ +name: Strike +version: @version@ +main: io.github.simpledev.strike.Strike +api-version: 1.16